diff options
Diffstat (limited to 'code-host/ssh-setup.sh')
-rwxr-xr-x | code-host/ssh-setup.sh | 22 |
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. | ||
5 | HOST_KEY_DIR="/srv/code/hostkeys" | ||
6 | if [ ! -d "$HOST_KEY_DIR" ]; then | ||
7 | mkdir "$HOST_KEY_DIR" | ||
8 | chmod 755 "$HOST_KEY_DIR" | ||
9 | chown code:code "$HOST_KEY_DIR" | ||
10 | fi | ||
11 | |||
12 | RSA_KEY_FILE="/srv/code/hostkeys/rsa_key" | ||
13 | if [ ! -f "$RSA_KEY_FILE" ]; then | ||
14 | ssh-keygen -f "$RSA_KEY_FILE" -N '' -t rsa | ||
15 | chown code:code "$RSA_KEY_FILE" | ||
16 | fi | ||
17 | |||
18 | ED25519_KEY_FILE="/srv/code/hostkeys/ed25519_key" | ||
19 | if [ ! -f "$ED25519_KEY_FILE" ]; then | ||
20 | ssh-keygen -f "$ED25519_KEY_FILE" -N '' -t ed25519 | ||
21 | chown code:code "$ED25519_KEY_FILE" | ||
22 | fi | ||