summaryrefslogtreecommitdiff
path: root/ssh/entrypoint.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ssh/entrypoint.sh')
-rwxr-xr-xssh/entrypoint.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/ssh/entrypoint.sh b/ssh/entrypoint.sh
new file mode 100755
index 0000000..c255adf
--- /dev/null
+++ b/ssh/entrypoint.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+set -e
+mkdir -p /repos /keys /home/git/.ssh /run/sshd
+touch /keys/authorized_keys
+chown -R git:git /home/git/.ssh 2>/dev/null || true
+chmod 700 /home/git/.ssh
+ssh-keygen -A
+cat > /etc/ssh/sshd_config <<EOF
+Port 22
+PermitRootLogin no
+PasswordAuthentication no
+PubkeyAuthentication yes
+AllowUsers git
+AuthorizedKeysFile /keys/authorized_keys
+X11Forwarding no
+AllowTcpForwarding no
+AllowAgentForwarding no
+EOF
+echo "sshd up · authorized_keys=/keys/authorized_keys (пишет бот)"
+exec /usr/sbin/sshd -D -e