Re: Authentification via https webserver and the users_users table using the libapache2-mod-auth-mysql
Hi I am happy to give myself the answer:
1.) The password is normaly stord in the hash column with a Crypt_MD5 encryption. --> so I was wrong in the last statement with the (login+password) hash format.
The configuration you need to set everything up is the following.
It was tested on my Server Ubuntu 8.10 LTS with tikiwiki 3.1
Be aware that you cannot use the function Send an email to the user in order to allow him to validate his account. on new users because a validation is not possible to the account is not validated. Just leave the check-box unchecked.
Have fun
Max
https with an authentication via SQL (tikiwiki) hash column
Packages
# sudo apt-get install libapache2-mod-auth-mysql libapache2-mod-php5 php5-mysql mysql-server mysql-client ssl-cert
Certificates
# mkdir ~/ssl-certificates # cd ~/ssl-certificates # openssl genrsa -des3 -out server.key 1024 # openssl rsa -in server.key -out server.key.insecure # openssl req -new -key server.key.insecure -out server.csr # openssl x509 -req -days 365 -in server.csr -signkey server.key.insecure -out server.crt # sudo mkdir /etc/apache2/ssl # sudo cp server.crt /etc/ssl/certs/apache.crt # sudo cp server.key.insecure /etc/ssl/private/apache.key
Starting Modules
# sudo a2enmod auth_mysql # sudo a2enmod ssl # sudo a2enmod dav
SQL user creation
# mysql -u root -p mysql> CREATE USER 'apache-ssl'@'%' IDENTIFIED BY '***'; mysql> GRANT USAGE ON * . * TO 'apache-ssl'@'%' IDENTIFIED BY '***' WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; mysql> GRANT SELECT ON `cdswiki` . * TO 'apache-ssl'@'%';
Changes on the website configuration in
The configuration is located in /etc/apache2/sites-available/
Changes on the begin
NameVirtualHost *:443 SSLEngine On SSLCertificateFile /etc/ssl/certs/apache.crt SSLCertificateKeyFile /etc/ssl/private/apache.key
Changes on site root
AuthBasicAuthoritative Off AuthUserFile /dev/null AuthMySQL On AuthName "acin wiki" AuthType Basic Auth_MySQL_Host localhost Auth_MySQL_Password *** Auth_MySQL_Username apache-ssl AuthMySQL_DB cdswiki AuthMySQL_Password_Table users_users Auth_MySQL_Username_Field login Auth_MySQL_Password_Field hash Auth_MySQL_Empty_Passwords Off Auth_MySQL_Encryption_Types Crypt_MD5 Auth_MySQL_Authoritative On require valid-user
Apache restart
# sudo /etc/init.d/apache restart