diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2026-04-24 23:36:52 +0200 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2026-06-04 19:39:17 +0200 |
| commit | ac89b3c715fd3eddca7898e069ee04498c1a1ba2 (patch) | |
| tree | eb0294e645dd494ebe2b222292e6f8463d936277 /entrypoint.sh | |
INITIAL COMMIT
Diffstat (limited to 'entrypoint.sh')
| -rw-r--r-- | entrypoint.sh | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..3737a7e --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,50 @@ +#!/bin/sh +set -Eeuo pipefail + +# Copy over the secrets to fix permissions +mkdir -p /run/git-host/secrets +cp /etc/git-host/secrets/authorized_keys /run/git-host/secrets/authorized_keys +cp /etc/git-host/secrets/htpasswd /run/git-host/secrets/htpasswd +cp /etc/git-host/secrets/ssh_host_ed25519_key /run/git-host/secrets/ssh_host_ed25519_key +cp /etc/git-host/secrets/ssh_host_ed25519_key.pub /run/git-host/secrets/ssh_host_ed25519_key.pub +cp /etc/git-host/secrets/ssh_host_rsa_key /run/git-host/secrets/ssh_host_rsa_key +cp /etc/git-host/secrets/ssh_host_rsa_key.pub /run/git-host/secrets/ssh_host_rsa_key.pub +chown -R root:root /run/git-host/secrets +chown root:git /run/git-host/secrets/authorized_keys +chown root:git /run/git-host/secrets/htpasswd +chown root:root /run/git-host/secrets/ssh_host_ed25519_key +chown root:root /run/git-host/secrets/ssh_host_ed25519_key.pub +chown root:root /run/git-host/secrets/ssh_host_rsa_key +chown root:root /run/git-host/secrets/ssh_host_rsa_key.pub +chmod 0755 /run/git-host /run/git-host/secrets +chmod 0640 /run/git-host/secrets/authorized_keys +chmod 0640 /run/git-host/secrets/htpasswd +chmod 0600 /run/git-host/secrets/ssh_host_ed25519_key +chmod 0644 /run/git-host/secrets/ssh_host_ed25519_key.pub +chmod 0600 /run/git-host/secrets/ssh_host_rsa_key +chmod 0644 /run/git-host/secrets/ssh_host_rsa_key.pub + +# Validate +/usr/sbin/sshd -t -f /etc/ssh/sshd_config +lighttpd -tt -f /etc/lighttpd/lighttpd.conf + +# Start servers +/usr/sbin/sshd -D -e -f /etc/ssh/sshd_config & +sshd_pid=$! + +lighttpd -D -f /etc/lighttpd/lighttpd.conf & +lighttpd_pid=$! + +# Wait for them to end, kill if either does +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}" |
