summaryrefslogtreecommitdiff
path: root/opt/auth.sh
blob: 6d87868b83c96457fe081af7845a1e1ea68254b5 (plain)
1
2
3
4
5
6
7
8
9
10
#!/bin/bash

# Check if we're enabling basic auth.
if [ "$HTTP_AUTH_PASSWORD" != "" ]; then
    echo "AuthType Basic
AuthName \"CGit\"
AuthUserFile /srv/www/htdocs/cgit/.htpasswd
Require valid-user" > /srv/www/htdocs/cgit/.htaccess
htpasswd  -c -b /srv/www/htdocs/cgit/.htpasswd $HTTP_AUTH_USER $HTTP_AUTH_PASSWORD
fi