summaryrefslogtreecommitdiffstats
path: root/remote/modules/ssh-auth-keys/data/opt
diff options
context:
space:
mode:
authorJonathan Bauer2015-02-09 17:32:57 +0100
committerJonathan Bauer2015-02-09 17:32:57 +0100
commitedff8dc5d0fb7c88942c451a1b1e6d1b426f6a0e (patch)
tree57306720aa6ed9a5df65806438603df0705f5343 /remote/modules/ssh-auth-keys/data/opt
parent[systemd] force reset on the tty before it is spawned (diff)
downloadtm-scripts-edff8dc5d0fb7c88942c451a1b1e6d1b426f6a0e.tar.gz
tm-scripts-edff8dc5d0fb7c88942c451a1b1e6d1b426f6a0e.tar.xz
tm-scripts-edff8dc5d0fb7c88942c451a1b1e6d1b426f6a0e.zip
[ssh-auth-keys] static module to copy keys from /root/.ssh/authorized_keys.d/ into /root/.ssh/authorized_keys
Diffstat (limited to 'remote/modules/ssh-auth-keys/data/opt')
-rwxr-xr-xremote/modules/ssh-auth-keys/data/opt/openslx/scripts/systemd-ssh_auth_keys21
1 files changed, 21 insertions, 0 deletions
diff --git a/remote/modules/ssh-auth-keys/data/opt/openslx/scripts/systemd-ssh_auth_keys b/remote/modules/ssh-auth-keys/data/opt/openslx/scripts/systemd-ssh_auth_keys
new file mode 100755
index 00000000..b3c7a6fe
--- /dev/null
+++ b/remote/modules/ssh-auth-keys/data/opt/openslx/scripts/systemd-ssh_auth_keys
@@ -0,0 +1,21 @@
+#!/bin/ash
+
+AUTH_KEYS_DIR="/root/.ssh/authorized_keys.d/"
+AUTH_KEYS_FILE="/root/.ssh/authorized_keys"
+
+# root-check
+[ "$(id -u)" -ne 0 ] && echo "Need to be root. Exiting." && exit 1
+
+# do we even have the directory?
+[ ! -d "$AUTH_KEYS_DIR" ] && echo "No such directory: $AUTH_KEYS_DIR" && exit 1
+
+# ok, lets cat them in the real file
+for KEY in "$AUTH_KEYS_DIR"/* ; do
+ if ! cat $KEY >> "$AUTH_KEYS_FILE" ; then
+ echo "Could not add '$KEY' to '$AUTH_KEYS_FILE'"
+ exit 1
+ fi
+done
+
+# all done, all good
+exit 0