aboutsummaryrefslogtreecommitdiff
path: root/ssh-bastion/entrypoint.sh
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-bastion/entrypoint.sh')
-rwxr-xr-xssh-bastion/entrypoint.sh40
1 files changed, 0 insertions, 40 deletions
diff --git a/ssh-bastion/entrypoint.sh b/ssh-bastion/entrypoint.sh
deleted file mode 100755
index f48a3c3..0000000
--- a/ssh-bastion/entrypoint.sh
+++ /dev/null
@@ -1,40 +0,0 @@
1#!/bin/sh
2
3if [ ! -d /srv/ssh/hostkeys ]; then
4 echo "No host keys found... generating"
5 mkdir -p /srv/ssh/hostkeys
6
7 ssh-keygen -f /srv/ssh/hostkeys/rsa_key -N '' -t rsa
8 ssh-keygen -f /srv/ssh/hostkeys/ed25519_key -N '' -t ed25519
9 ssh-keygen -f /srv/ssh/hostkeys/ecdsa_key -N '' -t ecdsa
10
11 rm *.pub
12fi
13
14if [ ! -d /srv/ssh/users ]; then
15 echo "No users directory found... creating"
16 mkdir -p /srv/ssh/users
17fi
18
19for path in /srv/ssh/users/*; do
20 user=$(basename $path)
21 if [ "$user" = "*" ]; then
22 break
23 fi
24
25 if getent passwd $user 2>&1 >/dev/null; then
26 echo "User $user already exists"
27 continue
28 fi
29
30 uid=$(cat /srv/ssh/users/$user/uid)
31 if [[ -z "$uid" ]]; then
32 echo "No UID for $user"
33 exit 1
34 fi
35
36 echo "Creating user ${user}(${uid})"
37 adduser -DH -s /sbin/nologin -u $uid $user
38done
39
40exec "$@"