Package: tinysshd
Version: 20190101-1
Severity: normal

This has annoyed me for a while, but I only just today realized it was an 
actual bug and not simply a missing feature.
I had to use "screen" to run two SSH clients at once.  I tried using "ssh -f" 
and could not reproduce the problem.
I am using "-F /dev/null" to disable my ~/.ssh/config.

I have ControlMaster enabled by default on all my SSH connections with
this at the bottom of my .ssh/config:

    Host *
      ControlMaster auto
      ControlPath ~/.ssh/master-%C
      ControlPersist 3600

If you do this (like me), a quick workaround that avoids this bug is to simply 
do
"ssh -M tinyssh-host" instead of
"ssh tinyssh-host".
This effectively disables ControlMaster for that one connection.


This issue is not discussed in upstream's issue tracker:
    https://github.com/janmojzis/tinyssh/issues

I have not yet tested a newer upstream version (currently available in
salsa, but not in sid or experimental yet).



Here is a transcript of me reproducing the problem.  I am connecting
to a basic Debian 11 Live VM running in qemu, with its port 22
forwarded to localhost 2022.

    bash5$ ssh -F/dev/null -oUserKnownHostsFile=/dev/null 
-oStrictHostKeyChecking=no root@localhost -p2022 systemctl status 
system-tinysshd.slice
    Warning: Permanently added '[localhost]:2022' (ED25519) to the list of 
known hosts.
    ● system-tinysshd.slice
         Loaded: loaded
         Active: active since Mon 2021-09-27 14:40:45 AEST; 198ms ago
          Tasks: 2
         Memory: 3.8M
            CPU: 178ms
         CGroup: /system.slice/system-tinysshd.slice
                 └─tinysshd@0-10.0.2.15:22-10.0.2.2:38146.service
                   ├─405 /usr/sbin/tinysshd -v -- /etc/tinyssh/sshkeydir
                   └─408 systemctl status system-tinysshd.slice

    Sep 27 14:40:45 main.lan systemd[1]: Created slice system-tinysshd.slice.
    Sep 27 14:40:46 main.lan tinysshd[405]: tinysshd: BIFzIJ9B: info: 
connection from 10.0.2.2:38146 {main_tinysshd.c:106}
    Sep 27 14:40:46 main.lan tinysshd[405]: tinysshd: BIFzIJ9B: info: auth: 
root: ssh-ed25519 
AAAAC3NzaC1lZDI1NTE5AAAAIIapAZ0E0353DaY6xBnasvu/DOvdWdKQ6RQURwq4l6Wu accepted 
{packet_auth.c:155}

    # Run two ssh clients at once, sharing a control master.
    # When the second one starts, tinysshd crashes, so the first one hangs up.
    bash5$ screen ssh -F/dev/null -oUserKnownHostsFile=/dev/null 
-oStrictHostKeyChecking=no root@localhost -p2022 -oControlMaster=auto 
-oControlPath=~/.ssh/master-%C -oControlPersist=3600
    bash5$ screen ssh -F/dev/null -oUserKnownHostsFile=/dev/null 
-oStrictHostKeyChecking=no root@localhost -p2022 -oControlMaster=auto 
-oControlPath=~/.ssh/master-%C -oControlPersist=3600


    # Examining the system after the problem happened.
    bash5$ ssh -F/dev/null -oUserKnownHostsFile=/dev/null 
-oStrictHostKeyChecking=no root@localhost -p2022 systemctl status 
system-tinysshd.slice
    Warning: Permanently added '[localhost]:2022' (ED25519) to the list of 
known hosts.
    ● system-tinysshd.slice
         Loaded: loaded
         Active: active since Mon 2021-09-27 14:40:45 AEST; 14s ago
          Tasks: 4
         Memory: 6.9M
            CPU: 429ms
         CGroup: /system.slice/system-tinysshd.slice
                 ├─tinysshd@2-10.0.2.15:22-10.0.2.2:38154.service
                 │ ├─423 /usr/sbin/tinysshd -v -- /etc/tinyssh/sshkeydir
                 │ └─426 -bash
                 └─tinysshd@3-10.0.2.15:22-10.0.2.2:38158.service
                   ├─433 /usr/sbin/tinysshd -v -- /etc/tinyssh/sshkeydir
                   └─436 systemctl status system-tinysshd.slice

    Sep 27 14:40:46 main.lan tinysshd[405]: tinysshd: BIFzIJ9B: info: 
connection from 10.0.2.2:38146 {main_tinysshd.c:106}
    Sep 27 14:40:46 main.lan tinysshd[405]: tinysshd: BIFzIJ9B: info: auth: 
root: ssh-ed25519 
AAAAC3NzaC1lZDI1NTE5AAAAIIapAZ0E0353DaY6xBnasvu/DOvdWdKQ6RQURwq4l6Wu accepted 
{packet_auth.c:155}
    Sep 27 14:40:46 main.lan tinysshd[405]: tinysshd: BIFzIJ9B: info: finished 
{main_tinysshd.c:287}
    Sep 27 14:40:55 main.lan tinysshd[412]: tinysshd: W19qgD40: info: 
