From 9236628dbac1c2d99d752731e8391fa1307f2b0c Mon Sep 17 00:00:00 2001 From: Jan Pazdziora Date: Tue, 17 Jul 2018 10:04:07 +0200 Subject: On Apache 2.4, test AuthBasicProvider socache PAM + AuthnCacheProvideFor PAM. --- tests/auth-socache.conf | 9 +++++++++ tests/config.sh | 3 +++ tests/run.sh | 13 +++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 tests/auth-socache.conf diff --git a/tests/auth-socache.conf b/tests/auth-socache.conf new file mode 100644 index 0000000..9d35f2c --- /dev/null +++ b/tests/auth-socache.conf @@ -0,0 +1,9 @@ + +LoadModule authn_socache_module modules/mod_authn_socache.so + +ScriptAlias /authn-cached /var/www/cgi-bin/auth.cgi + + AuthBasicProvider socache PAM + AuthnCacheProvideFor PAM + AuthnCacheTimeout 10 + diff --git a/tests/config.sh b/tests/config.sh index 6de8697..6a16991 100755 --- a/tests/config.sh +++ b/tests/config.sh @@ -12,4 +12,7 @@ chmod a+x /var/log/httpd touch /var/log/httpd/pam_exec.log chown apache /var/log/httpd/pam_exec.log cp tests/auth.conf /etc/httpd/conf.d/ +if rpm -ql httpd | grep mod_authn_socache ; then + cat tests/auth-socache.conf >> /etc/httpd/conf.d/auth.conf +fi htpasswd -bc /etc/htpasswd alice Tajnost diff --git a/tests/run.sh b/tests/run.sh index 6986a30..6b5ea4e 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -26,3 +26,16 @@ echo Secret > /etc/pam-auth/bob curl -u bob:Secret -s http://localhost/authn | tee /dev/stderr | grep 'User bob' echo Secret2 > /etc/pam-auth/bob curl -u bob:Secret -s -D /dev/stdout -o /dev/null http://localhost/authn | tee /dev/stderr | grep 401 + +if rpm -ql httpd | grep mod_authn_socache ; then + echo "Testing AuthBasicProvider socache PAM + AuthnCacheProvideFor PAM" + curl -s -D /dev/stdout -o /dev/null http://localhost/authn | tee /dev/stderr | grep 401 + curl -u bob:Secret -s -D /dev/stdout -o /dev/null http://localhost/authn-cached | tee /dev/stderr | grep 401 + echo Secret > /etc/pam-auth/bob + curl -u bob:Secret -s http://localhost/authn-cached | tee /dev/stderr | grep 'User bob' + echo Secret2 > /etc/pam-auth/bob + curl -u bob:Secret -s -D /dev/stdout -o /dev/null http://localhost/authn | tee /dev/stderr | grep 401 + curl -u bob:Secret -s http://localhost/authn-cached | tee /dev/stderr | grep 'User bob' + sleep 11 + curl -u bob:Secret -s -D /dev/stdout -o /dev/null http://localhost/authn-cached | tee /dev/stderr | grep 401 +fi -- cgit