This article will describe installing Trac which manages user with digest authentication.
Table of Contents
1 Install Trac
The following script will install Trac and create "test" project.
- Login to Trac via digest authentication.
- ADMIN_PASSWD is password of admin user for digest authentication.
- USER_NAME is user name of not admin user for digest authentication.
- USER_PASSWD is password name of not admin user for digest authentication.
#!/bin/sh -e [ -z "${ADMIN_PASSWD}" ] && ADMIN_PASSWD="trac" [ -z "${USER_NAME}" ] && USER_NAME="trac" [ -z "${USER_PASSWD}" ] && USER_PASSWD="trac" trac_install() { sudo dnf install -y trac mod_wsgi mod_ssl sudo firewall-cmd --add-service=https --permanent sudo firewall-cmd --reload sudo setsebool -P httpd_unified on sudo mkdir /var/lib/trac sudo mkdir /var/www/html/trac sudo chown apache:apache /var/www/html/trac } create_project() { proj=${1} sudo trac-admin /var/lib/trac/"${proj}" initenv "${proj}" sqlite:db/trac.db sudo trac-admin /var/lib/trac/"${proj}" deploy /var/www/html/trac/"${proj}" sudo chown -R apache:apache /var/lib/trac/"${proj}" sudo chown -R apache:apache /var/www/html/trac/"${proj}" sudo chcon -R -t httpd_sys_content_t /var/lib/trac/"${proj}" sudo dnf install -y expect expect -c " set timeout -1 spawn sudo htdigest -c /var/lib/trac/${proj}/.htdigest ${proj} admin expect \"New password: \" send \"${ADMIN_PASSWD}\n\" expect \"Re-type new password: \" send \"${ADMIN_PASSWD}\n\" expect eof " sudo trac-admin /var/lib/trac/"${proj}" permission add admin TRAC_ADMIN expect -c " set timeout -1 spawn sudo htdigest /var/lib/trac/${proj}/.htdigest ${proj} ${USER_NAME} expect \"New password: \" send \"${USER_PASSWD}\n\" expect \"Re-type new password: \" send \"${USER_PASSWD}\n\" expect eof " cat <<EOF | sudo tee /etc/httpd/conf.d/"${proj}".conf WSGIScriptAlias /trac/${proj} /var/www/html/trac/${proj}/cgi-bin/trac.wsgi <Location /trac/${proj}> AuthType Digest AuthName "${proj}" AuthUserFile /var/lib/trac/${proj}/.htdigest Require valid-user </Location> EOF sudo systemctl restart httpd } trac_main() { trac_install create_project test create_project OtherProject } trac_main