summaryrefslogtreecommitdiffstats
path: root/git-http-backend.cgi
diff options
context:
space:
mode:
authordelusionalai <delusionalai@jnsn.dev>2026-11-15 13:54:36 +0000
committerdelusionalai <delusionalai@jnsn.dev>2026-11-15 13:54:36 +0000
commited62c4ccf06c2c85d871a6334e3e0d82c6e4257a (patch)
tree69897b0d2be0fab353fa4bac3bbe9cb14171da24 /git-http-backend.cgi
parentcad3e5f4dff0c77c8eed020308c5bf8ffbff5964 (diff)
downloadgit-host-ed62c4ccf06c2c85d871a6334e3e0d82c6e4257a.tar.gz
git-host-ed62c4ccf06c2c85d871a6334e3e0d82c6e4257a.zip
The host, built around the access control executable
git-host is now the single home of the git repo configuration. The Dockerfile grew a build stage that installs git-authz from its own repository (the access-control / git-host-c project) via `make install`, so the image carries the executable, its example policy and the pre-receive hook symlink, all placed by the program's own installer rather than copied by hand. The server configuration is the git-authz-aware set that used to live beside the program: the entrypoint sets core.hooksPath and refuses to serve on a policy the hook cannot use, sshd carries PermitUserEnvironment and ForceCommand so a key's identity survives to the hook, create-repo prints the policy line to add, and git-host-key manages keys that name their user. cgitrc keeps the corrected ordering (repo-scoped settings above scan-path).
Diffstat (limited to 'git-http-backend.cgi')
-rw-r--r--git-http-backend.cgi12
1 files changed, 8 insertions, 4 deletions
diff --git a/git-http-backend.cgi b/git-http-backend.cgi
index 960ebc0..c69758b 100644
--- a/git-http-backend.cgi
+++ b/git-http-backend.cgi
@@ -1,8 +1,12 @@
#!/bin/sh
+# A .cgi-named door onto the stock backend, because mod_cgi dispatches by
+# extension. No policy in here: writes are decided by the pre-receive hook.
+#
+# It must stay a plain exec. REMOTE_USER is the identity the hooks authorise
+# from, and rewriting the environment here denies every push.
set -eu
-export GIT_PROJECT_ROOT="${GIT_PROJECT_ROOT:-/var/lib/git}"
-export GIT_HTTP_EXPORT_ALL="${GIT_HTTP_EXPORT_ALL:-1}"
-export HOME="${HOME:-/home/git}"
+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 /usr/libexec/git-core/git-http-backend
+exec "$BACKEND"