[NCLUG] Closing ports

dobbster dobbster at dobbster.com
Tue Apr 24 00:18:11 MDT 2001


> > By the way, I do have all of these ports commented out in /etc/services,
> > although I haven't rebooted or anything since I commented them out.  Does thi
> > s make a difference?
> 
> You should restart inetd with something like,
> 
> /etc/init.d/inetd reload
> or,
> /etc/rc.d/init.d/inetd reload
> 
> Sending a SIGHUP to the current inetd process does the same thing.

Wouldn't this only affect services spawned by inetd?  That is, the ones listed
in /etc/inetd.conf?  My impression is that in order to close and reopen all
ports, I'd have to at least switch to runlevel 1 and back again.

Actually, I did do this anyway, but it didn't help.  However, my original
problem has been resolved, or at least explained.  The ports were open because
portsentry was listening to them.  

My comment about /etc/services was a bit naive.  I know it's just a lookup table
for mapping service names to port numbers and protocols.  At the time I was
working on my problem, I had encountered web pages indicating that in some
OS'es, commenting out lines in /etc/services would close the port and disable
the corresponding service once the network had been restarted.

I'm not sure whether or not this is nonsense, but I don't see that it
necessarily applies to Linux.  It doesn't seem that all services require
/etc/services to know their port numbers.  The man page talks about functions
like "getservbyname()" which read the file to find the port, but it seems as if
it should be possible to write a server which doesn't require /etc/services -
The port number and protocol could be hard-coded.  Do all services actually
require an entry in the file?

(Heck if I know...  I've done very minimal socket-level programming...)

Mark



More information about the NCLUG mailing list