User guide
Securing NIS
43
• /usr/sbin/rpc.ypxfrd — Also called the ypxfrd service, this daemon is responsible for NIS
map transfers over the network.
• /usr/sbin/yppush — This application propagates changed NIS databases to multiple NIS
servers.
• /usr/sbin/ypserv — This is the NIS server daemon.
NIS is somewhat insecure by today's standards. It has no host authentication mechanisms and
transmits all of its information over the network unencrypted, including password hashes. As a result,
extreme care must be taken when setting up a network that uses NIS. This is further complicated by
the fact that the default configuration of NIS is inherently insecure.
It is recommended that anyone planning to implement an NIS server first secure the portmap service
as outlined in Section 2.2.2, “Securing Portmap”, then address the following issues, such as network
planning.
2.2.3.1. Carefully Plan the Network
Because NIS transmits sensitive information unencrypted over the network, it is important the service
be run behind a firewall and on a segmented and secure network. Whenever NIS information is
transmitted over an insecure network, it risks being intercepted. Careful network design can help
prevent severe security breaches.
2.2.3.2. Use a Password-like NIS Domain Name and Hostname
Any machine within an NIS domain can use commands to extract information from the server without
authentication, as long as the user knows the NIS server's DNS hostname and NIS domain name.
For instance, if someone either connects a laptop computer into the network or breaks into the
network from outside (and manages to spoof an internal IP address), the following command reveals
the /etc/passwd map:
ypcat -d <NIS_domain> -h <DNS_hostname> passwd
If this attacker is a root user, they can obtain the /etc/shadow file by typing the following command:
ypcat -d <NIS_domain> -h <DNS_hostname> shadow
Note
If Kerberos is used, the /etc/shadow file is not stored within an NIS map.
To make access to NIS maps harder for an attacker, create a random string for the DNS hostname,
such as o7hfawtgmhwg.domain.com. Similarly, create a different randomized NIS domain name.
This makes it much more difficult for an attacker to access the NIS server.
2.2.3.3. Edit the /var/yp/securenets File
If the /var/yp/securenets file is blank or does not exist (as is the case after a default installation),
NIS listens to all networks. One of the first things to do is to put netmask/network pairs in the file so
that ypserv only responds to requests from the appropriate network.