asbru-cm/asbru-cm

the ssh connection breaks off: Received disconnect from ...

Closed this issue · 3 comments

liprox commented

HI,

asbru-cm Version:
dpkg -l | grep asbru
ii asbru-cm 6.4.0-1

one Client is a arch linux, another is debian bookworm, the remote host is debian 11 or 12 with the same behavior.

we use asbru-cm multi user moderately. Most connections, whether ssh or rdp, work without errors. But some ssh connections, do not work:
very very strange behavior: first the ssh connection is established immediately. But as soon as I enter a command, no matter which one, the connection breaks off.
EDIT: if I wait for 10 Seconds or more the same "connection breaks down" without one command ...

In the first block, a direct local ssh connection without asbru-cm is shown, which works without any problems and permanently.
these are the journal lines of the ssh target (remote) host:

14:35root@dc~# journalctl -f
Jul 10 14:35:14 dc systemd[600395]: Listening on gpg-agent-ssh.socket - GnuPG cryptographic agent (ssh-agent emulation).
Jul 10 14:35:14 dc systemd[600395]: Listening on gpg-agent.socket - GnuPG cryptographic agent and passphrase cache.
Jul 10 14:35:14 dc systemd[600395]: Listening on dbus.socket - D-Bus User Message Bus Socket.
Jul 10 14:35:14 dc systemd[600395]: Reached target sockets.target - Sockets.
Jul 10 14:35:14 dc systemd[600395]: Reached target basic.target - Basic System.
Jul 10 14:35:14 dc systemd[600395]: Reached target default.target - Main User Target.
Jul 10 14:35:14 dc systemd[600395]: Startup finished in 787ms.
Jul 10 14:35:14 dc systemd[1]: Started user@0.service - User Manager for UID 0.
Jul 10 14:35:14 dc systemd[1]: Started session-83.scope - Session 83 of User root.
Jul 10 14:35:14 dc sshd[600392]: pam_env(sshd:session): deprecated reading of user environment enabled
Jul 10 14:36:06 dc systemd[1]: Started check-mk-agent@4225-463-999.service - Checkmk agent (PID 463/UID 999).
Jul 10 14:36:07 dc systemd[1]: check-mk-agent@4225-463-999.service: Deactivated successfully.
Jul 10 14:36:10 dc sshd[600579]: Accepted password for root from 192.168.8.5 port 47920 ssh2
Jul 10 14:36:10 dc sshd[600579]: pam_unix(sshd:session): session opened for user root(uid=0) by (uid=0)
Jul 10 14:36:10 dc systemd-logind[482]: New session 85 of user root.
Jul 10 14:36:10 dc systemd[1]: Started session-85.scope - Session 85 of User root.
Jul 10 14:36:10 dc sshd[600579]: pam_env(sshd:session): deprecated reading of user environment enabled
Jul 10 14:36:52 dc sshd[600855]: Accepted password for root from 192.168.8.5 port 41496 ssh2
Jul 10 14:36:52 dc sshd[600855]: pam_unix(sshd:session): session opened for user root(uid=0) by (uid=0)

In the second block, a local ssh connection is displayed via asbru-cm, which breaks off with the following lines:

Jul 10 14:37:32 dc sshd[600855]: Received disconnect from 192.168..8.5 port 41496:11: disconnected by user
Jul 10 14:37:32 dc sshd[600855]: Disconnected from user root 192.168.8.5 port 41496

some more lines, journalctl with ssh over asbur-cm:

Jul 10 14:36:52 dc systemd-logind[482]: New session 86 of user root.
Jul 10 14:36:52 dc systemd[1]: Started session-86.scope - Session 86 of User root.
Jul 10 14:36:52 dc sshd[600855]: pam_env(sshd:session): deprecated reading of user environment enabled
Jul 10 14:37:05 dc systemd[1]: Started check-mk-agent@4226-463-999.service - Checkmk agent (PID 463/UID 999).
Jul 10 14:37:07 dc systemd[1]: check-mk-agent@4226-463-999.service: Deactivated successfully.
Jul 10 14:37:32 dc sshd[600855]: Received disconnect from 192.168..8.5 port 41496:11: disconnected by user
Jul 10 14:37:32 dc sshd[600855]: Disconnected from user root 192.168.8.5 port 41496
Jul 10 14:37:32 dc sshd[600855]: pam_unix(sshd:session): session closed for user root
Jul 10 14:37:32 dc systemd-logind[482]: Session 86 logged out. Waiting for processes to exit.
Jul 10 14:37:32 dc systemd[1]: session-86.scope: Deactivated successfully.
Jul 10 14:37:32 dc systemd-logind[482]: Removed session 86.

with these few hosts working via asbru-cm ssh session is not possible

what I've tried so far:
deleted the not working ssh connection and set up a new one - without success.
a functioning other ssh connection => copy&paste => then only change the IP address and access data - without success.

