tcpd(1Mtcp)


tcpd -- control access to internet services

Synopsis

in.tcpd inet_daemon

Description

The tcpd program can be set up to monitor incoming requests for telnet, finger, ftp, exec, rsh, rlogin, tftp, talk and other services that have a one-to-one mapping onto executable files.

The program supports both 4.3BSD-style sockets and System V.4-style TLI. Functionality may be limited when the protocol underneath TLI is not an internet protocol.

Operation is as follows: whenever a request for service arrives, the inetd daemon is tricked into running the tcpd program instead of the desired server. tcpd logs the request and does some additional checks. When all is well, tcpd runs the appropriate server program and goes away.

Optional features are: pattern-based access control, client username lookups with the RFC 931 protocol, protection against hosts that pretend to have someone elses host name, and protection against hosts that pretend to have someone elses network address.

Logging

Connections that are monitored by tcpd are reported through the syslog(3G) facility. Each record contains a time stamp, the client host name and the name of the requested service. The information can be useful to detect unwanted activities, especially when logfile information from several hosts is merged.

In order to find out where your logs are going, examine the syslog configuration file, /etc/syslog.conf.

Access control

Optionally, tcpd supports a simple form of access control that is based on pattern matching. The access-control software provides hooks for the execution of shell commands when a pattern matches. For details, see hosts_access(4tcp).

Host name verification

The authentication scheme of some protocols (such as rlogin and rsh) relies on host names. Some implementations believe the host name that they get from any random name server; other implementations are more careful but use a flawed algorithm.

When looking up the client host name corresponding to an IP address, tcpd verifies the name that is returned by the DNS server by comparing it with the host name and address that are returned when the name is used to look up the corresponding IP address. This is know as a ``double reverse lookup''. If any discrepancy is detected, tcpd concludes that it is dealing with a host that is pretending to have someone else's host name.

The supplied version of tcpd was compiled with PARANOID defined, so that it will drop the connection in case of a host name/address mismatch.

Host address spoofing

Optionally, tcpd disables source-routing socket options on every connection that it deals with. This will take care of most attacks from hosts that pretend to have an address that belongs to someone elses network. UDP services do not benefit from this protection. This feature was turned on at compile time.

RFC 931 lookups

RFC 931 lookups are enabled (a compile-time option), so tcpd will attempt to establish the name of the client user. This will succeed only if the client host runs an RFC 931-compliant daemon. Client user name lookups will not work for datagram-oriented connections, and may cause noticeable delays in the case of connections from some machines.

Files

/etc/inet/hosts.allow
/etc/inet/hosts.deny

References

filter(4), hosts_access(4tcp), inetd.conf(4tcp), rpcbind(1Mtcp), syslog.conf(4bsd)

Notices

Some UDP (and RPC) daemons linger around for a while after they have finished their work, in case another request comes in. In the inetd configuration file, these services are registered with the wait option. Only the request that started such a daemon will be logged.

The program does not work with RPC services over TCP. These services are registered as rpc/tcp in the inetd configuration file. The only non-trivial service that is affected by this limitation is exec.

RPC broadcast requests (from rwall or rusers, for example) always appear to come from the responding host. What happens is that the client broadcasts the request to all rpcbind daemons on its network; each rpcbind daemon forwards the request to a local daemon. As far as the rwall and similar daemons know, the request comes from the local host.

Author

Wietse Venema (wietse@wzv.win.tue.nl),
Department of Mathematics and Computing Science,
Eindhoven University of Technology
Den Dolech 2, P.O. Box 513,
5600 MB Eindhoven, The Netherlands

Examples

In order to monitor access to the finger service, the following entry must exist uncommented in the inetd configuration file, /etc/inetd.conf:
   finger  stream  tcp  nowait  nobody  /usr/sbin/in.tcpd  in.fingerd
Similar changes will be needed for the other services that are to be covered by tcpd.

In the case of daemons that do not live in /usr/sbin, specify an absolute path name for the process name field. For example:

   ntalk  dgram  udp  wait  root  /usr/sbin/in.tcpd  /usr/local/lib/ntalkd
Only the last component (/usr/local/lib/ntalkd) of the pathname will be used for access control and logging.

Stop and restart inetd to have the changes take effect:

sacadm -k -p inetd
sacadm -s -p inetd


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004