diff mbox series

[OpenWrt-Devel] dropbear: Install to /(s)bin instead of /usr so OpenSSH can coexist

Message ID 20180617030636.19021-1-rosenp@gmail.com
State Changes Requested
Delegated to: John Crispin
Headers show
Series [OpenWrt-Devel] dropbear: Install to /(s)bin instead of /usr so OpenSSH can coexist | expand

Commit Message

Rosen Penev June 17, 2018, 3:06 a.m. UTC
If you run opkg install openssh-client and then remove it, the ssh client
symlink that was initially there goes away. This avoids that problem.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 package/network/services/dropbear/Makefile     | 18 +++++++++---------
 .../services/dropbear/files/dropbear.init      |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

Comments

Paul Oranje June 19, 2018, 4:56 p.m. UTC | #1
Can opkg remove not restore the original softlink to dropbear ? (bottom-line reinstall dropbear)
And even when that isn't an option, why also move the dropbear binary to sbin and not just the softlink ?

Paul

> Op 17 jun. 2018, om 05:06 heeft Rosen Penev <rosenp@gmail.com> het volgende geschreven:
> 
> If you run opkg install openssh-client and then remove it, the ssh client
> symlink that was initially there goes away. This avoids that problem.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> package/network/services/dropbear/Makefile     | 18 +++++++++---------
> .../services/dropbear/files/dropbear.init      |  2 +-
> 2 files changed, 10 insertions(+), 10 deletions(-)
> 
> diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile
> index 21ac09f724..41f51b284b 100644
> --- a/package/network/services/dropbear/Makefile
> +++ b/package/network/services/dropbear/Makefile
> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
> 
> PKG_NAME:=dropbear
> PKG_VERSION:=2017.75
> -PKG_RELEASE:=5
> +PKG_RELEASE:=6
> 
> PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
> PKG_SOURCE_URL:= \
> @@ -57,7 +57,7 @@ endef
> 
> define Package/dropbear/conffiles
> /etc/dropbear/dropbear_rsa_host_key
> -/etc/config/dropbear 
> +/etc/config/dropbear
> endef
> 
> define Package/dropbearconvert
> @@ -128,13 +128,13 @@ define Build/Compile
> endef
> 
> define Package/dropbear/install
> -	$(INSTALL_DIR) $(1)/usr/sbin
> -	$(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
> -	$(INSTALL_DIR) $(1)/usr/bin
> -	$(LN) ../sbin/dropbear $(1)/usr/bin/scp
> -	$(LN) ../sbin/dropbear $(1)/usr/bin/ssh
> -	$(LN) ../sbin/dropbear $(1)/usr/bin/dbclient
> -	$(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey
> +	$(INSTALL_DIR) $(1)/sbin
> +	$(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/sbin/dropbear
> +	$(INSTALL_DIR) $(1)/bin
> +	$(LN) ../sbin/dropbear $(1)/bin/scp
> +	$(LN) ../sbin/dropbear $(1)/bin/ssh
> +	$(LN) ../sbin/dropbear $(1)/bin/dbclient
> +	$(LN) ../sbin/dropbear $(1)/bin/dropbearkey
> 	$(INSTALL_DIR) $(1)/etc/config
> 	$(INSTALL_DATA) ./files/dropbear.config $(1)/etc/config/dropbear
> 	$(INSTALL_DIR) $(1)/etc/init.d
> diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init
> index 2225113498..d9a6bd4959 100755
> --- a/package/network/services/dropbear/files/dropbear.init
> +++ b/package/network/services/dropbear/files/dropbear.init
> @@ -6,7 +6,7 @@ START=50
> STOP=50
> 
> USE_PROCD=1
> -PROG=/usr/sbin/dropbear
> +PROG=/sbin/dropbear
> NAME=dropbear
> PIDCOUNT=0
> EXTRA_COMMANDS="killclients"
> -- 
> 2.17.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/listinfo/openwrt-devel
Rosen Penev June 19, 2018, 4:57 p.m. UTC | #2
On Tue, Jun 19, 2018 at 9:56 AM, Paul Oranje <por@oranjevos.nl> wrote:
> Can opkg remove not restore the original softlink to dropbear ? (bottom-line reinstall dropbear)
Possible.
> And even when that isn't an option, why also move the dropbear binary to sbin and not just the softlink ?
Simpler patch
>
> Paul
>
>> Op 17 jun. 2018, om 05:06 heeft Rosen Penev <rosenp@gmail.com> het volgende geschreven:
>>
>> If you run opkg install openssh-client and then remove it, the ssh client
>> symlink that was initially there goes away. This avoids that problem.
>>
>> Signed-off-by: Rosen Penev <rosenp@gmail.com>
>> ---
>> package/network/services/dropbear/Makefile     | 18 +++++++++---------
>> .../services/dropbear/files/dropbear.init      |  2 +-
>> 2 files changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile
>> index 21ac09f724..41f51b284b 100644
>> --- a/package/network/services/dropbear/Makefile
>> +++ b/package/network/services/dropbear/Makefile
>> @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
>>
>> PKG_NAME:=dropbear
>> PKG_VERSION:=2017.75
>> -PKG_RELEASE:=5
>> +PKG_RELEASE:=6
>>
>> PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
>> PKG_SOURCE_URL:= \
>> @@ -57,7 +57,7 @@ endef
>>
>> define Package/dropbear/conffiles
>> /etc/dropbear/dropbear_rsa_host_key
>> -/etc/config/dropbear
>> +/etc/config/dropbear
>> endef
>>
>> define Package/dropbearconvert
>> @@ -128,13 +128,13 @@ define Build/Compile
>> endef
>>
>> define Package/dropbear/install
>> -     $(INSTALL_DIR) $(1)/usr/sbin
>> -     $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
>> -     $(INSTALL_DIR) $(1)/usr/bin
>> -     $(LN) ../sbin/dropbear $(1)/usr/bin/scp
>> -     $(LN) ../sbin/dropbear $(1)/usr/bin/ssh
>> -     $(LN) ../sbin/dropbear $(1)/usr/bin/dbclient
>> -     $(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey
>> +     $(INSTALL_DIR) $(1)/sbin
>> +     $(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/sbin/dropbear
>> +     $(INSTALL_DIR) $(1)/bin
>> +     $(LN) ../sbin/dropbear $(1)/bin/scp
>> +     $(LN) ../sbin/dropbear $(1)/bin/ssh
>> +     $(LN) ../sbin/dropbear $(1)/bin/dbclient
>> +     $(LN) ../sbin/dropbear $(1)/bin/dropbearkey
>>       $(INSTALL_DIR) $(1)/etc/config
>>       $(INSTALL_DATA) ./files/dropbear.config $(1)/etc/config/dropbear
>>       $(INSTALL_DIR) $(1)/etc/init.d
>> diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init
>> index 2225113498..d9a6bd4959 100755
>> --- a/package/network/services/dropbear/files/dropbear.init
>> +++ b/package/network/services/dropbear/files/dropbear.init
>> @@ -6,7 +6,7 @@ START=50
>> STOP=50
>>
>> USE_PROCD=1
>> -PROG=/usr/sbin/dropbear
>> +PROG=/sbin/dropbear
>> NAME=dropbear
>> PIDCOUNT=0
>> EXTRA_COMMANDS="killclients"
>> --
>> 2.17.1
>>
>>
>> _______________________________________________
>> openwrt-devel mailing list
>> openwrt-devel@lists.openwrt.org
>> https://lists.openwrt.org/listinfo/openwrt-devel
>
Yousong Zhou June 22, 2018, 8:53 a.m. UTC | #3
On Sun, 17 Jun 2018 at 11:07, Rosen Penev <rosenp@gmail.com> wrote:
>
> If you run opkg install openssh-client and then remove it, the ssh client
> symlink that was initially there goes away. This avoids that problem.
>

opkg's "alternatives" support fits this situation perfectly.  Please
take busybox ip and ip-tiny, ip-full as an example.

                yousong
Rosen Penev June 22, 2018, 4:51 p.m. UTC | #4
On Fri, Jun 22, 2018 at 1:53 AM Yousong Zhou <yszhou4tech@gmail.com> wrote:
>
> On Sun, 17 Jun 2018 at 11:07, Rosen Penev <rosenp@gmail.com> wrote:
> >
> > If you run opkg install openssh-client and then remove it, the ssh client
> > symlink that was initially there goes away. This avoids that problem.
> >
>
> opkg's "alternatives" support fits this situation perfectly.  Please
> take busybox ip and ip-tiny, ip-full as an example.
>
Hmm? Dropbear needs to be installed alongside OpenSSH in order to edit
sshd_config to enable root login.
>                 yousong
Yousong Zhou June 25, 2018, 6:19 a.m. UTC | #5
On Sat, 23 Jun 2018 at 00:51, Rosen Penev <rosenp@gmail.com> wrote:
>
> On Fri, Jun 22, 2018 at 1:53 AM Yousong Zhou <yszhou4tech@gmail.com> wrote:
> >
> > On Sun, 17 Jun 2018 at 11:07, Rosen Penev <rosenp@gmail.com> wrote:
> > >
> > > If you run opkg install openssh-client and then remove it, the ssh client
> > > symlink that was initially there goes away. This avoids that problem.
> > >
> >
> > opkg's "alternatives" support fits this situation perfectly.  Please
> > take busybox ip and ip-tiny, ip-full as an example.
> >
> Hmm? Dropbear needs to be installed alongside OpenSSH in order to edit
> sshd_config to enable root login.

Sorry, failed to get how this symlink management thing affects root login.

I created a pull request for openssh-client [1] and patches also
dropbear [2] to use the alternatives support in opkg.  The
alternatives support intends to be a general solution to the
preinst/postrm hook or PATH precedence hack.

 [1] https://github.com/openwrt/packages/pull/6344
 [2] https://git.openwrt.org/?p=openwrt/staging/yousong.git;a=shortlog;h=refs/heads/ssh-alt

                yousong
diff mbox series

Patch

diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile
index 21ac09f724..41f51b284b 100644
--- a/package/network/services/dropbear/Makefile
+++ b/package/network/services/dropbear/Makefile
@@ -9,7 +9,7 @@  include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dropbear
 PKG_VERSION:=2017.75
-PKG_RELEASE:=5
+PKG_RELEASE:=6
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
@@ -57,7 +57,7 @@  endef
 
 define Package/dropbear/conffiles
 /etc/dropbear/dropbear_rsa_host_key
-/etc/config/dropbear 
+/etc/config/dropbear
 endef
 
 define Package/dropbearconvert
@@ -128,13 +128,13 @@  define Build/Compile
 endef
 
 define Package/dropbear/install
-	$(INSTALL_DIR) $(1)/usr/sbin
-	$(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/usr/sbin/dropbear
-	$(INSTALL_DIR) $(1)/usr/bin
-	$(LN) ../sbin/dropbear $(1)/usr/bin/scp
-	$(LN) ../sbin/dropbear $(1)/usr/bin/ssh
-	$(LN) ../sbin/dropbear $(1)/usr/bin/dbclient
-	$(LN) ../sbin/dropbear $(1)/usr/bin/dropbearkey
+	$(INSTALL_DIR) $(1)/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/dropbearmulti $(1)/sbin/dropbear
+	$(INSTALL_DIR) $(1)/bin
+	$(LN) ../sbin/dropbear $(1)/bin/scp
+	$(LN) ../sbin/dropbear $(1)/bin/ssh
+	$(LN) ../sbin/dropbear $(1)/bin/dbclient
+	$(LN) ../sbin/dropbear $(1)/bin/dropbearkey
 	$(INSTALL_DIR) $(1)/etc/config
 	$(INSTALL_DATA) ./files/dropbear.config $(1)/etc/config/dropbear
 	$(INSTALL_DIR) $(1)/etc/init.d
diff --git a/package/network/services/dropbear/files/dropbear.init b/package/network/services/dropbear/files/dropbear.init
index 2225113498..d9a6bd4959 100755
--- a/package/network/services/dropbear/files/dropbear.init
+++ b/package/network/services/dropbear/files/dropbear.init
@@ -6,7 +6,7 @@  START=50
 STOP=50
 
 USE_PROCD=1
-PROG=/usr/sbin/dropbear
+PROG=/sbin/dropbear
 NAME=dropbear
 PIDCOUNT=0
 EXTRA_COMMANDS="killclients"