apt -y install mariadb-server mariadb-client
apt install libaprutil1-dbd-mysql
a2enmod dbd
a2enmod authn_dbd
a2enmod authz_dbd
authn_socache
systemctl restart mysql
update-rc.d mysql enable
systemctl restart apache2
update-rc.d apache2enable
# mod_dbd configuration
DBDriver mysql
DBDParams "dbname=apache_auth user=apache pass=password"
DBDMin 4
DBDKeep 8
DBDMax 20
DBDExptime 300
<Directory "/var/chorke/www/dev.chorke.org/soft/">
AuthType Basic
AuthName Team
AuthBasicProvider dbd
# mod_authn_dbd SQL
AuthDBDUserPWQuery \
"SELECT password FROM authn WHERE user = %s AND login = 'true'"
# mod_authz_core configuration
Require dbd-group team
# mod_authz_dbd configuration
AuthzDBDQuery "SELECT group FROM authz WHERE user = %s"
# when a user fails to be authenticated or authorized,
# invite them to login; this page should provide a link
# to /team-private/login.html
ErrorDocument 401 "/login-info.html"
<Files "login.html">
AuthDBDUserPWQuery "SELECT password FROM authn WHERE user = %s"
Require dbd-login
AuthzDBDQuery "UPDATE authn SET login = 'true' WHERE user = %s"
AuthzDBDLoginToReferer On
</Files>
<Files "logout.html">
Require dbd-logout
AuthzDBDQuery "UPDATE authn SET login = 'false' WHERE user = %s"
</Files>
</Directory>