summaryrefslogtreecommitdiffstats
path: root/container/git-http-backend.cgi
diff options
context:
space:
mode:
Diffstat (limited to 'container/git-http-backend.cgi')
-rw-r--r--container/git-http-backend.cgi20
1 files changed, 20 insertions, 0 deletions
diff --git a/container/git-http-backend.cgi b/container/git-http-backend.cgi
new file mode 100644
index 0000000..e086525
--- /dev/null
+++ b/container/git-http-backend.cgi
@@ -0,0 +1,20 @@
+#!/bin/sh
+# git-http-backend.cgi - a .cgi-named door to the stock git-http-backend.
+#
+# There is no policy in here. Reads are open, and writes are decided by the
+# global pre-receive hook, which is a symlink to git-authz and is reached by
+# every repository through core.hooksPath in /etc/gitconfig.
+#
+# This file exists for one reason: lighttpd's mod_cgi dispatches by extension,
+# and the alias in lighttpd.conf needs something named *.cgi in front of it.
+#
+# REMOTE_USER is set by mod_auth on push requests (auth.conf) and the receive
+# hooks authorise the push from it, so this script must stay a plain exec:
+# unsetting or rewriting the environment here turns every push into "no
+# identity" and denies them all.
+set -eu
+
+BACKEND="${GIT_HOST_HTTP_BACKEND:-/usr/libexec/git-core/git-http-backend}"
+[ -x "$BACKEND" ] || { printf 'Status: 500 Internal Server Error\r\n\r\n' >&2; exit 1; }
+
+exec "$BACKEND"