[ILUG] Shutting down ports

Gavin McCullagh gavin at fiachra.ucd.ie
Tue Jan 8 22:19:05 GMT 2002


On Tue, 08 Jan 2002, Brendan Halpin wrote:

> For a friend running SuSE 6.4: how do you shut down access to
> specific ports? 

Presumably you mean to incoming connections.

To actually remove access to the port you need to run the firewall,
iptables.  Then you deny access to all ports and add back the ones which
should be available.  Any connection to disallowed ports should get "no route
to host".

That said most people (RedHat packagers excluded, I guess) would not 
consider this necessary.  Simply shutdown the service which listens on that
port.  Although the person can get a route to the port now, no service will
answer "Service Unavailable/Connection Closed by Remote Host" or some such.

This service will either be standalone or run by inetd (or xinetd) eg ssh
often is standalone listening on port 22.  This must be shutdown
explicitly in the rc.d scripts.  

telnet on the other hand is usually run by inetd (or xinetd etc).  This
means inetd listens on port 23 and when a connection is attempted it
accepts and starts the telnet daemon.  In this case you must configure
inetd not to listen on that port (/etc/services) and/or not to connect a
daemon to it (/etc/inetd.conf).  I would guess the former is strictly 
cleverer as inetd is not exposed either.

Gavin





More information about the ILUG mailing list