TCPD(8) UNIX Programmer's Manual TCPD(8) NAME tcpd - access control facility for internet services DESCRIPTION The _t_c_p_d program can be set up to monitor incoming requests for _t_e_l_n_e_t, _f_i_n_g_e_r, _f_t_p, _e_x_e_c, _r_s_h, _r_l_o_g_i_n, _t_f_t_p, _t_a_l_k, _c_o_m_- _s_a_t 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 proto- col underneath TLI is not an internet protocol. Operation is as follows: whenever a request for service arrives, the _i_n_e_t_d daemon is tricked into running the _t_c_p_d program instead of the desired server. _t_c_p_d logs the request and does some additional checks. When all is well, _t_c_p_d runs the appropriate server program and goes away. Optional features are: pattern-based access control, client username lookups with the RFC 931 etc. 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 _t_c_p_d are reported through the _s_y_s_l_o_g(3) 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, usually /etc/syslog.conf. ACCESS CONTROL Optionally, _t_c_p_d 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 fires. For details, see the _h_o_s_t_s__a_c_c_e_s_s(5) manual page. HOST NAME VERIFICATION The authentication scheme of some protocols (_r_l_o_g_i_n, _r_s_h) relies on host names. Some implementations believe the host name that they get from any random name server; other imple- mentations are more careful but use a flawed algorithm. _t_c_p_d verifies the client host name that is returned by the address->name DNS server by looking at the host name and address that are returned by the name->address DNS server. Printed 11/24/99 1 TCPD(8) UNIX Programmer's Manual TCPD(8) If any discrepancy is detected, _t_c_p_d concludes that it is dealing with a host that pretends to have someone elses host name. If the sources are compiled with -DPARANOID, _t_c_p_d will drop the connection in case of a host name/address mismatch. Otherwise, the hostname can be matched with the _P_A_R_A_N_O_I_D wildcard, after which suitable action can be taken. HOST ADDRESS SPOOFING Optionally, _t_c_p_d 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 bene- fit from this protection. This feature must be turned on at compile time. RFC 931 When RFC 931 etc. lookups are enabled (compile-time option) _t_c_p_d 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 PCs. EXAMPLES The details of using _t_c_p_d depend on pathname information that was compiled into the program. EXAMPLE 1 This example applies when _t_c_p_d expects that the original network daemons will be moved to an "other" place. In order to monitor access to the _f_i_n_g_e_r service, move the original finger daemon to the "other" place and install tcpd in the place of the original finger daemon. No changes are required to configuration files. # mkdir /other/place # mv /usr/etc/in.fingerd /other/place # cp tcpd /usr/etc/in.fingerd The example assumes that the network daemons live in /usr/etc. On some systems, network daemons live in /usr/sbin or in /usr/libexec, or have no `in.' prefix to their name. EXAMPLE 2 This example applies when _t_c_p_d expects that the network dae- mons are left in their original place. In order to monitor access to the _f_i_n_g_e_r service, perform the following edits on the _i_n_e_t_d configuration file (usually Printed 11/24/99 2 TCPD(8) UNIX Programmer's Manual TCPD(8) /_e_t_c/_i_n_e_t_d._c_o_n_f or /_e_t_c/_i_n_e_t/_i_n_e_t_d._c_o_n_f): finger stream tcp nowait nobody /usr/etc/in.fingerd in.fingerd becomes: finger stream tcp nowait nobody /some/where/tcpd in.fingerd The example assumes that the network daemons live in /usr/etc. On some systems, network daemons live in /usr/sbin or in /usr/libexec, the daemons have no `in.' prefix to their name, or there is no userid field in the inetd confi- guration file. Similar changes will be needed for the other services that are to be covered by _t_c_p_d. Send a `kill -HUP' to the _i_n_e_t_d(8) process to make the changes effective. EXAMPLE 3 In the case of daemons that do not live in a common direc- tory ("secret" or otherwise), edit the _i_n_e_t_d configuration file so that it specifies an absolute path name for the pro- cess name field. For example: ntalk dgram udp wait root /some/where/tcpd /usr/local/lib/ntalkd Only the last component (ntalkd) of the pathname will be used for access control and logging. BUGS 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 _w_a_i_t 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 _r_p_c/_t_c_p in the inetd configura- tion file. The only non-trivial service that is affected by this limitation is _r_e_x_d, which is used by the _o_n(_1) command. This is no great loss. On most systems, _r_e_x_d is less secure than a wildcard in /etc/hosts.equiv. RPC broadcast requests (for example: _r_w_a_l_l, _r_u_p, _r_u_s_e_r_s) always appear to come from the responding host. What happens is that the client broadcasts the request to all _p_o_r_t_m_a_p daemons on its network; each _p_o_r_t_m_a_p daemon forwards the request to a local daemon. As far as the _r_w_a_l_l etc. daemons know, the request comes from the local host. Printed 11/24/99 3 TCPD(8) UNIX Programmer's Manual TCPD(8) FILES The default locations of the host access control tables are: /etc/hosts.allow /etc/hosts.deny SEE ALSO hosts_access(5), format of the tcpd access control tables. syslog.conf(5), format of the syslogd control file. inetd.conf(5), format of the inetd control file. AUTHORS 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 Printed 11/24/99 4