-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathentrypoint.sh
More file actions
28 lines (22 loc) · 686 Bytes
/
entrypoint.sh
File metadata and controls
28 lines (22 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
set -e
# Logging function
log() {
echo "$(date +"%Y-%m-%d %T") - $1"
}
log "Generating new SSH host keys"
ssh-keygen -A -f /workspace
log "Ensuring ssh-user has a .ssh directory"
mkdir -p /home/ssh-user/.ssh
log "Adding files in workspace keys directory to the user's ssh authorized keys"
for keyfile in /workspace/keys/*; do
if [ -f "${keyfile}" ]; then
cat "${keyfile}" >> /home/ssh-user/.ssh/authorized_keys
echo "" >> /home/ssh-user/.ssh/authorized_keys
log "Authorized keys updated with ${keyfile}."
else
log "Key ${keyfile} is not a file."
fi
done
log "Starting the SSH server in the foreground"
/usr/sbin/sshd -D -e