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.1.tar.gz -or-
mod_authnz_external-3.2.1.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.x is a substantial rewrite designed to provide superior portability and better error reporting. It does not actually offer much in the way of new features and is not nearly as thoroughly tested as the 3.1.x branch. Conservative users may prefer to stay with the 3.1.x branch for the time being, but the 3.2.x branch is the future of mod_auth_external.

In 3.2.x, 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.

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:

Mod_auth*_external can pass the login and password to the authenticator by either of two methods, the "pipe" method or the "environment" method. The "environment" method, which was the default in versions prior to 3.1.0, may be insecure in some versions of Unix. I strongly recommend using "pipe" method.

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.

Authn / Authz

Users of mod_authnz_external may find it helpful understand a bit more of it's internal structure. It is actually best thought of as two functionally separate modules, mod_authn_external and mod_authz_external, which have combined into a single module simply because they share a lot of code. In any particular application, you may only be using one of these two modules, or you may be using both.

The mod_authn_external part is an authentication provider for the mod_auth_basic module. Mod_auth_basic handles all the negotiations with the browser, while all mod_authn_external does is check if a password submitted by the user is correct (which it does by running an external program to perform the check).

The mod_authz_external part does access control. It has no relation to mod_auth_basic. It comes into play after authentication is complete, when a "Require group" or "Require file-group" directive is given. It checks if the authenticated user is in the list of required groups (which it does by running an external program to perform the check).

Links:

Here are some relevant links:


Last Update: Thu Jul 31 18:00:52 EDT 2008