connection from 10.0.2.2:38150 {main_tinysshd.c:106}
    Sep 27 14:40:55 main.lan tinysshd[412]: tinysshd: W19qgD40: info: auth: 
root: ssh-ed25519 
AAAAC3NzaC1lZDI1NTE5AAAAIIapAZ0E0353DaY6xBnasvu/DOvdWdKQ6RQURwq4l6Wu accepted 
{packet_auth.c:155}
    Sep 27 14:40:57 main.lan tinysshd[412]: tinysshd: W19qgD40: BUG:  (protocol 
error){channel.c:57}
    Sep 27 14:40:57 main.lan tinysshd[423]: tinysshd: j6vr2uNR: info: 
connection from 10.0.2.2:38154 {main_tinysshd.c:106}
    Sep 27 14:40:57 main.lan tinysshd[423]: tinysshd: j6vr2uNR: info: auth: 
root: ssh-ed25519 
AAAAC3NzaC1lZDI1NTE5AAAAIIapAZ0E0353DaY6xBnasvu/DOvdWdKQ6RQURwq4l6Wu accepted 
{packet_auth.c:155}
    Sep 27 14:40:59 main.lan tinysshd[433]: tinysshd: CGtApdsN: info: 
connection from 10.0.2.2:38158 {main_tinysshd.c:106}
    Sep 27 14:40:59 main.lan tinysshd[433]: tinysshd: CGtApdsN: info: auth: 
root: ssh-ed25519 
AAAAC3NzaC1lZDI1NTE5AAAAIIapAZ0E0353DaY6xBnasvu/DOvdWdKQ6RQURwq4l6Wu accepted 
{packet_auth.c:155}


    bash5$ ssh -F/dev/null -oUserKnownHostsFile=/dev/null 
-oStrictHostKeyChecking=no root@localhost -p2022 systemctl --state=failed
    Warning: Permanently added '[localhost]:2022' (ED25519) to the list of 
known hosts.
      UNIT                                           LOAD   ACTIVE SUB    
DESCRIPTION
    ● tinysshd@1-10.0.2.15:22-10.0.2.2:38150.service loaded failed failed Tiny 
SSH server (10.0.2.2:38150)

    LOAD   = Reflects whether the unit definition was properly loaded.
    ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
    SUB    = The low-level unit activation state, values depend on unit type.
    1 loaded units listed.


    bash5$ ssh -F/dev/null -oUserKnownHostsFile=/dev/null 
-oStrictHostKeyChecking=no root@localhost -p2022 journalctl -u 
tinysshd@1-10.0.2.15:22-10.0.2.2:38150.service
    Warning: Permanently added '[localhost]:2022' (ED25519) to the list of 
known hosts.
    -- Journal begins at Mon 2021-09-27 14:40:36 AEST, ends at Mon 2021-09-27 
14:41:55 AEST. --
    Sep 27 14:40:55 main.lan systemd[1]: Starting Tiny SSH server 
(10.0.2.2:38150)...
    Sep 27 14:40:55 main.lan systemd[1]: Started Tiny SSH server 
(10.0.2.2:38150).
    Sep 27 14:40:55 main.lan tinysshd[412]: tinysshd: W19qgD40: info: 
connection from 10.0.2.2:38150 {main_tinysshd.c:106}
    Sep 27 14:40:55 main.lan tinysshd[412]: tinysshd: W19qgD40: info: auth: 
root: ssh-ed25519 
AAAAC3NzaC1lZDI1NTE5AAAAIIapAZ0E0353DaY6xBnasvu/DOvdWdKQ6RQURwq4l6Wu accepted 
{packet_auth.c:155}
    Sep 27 14:40:57 main.lan tinysshd[412]: tinysshd: W19qgD40: BUG:  (protocol 
error){channel.c:57}
    Sep 27 14:40:57 main.lan systemd[1]: 
tinysshd@1-10.0.2.15:22-10.0.2.2:38150.service: Main process exited, 
code=exited, status=111/n/a
    Sep 27 14:40:57 main.lan systemd[1]: 
tinysshd@1-10.0.2.15:22-10.0.2.2:38150.service: Failed with result 'exit-code'.
    Sep 27 14:40:57 main.lan systemd[1]: 
tinysshd@1-10.0.2.15:22-10.0.2.2:38150.service: Unit process 415 (bash) remains 
running after unit stopped.

    # Showing what versions of stuff I'm running.
    bash5$ ssh -F/dev/null -oUserKnownHostsFile=/dev/null 
-oStrictHostKeyChecking=no root@localhost -p2022 dpkg-query -W base-files 
tinysshd linux-image-cloud-amd64
    Warning: Permanently added '[localhost]:2022' (ED25519) to the list of 
known hosts.
    base-files  11.1
    linux-image-cloud-amd64     5.10.46-5
    tinysshd    20190101-1

Reply via email to