* [Buildroot] [PATCH 0/2 v4] busybox: improve support for telnetd (branch yem/pw)
@ 2015-07-13 9:05 Yann E. MORIN
2015-07-13 9:05 ` [Buildroot] [PATCH 1/2 v4] core/skeleton: drop /etc/securetty Yann E. MORIN
` (2 more replies)
0 siblings, 3 replies; 10+ messages in thread
From: Yann E. MORIN @ 2015-07-13 9:05 UTC (permalink / raw)
To: buildroot
Hello All!
This series improves upon the previous iterations to auto-start telnetd
on the target.
It now removes handling of securetty altogether, since we've concluded
it is not used by util-linux' login utility, and can also be ignored by
busybox' login even with our current busybox defconfig.
Changes v3 -> v4:
- drop support for securetty altogether
Regards,
Yann E. MORIN.
The following changes since commit b40509c7d80d6610b3f54e6da0dc1265bf6e9e22:
package/x11r7/xdriver_xf86-video-r128: bump version to 6.10.0 (2015-07-13 10:16:13 +0200)
are available in the git repository at:
git://git.busybox.net/~ymorin/git/buildroot yem/pw
for you to fetch changes up to 7d67670ffb919ed240b7fb157e44c8219375cff0:
busybox: improve support for telnetd (2015-07-13 11:00:30 +0200)
----------------------------------------------------------------
Alexey Brodkin (1):
busybox: improve support for telnetd
Yann E. MORIN (1):
core/skeleton: drop /etc/securetty
package/busybox/S50telnet | 36 +++++++++++++++++++++++++++
package/busybox/busybox.mk | 9 +++++++
package/util-linux/login.pam | 1 -
system/skeleton/etc/securetty | 57 -------------------------------------------
system/system.mk | 8 ------
5 files changed, 45 insertions(+), 66 deletions(-)
create mode 100755 package/busybox/S50telnet
delete mode 100644 system/skeleton/etc/securetty
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 10+ messages in thread* [Buildroot] [PATCH 1/2 v4] core/skeleton: drop /etc/securetty 2015-07-13 9:05 [Buildroot] [PATCH 0/2 v4] busybox: improve support for telnetd (branch yem/pw) Yann E. MORIN @ 2015-07-13 9:05 ` Yann E. MORIN 2015-07-13 9:20 ` Baruch Siach 2015-07-13 9:05 ` [Buildroot] [PATCH 2/2 v4] busybox: improve support for telnetd Yann E. MORIN 2015-07-13 11:02 ` [Buildroot] [PATCH 0/2 v4] busybox: improve support for telnetd (branch yem/pw) Thomas Petazzoni 2 siblings, 1 reply; 10+ messages in thread From: Yann E. MORIN @ 2015-07-13 9:05 UTC (permalink / raw) To: buildroot securetty is supposed to restrict the terminals root is allowed to login from. As it happens, login from busybox (w/ securetty support) is actually enforcing use of securetty, while login from util-linux is completely ignoring securetty altogether. Remove securetty from our skeleton altogether and stop worrying about it. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Arnout Vandecappelle <arnout@mind.be> Cc: Gustavo Zacarias <gustavo@zacarias.com.ar> --- package/util-linux/login.pam | 1 - system/skeleton/etc/securetty | 57 ------------------------------------------- system/system.mk | 8 ------ 3 files changed, 66 deletions(-) delete mode 100644 system/skeleton/etc/securetty diff --git a/package/util-linux/login.pam b/package/util-linux/login.pam index 1d9cd70..01f5632 100644 --- a/package/util-linux/login.pam +++ b/package/util-linux/login.pam @@ -1,4 +1,3 @@ -auth required pam_securetty.so auth required pam_unix.so nullok account required pam_unix.so diff --git a/system/skeleton/etc/securetty b/system/skeleton/etc/securetty deleted file mode 100644 index 0722677..0000000 --- a/system/skeleton/etc/securetty +++ /dev/null @@ -1,57 +0,0 @@ -tty1 -tty2 -tty3 -tty4 -tty5 -tty6 -tty7 -tty8 -ttyS0 -ttyS1 -ttyS2 -ttyS3 -ttyAMA0 -ttyAMA1 -ttyAMA2 -ttyAMA3 -ttySAC0 -ttySAC1 -ttySAC2 -ttySAC3 -ttyUL0 -ttyUL1 -ttyUL2 -ttyUL3 -ttyPS0 -ttyPS1 -ttyPSC0 -ttyPSC1 -ttyPSC2 -ttyPSC3 -ttyCPM0 -ttyCPM1 -ttyCPM2 -ttyCPM3 -ttymxc0 -ttymxc1 -ttymxc2 -ttyO0 -ttyO1 -ttyO2 -ttyO3 -ttyAM0 -ttyAM1 -ttyAM2 -ttySC0 -ttySC1 -ttySC2 -ttySC3 -ttySC4 -ttySC5 -ttySC6 -ttySC7 -ttyGS0 -hvc0 -hvc1 -hvc2 -hvc3 diff --git a/system/system.mk b/system/system.mk index 2794667..fd94e03 100644 --- a/system/system.mk +++ b/system/system.mk @@ -8,14 +8,6 @@ TARGET_GENERIC_GETTY_BAUDRATE = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_BAUDRAT TARGET_GENERIC_GETTY_TERM = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_TERM)) TARGET_GENERIC_GETTY_OPTIONS = $(call qstrip,$(BR2_TARGET_GENERIC_GETTY_OPTIONS)) -ifeq ($(BR2_TARGET_GENERIC_GETTY),y) -define SYSTEM_SECURETTY - grep -q '^$(TARGET_GENERIC_GETTY_PORT)$$' $(TARGET_DIR)/etc/securetty || \ - echo '$(TARGET_GENERIC_GETTY_PORT)' >> $(TARGET_DIR)/etc/securetty -endef -TARGET_FINALIZE_HOOKS += SYSTEM_SECURETTY -endif - ifneq ($(TARGET_GENERIC_HOSTNAME),) define SYSTEM_HOSTNAME mkdir -p $(TARGET_DIR)/etc -- 1.9.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/2 v4] core/skeleton: drop /etc/securetty 2015-07-13 9:05 ` [Buildroot] [PATCH 1/2 v4] core/skeleton: drop /etc/securetty Yann E. MORIN @ 2015-07-13 9:20 ` Baruch Siach 2015-07-13 9:35 ` Yann E. MORIN 0 siblings, 1 reply; 10+ messages in thread From: Baruch Siach @ 2015-07-13 9:20 UTC (permalink / raw) To: buildroot Hi Yann, On Mon, Jul 13, 2015 at 11:05:35AM +0200, Yann E. MORIN wrote: > securetty is supposed to restrict the terminals root is allowed to > login from. As it happens, login from busybox (w/ securetty support) > is actually enforcing use of securetty, while login from util-linux > is completely ignoring securetty altogether. > > Remove securetty from our skeleton altogether and stop worrying about > it. But CONFIG_FEATURE_SECURETTY=y is still there in current package/busybox/busybox.config. Shouldn't we disable it first? baruch -- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il - ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/2 v4] core/skeleton: drop /etc/securetty 2015-07-13 9:20 ` Baruch Siach @ 2015-07-13 9:35 ` Yann E. MORIN 2015-07-13 9:44 ` Baruch Siach 0 siblings, 1 reply; 10+ messages in thread From: Yann E. MORIN @ 2015-07-13 9:35 UTC (permalink / raw) To: buildroot Baruch, All, On 2015-07-13 12:20 +0300, Baruch Siach spake thusly: > On Mon, Jul 13, 2015 at 11:05:35AM +0200, Yann E. MORIN wrote: > > securetty is supposed to restrict the terminals root is allowed to > > login from. As it happens, login from busybox (w/ securetty support) > > is actually enforcing use of securetty, while login from util-linux > > is completely ignoring securetty altogether. > > > > Remove securetty from our skeleton altogether and stop worrying about > > it. > > But CONFIG_FEATURE_SECURETTY=y is still there in current > package/busybox/busybox.config. Shouldn't we disable it first? Indeed, it is still present, but that does not prevent root login to work when /etc/securetty is missing. So, I decided to leave it as-is. Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/2 v4] core/skeleton: drop /etc/securetty 2015-07-13 9:35 ` Yann E. MORIN @ 2015-07-13 9:44 ` Baruch Siach 2015-07-13 10:37 ` Yann E. MORIN 0 siblings, 1 reply; 10+ messages in thread From: Baruch Siach @ 2015-07-13 9:44 UTC (permalink / raw) To: buildroot Hi Yann, On Mon, Jul 13, 2015 at 11:35:52AM +0200, Yann E. MORIN wrote: > On 2015-07-13 12:20 +0300, Baruch Siach spake thusly: > > On Mon, Jul 13, 2015 at 11:05:35AM +0200, Yann E. MORIN wrote: > > > securetty is supposed to restrict the terminals root is allowed to > > > login from. As it happens, login from busybox (w/ securetty support) > > > is actually enforcing use of securetty, while login from util-linux > > > is completely ignoring securetty altogether. > > > > > > Remove securetty from our skeleton altogether and stop worrying about > > > it. > > > > But CONFIG_FEATURE_SECURETTY=y is still there in current > > package/busybox/busybox.config. Shouldn't we disable it first? > > Indeed, it is still present, but that does not prevent root login to > work when /etc/securetty is missing. > > So, I decided to leave it as-is. It would still break overlays with /etc/securetty (maybe locally modified). Why not just disable Busybox FEATURE_SECURETTY? baruch -- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il - ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/2 v4] core/skeleton: drop /etc/securetty 2015-07-13 9:44 ` Baruch Siach @ 2015-07-13 10:37 ` Yann E. MORIN 2015-07-13 10:46 ` Baruch Siach 0 siblings, 1 reply; 10+ messages in thread From: Yann E. MORIN @ 2015-07-13 10:37 UTC (permalink / raw) To: buildroot Baruch, All, On 2015-07-13 12:44 +0300, Baruch Siach spake thusly: > On Mon, Jul 13, 2015 at 11:35:52AM +0200, Yann E. MORIN wrote: > > On 2015-07-13 12:20 +0300, Baruch Siach spake thusly: > > > On Mon, Jul 13, 2015 at 11:05:35AM +0200, Yann E. MORIN wrote: > > > > securetty is supposed to restrict the terminals root is allowed to > > > > login from. As it happens, login from busybox (w/ securetty support) > > > > is actually enforcing use of securetty, while login from util-linux > > > > is completely ignoring securetty altogether. > > > > > > > > Remove securetty from our skeleton altogether and stop worrying about > > > > it. > > > > > > But CONFIG_FEATURE_SECURETTY=y is still there in current > > > package/busybox/busybox.config. Shouldn't we disable it first? > > > > Indeed, it is still present, but that does not prevent root login to > > work when /etc/securetty is missing. > > > > So, I decided to leave it as-is. > > It would still break overlays with /etc/securetty (maybe locally modified). > Why not just disable Busybox FEATURE_SECURETTY? After discussing this with Thomas, we've decided to keep it, especially to keep the case you mention (custom securetty from overlay) is still working as expected. The reasoning is that a user which installs a custom /etc/securetty will obviously have it contain the ttys he wants root to log in from, so he'd still be able to log in as root from those ttys. But if we were to remove FEATURE_SECURETTY, then he'd still be able to log in as root from those ttys, but *also* from *any other* tty, and would probably not notice that change as this is a silent change. So, we've concluded that we should keep FEATURE_SECURETTY since it works for our new use-case, and works for existing use-cases. Regards, Yann E. MORIN. -- .-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------' ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/2 v4] core/skeleton: drop /etc/securetty 2015-07-13 10:37 ` Yann E. MORIN @ 2015-07-13 10:46 ` Baruch Siach 2015-07-13 11:42 ` Arnout Vandecappelle 0 siblings, 1 reply; 10+ messages in thread From: Baruch Siach @ 2015-07-13 10:46 UTC (permalink / raw) To: buildroot Hi Yann, On Mon, Jul 13, 2015 at 12:37:35PM +0200, Yann E. MORIN wrote: > On 2015-07-13 12:44 +0300, Baruch Siach spake thusly: > > It would still break overlays with /etc/securetty (maybe locally > > modified). Why not just disable Busybox FEATURE_SECURETTY? > > After discussing this with Thomas, we've decided to keep it, especially > to keep the case you mention (custom securetty from overlay) is still > working as expected. > > The reasoning is that a user which installs a custom /etc/securetty will > obviously have it contain the ttys he wants root to log in from, so he'd > still be able to log in as root from those ttys. > > But if we were to remove FEATURE_SECURETTY, then he'd still be able to > log in as root from those ttys, but *also* from *any other* tty, and > would probably not notice that change as this is a silent change. > > So, we've concluded that we should keep FEATURE_SECURETTY since it works > for our new use-case, and works for existing use-cases. Makes sense. Thanks for the explanation. baruch -- http://baruch.siach.name/blog/ ~. .~ Tk Open Systems =}------------------------------------------------ooO--U--Ooo------------{= - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il - ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1/2 v4] core/skeleton: drop /etc/securetty 2015-07-13 10:46 ` Baruch Siach @ 2015-07-13 11:42 ` Arnout Vandecappelle 0 siblings, 0 replies; 10+ messages in thread From: Arnout Vandecappelle @ 2015-07-13 11:42 UTC (permalink / raw) To: buildroot On 07/13/15 12:46, Baruch Siach wrote: > Hi Yann, > > On Mon, Jul 13, 2015 at 12:37:35PM +0200, Yann E. MORIN wrote: >> On 2015-07-13 12:44 +0300, Baruch Siach spake thusly: >>> It would still break overlays with /etc/securetty (maybe locally >>> modified). Why not just disable Busybox FEATURE_SECURETTY? >> >> After discussing this with Thomas, we've decided to keep it, especially >> to keep the case you mention (custom securetty from overlay) is still >> working as expected. >> >> The reasoning is that a user which installs a custom /etc/securetty will >> obviously have it contain the ttys he wants root to log in from, so he'd >> still be able to log in as root from those ttys. >> >> But if we were to remove FEATURE_SECURETTY, then he'd still be able to >> log in as root from those ttys, but *also* from *any other* tty, and >> would probably not notice that change as this is a silent change. >> >> So, we've concluded that we should keep FEATURE_SECURETTY since it works >> for our new use-case, and works for existing use-cases. > > Makes sense. Thanks for the explanation. Thanks for paying attention to these things as well. Even when there's six of us together here, we are still vulnerable to group think and may miss things that way. So an external pair of eyes is definitely good! Regards, Arnout -- Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF ^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 2/2 v4] busybox: improve support for telnetd 2015-07-13 9:05 [Buildroot] [PATCH 0/2 v4] busybox: improve support for telnetd (branch yem/pw) Yann E. MORIN 2015-07-13 9:05 ` [Buildroot] [PATCH 1/2 v4] core/skeleton: drop /etc/securetty Yann E. MORIN @ 2015-07-13 9:05 ` Yann E. MORIN 2015-07-13 11:02 ` [Buildroot] [PATCH 0/2 v4] busybox: improve support for telnetd (branch yem/pw) Thomas Petazzoni 2 siblings, 0 replies; 10+ messages in thread From: Yann E. MORIN @ 2015-07-13 9:05 UTC (permalink / raw) To: buildroot From: Alexey Brodkin <Alexey.Brodkin@synopsys.com> If target has connection to the network it might be pretty useful to have telnet connection to it instead of serial console or even in addition to serial console. This changes makes the busybox package automatically install an init script, and tune the securetty file to make telnetd work when CONFIG_FEATURE_TELNETD_STANDALONE is enabled in the Busybox configuration. [Thomas: - don't create a new Buildroot Config.in option, just test if CONFIG_FEATURE_TELNETD_STANDALONE is enabled or not in the Busybox configuration - move the securetty tuning in busybox.mk instead of system.mk - use start-stop-daemon in the init script, in order to properly implement the stop and restart actions - misc other minor improvements in the init script.] [yann.morin.1998 at free.fr: - don't use securetty - drop stray variable BUSYBOX_SET_STANDALONE_TELNETD] Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com> Cc: Peter Korsgaard <peter@korsgaard.com> Cc: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> --- package/busybox/S50telnet | 36 ++++++++++++++++++++++++++++++++++++ package/busybox/busybox.mk | 9 +++++++++ 2 files changed, 45 insertions(+) create mode 100755 package/busybox/S50telnet diff --git a/package/busybox/S50telnet b/package/busybox/S50telnet new file mode 100755 index 0000000..463a772 --- /dev/null +++ b/package/busybox/S50telnet @@ -0,0 +1,36 @@ +#!/bin/sh +# +# Start telnet.... +# + +start() { + echo -n "Starting telnetd: " + start-stop-daemon -S -q -m -b -p /var/run/telnetd.pid \ + -x /usr/sbin/telnetd -- -F + [ $? = 0 ] && echo "OK" || echo "FAIL" +} + +stop() { + echo -n "Stopping telnetd: " + start-stop-daemon -K -q -p /var/run/telnetd.pid \ + -x /usr/sbin/telnetd + [ $? = 0 ] && echo "OK" || echo "FAIL" +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload) + stop + start + ;; + *) + echo "Usage: $0 {start|stop|restart}" + exit 1 +esac + +exit $? diff --git a/package/busybox/busybox.mk b/package/busybox/busybox.mk index 92874cd..9289e0a 100644 --- a/package/busybox/busybox.mk +++ b/package/busybox/busybox.mk @@ -168,6 +168,14 @@ endef BUSYBOX_DEPENDENCIES += linux-pam endif +# Telnet support +define BUSYBOX_INSTALL_TELNET_SCRIPT + if grep -q CONFIG_FEATURE_TELNETD_STANDALONE=y $(@D)/.config; then \ + $(INSTALL) -m 0755 -D package/busybox/S50telnet \ + $(TARGET_DIR)/etc/init.d/S50telnet ; \ + fi +endef + # Enable "noclobber" in install.sh, to prevent BusyBox from overwriting any # full-blown versions of apps installed by other packages with sym/hard links. define BUSYBOX_NOCLOBBER_INSTALL @@ -205,6 +213,7 @@ define BUSYBOX_INSTALL_INIT_SYSV $(BUSYBOX_INSTALL_MDEV_SCRIPT) $(BUSYBOX_INSTALL_LOGGING_SCRIPT) $(BUSYBOX_INSTALL_WATCHDOG_SCRIPT) + $(BUSYBOX_INSTALL_TELNET_SCRIPT) endef $(eval $(kconfig-package)) -- 1.9.1 ^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 0/2 v4] busybox: improve support for telnetd (branch yem/pw) 2015-07-13 9:05 [Buildroot] [PATCH 0/2 v4] busybox: improve support for telnetd (branch yem/pw) Yann E. MORIN 2015-07-13 9:05 ` [Buildroot] [PATCH 1/2 v4] core/skeleton: drop /etc/securetty Yann E. MORIN 2015-07-13 9:05 ` [Buildroot] [PATCH 2/2 v4] busybox: improve support for telnetd Yann E. MORIN @ 2015-07-13 11:02 ` Thomas Petazzoni 2 siblings, 0 replies; 10+ messages in thread From: Thomas Petazzoni @ 2015-07-13 11:02 UTC (permalink / raw) To: buildroot Dear Yann E. MORIN, On Mon, 13 Jul 2015 11:05:31 +0200, Yann E. MORIN wrote: > Alexey Brodkin (1): > busybox: improve support for telnetd > > Yann E. MORIN (1): > core/skeleton: drop /etc/securetty Both applied, thanks a lot! Thomas -- Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2015-07-13 11:42 UTC | newest] Thread overview: 10+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-07-13 9:05 [Buildroot] [PATCH 0/2 v4] busybox: improve support for telnetd (branch yem/pw) Yann E. MORIN 2015-07-13 9:05 ` [Buildroot] [PATCH 1/2 v4] core/skeleton: drop /etc/securetty Yann E. MORIN 2015-07-13 9:20 ` Baruch Siach 2015-07-13 9:35 ` Yann E. MORIN 2015-07-13 9:44 ` Baruch Siach 2015-07-13 10:37 ` Yann E. MORIN 2015-07-13 10:46 ` Baruch Siach 2015-07-13 11:42 ` Arnout Vandecappelle 2015-07-13 9:05 ` [Buildroot] [PATCH 2/2 v4] busybox: improve support for telnetd Yann E. MORIN 2015-07-13 11:02 ` [Buildroot] [PATCH 0/2 v4] busybox: improve support for telnetd (branch yem/pw) Thomas Petazzoni
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox