Open startergo opened 6 months ago
So, the same setup works for macOS El Capitan
and the server supports:
nmap --script ssh2-enum-algos -sV -p 22 192.168.45.131
Starting Nmap 7.95 ( https://nmap.org ) at 2024-05-24 09:46 EDT
Nmap scan report for 192.168.45.131
Host is up (1.3s latency).
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 6.9 (protocol 2.0)
| ssh2-enum-algos:
| kex_algorithms: (6)
| curve25519-sha256@libssh.org
| ecdh-sha2-nistp256
| ecdh-sha2-nistp384
| ecdh-sha2-nistp521
| diffie-hellman-group-exchange-sha256
| diffie-hellman-group14-sha1
| server_host_key_algorithms: (4)
| ssh-rsa
| ssh-dss
| ecdsa-sha2-nistp256
| ssh-ed25519
| encryption_algorithms: (6)
| chacha20-poly1305@openssh.com
| aes128-ctr
| aes192-ctr
| aes256-ctr
| aes128-gcm@openssh.com
| aes256-gcm@openssh.com
| mac_algorithms: (10)
| umac-64-etm@openssh.com
| umac-128-etm@openssh.com
| hmac-sha2-256-etm@openssh.com
| hmac-sha2-512-etm@openssh.com
| hmac-sha1-etm@openssh.com
| umac-64@openssh.com
| umac-128@openssh.com
| hmac-sha2-256
| hmac-sha2-512
| hmac-sha1
| compression_algorithms: (2)
| none
|_ zlib@openssh.com
Server configuration EC:
vagrant$ sudo sshd -T
port 22
protocol 2
addressfamily any
listenaddress [::]:22
listenaddress 0.0.0.0:22
usepam yes
serverkeybits 1024
logingracetime 120
keyregenerationinterval 3600
x11displayoffset 10
maxauthtries 6
maxsessions 10
clientaliveinterval 0
clientalivecountmax 3
streamlocalbindmask 0177
permitrootlogin yes
ignorerhosts yes
ignoreuserknownhosts no
rhostsrsaauthentication no
hostbasedauthentication no
hostbasedusesnamefrompacketonly no
rsaauthentication yes
pubkeyauthentication yes
kerberosauthentication no
kerberosorlocalpasswd yes
kerberosticketcleanup yes
gssapiauthentication no
gssapikeyexchange no
gssapicleanupcredentials yes
gssapistrictacceptorcheck no
gssapistorecredentialsonrekey no
passwordauthentication no
kbdinteractiveauthentication yes
challengeresponseauthentication yes
printmotd yes
printlastlog yes
x11forwarding no
x11uselocalhost yes
permittty yes
permituserrc yes
strictmodes yes
tcpkeepalive yes
permitemptypasswords no
permituserenvironment no
uselogin no
compression delayed
gatewayports no
usedns no
allowtcpforwarding yes
allowagentforwarding yes
allowstreamlocalforwarding yes
useprivilegeseparation sandbox
fingerprinthash SHA256
pidfile /var/run/sshd.pid
xauthlocation xauth
ciphers chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com
macs umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
versionaddendum none
kexalgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
hostbasedacceptedkeytypes *
pubkeyacceptedkeytypes *
loglevel INFO
syslogfacility AUTHPRIV
authorizedkeysfile .ssh/authorized_keys
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
acceptenv LANG
acceptenv LC_*
subsystem sftp /usr/libexec/sftp-server
maxstartups 10:30:100
permittunnel no
ipqos lowdelay throughput
rekeylimit 0 0
permitopen any
And I can SSH to the machine as designed:
Located networkmapper configuration file using Fusion6: /Library/Preferences/VMware Fusion/networking
2024/05/24 09:35:27 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:27 GuestIP discovered device matching nat: vmnet8
2024/05/24 09:35:27 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:27 Lookup up IP information...
2024/05/24 09:35:27 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:27 GuestAddress found MAC address in VMX: 00:0c:29:0f:c3:fa
2024/05/24 09:35:27 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:27 Trying DHCP leases path: /var/db/vmware/vmnet-dhcpd-vmnet8.leases
2024/05/24 09:35:27 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:27 Detected IP: 192.168.45.131
2024/05/24 09:35:27 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:27 [INFO] Attempting SSH connection to 192.168.45.131:22...
2024/05/24 09:35:27 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:27 [DEBUG] reconnecting to TCP connection for SSH
2024/05/24 09:35:27 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:27 [DEBUG] handshaking with SSH
2024/05/24 09:35:28 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:28 Keyboard interactive challenge:
2024/05/24 09:35:28 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:28 -- User:
2024/05/24 09:35:28 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:28 -- Instructions:
2024/05/24 09:35:28 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:28 -- Question 1: Password:
2024/05/24 09:35:29 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:29 Keyboard interactive challenge:
2024/05/24 09:35:29 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:29 -- User:
2024/05/24 09:35:29 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:29 -- Instructions:
2024/05/24 09:35:29 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:29 [DEBUG] handshake complete!
2024/05/24 09:35:29 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:29 [DEBUG] Opening new ssh session
2024/05/24 09:35:29 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:29 [INFO] agent forwarding enabled
2024/05/24 09:35:29 ui: [1;32m==> vmware-iso: Connected to SSH![0m
2024/05/24 09:35:29 ui: [1;32m==> vmware-iso: Uploading the 'darwin' VMware Tools[0m
2024/05/24 09:35:29 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 09:35:29 [DEBUG] Opening new ssh session
I think I found what the issue is:
The problem
However, there is one case where this creates problems: Either the client itself or the server has a very old implementation of SSH that does not support rsa-sha2-256 or rsa-sha2-512 signatures, for example: OpenSSH <=7.2 which was released in 2016-02-29 ([release notes](https://www.openssh.com/txt/release-7.2?ref=ikarus.sg)).The problem
That being said both macOS Mavericks and Yosemite have ssh versions lower than 7.2. https://ikarus.sg/rsa-is-not-dead/ Interrogating:
ssh -G vagrant@192.168.45.129 | grep pubkeyacceptedalgorithms
pubkeyacceptedalgorithms ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256
one can see that ssh-rsa
and ssh-dss
are missing.
So I have added to my config file:
Host *
PubkeyAcceptedAlgorithms +ssh-rsa,ssh-dss
HostKeyAlgorithms +ssh-rsa,ssh-dss
ssh -G vagrant@192.168.45.129 | grep pubkeyacceptedalgorithms
pubkeyacceptedalgorithms ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss
And -var 'temporary_key_pair_type=rsa'
-var 'temporary_key_pair_bits=1024'
But I still get
17:31:41 [DEBUG] reconnecting to TCP connection for SSH
2024/05/24 17:31:41 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 17:31:41 [DEBUG] handshaking with SSH
2024/05/24 17:31:41 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 17:31:41 [DEBUG] SSH handshake err: ssh: handshake failed: EOF
2024/05/24 17:31:48 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 17:31:48 [INFO] Attempting SSH connection to 192.168.45.129:22...
2024/05/24 17:31:48 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 17:31:48 [DEBUG] reconnecting to TCP connection for SSH
2024/05/24 17:31:48 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 17:31:48 [DEBUG] handshaking with SSH
2024/05/24 17:31:48 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 17:31:48 [DEBUG] SSH handshake err: ssh: handshake failed: EOF
2024/05/24 17:31:55 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 17:31:55 [INFO] Attempting SSH connection to 192.168.45.129:22...
2024/05/24 17:31:55 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 17:31:55 [DEBUG] reconnecting to TCP connection for SSH
2024/05/24 17:31:55 packer-plugin-vmware_v1.0.11_x5.0_darwin_amd64 plugin: 2024/05/24 17:31:55 [DEBUG] handshaking with SSH
I have also tried to upgrade the openssh inside the server, but could not get rid of this error.
Possibly related: https://github.com/hashicorp/packer/issues/8993
Possibly related to https://github.com/hashicorp/packer/issues/12917
I wonder if it is possible directly to add variable to golang?
-var 'sshConfig.Config.KEXAlgos = append(sshConfig.Config.KEXAlgos, "diffie-hellman-group-exchange-sha256")'
We're using the Go library directly for performing SSH-related operations, so I'm not sure there's a lot that OpenSSH supports that we do too. Honestly though you're not the first one noticing that our SSH code is a bit rigid, we should spend time on that front to see what we can do to make it more robust. Can't promise when that will happen, but we'll try to schedule some work on this ASAP.
Can't promise when that will happen, but we'll try to schedule some work on this ASAP.
Any progress on this?
Hey @startergo,
No progress yet, it's in my backlog but I haven't had time to look at it yet, still cannot promise when that'll happen unfortunately, sorry about that :/
Got one of the following errors ? See if the related guides can help.
Waiting for WinRM to become available
?Waiting for SSH to become available
?Issues on GitHub are intended to be related to bugs or feature requests, so we recommend using our other community resources instead of asking here if you have a question.
This is what the server inside the machine supports:
Debugging
ssh
connection:Settings on the server:
json
config file:macos109.json:
vagrantfile-macos109.tpl file:
Configuration options: