nix-community / nixbox

NixOS Vagrant boxes [maintainer=@ifurther]
https://app.vagrantup.com/nixbox/
MIT License
309 stars 101 forks source link

SSH fails in nixos-19.09 #46

Closed PierreR closed 4 years ago

PierreR commented 5 years ago

sshd won't start up with nixos-19.09 because of an extra security. A new security setting might break the current nixbox setting. Is there an easy trick to make it work again (using packer to build a box) ? Any idea ? 2019-09-05_22-34-26

Tried with: "iso_url": "https://releases.nixos.org/nixos/unstable/nixos-19.09pre191505.7d5375ebf4c/nixos-minimal-19.09pre191505.7d5375ebf4c-x86_64-linux.iso"

PierreR commented 5 years ago

If I change systemctl start sshd<enter> into "sudo systemctl start sshd<enter>", here is the output of the sshd service status:

2019-09-06_13-45-51 On the host:

g:false, HandshakeTimeout:0, UseSftp:false, KeepAliveInterval:5000000000, Timeout:0}...
2019/09/06 13:41:15 packer.exe: 2019/09/06 13:41:15 [DEBUG] reconnecting to TCP connection for SSH
2019/09/06 13:41:15 packer.exe: 2019/09/06 13:41:15 [DEBUG] handshaking with SSH
2019/09/06 13:41:15 packer.exe: 2019/09/06 13:41:15 [DEBUG] SSH handshake err: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
2019/09/06 13:41:15 packer.exe: 2019/09/06 13:41:15 [DEBUG] Detected authentication error. Increasing handshake attempts.
2019/09/06 13:41:22 packer.exe: 2019/09/06 13:41:22 [INFO] Attempting SSH connection to 127.0.0.1:2422...
2019/09/06 13:41:22 packer.exe: 2019/09/06 13:41:22 [DEBUG] Config to &ssh.Config{SSHConfig:(*ssh.ClientConfig)(0xc0000168f0), Connection:(func() (net.Conn, error))(0x11a65f0), Pty:false, DisableAgentForwarding:false, HandshakeTimeout:0, UseSftp:false, KeepAliveInterval:5000000000, Timeout:0}...
PierreR commented 5 years ago

In 19.03 the console user is root, now it is nixos. I have tried to add a "sudo -s<enter>" as the first boot command but no luck.

PierreR commented 5 years ago

Ok I know how to fix this. Will send a PR when 19.09 is out.