noports icon indicating copy to clipboard operation
noports copied to clipboard

sshnp v5.0.x if connection drops can leave stty in odd state

Open cconstab opened this issue 1 year ago • 2 comments

Describe the bug

The stty settings are changed as the sshnp is run but if the session crashed or terminates it can leave the stty is a un sane state.

Steps to reproduce

  1. Connect to a machine using sshnp
  2. wait for a timeout or kill the process from another session perhaps
  3. not that commands do not have the <CR> character so things look odd
  4. connect to the machine again and the behavour persists
  5. run stty sane things look fine
  6. log off
  7. things of client are still odd
  8. run stty sane on client
  9. things back to normal

Expected behavior

everything remains sane !

Screenshots

cconstab@iotdevice01:~/sshnp$ Connection to localhost closed by remote host.
cconstab@tarial sshnp % 
cconstab@tarial sshnp % 
cconstab@tarial sshnp % 
cconstab@tarial sshnp % sshnp -f @cconstab -t @ssh_1 -h @rv_am  -d iot_device01 
2024-01-29 18:37:00.557853 : Resolving remote username for user session
                                                                       2024-01-29 18:37:01.469293 : Resolving remote username for tunnel session
          2024-01-29 18:37:01.469608 : Fetching host and port from srvd
                                                                       2024-01-29 18:37:04.984349 : Sending session request to the device daemon
          2024-01-29 18:37:05.741698 : Waiting for response from the device daemon
                                                                                  2024-01-29 18:37:07.262416 : Received response from the device daemon
                 2024-01-29 18:37:07.263310 : Creating connection to socket rendezvous
                                                                                      2024-01-29 18:37:07.342179 : Starting tunnel session
    2024-01-29 18:37:08.417122 : Starting user session
                                                      Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.0-92-generic x86_64)

                                                                                                                         * Documentation:  https://help.ubuntu.com
                             * Management:     https://landscape.canonical.com
                                                                               * Support:        https://ubuntu.com/advantage

                                                                                                                               System information as of Tue Jan 30 02:37:08 AM UTC 2024

                                                   System load:            0.0
                                                                                Usage of /:             43.7% of 31.32GB
                                                                                                                          Memory usage:           16%
                 Swap usage:             0%
                                             Processes:              124
                                                                          Users logged in:        1
                                                                                                     IPv4 address for ens18: 192.168.1.64
     IPv6 address for ens18: ::4467:a0ff:fe43:8788

                                                   * Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
                                                                                                                                  just raised the bar for easy, resilient and secure K8s cluster deployment.

                                                                         https://ubuntu.com/engage/secure-kubernetes-at-the-edge

                                                                                                                                Expanded Security Maintenance for Applications is not enabled.

                                                        51 updates can be applied immediately.
                                                                                              To see these additional updates run: apt list --upgradable

                  1 additional security update can be applied with ESM Apps.
                                                                            Learn more about enabling ESM Apps service at https://ubuntu.com/esm


          Last login: Tue Jan 30 02:37:09 2024 from 127.0.0.1
cconstab@iotdevice01:~$ 
cconstab@iotdevice01:~$ 
cconstab@iotdevice01:~$ 
cconstab@iotdevice01:~$ 
cconstab@iotdevice01:~$ ls
a.a             attalk  Colin-snippets   pnp         sshnp                sshnp.old.1  startlosant.sh
                                                                                                     at_nautel_snmp  AWS     dosshnoports.sh  psshd       sshnp-linux-x64.tgz  sshnp.tgz    ubuntu-22.04.2-live-server-amd64.iso
                                                                                          at_talk         bob     drop             sshnoports  sshnp.old            startaws.sh  ubuntu-22.04.2-live-server-amd64.iso1
                                                                                cconstab@iotdevice01:~$ stty sane
cconstab@iotdevice01:~$ 
cconstab@iotdevice01:~$ 
cconstab@iotdevice01:~$ 
cconstab@iotdevice01:~$ 
cconstab@iotdevice01:~$ ls
a.a             attalk  Colin-snippets   pnp         sshnp                sshnp.old.1  startlosant.sh
at_nautel_snmp  AWS     dosshnoports.sh  psshd       sshnp-linux-x64.tgz  sshnp.tgz    ubuntu-22.04.2-live-server-amd64.iso
at_talk         bob     drop             sshnoports  sshnp.old            startaws.sh  ubuntu-22.04.2-live-server-amd64.iso1
cconstab@iotdevice01:~$ 
cconstab@iotdevice01:~$ 
cconstab@iotdevice01:~$ 
cconstab@iotdevice01:~$ 
logout
cconstab@tarial sshnp % ls
LICENSE		at_activate	debug		headless	srv		sshnp		systemd
                                                                                                       README.md	config		docker		install.sh	srvd		sshnpd
                                                      %                                                                               cconstab@tarial sshnp % stty sane
cconstab@tarial sshnp % ls
LICENSE		at_activate	debug		headless	srv		sshnp		systemd
README.md	config		docker		install.sh	srvd		sshnpd
cconstab@tarial sshnp %

Smartphones

  • sshnp v5.0.1

Were you using an atApplication when the bug was found?

No response

Additional context

No response

cconstab avatar Jan 30 '24 02:01 cconstab

Is this resolved @cconstab ?

XavierChanth avatar Mar 17 '24 18:03 XavierChanth

Still get odd state.if sshnp looses connection

Looses Carraige Return at end of line

And have to type

'stty sane'

cconstab avatar Mar 17 '24 18:03 cconstab