aboutsummaryrefslogtreecommitdiffstats
path: root/packages/busybox
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2008-03-24 17:57:00 +0000
committerKoen Kooi <koen@openembedded.org>2008-03-24 17:57:00 +0000
commit707122f5f0bdde57b8227a1f643d84e8cb0d6127 (patch)
tree898a9c833f3d7d9b3cf75e91895f6af27a8d38c6 /packages/busybox
parenta1e74e8420c93d8fb339f28a30f581de9a901843 (diff)
downloadopenembedded-707122f5f0bdde57b8227a1f643d84e8cb0d6127.tar.gz
busybox 1.9.1: add files needed for openwrt-style 'telnet failsafe login'
* the files aren't used in the recipe yet, just there for reference
Diffstat (limited to 'packages/busybox')
-rw-r--r--packages/busybox/busybox-1.9.1/defconfig2
-rw-r--r--packages/busybox/files/50telnet16
-rw-r--r--packages/busybox/files/login.failsafe19
3 files changed, 36 insertions, 1 deletions
diff --git a/packages/busybox/busybox-1.9.1/defconfig b/packages/busybox/busybox-1.9.1/defconfig
index 770ef6eb12..33d30911da 100644
--- a/packages/busybox/busybox-1.9.1/defconfig
+++ b/packages/busybox/busybox-1.9.1/defconfig
@@ -633,7 +633,7 @@ CONFIG_ROUTE=y
CONFIG_TELNET=y
# CONFIG_FEATURE_TELNET_TTYPE is not set
CONFIG_FEATURE_TELNET_AUTOLOGIN=y
-# CONFIG_TELNETD is not set
+CONFIG_TELNETD=y
# CONFIG_FEATURE_TELNETD_STANDALONE is not set
CONFIG_TFTP=y
CONFIG_FEATURE_TFTP_GET=y
diff --git a/packages/busybox/files/50telnet b/packages/busybox/files/50telnet
new file mode 100644
index 0000000000..3fb4a90494
--- /dev/null
+++ b/packages/busybox/files/50telnet
@@ -0,0 +1,16 @@
+#!/bin/sh
+# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2008 Koen Kooi
+
+# This starts telnetd if the password for 'root' is empty. This is needed for devices without a screen or serial console (wifi router, NAS, etc).
+
+start() {
+ if awk -F: '/^root:/ && ($2 != "") && ($2 !~ /\!/) {exit 1}' /etc/passwd 2>/dev/null
+ then
+ telnetd -l /bin/login.failsafe
+ fi
+}
+
+stop() {
+ killall telnetd
+}
diff --git a/packages/busybox/files/login.failsafe b/packages/busybox/files/login.failsafe
new file mode 100644
index 0000000000..e7c12a27fb
--- /dev/null
+++ b/packages/busybox/files/login.failsafe
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Copyright (C) 2006 OpenWrt.org
+# Copyright (C) 2008 Koen Kooi
+
+grep '^root:[^!]' /etc/passwd >&- 2>&-
+[ "$?" = "0" ] &&
+{
+ echo "Login failed."
+ exit 0
+} || {
+cat << EOF
+ === IMPORTANT ============================
+ Use 'passwd' to set your login password
+ this will disable telnet and enable SSH
+ ------------------------------------------
+EOF
+}
+
+exec /bin/sh --login