UNIX MISCONFIGURATION ISSUES

UNIX MISCONFIGURATION ISSUES


The host.equiv file

The hosts.equiv file allows or denies hosts and users to use the r-commands (e.g. rlogin, rsh or rcp) without supplying a password. The hosts.equiv file resides in the ROOTDIR /etc directory and lists the remote machines that may connect to the local machine and the local user names those machines may connect as. The .rhosts file resides in a user's home directory and specifies the remote machines and remote user names that the user may use to remotely log in to the local machine.

The file uses the following format: [ + | - ] [hostname] [username]

The hostname is the name of a host which is logically equivalent to the local host. Users logged into that host are allowed to access like-named user accounts on the local host without supplying a password. The hostname may be (optionally) preceded by a plus (+) sign. If the plus sign is used alone it allows any host to access your system. You can expicitly deny access to a host by preceding the hostname by a minus (-) sign. Users from that host must always supply a password. For security reasons you should always use the FQDN of the hostname and not the short hostname.

The username entry grants a specific user access to all user accounts (except root) without supplying a password. That means the user is NOT restricted to like-named accounts. The username may be (optionally) preceded by a plus (+) sign. You can also explicitly deny access to a specific user by preceding the username with a minus (-) sign. This says that the user is not trusted no matter what other entries for that host exist. Netgroups can be specified by preceding the netgroup by an @ sign.

Note: Be extremely careful when using the plus (+) sign. A simple typographical error could result in a standalone plus sign. A standalone plus sign is a wildcard character that means "any host"!

Examples

Here are some examples of hosts.equiv entries for the local host machine named colossus:

+ +

Example 1: Allows any user from any host to connect to colossus + big +

Example 2:Allows any user from the remote hosts tiny or big to connect to colossus.+ forbin

Example 3:Allows the user forbin to connect to colossus from any remote host.

Here is an example of how the hosts.equiv and the .rhosts file combine. Consider a hosts.equiv file with the following entry:

+ forbin and a .rhosts in the home directory of the user forbin with the following entry:
tiny +


The hosts.equiv entry allows the user forbin to connect to colossus as forbin from any remote host, while the .rhosts entry allows any user from the remote host tiny to connect to colossus as forbin. When both files have entries that apply, the most restrictive combination of the entries applies. In this case, these entries combine to mean that only the user forbin from the remote host tiny can connect to colossus as forbin.

An entry of + +

Presents two severe security hazards. First, it allows any user on any machine to connect to the local host as the same user name. Second, if it is specified in the ROOTDIR/etc/hosts.equiv file, it allows any user on any machine to connect to the local host as any user.

Warning

The user name checks provided by this mechanism are not secure, as the remote user name is received by the server unchecked for validation. Therefore, this mechanism should only be used in an environment where all hosts are completely trusted.

Specifying a numeric host address rather than a host name can somewhat help security considerations.

When a user name (or +) is specified in ROOTDIR/etc/hosts.equiv, that user (or all users, in the case of +) may log in to the local host as any local user. User names in ROOTDIR/etc/hosts.equiv should always be specified.

A .rhosts file must be owned by the user whose home directory it resides in and must be writable by only that user.

Further On

Some systems will only honour the contents of this file when it has owner root and no write permission for anybody else. Some exceptionally paranoid systems even require that there be no other hard links to the file. 

Modern systems use the Pluggable Authentication Modules library (PAM). With PAM a standalone plus sign is only considered a wildcard character which means "any host" when the word promiscuous is added to the auth component line in your PAM file for the particular service (e.g. rlogin).
References:
  1. http://linux.about.com/library/cmd/blcmdl5_hosts.equiv.htm 
  2. https://www.mkssoftware.com/docs/man4/rhosts.4.asp
  3. http://unixhelp.ed.ac.uk/CGI/man-cgi?hosts.equiv+5