Mod_Auth_External
Mod_Authnz_External

Apache External Authentication Modules

Original Coder: Nathan Neulinger (nneul@umr.edu)
Previous Maintainer: Tyler Allison (allison@nas.nasa.gov)
Current Maintainer: Jan Wolter (E-Mail)

DOWNLOAD:
For Apache 1.3: mod_auth_external-2.1.19.tar.gz
For Apache 2.0: mod_auth_external-2.2.11.tar.gz
For Apache 2.2: mod_authnz_external-3.1.0.tar.gz -or-
mod_authnz_external-3.2.0-beta.tar.gz

Pwauth is now distributed separately.

Introduction:

The Apache HTTP Daemon can be configured to require users to supply logins and passwords before accessing pages in some directories. Authentication is the process of checking if the password given is correct for a user. Apache has standard modules for authenticating out of several different kinds of databases. Mod_Auth_External and mod_authnz_external provide a flexible tool for creating authentication systems based on other databases.

These two modules provide basically the same functionality, and differ mainly in the way they interface to other authentication code in Apache. For Apache 2.1 and later, mod_authnz_external should be prefered. For older versions of Apache, mod_auth_external must be used.

The module can be used in either of two somewhat divergent ways:

I think mod_auth*_external is the best current solution for authenticating out of shadow password files, and other similar applications. For rapid prototyping and for an easy way to build your own modules, mod_perl may be a better solution in some cases.

Example Authenticators in Distribution:

Normally to use mod_auth*_external, you need to supply an authenticator. Checkpassword compatible authenticators, which are commonly used with qmail pop servers, can be used with mod_auth*_external. Several sample authenticators designed especially for mod_auth*_external are included in the distribution or available in separate packages:

For those users who want to develop their own authentication modules, there is detailed documentation included on how to write them in the distribution.

Bugs:

I've had reports that mod_auth*_external interacts badly with fancy auto indexing. An infinite loop of authentication requests starts, with the external authenticator being run endlessly. I have no fix for this at this time, nor do I know whether the problem is in mod_auth*_external or in mod_autoindex.

It has also been reported that it doesn't work with mod_frontpage.

Version Notes:

Version 3.2.0 is a beta release. In it, the code for launching the external authenticator has been rewritten to work by using Apache's internal process management library instead of directly calling the Unix process management functions like fork and execv. In theory this means that it should work on any operating system that Apache works on, including Windows. However, I only do Unix development, and don't even have a Windows C compiler, so I've only tested it under Unix. There is also a new alternate configuration command syntax, that will make it easier to support various other future improvements.

There used to be another version of mod_auth_external maintained by Satoh Fumiyasu. I believe the last version was called version 3.0.0beta3. The versions seem to have diverged after version 2.0.0, Tyler Allison's next-to-last release. It differed significantly from my version, and was not precisely compatible. Fumiyasu's version supported authenticating through a socket against an authentication daemon, a feature I hope to support in the future. It's documentation was mostly in Japanese. This seems to have largely disappeared from sight.

There was an older version of mod_auth_external included in the apache contributed module's pack apache-contrib-1.0.7. This is just Tyler Aliison's 2.0.1 release updated by Ralf Engelschall to work with Apache 1.3. Both my version and Satoh Fumiyasu's version are substantial advances beyond this.

Marc Van Selm has done some updates to mod_auth_external and the radius authenticator. His mod_auth_external authentication updates are pretty much the same as the Ralf Engelschall version, but his version of the radius code may be better than what is in my current package.

Compatibility:

Apache 1.3:
The 2.1.x versions of mod_auth_external are designed for use with Apache 1.3. This branch will continue to be supported for a while, though with steadily decreasing enthusiasm.

Apache 2.0:
The 2.2.x versions of mod_auth_external are designed for Apache 2.0.

Apache 2.2:
Apache 2.2 introduces authentication architecture with top-level authentication modules called mod_auth_basic and mod_auth_digest, which call lower-level authentication modules like mod_authn_file and mod_authn_dbm. Mod_Authnz_External is designed to fit into this scheme, and should be prefered by Apache 2.2 users.

Mod_Authnz_External does not work with digest authentication. I hope to implement this someday, but for a variety of reasons, I'm not confident that anyone would ever want to use it. In digest authentication, the password is one-way encrypted before it is sent by the browser to the http server. It is only possible to check the validity of that password, if the password database contains either plain text passwords or passwords encrypted by exactly the method defined in the digest authentication standard. If the database used some other one-way encryption method, then there would be no way to tell whether or not the password sent from the browser and the one in the database matched. So digest authentication could not be used with most authentication databases. Digest authentication out of a Unix password database is impossible, for example.

It is possible to use the old 2.2.x versions of mod_auth_external with Apache 2.2. You can just run mod_auth_external as a stand-alone authentication module, not using mod_auth_basic. Ideally we'd turn mod_auth_basic off for the directory, but this doesn't currently appear to be possible, so you have to set it to be non-authoritative, so that mod_auth_external will be run after it fails. This is described in the installation notes.

Windows:
It is possible that version 3.2.0 and later will work under Windows, and every other operating system supported by Apache, but this has not been tested.

Security Considerations:

For reasons of backward compatibility, mod_auth_external's default method of passing logins and passwords to external authentication programs is the "environment" method. This method is not secure on some versions of Unix. On such systems, the "pipe" method should be used instead. In fact, I recommend the use of the "pipe" method on all servers, and this is the default in mod_authnz_external

With the insecure "environment" method, mod_auth*_external passes the user's login and password to the external authentication program by putting them in environment variables called USER and PASS. On many versions of Unix (including SunOS and IRIX) any user logged onto the server can see these values by doing a "ps -e" command. This would obviously be a problem if there are ever untrusted users on your server. Other versions of Unix (including Linux) restrict "ps -e" so you can only see your own processes, but this may still be a problem if untrusted people can put CGI programs on your server, since those may run as the same user as your authentication program does. Some versions of Unix don't have a "ps -e" command at all, but even then it is best to be careful. Although the default "ps" command on Solaris won't display environment variables, the backwards compatible "/usr/ucb/ps" command does. Are you sure there isn't an old-style ps command on your system?

I recommend using the "pipe" method instead. Then, mod_auth*_external passes the user's login and password to the external authentication program via a pipe. This is far more secure. If this is done (and it should be), then there should be no problems on any version of Unix.

Links:

Here are some links to relevant software:


Last Update: Mon Jan 7 11:49:36 EST 2008