Host Access
Any client on a host in the host access control list is allowed access to the X server. This
system can work reasonably well in an environment where everyone trusts everyone, or when only a
single person can log in to a given machine, and is easy to use when the list of hosts used is
small. This system does not work well when multiple people can log in to a single machine and
mutual trust does not exist. The list of allowed hosts is stored in the X server and can be
changed with the xhost command. The list is stored in the server by network address, not host
names, so is not automatically updated if a host changes address while the server is running.
When using the more secure mechanisms listed below, the host list is normally configured to be the
empty list, so that only authorized programs can connect to the display. See the GRANTING ACCESS
section of the Xserver man page for details on how this list is initialized at server startup.
MIT-MAGIC-COOKIE-1
When using MIT-MAGIC-COOKIE-1, the client sends a 128 bit "cookie" along with the connection setup
information. If the cookie presented by the client matches one that the X server has, the
connection is allowed access. The cookie is chosen so that it is hard to guess; xdm generates
such cookies automatically when this form of access control is used. The user's copy of the
cookie is usually stored in the .Xauthority file in the home directory, although the environment
variable XAUTHORITY can be used to specify an alternate location. Xdm automatically passes a
cookie to the server for each new login session, and stores the cookie in the user file at login.
The cookie is transmitted on the network without encryption, so there is nothing to prevent a
network snooper from obtaining the data and using it to gain access to the X server. This system
is useful in an environment where many users are running applications on the same machine and want
to avoid interference from each other, with the caveat that this control is only as good as the
access control to the physical network. In environments where network-level snooping is
difficult, this system can work reasonably well.
XDM-AUTHORIZATION-1
Sites who compile with DES support can use a DES-based access control mechanism called XDM-
AUTHORIZATION-1. It is similar in usage to MIT-MAGIC-COOKIE-1 in that a key is stored in the
.Xauthority file and is shared with the X server. However, this key consists of two parts - a 56
bit DES encryption key and 64 bits of random data used as the authenticator.
When connecting to the X server, the application generates 192 bits of data by combining the
current time in seconds (since 00:00 1/1/1970 GMT) along with 48 bits of "identifier". For
TCP/IPv4 connections, the identifier is the address plus port number; for local connections it is
the process ID and 32 bits to form a unique id (in case multiple connections to the same server
are made from a single process). This 192 bit packet is then encrypted using the DES key and sent
to the X server, which is able to verify if the requestor is authorized to connect by decrypting
with the same DES key and validating the authenticator and additional data. This system is useful
in many environments where host-based access control is inappropriate and where network security
cannot be ensured.
SUN-DES-1
Recent versions of SunOS (and some other systems) have included a secure public key remote
procedure call system. This system is based on the notion of a network principal; a user name and
NIS domain pair. Using this system, the X server can securely discover the actual user name of
the requesting process. It involves encrypting data with the X server's public key, and so the
identity of the user who started the X server is needed for this; this identity is stored in the
.Xauthority file. By extending the semantics of "host address" to include this notion of network
principal, this form of access control is very easy to use.
To allow access by a new user, use xhost. For example,
xhost keith@ ruth@mit.edu
adds "keith" from the NIS domain of the local machine, and "ruth" in the "mit.edu" NIS domain.
For keith or ruth to successfully connect to the display, they must add the principal who started
the server to their .Xauthority file. For example:
xauth add expo.lcs.mit.edu:0 SUN-DES-1 unix.expo.lcs.mit.edu@our.domain.edu
This system only works on machines which support Secure RPC, and only for users which have set up
the appropriate public/private key pairs on their system. See the Secure RPC documentation for
details. To access the display from a remote host, you may have to do a keylogin on the remote
host first.
Server Interpreted
The Server Interpreted method provides two strings to the X server for entry in the access control
list. The first string represents the type of entry, and the second string contains the value of
the entry. These strings are interpreted by the server and different implementations and builds
may support different types of entries. The types supported in the sample implementation are
defined in the SERVER INTERPRETED ACCESS TYPES section below. Entries of this type can be
manipulated via xhost. For example to add a Server Interpreted entry of type localuser with a
value of root, the command is xhost+si:localuser:root.