TCPD(8)
๐ TCPD(8) โ the access control bouncer for your internet services ๐
okay bestie, sit down, hydrate, because we're talking about tcpd โ a total main character from the System Manager's Manual, section 8, i.e. the "only the sysadmin girlies should run this" zone. she's the access control facility for internet services and she is literally the vibe check your daemons deserve. ๐ซถ
โจ NAME โจ
tcpd โ access control facility for internet services. that's the whole name, she's simple like that ๐
๐ธ DESCRIPTION ๐ธ
so the tcpd program can be set up to monitor incoming requests for telnet, finger, ftp, exec, rsh, rlogin, tftp, talk, comsat and other services that have a one-to-one mapping onto executable files. basically if your service is a daemon-shaped thing, she can stand in front of it. no cap. ๐
the program supports both 4.3BSD-style sockets and System V.4-style TLI. quick lil caveat tho: functionality may be limited when the protocol underneath TLI is not an internet protocol. so if your TLI stack is being weird and non-internet, she's not at full power. noted. ๐ง
there are two possible modes of operation, and yes you have to pick one like it's a personality quiz:
- execution of
tcpdbefore a service started byinetd, or - linking a daemon with the
libwrapshared library, as documented in thehosts_access(3)manual page.
so when she's started by inetd, here's the whole thing: whenever a request for service arrives, the inetd daemon is tricked into running the tcpd program instead of the desired server. she logs the request, she does some additional checks, and when all is well, tcpd runs the appropriate server program and goes away. she does her job and leaves, which is honestly the most iconic energy possible. ๐
optional features, because she's got range:
- pattern-based access control
- client username lookups with the RFC 931 etc. protocol
- protection against hosts that pretend to have someone elses host name
- protection against hosts that pretend to have someone elses network address
๐ LOGGING ๐
connections that are monitored by tcpd are reported through the syslog(3) facility. every single record contains a time stamp, the client host name, and the name of the requested service. this info can be useful to detect unwanted activities, especially when logfile information from several hosts is merged. it's giving detective era. ๐
and if you wanna find out where your logs are actually going (fair question, bestie), examine the syslog configuration file, usually /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 fires. so yeah, she can run commands on you when a rule matches. for details, see the hosts_access(5) manual page. ๐
๐ฆ HOST NAME VERIFICATION ๐ฆ
okay this part is lowkey the most important part so pay attention bestie. the authentication scheme of some protocols (rlogin, 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. ๐
tcpd 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. if any discrepancy is detected, tcpd concludes that it is dealing with a host that pretends to have someone elses host name. caught in 4k. ๐
if the sources are compiled with-DPARANOID,tcpdwill drop the connection in case of a host name/address mismatch. otherwise, the hostname can be matched with thePARANOIDwildcard, after which suitable action can be taken.
๐ 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. โญ
real talk: UDP services do not benefit from this protection, and this feature must be turned on at compile time. so it's a build-time decision, not a runtime one. plan accordingly. ๐
๐ฅ RFC 931 ๐ฅ
when RFC 931 etc. lookups are enabled (again, compile-time option), 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. โจ
and here's the fine print: client user name lookups will not work for datagram-oriented connections, and may cause noticeable delays in the case of connections from PCs. so if a PC is dialing in, your lookup might be sitting there like ๐ง. noted.
๐ EXAMPLES ๐
the details of using tcpd depend on pathname information that was compiled into the program. so, like, read your own build bestie, she can't read it for you. ๐ญ
๐ EXAMPLE 1 ๐
this example applies when tcpd expects that the original network daemons will be moved to an "other" place.
in order to monitor access to the finger 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. slay. ๐
# mkdir /other/place
# mv /usr/sbin/in.fingerd /other/place
# cp tcpd /usr/sbin/in.fingerd
the example assumes that the network daemons live in /usr/sbin. on some systems, network daemons live in /usr/sbin or in /usr/libexec, or have no in. prefix to their name. (yes, the original says /usr/sbin both times, that's just how it is, we don't editorialize.) ๐
๐ฆ EXAMPLE 2 ๐ฆ
this example applies when tcpd expects that the network daemons are left in their original place.
in order to monitor access to the finger service, perform the following edits on the inetd configuration file (usually /etc/inetd.conf):
finger stream tcp nowait nobody /usr/sbin/in.fingerd in.fingerd
becomes:
finger stream tcp nowait nobody /usr/sbin/tcpd in.fingerd
the example assumes that the network daemons live in /usr/sbin. 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 configuration file. every system is a little different, it's giving โจuniqueโจ.
similar changes will be needed for the other services that are to be covered by tcpd. and then โ this is the part everyone forgets โ send a kill -HUP to the inetd(8) process to make the changes effective. ๐
๐ EXAMPLE 3 ๐
in the case of daemons that do not live in a common directory ("secret" or otherwise), edit the inetd configuration file so that it specifies an absolute path name for the process name field. for example:
ntalk dgram udp wait root /usr/sbin/tcpd /usr/local/lib/ntalkd
only the last component (ntalkd) of the pathname will be used for access control and logging. so the full path is just for finding the thing; the name is what gets matched. ๐ง
๐ BUGS ๐
okay the not-so-cute part, but we keep it real here:
- some UDP (and RPC) daemons linger around for a while after they have finished their work, in case another request comes in. in the
inetdconfiguration file these services are registered with thewaitoption. only the request that started such a daemon will be logged. so one log line, many requests. that's the deal. ๐ญ - the program does not work with RPC services over TCP. these services are registered as
rpc/tcpin theinetdconfiguration file. the only non-trivial service that is affected by this limitation isrexd, which is used by theon(1)command. this is no great loss. on most systems,rexdis less secure than a wildcard in/etc/hosts.equiv. i'm just the messenger bestie ๐ - RPC broadcast requests (for example:
rwall,rup,rusers) always appear to come from the responding host. what happens is that the client broadcasts the request to allportmapdaemons on its network; eachportmapdaemon forwards the request to a local daemon. as far as therwalletc. daemons know, the request comes from the local host. so the origin story is a lie. ๐ซ
๐ FILES ๐
the default locations of the host access control tables are:
/etc/hosts.allow
/etc/hosts.deny
those two files are literally the whole vibe check. ๐
โญ SEE ALSO โญ
hosts_access(3), functions provided by thelibwraplibrary.hosts_access(5), format of thetcpdaccess control tables.syslog.conf(5), format of thesyslogdcontrol file.inetd.conf(5), format of theinetdcontrol file.
go read them, bestie, they're the sequels. ๐
๐ 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
and that's the whole page, babes. ๐ this one comes straight out of the System Manager's Manual โ she's TCPD(8), section 8, footer and all. thanks for reading the entire thing, you ate. periodt. ๐
โจ๐
๐ฆ where this page comes from
- debian bookworm: tcpd 7.6.q-32
- debian trixie: tcpd 7.6.q-36
- nixos 26.05: tcp-wrappers 7.6.q-36
- nixpkgs unstable: tcp-wrappers 7.6.q-36
- ubuntu jammy: tcpd 7.6.q-31build2
- ubuntu noble: tcpd 7.6.q-33
- ubuntu questing: tcpd 7.6.q-36build1
- ubuntu resolute: tcpd 7.6.q-36build2
- ubuntu stonking: tcpd 7.6.q-37
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms