Add /etc/shells handling
v2 cover Add /etc/shells handling
Started with commit [1], all package providing a shell interpreter should be listed in /etc/shells file to avoid issues with dropbear or other tools.
Although a macro could be added to pkg-generic.mk to avoid duplicating the /etc/shells handling, there is less than ten shell packages in Buildroot. So add /etc/shells handling as a POST_INSTALL_TARGET_HOOKS or inside INSTALL_TARGET_CMDS.
[1] 4d279697afbf8fb295274784103be2b837113d5e
Romain Naour (8):
package/skeleton-init-common: add /bin/sh to /etc/shells package/busybox: add /bin/{a,hu}sh to /etc/shells package/dash: add /etc/dash to /etc/shells package/screen: add /usr/bin/screen to /etc/shells package/tmux: add /usr/bin/tmux to /etc/shells package/zsh: add /bin/zsh to /etc/shells package/mksh: add /bin/mksh to /etc/shells package/bash: add missing double-dollar for /etc/shells
package/bash/bash.mk | 2 +- package/busybox/busybox.mk | 14 ++++++++++++++ package/dash/dash.mk | 4 ++++ package/mksh/mksh.mk | 8 ++++++++ package/screen/screen.mk | 9 ++++++++- package/skeleton-init-common/skeleton-init-common.mk | 7 +++++++ package/tmux/tmux.mk | 8 ++++++++ package/zsh/zsh.mk | 8 ++++++++ 8 files changed, 58 insertions(+), 2 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/8 package/skeleton-init-common: add /bin/sh to /etc/shells
Add the default shell /bin/sh to /etc/shells only if BR2_SYSTEM_BIN_SH_NONE is not selected.
---
v2: add double-dollar after /bin/sh (Yann)
remove empty /etc/shells from skeleton (Yann, Peter) move the hook right after it's defined (Yann)
--- package/skeleton-init-common/skeleton-init-common.mk | 7 +++++++ 1 file changed, 7 insertions(+)
package/skeleton-init-common/skeleton-init-common.mk +7 -0
@@ -79,6 +79,13 @@ define SKELETON_INIT_COMMON_SET_BIN_SH rm -f $(TARGET_DIR)/bin/sh endef else +# Add /bin/sh to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. +define SKELETON_INIT_COMMON_ADD_SH_TO_SHELLS + grep -qsE '^/bin/sh$$' $(TARGET_DIR)/etc/shells \ + || echo "/bin/sh" >> $(TARGET_DIR)/etc/shells +endef +SKELETON_INIT_COMMON_POST_INSTALL_TARGET_HOOKS += SKELETON_INIT_COMMON_ADD_SH_TO_SHELLS ifneq ($(SKELETON_INIT_COMMON_BIN_SH),) define SKELETON_INIT_COMMON_SET_BIN_SH ln -sf $(SKELETON_INIT_COMMON_BIN_SH) $(TARGET_DIR)/bin/sh
Signature · 1 line
2.7.4
PATCH v2 1/8 package/skeleton-init-common: add /bin/sh to /etc/shells
Romain, All,
On 2018-01-17 18:44 +0100, Romain Naour spake thusly:
Quoted 4 lines
Add the default shell
/bin/shto/etc/shellsonly ifBR2_SYSTEM_BIN_SH_NONEis not selected.Signed-off-by Romain Naour <[email protected]>
Regards,
Yann E. MORIN.
Quoted 33 lines
---
v2: add double-dollar after/bin/sh(Yann)
remove empty/etc/shellsfrom skeleton (Yann, Peter) move the hook right after it's defined (Yann)--- package/skeleton-init-common/skeleton-init-common.mk | 7 +++++++ 1 file changed, 7 insertions(+)package/skeleton-init-common/skeleton-init-common.mk +7
-0@@ -79,6 +79,13 @@ define SKELETON_INIT_COMMON_SET_BIN_SH rm -f $(TARGET_DIR)/bin/sh endef else +# Add /bin/sh to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. +define SKELETON_INIT_COMMON_ADD_SH_TO_SHELLS + grep -qsE '^/bin/sh$$' $(TARGET_DIR)/etc/shells \ + || echo "/bin/sh" >> $(TARGET_DIR)/etc/shells +endef +SKELETON_INIT_COMMON_POST_INSTALL_TARGET_HOOKS += SKELETON_INIT_COMMON_ADD_SH_TO_SHELLS ifneq ($(SKELETON_INIT_COMMON_BIN_SH),) define SKELETON_INIT_COMMON_SET_BIN_SH ln -sf $(SKELETON_INIT_COMMON_BIN_SH) $(TARGET_DIR)/bin/shSignature · 6 lines
2.7.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH v2 2/8 package/busybox: add /bin/{a, hu}sh to /etc/shells
In reply to Romain NaourWhen ash (busybox) is selected, /bin/{a,hu}sh is not added to /etc/shells (see man shells). So, login tools like dropbear reject the ssh connexions for users using {a,hu}sh as shell in /etc/passwd.
buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected
---
v2: add double-dollar after /bin/{a,hu}sh (Yann)
add hush handling
msh has been removed from Busybox 1.28
https://git.busybox.net/busybox/commit/?id=2e989ef232e35750df573898077dd356003705b2
msh is unlikely used.
--- package/busybox/busybox.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
package/busybox/busybox.mk +14 -0
@@ -258,6 +258,19 @@ define BUSYBOX_INSTALL_TELNET_SCRIPT fi endef +# Add /bin/{a,hu}sh to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. +define BUSYBOX_INSTALL_ADD_TO_SHELLS + if grep -q CONFIG_ASH=y $(@D)/.config; then \ + grep -qsE '^/bin/ash$$' $(TARGET_DIR)/etc/shells \ + || echo "/bin/ash" >> $(TARGET_DIR)/etc/shells; \ + fi + if grep -q CONFIG_HUSH=y $(@D)/.config; then \ + grep -qsE '^/bin/hush$$' $(TARGET_DIR)/etc/shells \ + || echo "/bin/hush" >> $(TARGET_DIR)/etc/shells; \ + 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
@@ -291,6 +304,7 @@ define BUSYBOX_INSTALL_TARGET_CMDS $(BUSYBOX_INSTALL_INITTAB) $(BUSYBOX_INSTALL_UDHCPC_SCRIPT) $(BUSYBOX_INSTALL_MDEV_CONF) + $(BUSYBOX_INSTALL_ADD_TO_SHELLS) endef define BUSYBOX_INSTALL_INIT_SYSV
Signature · 1 line
2.7.4
PATCH v2 2/8 package/busybox: add /bin/{a, hu}sh to /etc/shells
Romain, All,
On 2018-01-17 18:44 +0100, Romain Naour spake thusly:
Quoted 7 lines
When ash (busybox) is selected,
/bin/{a,hu}shis not added to/etc/shells(see man shells). So, login tools like dropbear reject the ssh connexions for users using {a,hu}sh as shell in/etc/passwd.buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected
Signed-off-by Romain Naour <[email protected]>
Yet, a comment, see below...
Quoted 15 lines
---
v2: add double-dollar after/bin/{a,hu}sh(Yann)
add hush handling
msh has been removed from Busybox 1.28
https://git.busybox.net/busybox/commit/?id=2e989ef232e35750df573898077dd356003705b2
msh is unlikely used.--- package/busybox/busybox.mk | 14 ++++++++++++++ 1 file changed, 14 insertions(+)package/busybox/busybox.mk +0
-0
package/busybox/busybox.mk define BUSYBOX_INSTALL_TELNET_SCRIPT · line 264
Quoted 7 lines
package/busybox/busybox.mk +4
-0@@ -258,6 +258,19 @@ define BUSYBOX_INSTALL_TELNET_SCRIPT fi endef +# Add /bin/{a,hu}sh to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. +define BUSYBOX_INSTALL_ADD_TO_SHELLS + if grep -q CONFIG_ASH=y $(@D)/.config; then \
Idealy, I would have also ensured that the pattern is anchored to the beining (and end) of the line:
if grep -qsE '^CONFIG_ASH=y$$' $(@D)/.config; then \
But in practice, I don't think it is necessary. Hence my acked-by.
package/busybox/busybox.mk define BUSYBOX_INSTALL_TELNET_SCRIPT · line 268
Quoted 4 lines
package/busybox/busybox.mk +4
-0+ grep -qsE '^/bin/ash$$' $(TARGET_DIR)/etc/shells \ + || echo "/bin/ash" >> $(TARGET_DIR)/etc/shells; \ + fi + if grep -q CONFIG_HUSH=y $(@D)/.config; then \
Ditto.
Regards,
Yann E. MORIN.
Quoted 23 lines
package/busybox/busybox.mk +6
-0+ grep -qsE '^/bin/hush$$' $(TARGET_DIR)/etc/shells \ + || echo "/bin/hush" >> $(TARGET_DIR)/etc/shells; \ + 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@@ -291,6 +304,7 @@ define BUSYBOX_INSTALL_TARGET_CMDS $(BUSYBOX_INSTALL_INITTAB) $(BUSYBOX_INSTALL_UDHCPC_SCRIPT) $(BUSYBOX_INSTALL_MDEV_CONF) + $(BUSYBOX_INSTALL_ADD_TO_SHELLS) endef define BUSYBOX_INSTALL_INIT_SYSVSignature · 6 lines
2.7.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH v2 3/8 package/dash: add /etc/dash to /etc/shells
In reply to Romain NaourWhen dash is selected, /bin/dash is not added to /etc/shells (see man shells). So, login tools like dropbear reject the ssh connexions for users using dash as shell in /etc/passwd.
buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected
---
v2: add double-dollar after /bin/dash (Yann)
--- package/dash/dash.mk | 4 ++++ 1 file changed, 4 insertions(+)
package/dash/dash.mk +4 -0
@@ -9,8 +9,12 @@ DASH_SITE = http://gondor.apana.org.au/~herbert/dash/files DASH_LICENSE = BSD-3-Clause, GPL-2.0+ (mksignames.c) DASH_LICENSE_FILES = COPYING +# Add /bin/dash to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. define DASH_INSTALL_TARGET_CMDS $(INSTALL) -m 0755 $(@D)/src/dash $(TARGET_DIR)/bin/dash + grep -qsE '^/bin/dash$$' $(TARGET_DIR)/etc/shells \ + || echo "/bin/dash" >> $(TARGET_DIR)/etc/shells endef $(eval $(autotools-package))
Signature · 1 line
2.7.4
PATCH v2 3/8 package/dash: add /etc/dash to /etc/shells
Romain, All,
On 2018-01-17 18:44 +0100, Romain Naour spake thusly:
Quoted 7 lines
When dash is selected,
/bin/dashis not added to/etc/shells(see man shells). So, login tools like dropbear reject the ssh connexions for users using dash as shell in/etc/passwd.buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected
Signed-off-by Romain Naour <[email protected]>
Regards,
Yann E. MORIN.
Quoted 30 lines
---
v2: add double-dollar after/bin/dash(Yann)--- package/dash/dash.mk | 4 ++++ 1 file changed, 4 insertions(+)package/dash/dash.mk +4
-0@@ -9,8 +9,12 @@ DASH_SITE = http://gondor.apana.org.au/~herbert/dash/files DASH_LICENSE = BSD-3-Clause, GPL-2.0+ (mksignames.c) DASH_LICENSE_FILES = COPYING +# Add /bin/dash to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. define DASH_INSTALL_TARGET_CMDS $(INSTALL) -m 0755 $(@D)/src/dash $(TARGET_DIR)/bin/dash + grep -qsE '^/bin/dash$$' $(TARGET_DIR)/etc/shells \ + || echo "/bin/dash" >> $(TARGET_DIR)/etc/shells endef $(eval $(autotools-package))Signature · 6 lines
2.7.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH v2 4/8 package/screen: add /usr/bin/screen to /etc/shells
In reply to Romain NaourWhen screen is selected, /usr/bin/screen is not added to /etc/shells (see man shells). So, login tools like dropbear reject the ssh connexions for users using screen as shell in /etc/passwd.
buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected
---
v2: add double-dollar after /usr/bin/screen (Yann)
remove /etc/shells handling from SCREEN_INSTALL_SCREENRC (Yann) fix conding style (Yann)
--- package/screen/screen.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
package/screen/screen.mk +8 -1
@@ -17,7 +17,14 @@ SCREEN_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) SCREEN=screen install_bin define SCREEN_INSTALL_SCREENRC $(INSTALL) -m 0755 -D $(@D)/etc/screenrc $(TARGET_DIR)/etc/screenrc endef - SCREEN_POST_INSTALL_TARGET_HOOKS += SCREEN_INSTALL_SCREENRC +# Add /usr/bin/screen to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. +define SCREEN_INSTALL_ADD_SCREEN_TO_SHELLS + grep -qsE '^/usr/bin/screen$$' $(TARGET_DIR)/etc/shells \ + || echo "/usr/bin/screen" >> $(TARGET_DIR)/etc/shells +endef +SCREEN_POST_INSTALL_TARGET_HOOKS += SCREEN_INSTALL_ADD_SCREEN_TO_SHELLS + $(eval $(autotools-package))
Signature · 1 line
2.7.4
PATCH v2 4/8 package/screen: add /usr/bin/screen to /etc/shells
Romain, All,
On 2018-01-17 18:44 +0100, Romain Naour spake thusly:
Quoted 7 lines
When screen is selected,
/usr/bin/screenis not added to/etc/shells(see man shells). So, login tools like dropbear reject the ssh connexions for users using screen as shell in/etc/passwd.buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected
Signed-off-by Romain Naour <[email protected]>
Yet, a comment below...
Quoted 13 lines
---
v2: add double-dollar after/usr/bin/screen(Yann)
remove/etc/shellshandling fromSCREEN_INSTALL_SCREENRC(Yann) fix conding style (Yann)--- package/screen/screen.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)package/screen/screen.mk +0
-0
package/screen/screen.mk SCREEN_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) SCREEN=screen install_bin · line 19
Quoted 3 lines
package/screen/screen.mk +0
-0@@ -17,7 +17,14 @@ SCREEN_INSTALL_TARGET_OPTS = DESTDIR=$(TARGET_DIR) SCREEN=screen install_bin define SCREEN_INSTALL_SCREENRC $(INSTALL) -m 0755 -D $(@D)/etc/screenrc $(TARGET_DIR)/etc/screenrc endef
Spurious removal of empty line.
I personally prefer when there is no empty line between the hook definition and its registration, but we are not consistent throughout the tree.
But since this file had pre-existing empty liens, it is better to keep it as-is.
But my ack still stands as I prefer it that way! ;-)
Regards,
Yann E. MORIN.
Quoted 19 lines
package/screen/screen.mk +8
-1- SCREEN_POST_INSTALL_TARGET_HOOKS += SCREEN_INSTALL_SCREENRC +# Add /usr/bin/screen to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. +define SCREEN_INSTALL_ADD_SCREEN_TO_SHELLS + grep -qsE '^/usr/bin/screen$$' $(TARGET_DIR)/etc/shells \ + || echo "/usr/bin/screen" >> $(TARGET_DIR)/etc/shells +endef +SCREEN_POST_INSTALL_TARGET_HOOKS += SCREEN_INSTALL_ADD_SCREEN_TO_SHELLS + $(eval $(autotools-package))Signature · 6 lines
2.7.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH v2 5/8 package/tmux: add /usr/bin/tmux to /etc/shells
In reply to Romain NaourWhen tmux is selected, /usr/bin/tmux is not added to /etc/shells (see man shells). So, login tools like dropbear reject the ssh connexions for users using tmux as shell in /etc/passwd.
buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected
---
v2: add double-dollar after /usr/bin/tmux (Yann)
--- package/tmux/tmux.mk | 8 ++++++++ 1 file changed, 8 insertions(+)
package/tmux/tmux.mk +8 -0
@@ -10,4 +10,12 @@ TMUX_LICENSE = ISC TMUX_LICENSE_FILES = README TMUX_DEPENDENCIES = libevent ncurses host-pkgconf +# Add /usr/bin/tmux to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. +define TMUX_INSTALL_ADD_TMUX_TO_SHELLS + grep -qsE '^/usr/bin/tmux$$' $(TARGET_DIR)/etc/shells \ + || echo "/usr/bin/tmux" >> $(TARGET_DIR)/etc/shells +endef +TMUX_POST_INSTALL_TARGET_HOOKS += TMUX_INSTALL_ADD_TMUX_TO_SHELLS + $(eval $(autotools-package))
Signature · 1 line
2.7.4
PATCH v2 5/8 package/tmux: add /usr/bin/tmux to /etc/shells
Romain, All,
On 2018-01-17 18:44 +0100, Romain Naour spake thusly:
Quoted 8 lines
When tmux is selected,
/usr/bin/tmuxis not added to/etc/shells(see man shells). So, login tools like dropbear reject the ssh connexions for users using tmux as shell in/etc/passwd.buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected
Signed-off-by Romain Naour <[email protected]>Cc "Yann E. MORIN" <[email protected]>
Regards,
Yann E. MORIN.
Quoted 26 lines
---
v2: add double-dollar after/usr/bin/tmux(Yann)--- package/tmux/tmux.mk | 8 ++++++++ 1 file changed, 8 insertions(+)package/tmux/tmux.mk +8
-0@@ -10,4 +10,12 @@ TMUX_LICENSE = ISC TMUX_LICENSE_FILES = README TMUX_DEPENDENCIES = libevent ncurses host-pkgconf +# Add /usr/bin/tmux to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. +define TMUX_INSTALL_ADD_TMUX_TO_SHELLS + grep -qsE '^/usr/bin/tmux$$' $(TARGET_DIR)/etc/shells \ + || echo "/usr/bin/tmux" >> $(TARGET_DIR)/etc/shells +endef +TMUX_POST_INSTALL_TARGET_HOOKS += TMUX_INSTALL_ADD_TMUX_TO_SHELLS + $(eval $(autotools-package))Signature · 1 line
2.7.4
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH v2 6/8 package/zsh: add /bin/zsh to /etc/shells
In reply to Romain NaourWhen zsh is selected, /bin/zsh is not added to /etc/shells (see man shells). So, login tools like dropbear reject the ssh connexions for users using zsh as shell in /etc/passwd.
buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected
---
v2: add double-dollar after /bin/zsh (Yann)
--- package/zsh/zsh.mk | 8 ++++++++ 1 file changed, 8 insertions(+)
package/zsh/zsh.mk +8 -0
@@ -34,6 +34,14 @@ else ZSH_CONF_OPTS += --disable-pcre endif +# Add /bin/zsh to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. +define ZSH_INSTALL_ADD_ZSH_TO_SHELLS + grep -qsE '^/bin/zsh$$' $(TARGET_DIR)/etc/shells \ + || echo "/bin/zsh" >> $(TARGET_DIR)/etc/shells +endef +ZSH_POST_INSTALL_TARGET_HOOKS += ZSH_INSTALL_ADD_ZSH_TO_SHELLS + # Remove versioned zsh-x.y.z binary taking up space define ZSH_TARGET_INSTALL_FIXUPS rm -f $(TARGET_DIR)/bin/zsh-$(ZSH_VERSION)
Signature · 1 line
2.7.4
PATCH v2 6/8 package/zsh: add /bin/zsh to /etc/shells
Romain, All,
On 2018-01-17 18:44 +0100, Romain Naour spake thusly:
Quoted 7 lines
When zsh is selected,
/bin/zshis not added to/etc/shells(see man shells). So, login tools like dropbear reject the ssh connexions for users using zsh as shell in/etc/passwd.buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected
Signed-off-by Romain Naour <[email protected]>
Regards,
Yann E. MORIN.
Quoted 32 lines
---
v2: add double-dollar after/bin/zsh(Yann)--- package/zsh/zsh.mk | 8 ++++++++ 1 file changed, 8 insertions(+)package/zsh/zsh.mk +8
-0@@ -34,6 +34,14 @@ else ZSH_CONF_OPTS += --disable-pcre endif +# Add /bin/zsh to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. +define ZSH_INSTALL_ADD_ZSH_TO_SHELLS + grep -qsE '^/bin/zsh$$' $(TARGET_DIR)/etc/shells \ + || echo "/bin/zsh" >> $(TARGET_DIR)/etc/shells +endef +ZSH_POST_INSTALL_TARGET_HOOKS += ZSH_INSTALL_ADD_ZSH_TO_SHELLS + # Remove versioned zsh-x.y.z binary taking up space define ZSH_TARGET_INSTALL_FIXUPS rm -f $(TARGET_DIR)/bin/zsh-$(ZSH_VERSION)Signature · 6 lines
2.7.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH v2 7/8 package/mksh: add /bin/mksh to /etc/shells
In reply to Romain NaourWhen mksh is selected, /bin/mksh is not added to /etc/shells (see man shells). So, login tools like dropbear reject the ssh connexions for users using mksh as shell in /etc/passwd.
buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected
---
v2: add double-dollar after /bin/mksh (Yann)
--- package/mksh/mksh.mk | 8 ++++++++ 1 file changed, 8 insertions(+)
package/mksh/mksh.mk +8 -0
@@ -21,4 +21,12 @@ define MKSH_INSTALL_TARGET_CMDS $(INSTALL) -m 0755 -D $(@D)/mksh $(TARGET_DIR)/bin/mksh endef +# Add /bin/mksh to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. +define MKSH_INSTALL_ADD_MKSH_TO_SHELLS + grep -qsE '^/bin/mksh$$' $(TARGET_DIR)/etc/shells \ + || echo "/bin/mksh" >> $(TARGET_DIR)/etc/shells +endef +MKSH_POST_INSTALL_TARGET_HOOKS += MKSH_INSTALL_ADD_MKSH_TO_SHELLS + $(eval $(generic-package))
Signature · 1 line
2.7.4
PATCH v2 7/8 package/mksh: add /bin/mksh to /etc/shells
Romain, All,
On 2018-01-17 18:44 +0100, Romain Naour spake thusly:
Quoted 18 lines
When mksh is selected,
/bin/mkshis not added to/etc/shells(see man shells). So, login tools like dropbear reject the ssh connexions for users using mksh as shell in/etc/passwd.buildroot authpriv.warn dropbear[853]: User 'kubu' has invalid shell, rejected
Signed-off-by Romain Naour <[email protected]>---
v2: add double-dollar after/bin/mksh(Yann)--- package/mksh/mksh.mk | 8 ++++++++ 1 file changed, 8 insertions(+)package/mksh/mksh.mk +0
-0
package/mksh/mksh.mk define MKSH_INSTALL_TARGET_CMDS · line 30
Quoted 10 lines
package/mksh/mksh.mk +7
-0@@ -21,4 +21,12 @@ define MKSH_INSTALL_TARGET_CMDS $(INSTALL) -m 0755 -D $(@D)/mksh $(TARGET_DIR)/bin/mksh endef +# Add /bin/mksh to /etc/shells otherwise some login tools like dropbear +# can reject the user connexion. See man shells. +define MKSH_INSTALL_ADD_MKSH_TO_SHELLS + grep -qsE '^/bin/mksh$$' $(TARGET_DIR)/etc/shells \ + || echo "/bin/mksh" >> $(TARGET_DIR)/etc/shells +endef +MKSH_POST_INSTALL_TARGET_HOOKS += MKSH_INSTALL_ADD_MKSH_TO_SHELLS
Since mksh is a generic package, you could just include that code within MKSH_ISNTALL_TARGET_CMDS, and do without the hook:
define MKSH_INSTALL_TARGET_CMDS
$(INSTALL) -m 0755 -D $(@D)/mksh $(TARGET_DIR)/bin/mksh
grep -qsE '^/bin/mksh$$' $(TARGET_DIR)/etc/shells \
|| echo "/bin/mksh" >> $(TARGET_DIR)/etc/shells
endefRegards,
Yann E. MORIN.
Quoted 8 lines
package/mksh/mksh.mk +0
-0$(eval $(generic-package))Signature · 6 lines
2.7.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH v2 8/8 package/bash: add missing double-dollar for /etc/shells
In reply to Romain NaourCommit 4d279697afbf8fb295274784103be2b837113d5e missed one comment from Yann E. Morin about the double-dollar.
--- package/bash/bash.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/bash/bash.mk +1 -1
@@ -46,7 +46,7 @@ define BASH_INSTALL_TARGET_CMDS $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ DESTDIR=$(TARGET_DIR) exec_prefix=/ install rm -f $(TARGET_DIR)/bin/bashbug - grep -qsE '^/bin/bash' $(TARGET_DIR)/etc/shells \ + grep -qsE '^/bin/bash$$' $(TARGET_DIR)/etc/shells \ || echo "/bin/bash" >> $(TARGET_DIR)/etc/shells endef
Signature · 1 line
2.7.4
PATCH v2 8/8 package/bash: add missing double-dollar for /etc/shells
Romain, All,
On 2018-01-17 18:44 +0100, Romain Naour spake thusly:
Quoted 4 lines
Commit
4d279697afbf8fb295274784103be2b837113d5emissed one comment from Yann E. Morin about the double-dollar.Signed-off-by Romain Naour <[email protected]>
Regards,
Yann E. MORIN.
Quoted 24 lines
--- package/bash/bash.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)package/bash/bash.mk +1
-1@@ -46,7 +46,7 @@ define BASH_INSTALL_TARGET_CMDS $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \ DESTDIR=$(TARGET_DIR) exec_prefix=/ install rm -f $(TARGET_DIR)/bin/bashbug - grep -qsE '^/bin/bash' $(TARGET_DIR)/etc/shells \ + grep -qsE '^/bin/bash$$' $(TARGET_DIR)/etc/shells \ || echo "/bin/bash" >> $(TARGET_DIR)/etc/shells endefSignature · 6 lines
2.7.4 _______________________________________________ buildroot mailing list buildroot at busybox.net http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'