Table of Contents

Summary

To develop a declarative syntax for PAM modules to express the features they support, and tools to use this information to present a debconf-based interface to users (including sensible defaults) for enabling/disabling modules in the PAM config, /etc/pam.d/common-*.

Release Note

This section should include a paragraph describing the end-user impact of this change. It is meant to be included in the release notes of the first release in which it is implemented. (Not all of these will actually be included in the release notes, at the release manager's discretion; but writing them is a useful exercise.)

It is mandatory.

Rationale

Currently, there is no easy way to integrate new PAM modules into the system configuration. The best available option is auth-client-config, which is not scalable because complete PAM profiles must be registered centrally and there are various PAM modules that want to be used in combination with others, resulting in a geometric explosion of options. We need a way for individual PAM modules, including third-party modules, to declare themselves to the system so that users can easily enable or disable their most straightforward functionality at install time.

Use Cases

  1. Lenny upgrades his existing Ubuntu system, pulling in the new version of libpam-runtime. He has never modified his /etc/pam.d/ config files. His config must be automatically converted to the new pam_unix-based defaults, even if other non-default pam module packages are installed, so that the upgrade does not disrupt authentication on his system.

  2. Arnold upgrades his existing Ubuntu system, pulling in the new version of libpam-runtime. He has modified /etc/pam.d/common-auth for his use. He should be prompted on upgrade whether to accept the new configuration schema, with a default of "no".

  3. Carmen has installed a new Ubuntu system with the new PAM configuration support. She then installs the libpam-krb5 package. Kerberos-based authentication is automatically configured for her without prompting.

  4. Carmen wishes to disable Kerberos authentication because of a problem with her site's infrastructure. She launches a configuration tool from the System menu, which brings up a debconf UI permitting her to disable the krb5 authentication profile.

Assumptions

Design

Implementation

PAM stack layout

   # prime the stack with a positive return value if there isn't one already;
   # this avoids us returning an error just because nothing sets a success code
   # since the auth modules below will each just jump around
   auth    required                        pam_permit.so
   # here are the per-package snippets (the "Primary" block)
   auth    [success=2 default=ignore]      pam_krb5.so ignore_root
   auth    [success=1 default=ignore]      pam_unix.so nullok_secure try_first_pass
   # here's the fallback if no module succeeds
   auth    requisite                       pam_deny.so
   # and here are more per-package snippets (the "Additional" block)
   auth    optional                        pam_smbpass.so migrate

config file format

   Name: Unix authentication
   Default: yes
   Priority: 1
   Conflicts: unix-session-only
   Auth-Type: Primary
   Auth:
       [success=end default=ignore]        pam_unix.so nullok_secure try_first_pass
   Auth-Initial:
       [success=end default=ignore]        pam_unix.so nullok_secure

module package implementation

Packages implementing PAM profiles under this spec should call pam-auth-update with the --package argument in their postinst script. In the prerm script, these packages should call pam-auth-update --package --remove only when the prerm has been called with remove as its first argument; e.g.:

if [ "$1" = remove ]; then
        pam-auth-update --package --remove unix
fi

Packages which have previously modified /etc/pam.d/common-* may invoke pam-auth-update with the additional --force argument on initial upgrade to this system, if the package can reliably determine that the /etc/pam.d/common-* files on disk have not been modified by the user (i.e., md5sum or similar). Use of the --force argument by a package maintainer script is prohibited in all other cases. Packages must depend on libpam-runtime (>= 1.0.1-6) to ensure availability of pam-auth-update.

UI Changes

This change introduces three new debconf questions. They will not be displayed on systems with the default configuration, but must be shown to users when upgrading from systems with modified PAM configs and when the user chooses to manually configure the authentication settings.

Code Changes

Migration

Because the central authentication config of the system is affected by this spec, it is very sensitive to migration concerns. Care must be taken to never overwrite locally-modified configuration files without explicit permission from the user, and a copy of all local modifications must be preserved.

Test/Demo Plan

  1. install intrepid
  2. install the libpam-cracklib package
  3. change your user password using the 'passwd' command to something weak (short, all lower-case letters)
  4. see that cracklib password strength checking has been automatically enabled!
  5. remove libpam-cracklib
  6. see that cracklib has been removed from /etc/pam.d/common-password

It's that simple!

Outstanding Issues

Module packages shipping the PAM profiles in /usr/share/pam-configs/ is conceptually incompatible with biarch, posing another barrier to the implementation of a biarch PAM package (see open bug #112937). It would be better to address this with a full multiarch implementation in dpkg.

Need to think through implied stacking semantics some more: we have interesting use cases that are either alternatives (unix or krb5 or winbind), or compound methods (passwd+secureid for auth, unix+smbpasswd for passwd), supporting all of these may require a more complex matrix of snippets with nesting of "alternative" sets; UI for this may be too unwieldly to live, how can we scale it back? It would be possible to declare compound configs for e.g., "unix+smbpasswd" or such, but that's less scalable/flexible and provides fewer benefits over auth-client-config. For now, the configurability is limited to one set of alternatives plus a set of "also required" methods, with configs declaring which they are.

If a module ever needed to "sandwich" other modules, this isn't currently supported.


CategorySpec

PAMConfigFrameworkSpec (last edited 2010-06-05 19:30:38 by minbar)