Hello all ,
I'm  having some problem with apache and bloodhound .
Running trac with the command :
tracd /bloodhound/environments/main --port=8000
everything works just fine ,
but if I try to run it from Apache ( and I will , because I need ldap auth ) I can only browse
the directory "bloodhound" .
Obviously I did something wrong :) but don't know what ... there are many thing not very clear to me , so I hope you can help me .


From the instruction of the README I wrote this script , could someone please take a look at it and tell me where are those errors ?
( There are some question between the code lines )
I'm on a Debian , but I could test it on Centos and OpenSuse too ,maybe could be handy to someone else ...

Many thanks in advance .

Ciao

David

---------------------------START -------------------------------------------------------------------------------------------------------------------------------------

#!/bin/bash
########################################################################################
### lazy.bash install bloodhound on debian wheezy bash lazy.bash or bash -x lazy.bash for verbose output #
########################################################################################

INSTALL=$(which apt-get) # does it work with yum-install -y or zypper too ?
DB=postgresql            # postresql or sqlite
SYSUSER="bloodhound"     # owner of bloodhound dir
DBUSER="bloodhound"      # pg user
DBNAME="bloodhound"      # pg db
ADMINUSER="admin"        # <- change me !
ADMINPASSWD="admin"      # <- change me !
APACHEDIR="/var/www"     # <- check me  !
APACHEGROUP="www-data"   # <- check me  !
PGCONF=$( find /etc -name pg_hba.conf)
PORT="80"                # apache2 port
#debian packages names !
PACKAGES="sudo python2.7 python-setuptools python-pip postgresql python-psycopg2 subversion libapache2-mod-wsgi apache2-utils "


########################################################################################

grep $SYSUSER /etc/passwd || adduser $SYSUSER
#echo $PGCONF
$INSTALL install $PACKAGES
pip install virtualenv


###### Is this step needed even if later we call bloodhound_setup.py ?
if [[ $DB=="postgresql" ]];then
#sudo -u postgres dropdb $DBNAME # Uncomment if it's not the #sudo -u postgres dropuser $DBUSER # first time you run the script
    sudo -u  postgres createuser -U postgres -S -D -R -E -P $DBUSER
    sudo -u  postgres createdb -U postgres -O $DBUSER -E UTF-8 $DBNAME
    #cp $PGCONF $PGCONF-$$-backup
    #cp $PGCONF-orig $PGCONF
    sed -i.bak 's/all[\+ ]peer/md5/g'  $PGCONF
    /etc/init.d/postgresql restart
fi

cd $APACHEDIR
if [ -d bloodhound ];then
    rm -rf bloodhound
fi

########### The url in the README is wrong .... this one is correct

svn co https://svn.apache.org/repos/asf/bloodhound/trunk bloodhound

chown -R $SYSUSER:$APACHEGROUP  ./bloodhound # are those perms ok ???

cd $APACHEDIR/bloodhound/installer
virtualenv --system-site-packages bloodhound
source ./bloodhound/bin/activate
pip install -r requirements-dev.txt
python bloodhound_setup.py

###### do I need to sudo or maybe I could just chown -R everything at the end ??

sudo -u $SYSUSER "mkdir -p bloodhound/environments/"
sudo -u $SYSUSER "cd bloodhound/environments/"

sudo -u $SYSUSER "python ../../createdigest.py --user=$ADMINUSER --password=$ADMINPASSWD --realm=bloodhound -f bloodhound.htdigest "
sudo -u $SYSUSER echo "
[account-manager]
account_changes_notify_addresses =
authentication_url =
db_htdigest_realm =
force_passwd_change = true
hash_method = HtDigestHashMethod
htdigest_file = $APACHEDIR/bloodhound/installer/bloodhound/environments/bloodhound.htdigest
htdigest_realm = bloodhound
htpasswd_file =
htpasswd_hash_type = crypt
password_file = $APACHEDIR/bloodhound/installer/bloodhound/environments/bloodhound.htdigest
password_store = HtDigestStore
persistent_sessions = False
refresh_passwd = False
user_lock_max_time = 0
verify_email = True

[components]
acct_mgr.admin.*= enabled
acct_mgr.api.accountmanager = enabled
acct_mgr.guard.accountguard = enabled
acct_mgr.htfile.htdigeststore = enabled
acct_mgr.web_ui.accountmodule = enabled
acct_mgr.web_ui.loginmodule = enabled
bhtheme.* = enabled
bhdashboard.* = enabled
multiproduct.* = enabled
themeengine.* = enabled
trac.ticket.report.reportmodule = disabled
trac.ticket.web_ui.ticketmodule = disabled
trac.web.auth.loginmodule = disabled

[header_logo]
src =

[mainnav]
browser.label = Source
roadmap = disabled
timeline = disabled
tickets.label = Tickets

[theme]
theme =

[trac]
mainnav = dashboard,wiki,browser,tickets,newticket,timeline,roadmap,search,admin
" > base.ini



trac-admin ./bloodhound/environments/main/ deploy ./bloodhound/site # <- Is this step needed ?

a2enmod wsgi auth_digest

#in the example we are not listening on standard port ... so I added this
if (( $PORT!=80 )); then
  cp /etc/apache2/ports.conf /etc/apache2/ports.conf-back.$$
  echo "NameVirtualhost *:$PORT" >> /etc/apache2/ports.conf
  echo "Listen $PORT" >> /etc/apache2/ports.conf
fi

echo "
<VirtualHost *:$PORT>
WSGIDaemonProcess bloodhound_tracker user=$SYSUSER python-path=$APACHEDIR/bloodhound/installer/bloodhound/lib/python2.7/site-packages WSGIScriptAlias /bloodhound $APACHEDIR/bloodhound/installer/bloodhound/site/cgi-bin/trac.wsgi
<Directory $APACHEDIR/bloodhound/installer/bloodhound/site/cgi-bin>
      WSGIProcessGroup bloodhound_tracker
      WSGIApplicationGroup %{GLOBAL}
      Order deny,allow
      Allow from all
</Directory>
<LocationMatch "/bloodhound/[^/]+/login">
      AuthType Digest
      AuthName "Bloodhound"
      AuthDigestDomain /bloodhound
AuthUserFile $APACHEDIR/bloodhound/installer/bloodhound/environments/main/bloodhound.htdigest
      Require valid-user
</LocationMatch>
</VirtualHost>
" > /etc/apache2/sites-available/bloodhound

a2ensite bloodhound
apachectl configtest && apachectl graceful


------------------------------------------------------------END-------------------------------------------------------------------------------------------------

Reply via email to