aboutsummaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
Diffstat (limited to 'init')
-rwxr-xr-xinit16
1 files changed, 10 insertions, 6 deletions
diff --git a/init b/init
index 9c068c8..e29de66 100755
--- a/init
+++ b/init
@@ -394,10 +394,13 @@ newaliases
# - Change host key locations to (persistent) /state/etc/ssh/ and remove
# existing keys. If no corresponding key exists in /state, generate it.
#
+# - Disable root login.
+#
# - Disable password authentication.
#
sed -r -i \
-e "s%^#?HostKey +(.+)%HostKey /state\1%" \
+ -e "s%^#?PermitRootLogin.*%PermitRootLogin no%" \
-e "s%^#?PasswordAuthentication.*%PasswordAuthentication no%" \
/etc/ssh/sshd_config
@@ -412,15 +415,16 @@ for k in $(echo /etc/ssh/ssh_host_*_key | \
done
rm -f /etc/ssh/ssh_host_*_key*
-# Add buildos.ssh_key to root's authorized_keys.
+# Add buildos.ssh_key to build's authorized_keys.
#
if [ -n "$ssh_key" ]; then
- info "adding buildos.ssh_key to ~root/.ssh/authorized_keys"
- mkdir -p /root/.ssh
- chmod 700 /root/.ssh
+ info "adding buildos.ssh_key to ~build/.ssh/authorized_keys"
+ mkdir -p /build/.ssh
+ echo "$ssh_key" >>/build/.ssh/authorized_keys
- echo "$ssh_key" >>/root/.ssh/authorized_keys
- chmod 600 /root/.ssh/authorized_keys
+ chown build:build /build/.ssh /build/.ssh/authorized_keys
+ chmod 700 /build/.ssh
+ chmod 600 /build/.ssh/authorized_keys
fi
# Configure the TFTP server (tftpd-hpa).