In securing Unix systems, one of the first items people generally recommend is to disable services in /etc/inetd.conf that are not needed. Unfortunately, it's often not clear which services are needed and which are not. The following tip can help with that.
The basic assumption here is that when your system is backed up the last access time of the binaries used by inetd get updated (along with all other files on the system). The last access time of a binary is also updated each time inetd opens that binary to provide a given service.
To take advantage of this, we first create a file somewhere that no one has a reason to open (e.g. /etc/flagfile). Now, let the machine sit for awhile (how long depends on your environment). Probably at least one full backup cycle.
Next run the attached code. This will list the last access time of all binaries used in /etc/inetd.conf -- you'll need to add a line to do the same "ls -lLu" on your flagfile.
Now, look over the output for services that show a last access time that's different from your flag file. Now you know that service is in use.
Of course, you need to repeat this process over a large enough period of time to get good data. Running it right before your backups begin will give you the best results.
Why people are using some of the services it finds is another exercise...
#!/bin/sh
for i in `grep -v ^# /etc/inetd.conf | awk '{print $6}'`; do
Requires Free Membership to View
continue
fi
ls -lLu $i
done
# Change this to your own flag file
ls -lLu /etc/flagfile
This was first published in November 2001
Security Management Strategies for the CIO
Join the conversationComment
Share
Comments
Results
Contribute to the conversation