regards,
gerd

Did you activate the "Expect DEBUG" setting in Ásbrú (Preferences > Terminal Options > Advanced) to have more information on when (which step of the login process) it breaks ?

(if you share the output, be careful as it may contain senstive information).

liprox commented

Hy

here are some lines in debug mode

spawn id(11): Does `...5;11m\033[1mShell\033[0m\033[37m\033[0m:\033[38;5;9m /bin/bash 5.2.15\033[0m \r\n\033[30C\033[38;5;11m\033[1mResolution\033[0m\033[37m\033[0m:\033[38;5;9m 1280x800\033[0m \r\n\033[30'
match:
  pattern #2: -eof `'? No.
  pattern #3: -re `\\[__PAC__SUDO__PROMPT__\\]'? No.
  pattern #4: -re `^.+ontinue connecting \\(([^/]+)\\/([^/]+)(?:[^)]+)?\\)\\?\\s*$'? No.
  pattern #5: -re `.*(any key to continue|tecla para continuar).*'? No.
  pattern #6: -re `.*ffending .*key in (.+?)\\:(\\d+).*'? No.
  pattern #7: -re `([lL]ogin|[uU]suario|([uU]ser-?)*[nN]ame.*|[uU]ser)\\s*:\\s*$'? No.
  pattern #8: -re `([pP]ass|[pP]ass[wW]or[dt](\\s+for\\s+|\\w+@[\\w\\-\\.]+)*|[cC]ontrase.a|Enter passphrase for key \'.+\')\\s*:\\s*$'? No.
  pattern #9: -re `(([#%:>~\\$\\] ])(?!\\g{-1})){3,4}|(\\w[@\\/]\\w|sftp).*?[#%>~\\$\\]]|([\\w\\-\\.]+)[%>\\$\\]]( |\\033)|^[#%\\$>\\:\\]~] *$'? No.


spawn id(11): Does `...\033[0m\033[37m\033[0m:\033[38;5;9m /bin/bash 5.2.15\033[0m \r\n\033[30C\033[38;5;11m\033[1mResolution\033[0m\033[37m\033[0m:\033[38;5;9m 1280x800\033[0m \r\n\033[30C\033[38;5;11m\033[1mTerminal\033[0m\033[37m\033[0m:\033[38;5;9m /dev/pts/1\033[0m \r\n\033[30C\033[38;5;11m\033[1mCPU\033[0m\033[37m\033[0m:\033[38;5;9m Intel Xeon Silver 4114 (4) @ 2.199GHz\033[0m \r\n\033[30C\033[38;5;11m\033[1mGPU\033[0m\033[37m\033[0m:\033[38;5;9m 00:02.0 Vendor 1234 Device 1111\033[0m \r\n\033[30C\033[38;5;11m\033[1mMemory\033[0m\033[37m\033[0m:\033[38;5;9m 480MiB / 1966MiB\033[0m \r\n\r\n\033[30C\033[30m\033[40m   \033[31m\033[41m   \033[32m\033[42m   \033[33m\033[43m   \033[34m\033[44m   \033[35m\033[45m   \033[36m\033[46m   \033[37m\033[47m   \033[m\r\n\033[30C\033[38;5;8m\033[48;5;8m   \033[38;5;9m\033[48;5;9m   \033[38;5;10m\033[48;5;10m   \033[38;5;11m\033[48;5;11m   \033[38;5;12m\033[48;5;12m   \033[38;5;13m\033[48;5;13m   \033[38;5;14m\033[48;5;14m   \033[38;5;15m\033[48;5;15m   \033[m\r\n\r\n\r\n\033[?25h\033[?7h'
match:
  pattern #2: -eof `'? No.
  pattern #3: -re `\\[__PAC__SUDO__PROMPT__\\]'? No.
  pattern #4: -re `^.+ontinue connecting \\(([^/]+)\\/([^/]+)(?:[^)]+)?\\)\\?\\s*$'? No.
  pattern #5: -re `.*(any key to continue|tecla para continuar).*'? No.
  pattern #6: -re `.*ffending .*key in (.+?)\\:(\\d+).*'? No.
  pattern #7: -re `([lL]ogin|[uU]suario|([uU]ser-?)*[nN]ame.*|[uU]ser)\\s*:\\s*$'? No.
  pattern #8: -re `([pP]ass|[pP]ass[wW]or[dt](\\s+for\\s+|\\w+@[\\w\\-\\.]+)*|[cC]ontrase.a|Enter passphrase for key \'.+\')\\s*:\\s*$'? No.
  pattern #9: -re `(([#%:>~\\$\\] ])(?!\\g{-1})){3,4}|(\\w[@\\/]\\w|sftp).*?[#%>~\\$\\]]|([\\w\\-\\.]+)[%>\\$\\]]( |\\033)|^[#%\\$>\\:\\]~] *$'? No.

