| 1 |
.TH TCPD 8 |
| 2 |
.SH NAME |
| 3 |
tcpd \- access control facility for internet services |
| 4 |
.SH DESCRIPTION |
| 5 |
.PP |
| 6 |
The \fItcpd\fR program can be set up to monitor incoming requests for |
| 7 |
\fItelnet\fR, \fIfinger\fR, \fIftp\fR, \fIexec\fR, \fIrsh\fR, |
| 8 |
\fIrlogin\fR, \fItftp\fR, \fItalk\fR, \fIcomsat\fR and other services |
| 9 |
that have a one-to-one mapping onto executable files. |
| 10 |
.PP |
| 11 |
The program supports both 4.3BSD-style sockets and System V.4-style |
| 12 |
TLI. Functionality may be limited when the protocol underneath TLI is |
| 13 |
not an internet protocol. |
| 14 |
.PP |
| 15 |
There are two possible modes of operation: execution of \fItcpd\fP |
| 16 |
before a service started by \fIinetd\fP, or linking a daemon with |
| 17 |
the \fIlibwrap\fP shared library as documented in the \fIhosts_access\fR(3) |
| 18 |
manual page. Operation when started by \fIinetd\fP |
| 19 |
is as follows: whenever a request for service arrives, the |
| 20 |
\fIinetd\fP daemon is tricked into running the \fItcpd\fP program |
| 21 |
instead of the desired server. \fItcpd\fP logs the request and does |
| 22 |
some additional checks. When all is well, \fItcpd\fP runs the |
| 23 |
appropriate server program and goes away. |
| 24 |
.PP |
| 25 |
Optional features are: pattern-based access control, client username |
| 26 |
lookups with the RFC 931 etc. protocol, protection against hosts that |
| 27 |
pretend to have someone elses host name, and protection against hosts |
| 28 |
that pretend to have someone elses network address. |
| 29 |
.SH LOGGING |
| 30 |
Connections that are monitored by |
| 31 |
.I tcpd |
| 32 |
are reported through the \fIsyslog\fR(3) facility. Each record contains |
| 33 |
a time stamp, the client host name and the name of the requested |
| 34 |
service. The information can be useful to detect unwanted activities, |
| 35 |
especially when logfile information from several hosts is merged. |
| 36 |
.PP |
| 37 |
In order to find out where your logs are going, examine the syslog |
| 38 |
configuration file, usually /etc/syslog.conf. |
| 39 |
.SH ACCESS CONTROL |
| 40 |
Optionally, |
| 41 |
.I tcpd |
| 42 |
supports a simple form of access control that is based on pattern |
| 43 |
matching. The access-control software provides hooks for the execution |
| 44 |
of shell commands when a pattern fires. For details, see the |
| 45 |
\fIhosts_access\fR(5) manual page. |
| 46 |
.SH HOST NAME VERIFICATION |
| 47 |
The authentication scheme of some protocols (\fIrlogin, rsh\fR) relies |
| 48 |
on host names. Some implementations believe the host name that they get |
| 49 |
from any random name server; other implementations are more careful but |
| 50 |
use a flawed algorithm. |
| 51 |
.PP |
| 52 |
.I tcpd |
| 53 |
verifies the client host name that is returned by the address->name DNS |
| 54 |
server by looking at the host name and address that are returned by the |
| 55 |
name->address DNS server. If any discrepancy is detected, |
| 56 |
.I tcpd |
| 57 |
concludes that it is dealing with a host that pretends to have someone |
| 58 |
elses host name. |
| 59 |
.PP |
| 60 |
If the sources are compiled with -DPARANOID, |
| 61 |
.I tcpd |
| 62 |
will drop the connection in case of a host name/address mismatch. |
| 63 |
Otherwise, the hostname can be matched with the \fIPARANOID\fR wildcard, |
| 64 |
after which suitable action can be taken. |
| 65 |
.SH HOST ADDRESS SPOOFING |
| 66 |
Optionally, |
| 67 |
.I tcpd |
| 68 |
disables source-routing socket options on every connection that it |
| 69 |
deals with. This will take care of most attacks from hosts that pretend |
| 70 |
to have an address that belongs to someone elses network. UDP services |
| 71 |
do not benefit from this protection. This feature must be turned on |
| 72 |
at compile time. |
| 73 |
.SH RFC 931 |
| 74 |
When RFC 931 etc. lookups are enabled (compile-time option) \fItcpd\fR |
| 75 |
will attempt to establish the name of the client user. This will |
| 76 |
succeed only if the client host runs an RFC 931-compliant daemon. |
| 77 |
Client user name lookups will not work for datagram-oriented |
| 78 |
connections, and may cause noticeable delays in the case of connections |
| 79 |
from PCs. |
| 80 |
.SH EXAMPLES |
| 81 |
The details of using \fItcpd\fR depend on pathname information that was |
| 82 |
compiled into the program. |
| 83 |
.SH EXAMPLE 1 |
| 84 |
This example applies when \fItcpd\fR expects that the original network |
| 85 |
daemons will be moved to an "other" place. |
| 86 |
.PP |
| 87 |
In order to monitor access to the \fIfinger\fR service, move the |
| 88 |
original finger daemon to the "other" place and install tcpd in the |
| 89 |
place of the original finger daemon. No changes are required to |
| 90 |
configuration files. |
| 91 |
.nf |
| 92 |
.sp |
| 93 |
.in +5 |
| 94 |
# mkdir /other/place |
| 95 |
# mv /usr/sbin/in.fingerd /other/place |
| 96 |
# cp tcpd /usr/sbin/in.fingerd |
| 97 |
.fi |
| 98 |
.PP |
| 99 |
The example assumes that the network daemons live in /usr/sbin. On some |
| 100 |
systems, network daemons live in /usr/sbin or in /usr/libexec, or have |
| 101 |
no `in.\' prefix to their name. |
| 102 |
.SH EXAMPLE 2 |
| 103 |
This example applies when \fItcpd\fR expects that the network daemons |
| 104 |
are left in their original place. |
| 105 |
.PP |
| 106 |
In order to monitor access to the \fIfinger\fR service, perform the |
| 107 |
following edits on the \fIinetd\fR configuration file (usually |
| 108 |
\fI/etc/inetd.conf\fR): |
| 109 |
.nf |
| 110 |
.sp |
| 111 |
.ti +5 |
| 112 |
finger stream tcp nowait nobody /usr/sbin/in.fingerd in.fingerd |
| 113 |
.sp |
| 114 |
becomes: |
| 115 |
.sp |
| 116 |
.ti +5 |
| 117 |
finger stream tcp nowait nobody /usr/sbin/tcpd in.fingerd |
| 118 |
.sp |
| 119 |
.fi |
| 120 |
.PP |
| 121 |
The example assumes that the network daemons live in /usr/sbin. On some |
| 122 |
systems, network daemons live in /usr/sbin or in /usr/libexec, the |
| 123 |
daemons have no `in.\' prefix to their name, or there is no userid |
| 124 |
field in the inetd configuration file. |
| 125 |
.PP |
| 126 |
Similar changes will be needed for the other services that are to be |
| 127 |
covered by \fItcpd\fR. Send a `kill -HUP\' to the \fIinetd\fR(8) |
| 128 |
process to make the changes effective. |
| 129 |
.SH EXAMPLE 3 |
| 130 |
In the case of daemons that do not live in a common directory ("secret" |
| 131 |
or otherwise), edit the \fIinetd\fR configuration file so that it |
| 132 |
specifies an absolute path name for the process name field. For example: |
| 133 |
.nf |
| 134 |
.sp |
| 135 |
ntalk dgram udp wait root /usr/sbin/tcpd /usr/local/lib/ntalkd |
| 136 |
.sp |
| 137 |
.fi |
| 138 |
.PP |
| 139 |
Only the last component (ntalkd) of the pathname will be used for |
| 140 |
access control and logging. |
| 141 |
.SH BUGS |
| 142 |
Some UDP (and RPC) daemons linger around for a while after they have |
| 143 |
finished their work, in case another request comes in. In the inetd |
| 144 |
configuration file these services are registered with the \fIwait\fR |
| 145 |
option. Only the request that started such a daemon will be logged. |
| 146 |
.PP |
| 147 |
The program does not work with RPC services over TCP. These services |
| 148 |
are registered as \fIrpc/tcp\fR in the inetd configuration file. The |
| 149 |
only non-trivial service that is affected by this limitation is |
| 150 |
\fIrexd\fR, which is used by the \fIon(1)\fR command. This is no great |
| 151 |
loss. On most systems, \fIrexd\fR is less secure than a wildcard in |
| 152 |
/etc/hosts.equiv. |
| 153 |
.PP |
| 154 |
RPC broadcast requests (for example: \fIrwall, rup, rusers\fR) always |
| 155 |
appear to come from the responding host. What happens is that the |
| 156 |
client broadcasts the request to all \fIportmap\fR daemons on its |
| 157 |
network; each \fIportmap\fR daemon forwards the request to a local |
| 158 |
daemon. As far as the \fIrwall\fR etc. daemons know, the request comes |
| 159 |
from the local host. |
| 160 |
.SH FILES |
| 161 |
.PP |
| 162 |
The default locations of the host access control tables are: |
| 163 |
.PP |
| 164 |
/etc/hosts.allow |
| 165 |
.br |
| 166 |
/etc/hosts.deny |
| 167 |
.SH SEE ALSO |
| 168 |
.na |
| 169 |
.nf |
| 170 |
hosts_access(3), functions provided by the libwrap library. |
| 171 |
hosts_access(5), format of the tcpd access control tables. |
| 172 |
syslog.conf(5), format of the syslogd control file. |
| 173 |
inetd.conf(5), format of the inetd control file. |
| 174 |
.SH AUTHORS |
| 175 |
.na |
| 176 |
.nf |
| 177 |
Wietse Venema ([email protected]), |
| 178 |
Department of Mathematics and Computing Science, |
| 179 |
Eindhoven University of Technology |
| 180 |
Den Dolech 2, P.O. Box 513, |
| 181 |
5600 MB Eindhoven, The Netherlands |
| 182 |
\" @(#) tcpd.8 1.5 96/02/21 16:39:16 |