diff options
author | Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr> | 2011-02-02 18:50:50 +0000 |
---|---|---|
committer | Vasilis Tsiligiannis <b_tsiligiannis@silverton.gr> | 2011-02-02 18:50:50 +0000 |
commit | f25945f89645d37f29551345d1117778e85fd2bb (patch) | |
tree | d9469fec9ea86ec2aee9608de06c97cf79117e88 /package/busybox/files | |
parent | d51f7e6f9d9f0c58d22e158aa07b96a0044570fd (diff) | |
download | master-187ad058-f25945f89645d37f29551345d1117778e85fd2bb.tar.gz master-187ad058-f25945f89645d37f29551345d1117778e85fd2bb.tar.bz2 master-187ad058-f25945f89645d37f29551345d1117778e85fd2bb.zip |
[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
Diffstat (limited to 'package/busybox/files')
-rwxr-xr-x | package/busybox/files/telnet | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/package/busybox/files/telnet b/package/busybox/files/telnet index b8823379b9..a1e17275a3 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 |