Bug 3187 - 'unknown error' reported on local network if internet not available
Summary: 'unknown error' reported on local network if internet not available
Status: CLOSED WORKSFORME
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 8.3p1
Hardware: 68k Mac OS X
: P5 normal
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-06-26 03:46 AEST by Craig James
Modified: 2021-04-23 14:58 AEST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Craig James 2020-06-26 03:46:27 AEST
I'm running a VirtualBox on a Mac (Catalina) which listens on 192.168.77.6. Normally "ssh user@192.168.77.6" works. "ssh user@host.domain.com" also works, where "host.domain.com" is defined in /etc/hosts as 192.168.77.6. Now turn off WiFi so there's no internet connectivity. The first command, "ssh user@192.168.77.6" still works. But "ssh user@host.domain.com" fails with the message "ssh: connect to host hostname.domain.com port 22: Undefined error: 0". If I then turn on networking via BlueTooth through an iPhone (172.20.10.5), ssh works again. It feels like a DNS problem: DNS fails, and rather than continuing to use /etc/hosts, it just gives an error. This makes it impossible to use ssh for local networks when the Mac has no internet available.
Comment 1 Damien Miller 2020-06-26 13:09:29 AEST
Please capture the debugging output of a failing ssh execution and attach it to this bug. You can run "ssh -vvv user@host"
Comment 2 Craig James 2020-06-26 23:56:06 AEST
 $ ssh -vvv user@host.domain.com
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/cjames/.ssh/config
debug1: /Users/cjames/.ssh/config line 46: Applying options for host.domain.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to host.domain.com port 22.
ssh: connect to host host.domain.com port 22: Undefined error: 0
Comment 3 Damien Miller 2020-07-17 14:23:13 AEST
I can't replicate this with OpenSSH 8.2 or HEAD. It looks like you have some configuration in ~/ssh/config that might be relevant - what is in there?
Comment 4 Craig James 2020-07-23 01:57:42 AEST
The relevant entry from my ~/.ssh/config file is:

Host v-application.emolecules.com
  User emi
  IdentityFile ~/.ssh/vagrant

The file ~/.ssh/vagrant is an RSA private key file.

The host "v-application.emolecules.com" is defined in my Macintosh /etc/hosts file as:

$ grep v-application.emolecules.com /etc/hosts
192.168.77.6  v-application.emolecules.com

Hope that helps.
Comment 5 Damien Miller 2020-07-24 13:17:04 AEST
I can't replicate this using OpenSSH 8.3p1 on my available Mac hardware:

Darwin djm-mba 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64

However I don't see anything that could have caused this bug to be fixed between 8.1 and 8.3p1. Are you using the OpenSSH that Apple ships or one you've compiled yourself? (manually or via macports/brew etc)

If you are using the Apple version, I suggest trying to reproduce the problem using a locally built OpenSSH to exclude any modifications they may have made.

Otherwise, I recommend capturing a syscall trace from ssh to see where it is going wrong. See https://stackoverflow.com/questions/31045575/how-to-trace-system-calls-of-a-program-in-mac-os-x for some hints here
Comment 6 Damien Miller 2020-11-27 13:34:45 AEDT
I'm not able to reproduce this. Please reopen if you can reproduce this using stock OpenSSH built from source.
Comment 7 Damien Miller 2021-04-23 14:58:13 AEST
closing resolved bugs as of 8.6p1 release