I’ve a bbs system up and running storing the user accounts and their passwords (as md5 hash) in a database. The trac belonging to the bbs stores it’s data in a sqlite db and gave me a hard time for setting up useraccounts. I finally managed to validate users against the data from the mysql database. This is how it works for a standalone tracker project configured as apache2 site with mod_python:

‹Location /trac›
SetHandler mod_python
PythonInterpreter main_interpreter
PythonHandler trac.web.modpython_frontend
PythonOption TracEnv /path/to/trackerenv
PythonOption TracUriRoot /trac
PythonDebug off
‹LocationMatch /trac/login›
AuthType Basic
AuthName "Please login with your bbs (forum) account"
Require valid-user
AuthUserFile /dev/null
AuthBasicAuthoritative off
Auth_MYSQL on
Auth_MySQL_Authoritative off
Auth_MySQL_DB thedbname
Auth_MySQL_Username theloginused
Auth_MySQL_Password thepasswordused
Auth_MySQL_Password_Table thetablewiththeuserdata
Auth_MySQL_Username_Field thefieldwiththeusernames
Auth_MySQL_Password_Field thefieldwiththeuserpasswordsstoredasmd5
Auth_MySQL_Empty_Passwords Off
Auth_MySQL_Encryption_Types PHP_MD5

With that settings I was able to produce a login request on the login-site of the tracker that could be feed with users and passwords from my existing bbs database tables. Now the users could login to the tracker and I could remove ticket/wiki creation/modification from the anonymous access to prevent spambots spamming the tracker.

trac-admin /path/to/trackenv permission remove anonymous TICKET_CREATE TICKET_MODIFY WIKI_MODIFY WIKI_CREATE
trac-admin /path/to/trackenv permission add authenticated TICKET_CREATE TICKET_MODIFY WIKI_MODIFY WIKI_CREATE

Leave a Reply