2.5. TCP Wrappers and xinetd
Controlling access to network services is one of the most important security tasks facing a server administrator. Fedora provides several tools for this purpose. For example, an
iptables-based firewall filters out unwelcome network packets within the kernel's network stack. For network services that utilize it, TCP Wrappers add an additional layer of protection by defining which hosts are or are not allowed to connect to "
" network services. One such wrapped network service is the
. This service is called a super server because it controls connections to a subset of network services and further refines access control.
This chapter focuses on the role of TCP Wrappers and
in controlling access to network services and reviews how these tools can be used to enhance both logging and utilization management. Refer to Section 2.9, “IPTables”
for information about using firewalls with
The TCP Wrappers package (
tcp_wrappers) is installed by default and provides host-based access control to network services. The most important component within the package is the
/usr/lib/libwrap.a library. In general terms, a TCP-wrapped service is one that has been compiled against the
When a connection attempt is made to a TCP-wrapped service, the service first references the host's access files (
/etc/hosts.deny) to determine whether or not the client is allowed to connect. In most cases, it then uses the syslog daemon (
syslogd) to write the name of the requesting client and the requested service to
If a client is allowed to connect, TCP Wrappers release control of the connection to the requested service and take no further part in the communication between the client and the server.
In addition to access control and logging, TCP Wrappers can execute commands to interact with the client before denying or releasing control of the connection to the requested network service.
Because TCP Wrappers are a valuable addition to any server administrator's arsenal of security tools, most network services within Fedora are linked to the
libwrap.a library. Some such applications include
To determine if a network service binary is linked to
libwrap.a, type the following command as the root user:
ldd <binary-name> | grep libwrap
with the name of the network service binary.
If the command returns straight to the prompt with no output, then the network service is
The following example indicates that
/usr/sbin/sshd is linked to
[[email protected] ~]# ldd /usr/sbin/sshd | grep libwrap
libwrap.so.0 => /lib/libwrap.so.0 (0x00655000)
[[email protected] ~]#
18.104.22.168. Advantages of TCP Wrappers
TCP Wrappers provide the following advantages over other network service control techniques:
Transparency to both the client and the wrapped network service
— Both the connecting client and the wrapped network service are unaware that TCP Wrappers are in use. Legitimate users are logged and connected to the requested service while connections from banned clients fail.
Centralized management of multiple protocols
— TCP Wrappers operate separately from the network services they protect, allowing many server applications to share a common set of access control configuration files, making for simpler management.