busybox: Disable telnet if an SSH public key for root exists (#8760)
SVN-Revision: 25317
This commit is contained in:
parent
4fec7f7edb
commit
b435f9d603
1 changed files with 7 additions and 1 deletions
|
@ -10,8 +10,14 @@ has_root_pwd() {
|
||||||
test -n "${pwd#!}"
|
test -n "${pwd#!}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
has_ssh_pubkey() {
|
||||||
|
( test -x /usr/sbin/dropbear && grep -qs "^ssh-" /etc/dropbear/authorized_keys ) || \
|
||||||
|
( test -x /usr/sbin/sshd && grep -qs "^ssh-" /root/.ssh/authorized_keys )
|
||||||
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
if ( ! has_root_pwd /etc/passwd && ! has_root_pwd /etc/shadow ) || \
|
if ( ! has_ssh_pubkey && \
|
||||||
|
! has_root_pwd /etc/passwd && ! has_root_pwd /etc/shadow ) || \
|
||||||
( [ ! -x /usr/sbin/dropbear ] && [ ! -x /usr/sbin/sshd ] );
|
( [ ! -x /usr/sbin/dropbear ] && [ ! -x /usr/sbin/sshd ] );
|
||||||
then
|
then
|
||||||
telnetd -l /bin/login.sh
|
telnetd -l /bin/login.sh
|
||||||
|
|
Loading…
Reference in a new issue