re-order ssh config code
and add log info about temp key use
This commit is contained in:
parent
c41be0072c
commit
fa08356540
Binary file not shown.
|
@ -79,6 +79,19 @@ rc-service networking start
|
||||||
## Setup temporary SSH server (root login, no password)
|
## Setup temporary SSH server (root login, no password)
|
||||||
## we use some bundled or optionaly provided keys to avoid generation at boot and save time
|
## we use some bundled or optionaly provided keys to avoid generation at boot and save time
|
||||||
apk add openssh
|
apk add openssh
|
||||||
|
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig
|
||||||
|
cp /etc/conf.d/sshd /etc/conf.d/sshd.orig
|
||||||
|
|
||||||
|
cat <<-EOF >> /etc/ssh/sshd_config
|
||||||
|
AuthenticationMethods none
|
||||||
|
PermitEmptyPasswords yes
|
||||||
|
PermitRootLogin yes
|
||||||
|
Banner /tmp/.trash/banner
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<-EOF >> /etc/conf.d/sshd
|
||||||
|
sshd_disable_keygen=yes
|
||||||
|
EOF
|
||||||
|
|
||||||
# banner file
|
# banner file
|
||||||
cat <<-EOF > /tmp/.trash/banner
|
cat <<-EOF > /tmp/.trash/banner
|
||||||
|
@ -90,25 +103,14 @@ cat <<-EOF > /tmp/.trash/banner
|
||||||
# bundled temporary keys are moved in RAM /tmp so they won't be stored
|
# bundled temporary keys are moved in RAM /tmp so they won't be stored
|
||||||
# within permanent config later (new ones will then be generated)
|
# within permanent config later (new ones will then be generated)
|
||||||
mv /etc/ssh/ssh_host_*_key* /tmp/.trash/.
|
mv /etc/ssh/ssh_host_*_key* /tmp/.trash/.
|
||||||
|
|
||||||
cp /etc/ssh/sshd_config /etc/ssh/sshd_config.orig
|
|
||||||
cat <<-EOF >> /etc/ssh/sshd_config
|
|
||||||
AuthenticationMethods none
|
|
||||||
PermitEmptyPasswords yes
|
|
||||||
PermitRootLogin yes
|
|
||||||
Banner /tmp/.trash/banner
|
|
||||||
EOF
|
|
||||||
|
|
||||||
# inject optional custom keys (those might be stored)
|
# inject optional custom keys (those might be stored)
|
||||||
if ! install -m600 "${ovlpath}"/ssh_host_*_key* /etc/ssh/; then
|
if ! install -m600 "${ovlpath}"/ssh_host_*_key* /etc/ssh/; then
|
||||||
echo "HostKey /tmp/.trash/ssh_host_ed25519_key" >> /etc/ssh/sshd_config
|
logger -st ${0##*/} "Using bundled ssh keys from RAM..."
|
||||||
echo "HostKey /tmp/.trash/ssh_host_rsa_key" >> /etc/ssh/sshd_config
|
cat <<-EOF >> /etc/ssh/sshd_config
|
||||||
fi
|
HostKey /tmp/.trash/ssh_host_ed25519_key
|
||||||
|
HostKey /tmp/.trash/ssh_host_rsa_key
|
||||||
cp /etc/conf.d/sshd /etc/conf.d/sshd.orig
|
|
||||||
cat <<-EOF >> /etc/conf.d/sshd
|
|
||||||
sshd_disable_keygen=yes
|
|
||||||
EOF
|
EOF
|
||||||
|
fi
|
||||||
|
|
||||||
rc-service sshd start
|
rc-service sshd start
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue