From 8667f8615da479a8e9c4e8d5bb5987632d75bfaf Mon Sep 17 00:00:00 2001 From: Elizabeth Hunt Date: Fri, 5 Dec 2025 21:43:18 -0800 Subject: Add ssh server --- entrypoint.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'entrypoint.sh') diff --git a/entrypoint.sh b/entrypoint.sh index 5bdcede..58aea85 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,6 +2,38 @@ set -e +# Set up git-shell-commands in the repositories directory (volume-safe) +echo "Setting up git-shell-commands..." +mkdir -p /var/lib/git/repositories/git-shell-commands +cp -r /usr/local/share/git-shell-commands/* /var/lib/git/repositories/git-shell-commands/ +chmod +x /var/lib/git/repositories/git-shell-commands/* +chown -R code:code /var/lib/git/repositories +chmod 755 /var/lib/git/repositories + +# Verify setup +echo "Git-shell commands installed:" +ls -la /var/lib/git/repositories/git-shell-commands/ + +# Set up SSH host keys (with volume support) +echo "Setting up SSH host keys..." +mkdir -p /etc/ssh/host_keys + +# Check if host keys are mounted from a volume, if not generate them +if [ -f /etc/ssh/host_keys/ssh_host_rsa_key ]; then + echo "Using existing host keys from volume..." + cp /etc/ssh/host_keys/ssh_host_* /etc/ssh/ +else + echo "Generating new SSH host keys..." + ssh-keygen -A + # Copy generated keys to the persistent location if it's writable + if [ -w /etc/ssh/host_keys ]; then + cp /etc/ssh/ssh_host_* /etc/ssh/host_keys/ 2>/dev/null || true + fi +fi + +echo "Starting SSH daemon..." +/usr/sbin/sshd + echo "Starting fcgiwrap..." su -l www-data -s /bin/bash -c "/usr/sbin/fcgiwrap -s unix:/run/sock/fcgiwrap.socket" & -- cgit v1.2.3-70-g09d2