summaryrefslogtreecommitdiff
path: root/package/busybox/files/telnet
diff options
context:
space:
mode:
authorVasilis Tsiligiannis <acinonyx@openwrt.gr>2011-02-02 18:50:50 +0000
committerVasilis Tsiligiannis <acinonyx@openwrt.gr>2011-02-02 18:50:50 +0000
commitb435f9d603c5ba47abf331b4104bfe2dd7dbfd54 (patch)
treef3d0c50837e574350940f77fde9958c0e85ee4e7 /package/busybox/files/telnet
parent4fec7f7edb0718c322e1ec574e0b02a227551db0 (diff)
downloadmtk-20170518-b435f9d603c5ba47abf331b4104bfe2dd7dbfd54.zip
mtk-20170518-b435f9d603c5ba47abf331b4104bfe2dd7dbfd54.tar.gz
mtk-20170518-b435f9d603c5ba47abf331b4104bfe2dd7dbfd54.tar.bz2
busybox: Disable telnet if an SSH public key for root exists (#8760)
SVN-Revision: 25317
Diffstat (limited to 'package/busybox/files/telnet')
-rwxr-xr-xpackage/busybox/files/telnet8
1 files changed, 7 insertions, 1 deletions
diff --git a/package/busybox/files/telnet b/package/busybox/files/telnet
index b882337..a1e1727 100755
--- a/package/busybox/files/telnet
+++ b/package/busybox/files/telnet
@@ -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