Keep `Abnormal Disconnect` and reconnect frequently

core-shell

(Hobai Riku) #1

i use core shell 1.4.8 , recently i found that all my host will continually Abnormal Disconnect
automatically like this:


which is very annoying, it keep interrupting my operation. I don't know why this happens, my host is fine in termius or my local terminal, please help.


(Yang.Y) #2

Please try again with ServerAliveCountMax and ServerAliveInterval cleared:

image


(Hobai Riku) #3

It works, thanks!:grin: but is this a bug or something in my network environment produces this ?


(Hobai Riku) #4

un...It stiil happens, but it will last longer.:disappointed_relieved:


(Yang.Y) #5

That's sad, could you please check the log file /var/log/auth.log on your host? Ubuntu sshd service prints log in that file if you didn't change the log location.

The log file can reveal some clues, and it would be helpful if you can paste the /etc/ssh/sshd_config file content of the host.


(Hobai Riku) #6

this is the log:

Jan 31 17:30:01 reachnn CRON[13516]: pam_unix(cron:session): session opened for user root by (uid=0)
Jan 31 17:30:01 reachnn CRON[13515]: pam_unix(cron:session): session opened for user root by (uid=0)
Jan 31 17:30:01 reachnn CRON[13515]: pam_unix(cron:session): session closed for user root
Jan 31 17:30:02 reachnn CRON[13516]: pam_unix(cron:session): session closed for user root
Jan 31 17:30:28 reachnn sshd[13157]: pam_unix(sshd:session): session closed for user root
Jan 31 17:30:31 reachnn sshd[13595]: Accepted publickey for root from 192.168.16.51 port 63148 ssh2: RSA SHA256:1aNsfMJrbM0LT7Xip4nWdz7I2GJCe7M0UNBFEBi9nUA
Jan 31 17:30:31 reachnn sshd[13595]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jan 31 17:30:33 reachnn sshd[13303]: pam_unix(sshd:session): session closed for user root
Jan 31 17:30:36 reachnn sshd[13743]: Accepted publickey for root from 192.168.16.51 port 63149 ssh2: RSA SHA256:1aNsfMJrbM0LT7Xip4nWdz7I2GJCe7M0UNBFEBi9nUA
Jan 31 17:30:36 reachnn sshd[13743]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jan 31 17:30:50 reachnn sshd[13595]: pam_unix(sshd:session): session closed for user root
Jan 31 17:30:52 reachnn sshd[13743]: pam_unix(sshd:session): session closed for user root
Jan 31 17:30:54 reachnn sshd[13925]: Accepted publickey for root from 192.168.16.51 port 63158 ssh2: RSA SHA256:1aNsfMJrbM0LT7Xip4nWdz7I2GJCe7M0UNBFEBi9nUA
Jan 31 17:30:54 reachnn sshd[13925]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jan 31 17:30:56 reachnn sshd[14066]: Accepted publickey for root from 192.168.16.51 port 63159 ssh2: RSA SHA256:1aNsfMJrbM0LT7Xip4nWdz7I2GJCe7M0UNBFEBi9nUA
Jan 31 17:30:56 reachnn sshd[14066]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jan 31 17:31:01 reachnn CRON[14213]: pam_unix(cron:session): session opened for user root by (uid=0)
Jan 31 17:31:01 reachnn CRON[14213]: pam_unix(cron:session): session closed for user root
Jan 31 17:31:08 reachnn sshd[13925]: pam_unix(sshd:session): session closed for user root
Jan 31 17:31:12 reachnn sshd[14241]: Accepted publickey for root from 192.168.16.51 port 63166 ssh2: RSA SHA256:1aNsfMJrbM0LT7Xip4nWdz7I2GJCe7M0UNBFEBi9nUA
Jan 31 17:31:12 reachnn sshd[14241]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jan 31 17:31:14 reachnn sshd[14066]: pam_unix(sshd:session): session closed for user root
Jan 31 17:31:18 reachnn sshd[14397]: Accepted publickey for root from 192.168.16.51 port 63167 ssh2: RSA SHA256:1aNsfMJrbM0LT7Xip4nWdz7I2GJCe7M0UNBFEBi9nUA
Jan 31 17:31:18 reachnn sshd[14397]: pam_unix(sshd:session): session opened for user root by (uid=0)
Jan 31 17:31:25 reachnn sshd[14241]: pam_unix(sshd:session): session closed for user root
Jan 31 17:31:29 reachnn sshd[14566]: Accepted publickey for root from 192.168.16.51 port 63171 ssh2: RSA SHA256:1aNsfMJrbM0LT7Xip4nWdz7I2GJCe7M0UNBFEBi9nUA
Jan 31 17:31:29 reachnn sshd[14566]: pam_unix(sshd:session): session opened for user root by (uid=0)

