Solved

AIX 5.3 - Enabled services

Posted on 2009-07-08
2
787 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
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.
Suggested Courses

623 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