PAM authentication with Apache 2.2

| | Comments (0)

安裝 Mod_Auth_External
apxs -c mod_authnz_external.c
apxs -i -a mod_authnz_external.la

安裝 pwauth
編輯 config.h 裡的 #define SERVER_UIDS, 將 Apache 執行者的 UID 加入,
例如: #define SERVER_UIDS 72
make
chmod 4755 pwauth (pwauth 需 setuid root, 使能讀取 /etc/shadow)
mv pwauth /usr/sbin

在 httpd.conf 加入
LoadModule authnz_external_module modules/mod_authnz_external.so
AddExternalAuth pwauth /usr/sbin/pwauth
SetExternalAuthMethod pwauth pipe

建立 /etc/pam.d/pwauth
內容
auth required /lib/security/pam_pwdb.so shadow nullok
auth required /lib/security/pam_nologin.so
account required /lib/security/pam_pwdb.so

如此 Apache 的認證就可以用系統帳號了, 不需用 htpasswd 建立
.htaccess 內容
AuthType Basic
AuthName Login
AuthBasicProvider external
AuthExternal pwauth
GroupExternal unixgroup
require valid-user

ref. HOWTO PAM authentication with Apache 2.2 and mod authnz external - Gentoo Linux Wiki
mod_auth_pam 此專案已不再開發與維護了, 不建議使用.

Leave a comment

March 2009

Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

About this Entry

This page contains a single entry by Pank published on July 7, 2008 3:39 AM.

腸病毒 was the previous entry in this blog.

SIS chip on-board VGA 螢幕 DDC 壞掉時修改最大解析度 is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.