Set PermitRootLogin without-password

This replaces the PermitRootLogin yes + PasswordAuthentication no construction.
This commit is contained in:
Jørn Åne de Jong 2022-06-02 20:55:19 +02:00 committed by Nico Schottelius
parent beb967c196
commit 84daa8eca4

View file

@ -178,11 +178,19 @@ sysrc -f "$UFSTARGET/etc/rc.conf" \
tzsetup -s -C "$UFSTARGET" UTC tzsetup -s -C "$UFSTARGET" UTC
cat >>"$UFSTARGET/etc/ssh/sshd_config" <<EOF # Add PermitRootLogin without-password, unless PermitRootLogin yes was already set
PermitRootLogin yes sed -i .orig -e '/^#PermitRootLogin[[:blank:]]/a\
PasswordAuthentication no PermitRootLogin without-password
PermitEmptyPasswords no ' -e '/^PermitRootLogin[[:blank:]]*no/ s/\([[:blank:]]\).*$/\1without-password/' \
"$UFSTARGET/etc/ssh/sshd_config"
if ! grep -Eq '^PermitRootLogin (without-password|yes)' "$UFSTARGET/etc/ssh/sshd_config"
then
cat >>"$UFSTARGET/etc/ssh/sshd_config" <<EOF
# Added by Ungleich
PermitRootLogin without-password
EOF EOF
fi
# Set zstd-19 compression, copy all data to the pool, and then set compression to default again # Set zstd-19 compression, copy all data to the pool, and then set compression to default again
# This will make the base image smaller, at the cost of taking longer to generate, as zstd-19 is slow to write # This will make the base image smaller, at the cost of taking longer to generate, as zstd-19 is slow to write