Previous Next Contents

4.4 Example configuration file entries

In this section, we give some examples of entries that can be present in the Linux-PAM configuration file. As a first attempt at configuring your system you could do worse than to implement these.

Default policy

If a system is to be considered secure, it had better have a reasonably secure `OTHER' entry. The following is a paranoid setting (which is not a bad place to start!):

#
# default; deny access
#
OTHER   auth     required       /usr/lib/security/pam_deny.so
OTHER   account  required       /usr/lib/security/pam_deny.so
OTHER   password required       /usr/lib/security/pam_deny.so
OTHER   session  required       /usr/lib/security/pam_deny.so
Whilst fundamentally a secure default, this is not very sympathetic to a misconfigured system. For example, such a system is vulnerable to locking everyone out should the rest of the file become badly written.

The module pam_deny (documented in a later section) is not very sophisticated. For example, it logs no information when it is invoked so unless the users of a system contact the administrator when failing to execute a service application, the administrator may go for a long while in ignorance of the fact that his system is misconfigured.

The addition of the following line before those in the above example would provide a suitable warning to the administrator.

#
# default; wake up! This application is not configured
#
OTHER   auth     required       /usr/lib/security/pam_warn.so
OTHER   password required       /usr/lib/security/pam_warn.so
Having two ``OTHER auth'' lines is an example of stacking.

On a system that uses the /etc/pam.d/ configuration, the corresponding default setup would be achieved with the following file:

#
# default configuration: /etc/pam.d/other
#
auth     required       /usr/lib/security/pam_warn.so
auth     required       /usr/lib/security/pam_deny.so
account  required       /usr/lib/security/pam_deny.so
password required       /usr/lib/security/pam_warn.so
password required       /usr/lib/security/pam_deny.so
session  required       /usr/lib/security/pam_deny.so
This is the only explicit example we give for an /etc/pam.d/ file. In general, it should be clear how to transpose the remaining examples to this configuration scheme.

On a less sensitive computer, one on which the system administrator wishes to remain ignorant of much of the power of Linux-PAM, the following selection of lines (in /etc/pam.conf) is likely to mimic the historically familiar Linux setup.

#
# default; standard UNIX access
#
OTHER   auth     required       /usr/lib/security/pam_unix_auth.so
OTHER   account  required       /usr/lib/security/pam_unix_acct.so
OTHER   password required       /usr/lib/security/pam_unix_passwd.so
OTHER   session  required       /usr/lib/security/pam_unix_sess.so
In general this will provide a starting place for most applications. Unfortunately, most is not all. One application that might require additional lines is ftpd if you wish to enable anonymous-ftp.

To enable anonymous-ftp, the following lines might be used to replace the default (OTHER) ones. (*WARNING* as of 1996/12/28 this does not work correctly with any ftpd. Consequently, this description may be subject to change or the application will be fixed.)

#
# ftpd; add ftp-specifics. These lines enable anonymous ftp over
#       standard UNIX access (the listfile entry blocks access to
#       users listed in /etc/ftpusers)
#
ftpd    auth    sufficient  /usr/lib/security/pam_ftp.so
ftpd    auth    required    /usr/lib/security/pam_unix_auth.so use_first_pass
ftpd    auth    required    /usr/lib/security/pam_listfile.so \
                        onerr=succeed item=user sense=deny file=/etc/ftpusers
Note, the second line is necessary since the default entries are ignored by a service application (here ftpd) if there are any entries in /etc/pam.conf for that specified service. Again, this is an example of authentication module stacking. Note the use of the sufficient control-flag. It says that ``if this module authenticates the user, ignore the subsequent auth modules''. Also note the use of the ``use_first_pass'' module-argument, this instructs the UNIX authentication module that it is not to prompt for a password but rely one already having been obtained by the ftp module.

The standard UNIX modules, used above, are strongly tied to using the default `libc' user database functions (see for example, man getpwent). It is the opinion of the author that these functions are not sufficently flexible to make full use of the power of Linux-PAM. For this reason, and as a small plug, I mention in passing that there is a pluggable replacement for the pam_unix_.. modules; pam_pwdb. See the section below for a more complete description.


Previous Next Contents