### =>  without debug mode on this promt you believe, the session is connected, but ...:

14:44root@dc~# 
spawn id(11): Does `...[38;5;11m\033[1mResolution\033[0m\033[37m\033[0m:\033[38;5;9m 1280x800\033[0m \r\n\033[30C\033[38;5;11m\033[1mTerminal\033[0m\033[37m\033[0m:\033[38;5;9m /dev/pts/1\033[0m \r\n\033[30C\033[38;5;11m\033[1mCPU\033[0m\033[37m\033[0m:\033[38;5;9m Intel Xeon Silver 4114 (4) @ 2.199GHz\033[0m \r\n\033[30C\033[38;5;11m\033[1mGPU\033[0m\033[37m\033[0m:\033[38;5;9m 00:02.0 Vendor 1234 Device 1111\033[0m \r\n\033[30C\033[38;5;11m\033[1mMemory\033[0m\033[37m\033[0m:\033[38;5;9m 480MiB / 1966MiB\033[0m \r\n\r\n\033[30C\033[30m\033[40m   \033[31m\033[41m   \033[32m\033[42m   \033[33m\033[43m   \033[34m\033[44m   \033[35m\033[45m   \033[36m\033[46m   \033[37m\033[47m   \033[m\r\n\033[30C\033[38;5;8m\033[48;5;8m   \033[38;5;9m\033[48;5;9m   \033[38;5;10m\033[48;5;10m   \033[38;5;11m\033[48;5;11m   \033[38;5;12m\033[48;5;12m   \033[38;5;13m\033[48;5;13m   \033[38;5;14m\033[48;5;14m   \033[38;5;15m\033[48;5;15m   \033[m\r\n\r\n\r\n\033[?25h\033[?7h\033[?2004h\033[1;33m14:44\033[0;31mroot@\033[1;36mdc\033[0;33m~\033[1;32m# '
match:
  pattern #2: -eof `'? No.
  pattern #3: -re `\\[__PAC__SUDO__PROMPT__\\]'? No.
  pattern #4: -re `^.+ontinue connecting \\(([^/]+)\\/([^/]+)(?:[^)]+)?\\)\\?\\s*$'? No.
  pattern #5: -re `.*(any key to continue|tecla para continuar).*'? No.
  pattern #6: -re `.*ffending .*key in (.+?)\\:(\\d+).*'? No.
  pattern #7: -re `([lL]ogin|[uU]suario|([uU]ser-?)*[nN]ame.*|[uU]ser)\\s*:\\s*$'? No.
  pattern #8: -re `([pP]ass|[pP]ass[wW]or[dt](\\s+for\\s+|\\w+@[\\w\\-\\.]+)*|[cC]ontrase.a|Enter passphrase for key \'.+\')\\s*:\\s*$'? No.
  pattern #9: -re `(([#%:>~\\$\\] ])(?!\\g{-1})){3,4}|(\\w[@\\/]\\w|sftp).*?[#%>~\\$\\]]|([\\w\\-\\.]+)[%>\\$\\]]( |\\033)|^[#%\\$>\\:\\]~] *$'? No.

### => aboud 10 Seconds wait, than close the not connected session with the following:
  
[asbru_conn(93894)][dc][dc - example.de]: CLOSE:TIMEOUT:40 seconds trying to connect or get prompt!!
[asbru_conn(93894)][dc][dc - example.de]: DISCONNECTED:1:TIMEOUT
[asbru_conn(93894)][dc][dc - example.de]: DISCONNECTED

DISCONNECTED (PRESS <ENTER> TO RECONNECT) (Thu Jul 20 14:45:02 2023) 

EDIT:
on last weekend again: I copy&past one old good working ssh connection in asbru-cm, renaming, changing the IP and Login Data, nothing elese. And the result is now one of the "breaking bad" connections ... Hmmm?
If i chang to command line, KDE Konsole, the same ssh connection is working well, as expected

we actually have a complex level of network configuration here, with VLANs and extensive firewall rules. Nevertheless, it makes no sense to me that Asbru-cm is on strike while the command line is working.
Or does asbru-cm need additional configuration regarding network, VLAN and firewall in this case?

regards

this issue is solved.
a big thank you goes to gfrenoy!

the reason was very individual. our self made used terminal options:

root@dc~# cat .bashrc | grep PS1
PS1='\[\033[1;33m\]\A\[\033[0;31m\]\u@\[\033[1;36m\]\h\[\033[0;33m\]\w\[\033[1;32m\]# '

end with one space. This Line, the ending space, was not suitable with the default:
Preferences - Local-Shell-Option - Look-and-Feel - "Promt RegExp"

Now we use (only in few ssh connections) the individual one:
Edit Connection - Terminal Option - +Use-these-personal-options - Promt RegExp:
[#%\$>~→]|\:\/\s*$
regards,
gerd