summaryrefslogtreecommitdiff
path: root/opt/auth.sh
diff options
context:
space:
mode:
Diffstat (limited to 'opt/auth.sh')
-rw-r--r--opt/auth.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/opt/auth.sh b/opt/auth.sh
new file mode 100644
index 0000000..6d87868
--- /dev/null
+++ b/opt/auth.sh
@@ -0,0 +1,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 \ No newline at end of file