Writeup · Mar 23, 2016
Changes in mod_authz_unixgroup from Apache 2.2 to 2.4
- Apache
- Linux
- Access control
mod_authz_unixgroup is an Apache module that can be used to allow members of Unix groups on the server to access restricted content with their Unix user credentials. These groups are defined in a Require directive and therefore it can be used with essentially any AuthType. We use this extensively at my place of work, as all our users and groups are stored in our Active Directory, which are then mapped to Unix users and groups on all our machines via pam_ldap.
When switching from Apache 2.2 to 2.4, I experienced some issues with compatibility with our current implementation of the module. Under 2.2, the module had to be initialized with AuthzUnixgroup On and the Require directive was Require group mygroup. The whole configuration looked something like this:
AuthType Basic
AuthzUnixgroup On
Require group mygroup
However, this resulted in a 500 error with the following in the logs on Apache 2.4:
Invalid command 'AuthzUnixgroup', perhaps misspelled or defined by a module not included in the server configuration
Surprisingly, I could not find any sign of this error in Google searches. The module was definitely loaded but this directive was unrecognized with no further explanation. I was about to compile the module from source in an attempt to troubleshoot when I found the answer buried in the INSTALL file:
Previous versions of mod_authz_unixgroup needed a
AuthzUnixgroup onto tell Apache that theRequire file-group(orRequire group) directive was supposed to be handled by mod_authz_unixgroup. Now we have a distinct directive,Require unix-file-group(andRequire unix-group) instead, so theAuthzUnixgroupis no longer needed and no longer exists.
That certainly explained my error. Now, our configurations look more like this on Apache 2.4:
AuthType Basic
Require unix-group mygroup
Behavior is now identical to how it was on 2.2.