-
Notifications
You must be signed in to change notification settings - Fork 36
Expand file tree
/
Copy pathdocker-entrypoint.sh
More file actions
executable file
·34 lines (26 loc) · 1.1 KB
/
docker-entrypoint.sh
File metadata and controls
executable file
·34 lines (26 loc) · 1.1 KB
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
29
30
31
32
33
34
#!/bin/sh
if [ -s /root/docker-vpn_keys ]; then
echo "Copying keys to /root/.ssh/authorized_keys"
cp -v /root/docker-vpn_keys /root/.ssh/authorized_keys
fi
if [ ! -s /root/.ssh/authorized_keys ]; then
if [ -z "${AUTHORIZED_KEYS}" ]; then
echo "Need your ssh public key as AUTHORIZED_KEYS env variable. Abnormal exit ..."
exit 1
fi
echo "Populating /root/.ssh/authorized_keys with the value from AUTHORIZED_KEYS env variable ..."
echo "${AUTHORIZED_KEYS}" > /root/.ssh/authorized_keys
fi
chown root /root/.ssh/authorized_keys
chmod 600 /root/.ssh/authorized_keys
# echo "Generating new host keys as necessary..."
# ssh-keygen -A
echo "Generating new host keys as necessary..."
ssh-keygen -A
# move internal key so that ssh localhost works inside the container
cp /etc/ssh/ssh_host_ed25519_key /root/.ssh/id_ed25519
cat /etc/ssh/ssh_host_ed25519_key.pub >> /root/.ssh/authorized_keys
echo "Starting supervisor..."
/usr/bin/supervisord --configuration=/etc/supervisord.conf --logfile=/dev/null
# Execute the command passed to docker (likely a VPN connection command)
exec "$@"