pwauth
A Unix Web Authenticator
Author: Jan Wolter (E-Mail)

DOWNLOAD:
Stable version: pwauth-2.3.6.tar.gz

Introduction:

Pwauth is an authenticator designed to be used with mod_auth_external or mod_authnz_external and the Apache HTTP Daemon to support reasonably secure web authentication out of the system password database on most versions of Unix.

What pwauth actually does is very simple. Given a login and a password, it returns a status code indicating whether it is a valid login/password or not. It is normally installed as an suid-root program, so other programs (like Apache or a CGI program) can run it to check if a login/password is valid even though they don't themselves have read access to the system password database.

Applications:

I have used pwauth in two major configurations:

The APIs for Unix authentication systems vary quite a lot, and pwauth supports most of them. Major variations include:

Features:

Other configurable features of pwauth include:

Because in typical configurations pwauth is run very frequently (on each HTTP request to a protected page), all configuration is compiled in. This means it does not have to read and parse a configuration file on every run, improving performance. It does mean that you need to recompile pwauth every time you change it's configuration. (But, of course, it does not have to be recompiled if the PAM or login.conf configuration is changed.)

Security Considerations:

I believe that pwauth, with mod_auth_external, is the most secure method for doing web authentication out of unix shadow password systems. Mod_auth_pam or mod_auth_system can also do this, but since they are internal authenticators, they will only work if you make the shadow password file readable to the http server. This means that if there are any exploitable vulnerabilities in the http server, then it may be possible for people to grab a copy of your shadow password file. Worse, any CGI program on your system which is not run under suExec or cgiwrap also has read access to your shadow password database, and any bugs in these might also expose your entire password database. When mod_auth_external and pwauth are used, neither the http server nor any CGI programs are given access to the shadow database. Only the pwauth program does. Since it is a small and simple program, it is much easier to assure that it does not have security weaknesses.

Having said that, web authentication from a Unix password file is an idea that many sensible people find seriously questionable. We developed it for use on a system whose security concerns are seriously different, and it has worked well for us over many years, in the face of fairly intense hacker activity. See Apache's FAQ for a discussion of some of the issues here. Pwauth has features that can address most of the arguments made here, if correctly configured, but you need to be aware of the issues and extremely careful.

A fundamental security problem with web authentication is that the passwords are sent in clear text over the network. In the case of basic authentication, they are sent with every page request. Furthermore, with the http protocol, unlike a protocol like telnet, copies of passwords are likely to be cached in various places along the way. Though exploits based on this are rare, it is a fundamentally sloppy way to treat a password. I strongly recommend that pwauth be used with the https protocol, which encrypts all requests including the passwords, whenever possible.

When using form-based authentication there is another potential security problem that has nothing directly to do with pwauth. Typically in such systems you assign each successfully logged in user a session ID, which they can use to identify themselves in future http requests. This is either placed in a cookie, or passed from page to page as a CGI query argument. If it is a cookie, or the query string of a GET request, then it will be passed to the CGI program in an environment variable. On most (but not all) Unix systems, any logged in user can see the environment variables of any process running on the system. This would make it possible to steal the session ID and impersonate the user. Basic authentication does not have this problem, nor do query arguments in POST requests (but few web sites use exclusively POST requests).

Mod_auth_external has two ways of passing arguments to the external authenticator. The "environment" method passes the user's login and password via environment variables and has the same security problem as described above. It should never be used. Use the "pipe" method instead. This passes arguments securely.

Release Notes:

Versions of pwauth prior to version 2.2.8 were distributed as part of the mod_auth_external package. Pwauth version 2.2.8 is identical to the version included in the mod_auth_external version 2.2.8 release. Later version numbers for the two packages diverged, retaining no correspondence to each other.

Links

Here are some links to relevant software:


Last Update: Mon Dec 17 08:09:19 EST 2007