Book Image

Pluggable Authentication Modules: The Definitive Guide to PAM for Linux SysAdmins and C Developers

By : Kenneth Geisshirt
Book Image

Pluggable Authentication Modules: The Definitive Guide to PAM for Linux SysAdmins and C Developers

By: Kenneth Geisshirt

Overview of this book

<p>PAM-aware applications reduce the complexity of authentication. With PAM you can use the same user database for every login process. PAM also supports different authentication processes as required. Moreover, PAM is a well-defined API, and PAM-aware applications will not break if you change the underlying authentication configuration.<br /><br />The PAM framework is widely used by most Linux distributions for authentication purposes. Originating from Solaris 2.6 ten years ago, PAM is used today by most proprietary and free UNIX operating systems including GNU/Linux, FreeBSD, and Solaris, following both the design concept and the practical details. PAM is thus a unifying technology for authentication mechanisms in UNIX. <br /><br />PAM is a modular and flexible authentication management layer that sits between Linux applications and the native underlying authentication system. PAM can be implemented with various applications without having to recompile the applications to specifically support PAM.</p>
Table of Contents (13 chapters)

Automating PAM Tests


The authentication procedure is a manual one. The user has to type in a user name and password. If you have a complex PAM configuration with many modules, manually testing it will take some time. Moreover, when you change a minor thing, you have to go though all the test cases again.

The pamtester utility introduced in the previous section is an interactive command-line program—you have to type in the authentication token (password) for each test case.

It is possible to automate PAM testing by combining pamtester with Expect. Expect is a general software package, which can be used to turn interactive command-line programs into non-interactive programs. It is out of the scope for this book to describe Expect in detail but you can learn more at http://expect.nist.gov/. An Expect script for automated testing of the httpd service is shown below:

  #!/usr/bin/expect -f
  # pamtest - automated PAM tests
  send_user "Valid user, valid password"
  spawn pamtester httpd pamela authenticate...