Re: [OpenWrt-Devel] [PATCH] dropbear: close all active clients on shutdown

2018-07-12 Thread John Crispin



On 12/07/18 18:18, Luis Araneda wrote:

Hi John,

On Thu, Jul 12, 2018 at 2:49 AM John Crispin  wrote:

does this break sysupgrade when run via ssh ?

No, it works as expected, as sysupgrade is done in stages now.

I just tested with an Asus RT-AC58U connected with a serial console
and an SSH connection.

The sysupgrade was done though the SSH connection:

root@OpenWrt:~# sysupgrade 
/tmp/openwrt-ipq40xx-asus_rt-ac58u-squashfs-sysupgrade.bin
Saving config files...
Commencing upgrade. Closing all shell sessions.
Connection to 192.168.1.1 closed by remote host.
Connection to 192.168.1.1 closed.

The output from the serial console confirms that the sysupgrade was
done correctly:

Watchdog handover: fd=3
- watchdog -
killall: telnetd: no process killed
Sending TERM to remaining processes ... uhttpd nlbwmon ubusd collectd dnsmasq 
hostapd hostapd ntpd logd rpcd netifd oe
Sending KILL to remaining processes ...
Switching to ramdisk...
Performing system upgrade...

(removed some lines no improve readability)

Thanks,

Luis Araneda.


Hi Luis,
thanks for the elaborate test report
    John

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] dropbear: close all active clients on shutdown

2018-07-12 Thread Luis Araneda
Hi John,

On Thu, Jul 12, 2018 at 2:49 AM John Crispin  wrote:
> does this break sysupgrade when run via ssh ?

No, it works as expected, as sysupgrade is done in stages now.

I just tested with an Asus RT-AC58U connected with a serial console
and an SSH connection.

The sysupgrade was done though the SSH connection:
> root@OpenWrt:~# sysupgrade 
> /tmp/openwrt-ipq40xx-asus_rt-ac58u-squashfs-sysupgrade.bin
> Saving config files...
> Commencing upgrade. Closing all shell sessions.
> Connection to 192.168.1.1 closed by remote host.
> Connection to 192.168.1.1 closed.

The output from the serial console confirms that the sysupgrade was
done correctly:
> Watchdog handover: fd=3
> - watchdog -
> killall: telnetd: no process killed
> Sending TERM to remaining processes ... uhttpd nlbwmon ubusd collectd dnsmasq 
> hostapd hostapd ntpd logd rpcd netifd oe
> Sending KILL to remaining processes ...
> Switching to ramdisk...
> Performing system upgrade...
(removed some lines no improve readability)

Thanks,

Luis Araneda.

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH] dropbear: close all active clients on shutdown

2018-07-12 Thread John Crispin



On 12/07/18 04:36, Luis Araneda wrote:

From: Christian Schoenebeck 

Override the default shutdown action (stop) and close all processes
of dropbear

Since commit 498fe85, the stop action only closes the process
that's listening for new connections, maintaining the ones with
existing clients.
This poses a problem when restarting or shutting-down a device,
because the connections with existing SSH clients, like OpenSSH,
are not properly closed, causing them to hang.

This situation can be avoided by closing all dropbear processes when
shutting-down the system, which closes properly the connections with
current clients.


does this break sysupgrade when run via ssh ?
    John


Signed-off-by: Christian Schoenebeck 
[Luis: Rework commit message]
Signed-off-by: Luis Araneda 
---
  package/network/services/dropbear/files/dropbear.init | 5 +
  1 file changed, 5 insertions(+)

diff --git a/package/network/services/dropbear/files/dropbear.init 
b/package/network/services/dropbear/files/dropbear.init
index 2225113498..b86e52d8bc 100755
--- a/package/network/services/dropbear/files/dropbear.init
+++ b/package/network/services/dropbear/files/dropbear.init
@@ -148,6 +148,11 @@ service_triggers()
procd_add_validation validate_section_dropbear
  }
  
+shutdown() {

+   # close all open connections
+   killall dropbear
+}
+
  killclients()
  {
local ignore=''



___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] dropbear: close all active clients on shutdown

2018-07-11 Thread Luis Araneda
From: Christian Schoenebeck 

Override the default shutdown action (stop) and close all processes
of dropbear

Since commit 498fe85, the stop action only closes the process
that's listening for new connections, maintaining the ones with
existing clients.
This poses a problem when restarting or shutting-down a device,
because the connections with existing SSH clients, like OpenSSH,
are not properly closed, causing them to hang.

This situation can be avoided by closing all dropbear processes when
shutting-down the system, which closes properly the connections with
current clients.

Signed-off-by: Christian Schoenebeck 
[Luis: Rework commit message]
Signed-off-by: Luis Araneda 
---
 package/network/services/dropbear/files/dropbear.init | 5 +
 1 file changed, 5 insertions(+)

diff --git a/package/network/services/dropbear/files/dropbear.init 
b/package/network/services/dropbear/files/dropbear.init
index 2225113498..b86e52d8bc 100755
--- a/package/network/services/dropbear/files/dropbear.init
+++ b/package/network/services/dropbear/files/dropbear.init
@@ -148,6 +148,11 @@ service_triggers()
procd_add_validation validate_section_dropbear
 }
 
+shutdown() {
+   # close all open connections
+   killall dropbear
+}
+
 killclients()
 {
local ignore=''
-- 
2.18.0


___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel