[oe-commits] org.oe.dev busybox 1.9.1: add files needed for openwrt-style 'telnet failsafe login'

koen commit oe at amethyst.openembedded.net
Mon Mar 24 17:59:30 UTC 2008


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

Author: koen at openembedded.org
Branch: org.openembedded.dev
Revision: 4f38c623129076351ddc15086ffe865d87b655b4
ViewMTN: http://monotone.openembedded.org/revision/info/4f38c623129076351ddc15086ffe865d87b655b4
Files:
1
packages/busybox/files/50telnet
packages/busybox/files/login.failsafe
packages/busybox/busybox-1.9.1/defconfig
Diffs:

#
# mt diff -rfc79b692a0cb7a0ec569d1ccb1079a1fd1d83249 -r4f38c623129076351ddc15086ffe865d87b655b4
#
#
#
# add_file "packages/busybox/files/50telnet"
#  content [1da1219aa725bae7dfd982000c97e159804237f9]
# 
# add_file "packages/busybox/files/login.failsafe"
#  content [d3eaa22066e6d13ead9d5ee78fd47ad0d251a261]
# 
# patch "packages/busybox/busybox-1.9.1/defconfig"
#  from [183a1034704ae8119a3b8348768ba35a162e96b8]
#    to [f0e872e8e6f3bc9941075571caf38d1a62657458]
#
============================================================
--- packages/busybox/files/50telnet	1da1219aa725bae7dfd982000c97e159804237f9
+++ packages/busybox/files/50telnet	1da1219aa725bae7dfd982000c97e159804237f9
@@ -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
+}
============================================================
--- packages/busybox/files/login.failsafe	d3eaa22066e6d13ead9d5ee78fd47ad0d251a261
+++ packages/busybox/files/login.failsafe	d3eaa22066e6d13ead9d5ee78fd47ad0d251a261
@@ -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
============================================================
--- packages/busybox/busybox-1.9.1/defconfig	183a1034704ae8119a3b8348768ba35a162e96b8
+++ packages/busybox/busybox-1.9.1/defconfig	f0e872e8e6f3bc9941075571caf38d1a62657458
@@ -633,7 +633,7 @@ CONFIG_FEATURE_TELNET_AUTOLOGIN=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






More information about the Openembedded-commits mailing list