Case Study: Site Construction
Putting together all you've learned, you can now construct a good /etc/hosts.allow for your site. Here, you'll do just that.
First, see what is enabled. Use the following command to get your listing (it might be different from the text):
grep -v ^# /etc/inetd.conf | grep -v ^$| grep -v internal
The preceding command line searches (grep) inetd.conf and excludes lines (-v) that begin with #. The results are piped to another grep, which excludes blank lines (show as the regular expression ^$), and then excludes lines with the word internal:
ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd −;l -a telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd pop3 stream tcp nowait root /usr/sbin/tcpd ipop3d imap stream tcp ...
Get Special Edition Using Linux®, Sixth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.