and the config file:

# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 1024

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
#PermitRootLogin prohibit-password
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile     %h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes

(Yang.Y) #7

Nothing special in your log and config file. Could you please execute the "Equivalent Command" in system Terminal.app and see if everything works? And, could you please also paste the /etc/ssh/ssh_config file content on your Mac?


(Hobai Riku) #8

this is cmd on core shell and terminal.app:

on core shell, connection will disconnect, but terminal not.
my ssh config:

#	$OpenBSD: ssh_config,v 1.33 2017/05/07 23:12:57 djm Exp $

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

# Host *
#   ForwardAgent no
#   ForwardX11 no
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   IdentityFile ~/.ssh/id_ecdsa
#   IdentityFile ~/.ssh/id_ed25519
#   Port 22
#   Protocol 2
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   RekeyLimit 1G 1h

Host *
	SendEnv LANG LC_*

(Yang.Y) #9

Weird issue, could you please open Console.app, looking for keyword "coressh" and then connect to your host again? Console.app should print some log items about Core Shell.

image


(Hobai Riku) #10

this is the log for connecting:


there are some error log, should i paste more about it?


(Yang.Y) #11

That's the problem:

Thanks a million for the clue, I'll try to find out the solution. Before we solve this issue, please install Core Helper:

And set to use system config file:

If the problem persists, please reboot your Mac and try again.


(Hobai Riku) #12

My pleasure to help, i will try Core Helper, thank :ok_hand:


(Yang.Y) #13

The issue is fixed in version 1.4.9 – a hot-fix release is now available for upgrade on Mac App Store.

macOS always tries to terminate idle background services when it's under memory pressure, as the Core Shell's openssh service listening for network data, the system mistakenly considers it's in idle.

The solution is simple, just tell the system "I'm waiting for more remote data, not here idling at all, please don't kill me".

@HobaiRiku Thank you again for all your help :slight_smile:


Keeps disconnecting and reconnecting when starting reverse ssh tunnel (intermittent)
(Hobai Riku) #14

You are wellcome, and YES!, when I'm home and my MBP has not so much IDE and Parallels Desktop opened, this bug will not show up obviously, but anyway, it is wonderful to find out and fixed so soon, you are really good at this.
Hope Core Shell is getting better n better, and happy new year!


(Yang.Y) #15

I wish the same to you :sparkler:


(Ghufran Syed) #16

This was driving me nuts - I guess I should have got in touch sooner! Great job on fixing this so quick!


(Ghufran Syed) #17

Hmm, I downloaded and re-installed core helper, and it seemed to have fixed the problem, but then it came back :frowning:
I currently have 1.4.5, but when I go to the app store , it shows the new update 1.4.9, but doesn't give me an option to update Core Tunnel, just a button to "open".

Do you guys have any alternative method of download? Or any way to force an update via mac app store?


(Hobai Riku) #18

@ghufransyed delete and reinstall


(Ghufran Syed) #19

Thanks, just did that - I now have version 1.4.9, but still having same problem. May be my setup is incorrect, it only does it for my reverse tunnel, not for the other tunnels. But it's intermittent, which sounds like the problem you had. @yang, should I post the logs here, email them or start a new post?


(Yang.Y) #20

It may not the same problem, please make a new post and post the logs and a screenshot of Console.app:

image