Before talking about the MySQL user authentication of the Samba server, I've actually written the Apache authentication for MySQL. But it used to be just a test, not actually used. The above mentioned knowledge management, in fact within the company we run a plog based blog system. The original system was not posted to the Internet, and it was decided to publish to the Internet in order to make it available to various branches of the company. In order to minimize the Hack of the blog system, so I decided to use the plug-in Mod_auth_mysql module to achieve user authentication, thereby reducing the company's internal system exposure to unauthorized users of the risk.
In this installation, only to find that the original Mod_auth_mysql have several versions, and the document is almost incomplete. This article downloads the program from SourceForge.net (sf.net)
http://modauthmysql.sourceforge.net/
The current version of 2.9.0, after downloading, establishes the directory Mod_auth_mysql, and then enters the directory for decompression. (Do not extract directly under/USR/LOCAL/SRC), according to the build file instructions, the installation steps are as follows:
apxs -c -lmysqlclient -lm -lz mod_auth_mysql.c
apxs -i mod_auth_mysql.la
and add the following line to the httpd.conf.
LoadModule Mysql_auth_module modules/mod_auth_mysql.so
In fact, compilation and installation is not difficult, configuration is the larger challenge, especially to have already existing user table combined. The user table for my Plog database is plog_users, and I set the configuration as follows:
<ifmodule mod_auth_mysql.c>
<location/>
AuthType Basic
# Connect to the host address of the database, generally with local connection, so for localhost
Authmysqlhost localhost
Authmysqlport nnnn
# Name of the database
Authmysqldb Plog
# Users connecting to the database?
Authmysqluser Plogdb_user
# Password to connect to the database
AuthMySQLPassword password
# none: not encrypted (plain text)
# crypt: UNIX crypt() encryption
# scrambled: MySQL PASSWORD encryption
# md5: MD5 hashing
# aes: Advanced Encryption Standard (AES) encryption
# sha1: Secure Hash Algorihm (SHA1)`
AuthMySQLPwEncryption md5
AuthMySQLEnable On
AuthMySQLUserTable plog_users
AuthMySQLNameField user
AuthMySQLPasswordField password
AuthMySQLGroupTable plog_users
AuthMySQLGroupField user_group
</Location>
</IfModule>