1
0

entrypoint.sh 591 B

1234567891011121314151617181920212223
  1. #!/bin/sh
  2. set -eu
  3. # sync with https://github.com/fphammerle/docker-gitolite/blob/master/entrypoint.sh
  4. if [ ! -f "$SSHD_HOST_KEYS_DIR/rsa" ]; then
  5. ssh-keygen -t rsa -b 4096 -N '' -f "$SSHD_HOST_KEYS_DIR/rsa"
  6. fi
  7. if [ ! -f "$SSHD_HOST_KEYS_DIR/ed25519" ]; then
  8. ssh-keygen -t ed25519 -N '' -f "$SSHD_HOST_KEYS_DIR/ed25519"
  9. fi
  10. unset SSHD_HOST_KEYS_DIR
  11. authorized_keys_path="$CLIENT_HOME/.ssh/authorized_keys"
  12. printenv SSH_CLIENT_PUBLIC_KEYS > "$authorized_keys_path"
  13. chmod a+r "$authorized_keys_path"
  14. unset SSH_CLIENT_PUBLIC_KEYS
  15. unset CLIENT_USER
  16. unset CLIENT_HOME
  17. set -x
  18. exec "$@"