]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
aws: Install SSH keys only for setup user
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 12 Jul 2018 12:57:19 +0000 (13:57 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 14 Jul 2018 13:20:18 +0000 (14:20 +0100)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/initscripts/helper/aws-setup

index 125cacc1f8d90d9fac2959e26f34f849784010f5..0d85a44e43b7157bb9adcecc372d5f8cd25015a5 100644 (file)
@@ -89,22 +89,19 @@ import_aws_configuration() {
                useradd setup -s /usr/bin/run-setup -g nobody -m
        fi
 
-       # Import SSH keys
-       local user
-       for user in /root /home/setup; do
-               local line
-               for line in $(get "public-keys/"); do
-                       local key_no="${line%=*}"
-
-                       local key="$(get public-keys/${key_no}/openssh-key)"
-                       if [ -n "${key}" ] && ! grep -q "^${key}$" "${user}/.ssh/authorized_keys" 2>/dev/null; then
-                               mkdir -p "${user}/.ssh"
-                               chmod 700 "${user}/.ssh"
-
-                               echo "${key}" >> "${user}/.ssh/authorized_keys"
-                               chmod 600 "${user}/.ssh/authorized_keys"
-                       fi
-               done
+       # Import SSH keys for setup user
+       local line
+       for line in $(get "public-keys/"); do
+               local key_no="${line%=*}"
+
+               local key="$(get public-keys/${key_no}/openssh-key)"
+               if [ -n "${key}" ] && ! grep -q "^${key}$" "/home/setup/.ssh/authorized_keys" 2>/dev/null; then
+                       mkdir -p "/home/setup/.ssh"
+                       chmod 700 "/home/setup/.ssh"
+
+                       echo "${key}" >> "/home/setup/.ssh/authorized_keys"
+                       chmod 600 "/home/setup/.ssh/authorized_keys"
+               fi
        done
 
        # Import any DNS server settings