Debian 7.0
Sponsored Link

Basic Auth + PAM2013/05/11

Configure httpd and set a page that people must authenticate and the authentication is from PAM.
[1] Install mod-auth-external and pwauth.
aptitude -y install libapache2-mod-authnz-external pwauth
a2enmod authnz_external

Enabling module authnz_external.
To activate the new configuration, you need to run:
service apache2 restart
[root@www ~]#
vi /etc/apache2/conf.d/auth_pam.conf
# for example, users must authenticate under /var/www/test

AddExternalAuth pwauth /usr/sbin/pwauth
SetExternalAuthMethod pwauth pipe
<Directory /var/www/test>
    AuthType Basic
    AuthName "PAM Authentication"
    AuthBasicProvider external
    AuthExternal pwauth
    require valid-user

/etc/init.d/apache2 restart

Restarting web server: apache2 ... waiting .
# create a test page

[root@www ~]#
vi /var/www/test/index.html
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page for PAM Auth
  Access to the test page with web browser, then authentication is required as a config. Input a user in local /etc/passwd and authenticate here.
  Just accessed.
Matched Content