You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

28 lines
547 B

#!/bin/sh
failsafe_sshd () {
# if dropbear is executable it can handle failsafe
[ -x /usr/sbin/dropbear ] && return
sshd_tmpdir=/tmp/sshd
mkdir $sshd_tmpdir
for type in ed25519; do
key=$sshd_tmpdir/ssh_host_${type}_key
ssh-keygen -N '' -t ${type} -f ${key}
done
mkdir -m 0700 -p /var/empty
cat > $sshd_tmpdir/sshd_config <<EOF
HostKey $sshd_tmpdir/ssh_host_ed25519_key
PermitRootLogin yes
PermitEmptyPasswords yes
EOF
/usr/sbin/sshd -f $sshd_tmpdir/sshd_config -E $sshd_tmpdir/sshd.log
}
boot_hook_add failsafe failsafe_sshd