Version 11 (Release 6.1)

Xsecurity(X1M)


Xsecurity -- X display access control

Description

X provides mechanism for implementing many access control systems. The sample implementation includes three mechanisms:

Host Access
Simple host-based access control.

MIT-MAGIC-COOKIE-1
Shared plain-text ``cookies''

MIT-KERBEROS-5
Kerberos Version 5 user-to-user.

Access system descriptions


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. 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.

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.


MIT-KERBEROS-5
Kerberos is a network-based authentication scheme developed by MIT for Project Athena. It allows mutually suspicious principals to authenticate each other as long as each trusts a third party, Kerberos. Each principal has a secret key known only to it and Kerberos. Principals includes servers, such as an FTP server or X server, and human users, whose key is their password. Users gain access to services by getting Kerberos tickets for those services from a Kerberos server. Since the X server has no place to store a secret key, it shares keys with the user who logs in. X authentication thus uses the user-to-user scheme of Kerberos version 5.

Since Kerberos is a user-based authorization protocol, like the SUN-DES-1 protocol, the owner of a display can enable and disable specific users, or Kerberos principals. The xhost client is used to enable or disable authorization. For example,

xhost krb5:judy krb5:gildea@x.org

adds ``judy'' from the Kerberos realm of the local machine, and ``gildea'' from the x.org realm.


The authorization file

Except for Host Access control, each of these systems uses data stored in the .Xauthority file to generate the correct authorization information to pass along to the X server at connection setup. MIT-MAGIC-COOKIE-1 stores secret data in the file; so anyone who can read the file can gain access to the X server.

Each entry in the .Xauthority file matches a certain connection family (TCP/IP, DECnet or local connections) and X display name (hostname plus display number). This allows multiple authorization entries for different displays to share the same data file. A special connection family (FamilyWild, value 65535) causes an entry to match every display, allowing the entry to be used for all connections. Each entry additionally contains the authorization name and whatever private authorization data is needed by that authorization type to generate the correct information at connection setup time.

The xauth program manipulates the .Xauthority file format. It understands the semantics of the connection families and address formats, displaying them in an easy to understand format. It also understands that SUN-DES-1 and MIT-KERBEROS-5 use string values for the authorization data, and displays them appropriately.

The X server (when running on a workstation) reads authorization information from a file name passed on the command line with the -auth option. The authorization entries in the file are used to control access to the server. In each of the authorization schemes listed above, the data needed by the server to initialize an authorization scheme is identical to the data needed by the client to generate the appropriate authorization information, so the same file can be used by both processes. This is especially useful when xinit is used.


MIT-MAGIC-COOKIE-1
This system uses 128 bits of data shared between the user and the X server. Any collection of bits can be used. xdm generates these keys using a cryptographically secure pseudo random number generator, and so the key to the next session cannot be computed from the current session key.

MIT-KERBEROS-5
Kerberos reads tickets from the cache pointed to by the KRB5CCNAME environment variable, so does not use any data from the .Xauthority file. An entry with no data must still exist to tell clients that MIT-KERBEROS-5 is available.

Unlike the .Xauthority file for clients, the authority file passed by xdm to a local X server (with ``-auth filename'', see xdm(1)) does contain the name of the credentials cache, since the X server will not have the KRB5CCNAME environment variable set. The data of the MIT-KERBEROS-5 entry is the credentials cache name and has the form ``UU:FILE:filename'', where filename is the name of the credentials cache file created by xdm. Note again that this form is not used by clients.

Files

.Xauthority

References

X(X1M), xauth(X1M), xhost(X1M), xinit(X1M).
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004