blob: a95745d096d8285cb74d62034f7687714b4a0357 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#!/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
|