Installing auth openid on trac with Dreamhost
It turns out installing plugins, and particularly the openid plugin, on a shared dreamhost environment is arduous at best. �After a bit of work and research I managed to get it to work so here you go:
I. Perform a one-click install of trac from the web panel
if you don’t know how to do this you shouldn’t even try to proceed.
II. Setup a virtual python environment
Having a shared account with no sudo access you need to setup a local python environment to do all of the building. I found a reference here on how to do that. Here are the steps
cd ~
wget�virtual-python.py
python virtual-python.py
wget http://peak.telecommunity.com/dist/ez_setup.py
bin/python ez_setup.py
export PYTHONPATH=~/lib/python2.4/:~/lib/python2.4/site-packages/
III. Build the plugin
mkdir install_dir
cd install_dir
hg clone http://bitbucket.org/Dalius/authopenid-plugin/cd authopenid-plugin
python setup.py install –prefix=$HOME
cp ~/lib/python2.4/site-packages/*.egg <your_trac>/plugins
For more info see this article.
IV. Configure openid
edit <your_trac>/conf/trac.ini
add the following lines:
[components] trac.web.auth.* = disabled authopenid.* = enabled
see the above article for more config options.
V. Install Element Tree
As of this writing, element tree was not installed in the dream host system python cache. �In order to get around this do the following:
cd ~/install_dir
wget�http://effbot.org/media/downloads/elementtree-1.2.6-20050316.tar.gz
tar xzvf�elementtree-1.2.6-20050316.tar.gz
cd�elementtree-1.2.6-20050316
setup.py install
In order to get our trac instance to pick up this library, we need to package it as an egg
edit its setup.py
change
from distutils.core import setup, Extension
to:
from setuptools import setup, Extension
then run
python setup.py bdist_egg
cp dist/*.egg <your_trac>/plugins
you now have all of the files installed you need to run openid on trac
VI. Creating the plugin schema
If you go to you project home page and you see the message:
TracError: The Trac Environment needs to be upgraded.
Then like me you need to initialize the SQL tables used by the python-openid plugin. If that is the case then do the following:
cd <your_trac>/db
sqlite3 trac.db
CREATE TABLE oid_nonces(server_url VARCHAR);
<hit enter>
CREATE TABLE oid_associations(server_url VARCHAR(2047),handle VARCHAR(255),secret BLOB(128),issued INTEGER,lifetime INTEGER,assoc_type VARCHAR(64),PRIMARY KEY (server_url, handle));
<hit enter>
.exit
See the�source code for more info. Now we need to “upgrade” the schema
cd ~/install-dir
wget http://openidenabled.com/files/python-openid/packages/python-openid-2.2.4.tar.gz
tar xzvf python-openid-2.2.4.tar.gz
cd �python-openid-2.2.4cd �contrib
./upgrade-store-1.1-to-2.0 –sqlite=<your_trac>/db/trac.db
on the above line you must use the absolute path to your trac instance. No using ~ as a home dir shortcut.
This should run successfully.If the output of that command is �”no such table oid…” Then something was messed up with using sqllite. Go back in and use the command .tables and make sure the two tables are there. If not, re-run the create table commands and look for error messages.
DONE! You should now be able to log in to your trac instance.
VII. Setting OpenId permissions in trac
Setup your account with permissions.ant more? log in and check trac.log
edit <your_trac>/conf/trac.ini
change the logging section so it looks like this:
[logging]
log_file = trac.log
log_level = DEBUG
log_type = file
save and exit. Now:
tail -n 200 -F <your_trac>/log/trac.log
Next log in to your trac instance (using a web browser) using a openid account.
You’ll see something like�Retrieving session for ID u’http://xxxxxxxxxxxxxxxxxxxxxxxxx’
Everything between the single quotes is your account name. Now we can use trac-admin to give our openid account some permissions:
trac-admin <trac_instance>
permission add <account_name> <PERMISSION>
where permission is something �like TRAC_ADMIN. �Use the command permission list to see currently assigned permissions
VIII. Cleanup
One thing I dislike about the one click install is it messes up the logo area. �Here’s a simple fix
edit <your_trac>/.htaccess
after the line
RewriteCond $1 !^htdocs(.*).png$
add the line
RewriteCond $1 !^chrome(.*).png$
save and the logo should now show up.
Good luck. let me know if you run into other stumbling blocks and I’ll update the instructions.
Tight! After this, I’d be interested in seeing a SSO widget provider like RPX (http://rpxnow.com) smushed into it as well.
Thank you a lot for this information! I was looking for it and it should be at Dreamhost in THEIR tutorials
Thanks a ton! A few updates:
* easy_install works with ElementTree, TracAuthOpenId
* python-openid moved:
http://github.com/openid/python-openid/downloads
* upgrade-store-1.1-to-2.0 requires 2 dashes ( –sqlite… )
Thanks again!
Fantastically useful tutorial. I was stuck with the whole plugin thing and this was EXACTLY what I needed, and worked like a charm. Thanks so much!
needs to be updated to reflect python 2.5 in PYTHONPATH
need two hyphens in front of prefix ‘python setup.py install –prefix=$HOME’
love it, thanks a bunch!!!! the DH wiki needs you!!
also you need to make the ‘upgrade-store-1.1-to-2.0′ executable
$ chmod +x upgrade-store-1.1-to-2.0
@daniellench Thanks. I’ll go through and update. Glad it was helpful
also, the session id in the log didnt work when i added the string to TRAC_ADMIN
Promoting anonymous session ******************** to authenticated session for user username
i gave my username the TRAC_ADMIN and it works, this has me a bit worried. i would like to have the unique identifier there instead.
please email me, i have some other questions
thx,
dan
Nice info. That’s what i looking at this time. i never found Installing auth openid on trac with Dreamhost before by google. and i found it here.
Thanks man! I used just a portion of the data, but it was QUITE useful.
Howdy would you mind stating which blog platform you’re using? I’m planning to start my own blog soon but I’m having a hard time deciding between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then most blogs and I’m looking for something unique. P.S My apologies for getting off-topic but I had to ask!
Your website operator frequently publish record records this readers could respond to within a comment part.Your registry in addition gets bombarded with Spyware links and also word options in addition.Have to have a new laptop computer?