diff mbox series

[LEDE-DEV] dropbear: Link ssh and scp command to /bin instead of /usr/bin

Message ID 20170902013941.28781-1-rosenp@gmail.com
State Changes Requested
Headers show
Series [LEDE-DEV] dropbear: Link ssh and scp command to /bin instead of /usr/bin | expand

Commit Message

Rosen Penev Sept. 2, 2017, 1:39 a.m. UTC
ssh and scp commands interfere with OpenSSH when installed in /usr/bin .

One use case is when installing dropbear to get root access when only OpenSSH is available (OpenSSH disallows root password logins). Once dropbear installs, it replaces OpenSSH's executables, even when removed with opkg. OpenSSH must be reinstalled to get them back.

v2: Fix paths.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 package/network/services/dropbear/Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Baptiste Jonglez Sept. 2, 2017, 6:47 a.m. UTC | #1
On 01-09-17, Rosen Penev wrote:
> ssh and scp commands interfere with OpenSSH when installed in /usr/bin .
> 
> One use case is when installing dropbear to get root access when only OpenSSH is available (OpenSSH disallows root password logins). Once dropbear installs, it replaces OpenSSH's executables, even when removed with opkg. OpenSSH must be reinstalled to get them back.

Wouldn't it be better to use Yousong's alternatives support in opkg?
Instead of moving paths around with no guarantee that they will stay
unique in the future...

> v2: Fix paths.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  package/network/services/dropbear/Makefile | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile
> index 7302db273c..2568b830a6 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:=3
> +PKG_RELEASE:=4
>  
>  PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
>  PKG_SOURCE_URL:= \
> @@ -126,10 +126,11 @@ 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)/bin
> +	$(LN) ../sbin/dropbear $(1)/bin/scp
> +	$(LN) ../sbin/dropbear $(1)/bin/ssh
>  	$(INSTALL_DIR) $(1)/etc/config
>  	$(INSTALL_DATA) ./files/dropbear.config $(1)/etc/config/dropbear
>  	$(INSTALL_DIR) $(1)/etc/init.d
Kevin Darbyshire-Bryant Sept. 2, 2017, 12:17 p.m. UTC | #2
On 02/09/17 02:39, Rosen Penev wrote:
> ssh and scp commands interfere with OpenSSH when installed in /usr/bin .
> 
> One use case is when installing dropbear to get root access when only OpenSSH is available (OpenSSH disallows root password logins). Once dropbear installs, it replaces OpenSSH's executables, even when removed with opkg. OpenSSH must be reinstalled to get them back.
> 
> v2: Fix paths.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>   package/network/services/dropbear/Makefile | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)

<snip>

>   	$(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)/bin
> +	$(LN) ../sbin/dropbear $(1)/bin/scp
> +	$(LN) ../sbin/dropbear $(1)/bin/ssh
>   	$(INSTALL_DIR) $(1)/etc/config

Unfortunately this still has issues, namely scp & ssh no longer work on 
the device and (in my tests) scp to the device also failed.  The 
symbolic links for /bin/scp & /bin/ssh point to '../sbin/dropbear' - 
dropbear is actually in '/usr/sbin/dropbear'.  The following appears to 
work, but could do with a lot more testing/checking.

+       $(LN) ../usr/sbin/dropbear $(1)/bin/scp
+       $(LN) ../usr/sbin/dropbear $(1)/bin/ssh


Cheers,

Kevin
diff mbox series

Patch

diff --git a/package/network/services/dropbear/Makefile b/package/network/services/dropbear/Makefile
index 7302db273c..2568b830a6 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:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:= \
@@ -126,10 +126,11 @@  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)/bin
+	$(LN) ../sbin/dropbear $(1)/bin/scp
+	$(LN) ../sbin/dropbear $(1)/bin/ssh
 	$(INSTALL_DIR) $(1)/etc/config
 	$(INSTALL_DATA) ./files/dropbear.config $(1)/etc/config/dropbear
 	$(INSTALL_DIR) $(1)/etc/init.d