Solved

AIX 5.3 - Enabled services

Posted on 2009-07-08
2
781 Views
Last Modified: 2013-11-17
I have used a script to determine the services running on a specific AIX server. So the script have two sections that I'm not sure about.

1)

br_1
INETCONF="/etc/inetd.conf"
echo "# Checking for $INETCONF has services running that should be disabled - FAILS CHECK"
echo `egrep  "^time|^daytime|^echo|^chargen|^telnet|^finger|^talk|^comsat|^shell|^login|^uucp|^tftp|^name|^printer|^shell|^login" $INETCONF`
enbr_1

This produces this results:

BEGINRECORD
416
# Checking for /etc/inetd.conf has services running that should be disabled - FAILS CHECK

ENDRECORD

So how should I interpret the result?

2)

br_1
echo "# Checking ChatList=name exec comsat talk uucp smtp tftp finger systat netstat rquotad rusersd sprayd walld rexd shell login exec comsat time echo discard daytime chargen 100087 rwalld rstatd 100068 100083 100221 fs ufsd 100232 100235 printer 536870916"
 for SERVC in $ChatList
  do
    grep "^${SERVC}" ${INET} >/dev/null 2>&-

    if [ $? -eq 0 ]; then
    echo "#  $SERVC Open - FAILS CHECK"
    else
    echo "# $SERVC Closed - PASSES CHECK"
    fi
 done
 enbr_1

And the result is:

BEGINRECORD
418
# Checking ChatList=name exec comsat talk uucp smtp tftp finger systat netstat rquotad rusersd sprayd walld rexd shell login exec comsat time echo discard daytime chargen 100087 rwalld rstatd 100068 100083 100221 fs ufsd 100232 100235 printer 536870916
# name Closed - PASSES CHECK
# exec Closed - PASSES CHECK
# comsat Closed - PASSES CHECK
# talk Closed - PASSES CHECK
...
ENDRECORD

So it seems that the result for this one differs from the result of the first script.

To sum up, can I say that the services are disabled or not?

Is there a better way to check for enabled services?

Thanks for the help!
0
Comment
Question by:ralmada
2 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 250 total points
ID: 24805231
Hi,
it looks a bit strange, but let's see -
The first script checks for several services (portnames) in inetd.conf.
portname must start in the first nonblank position of its line in inetd.conf, and that's what the script checks (^ means start of line). A nonblank character in front of a portname in inetd.conf would make the entry invalid (or commented out in case of '#'), thus the service would not be active.
The script gives no output - meaning none of the checked services was found active. The heading "... FAILS CHECK" is always displayed, regardless of the result - for what reasons ever.
The second script uses the opposite approach - if a service name is found in the correct position (grep "^${SERVC}" ${INET} results in RC 0) a "FAILS CHECK" message is displayed. No such message is diplayed, meaning "check OK", like in the first script.
To sum up - both scripts basically give the same result  (in a different format, the heading of the first one being misleading), that none of the checked services is active.
A better way? Yes, it's AIX!
Simply issue
lssrc -ls inetd
and you will see all your active services at a glance.
HTH
wmp
 
0
 
LVL 41

Author Closing Comment

by:ralmada
ID: 31601161
Thanks!!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now