mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-28 12:52:05 +02:00
[package] busybox: Disable telnet if an SSH public key for root exists (#8760)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@25317 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
1bba18de7a
commit
d3c45eaee1
@ -10,8 +10,14 @@ has_root_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() {
|
||||
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 ] );
|
||||
then
|
||||
telnetd -l /bin/login.sh
|
||||
|
Loading…
Reference in New Issue
Block a user