aboutsummaryrefslogtreecommitdiff
path: root/code-host/ssh-setup.sh
diff options
context:
space:
mode:
Diffstat (limited to 'code-host/ssh-setup.sh')
-rwxr-xr-xcode-host/ssh-setup.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/code-host/ssh-setup.sh b/code-host/ssh-setup.sh
new file mode 100755
index 0000000..a896fb0
--- /dev/null
+++ b/code-host/ssh-setup.sh
@@ -0,0 +1,22 @@
1#!/bin/sh
2
3# Make host keys directory and generate keys if they don't exist at server
4# startup time.
5HOST_KEY_DIR="/srv/code/hostkeys"
6if [ ! -d "$HOST_KEY_DIR" ]; then
7 mkdir "$HOST_KEY_DIR"
8 chmod 755 "$HOST_KEY_DIR"
9 chown code:code "$HOST_KEY_DIR"
10fi
11
12RSA_KEY_FILE="/srv/code/hostkeys/rsa_key"
13if [ ! -f "$RSA_KEY_FILE" ]; then
14 ssh-keygen -f "$RSA_KEY_FILE" -N '' -t rsa
15 chown code:code "$RSA_KEY_FILE"
16fi
17
18ED25519_KEY_FILE="/srv/code/hostkeys/ed25519_key"
19if [ ! -f "$ED25519_KEY_FILE" ]; then
20 ssh-keygen -f "$ED25519_KEY_FILE" -N '' -t ed25519
21 chown code:code "$ED25519_KEY_FILE"
22fi