summaryrefslogtreecommitdiffstats
path: root/container/entrypoint.sh
diff options
context:
space:
mode:
authordev <dev@example>2026-11-15 13:54:31 +0000
committerdev <dev@example>2026-11-15 13:54:31 +0000
commitda06d4f56afa72ae832238f91358b9aeaeaf0da5 (patch)
tree7ead0d915bf4e388dcc55d3b63b4fc0628ef895b /container/entrypoint.sh
parent85b7fa7f8456c84f65a0d81b760c430098ae7fd8 (diff)
downloadaccess-control-main.tar.gz
access-control-main.zip
Only build the access control executableHEADmain
The container image and all the server configuration (Dockerfile, entrypoint, cgitrc, sshd, lighttpd, create-repo, git-host-key) move to the git-host project. This repo is now just the program: cmd/, src/, test/, the Makefile that builds git-authz and installs it, and the example policy - the same cmd/src/test/obj layout the reference projects use. The CI pipeline keeps the compile-and-test gate (strict, test, sanitizer, install) and drops the container-build job, which belongs to git-host now.
Diffstat (limited to 'container/entrypoint.sh')
-rwxr-xr-xcontainer/entrypoint.sh58
1 files changed, 0 insertions, 58 deletions
diff --git a/container/entrypoint.sh b/container/entrypoint.sh
deleted file mode 100755
index df33b47..0000000
--- a/container/entrypoint.sh
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/bin/sh
-set -Eeuo pipefail
-
-SECRETS_SRC=/etc/git-host/secrets
-SECRETS_DIR=/run/git-host/secrets
-
-need_secret() { # <name> [mode] [owner-group]
- name="$1"; mode="${2:-0600}"; group="${3:-root}"
- if [ ! -r "$SECRETS_SRC/$name" ]; then
- printf 'entrypoint: missing secret %s\n' "$SECRETS_SRC/$name" >&2
- printf 'entrypoint: mount it there (a Kubernetes Secret works as-is)\n' >&2
- exit 1
- fi
- cp "$SECRETS_SRC/$name" "$SECRETS_DIR/$name"
- chown "root:$group" "$SECRETS_DIR/$name"
- chmod "$mode" "$SECRETS_DIR/$name"
-}
-
-# Mounted secrets arrive with whatever mode the volume plugin chose. sshd refuses
-# keys that are too loose; lighttpd must read htpasswd as the git user.
-
-mkdir -p "$SECRETS_DIR"
-need_secret authorized_keys 0640 git
-need_secret htpasswd 0640 git
-need_secret ssh_host_ed25519_key
-need_secret ssh_host_ed25519_key.pub 0644
-need_secret ssh_host_rsa_key
-need_secret ssh_host_rsa_key.pub 0644
-chmod 0755 /run/git-host "$SECRETS_DIR"
-
-# The single most important line in the container: without it a repository carries
-# no policy and pushes go unchecked. The policy is never copied, so a ConfigMap
-# update takes effect on the next push.
-
-git config --file /etc/gitconfig core.hooksPath "${GIT_HOST_HOOK_DIR:-/usr/local/share/git-host/hooks}"
-
-# Do not serve a host that cannot enforce anything.
-
-git-authz validate
-
-/usr/sbin/sshd -D -e -f /etc/ssh/sshd_config &
-sshd_pid=$!
-
-lighttpd -D -f /etc/lighttpd/lighttpd.conf &
-lighttpd_pid=$!
-
-terminate() {
- kill "${sshd_pid}" "${lighttpd_pid}" 2>/dev/null || true
-}
-
-trap terminate INT TERM
-
-status=0
-wait -n "${sshd_pid}" "${lighttpd_pid}" || status=$?
-terminate
-wait "${sshd_pid}" 2>/dev/null || true
-wait "${lighttpd_pid}" 2>/dev/null || true
-exit "${status}"