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.
root@www:~#
aptitude -y install libapache2-mod-authnz-external pwauth
root@www:~#
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>
    SSLRequireSSL
    AuthType Basic
    AuthName "PAM Authentication"
    AuthBasicProvider external
    AuthExternal pwauth
    require valid-user
</Directory>

root@www:~#
/etc/init.d/apache2 restart

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

[root@www ~]#
vi /var/www/test/index.html
<html>
<body>
<div style="width: 100%; font-size: 40px; font-weight: bold; text-align: center;">
Test Page for PAM Auth
</div>
</body>
</html>
  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