SOLVED! The machine is a Dell Poweredge system which ran what they call iDRAC in the background - iDRAC in its turn ran a SSH-server which conflicted with the one I installed in Debian. The solution for me was just to disable iDRAC since I don't use it, and I'm glad I don't. I have no idea how that conflict should've been solved.
Just installed Debian Stretch on a machine. Minimal install haven't done pretty much anything but installing openssh-server and setting up my network interface. The problem I have seems to be related to the networking service.
Straight from boot I'm not able to connect to my server via SSH remotely. The server has internet connection at this time, I'm able to ping it and ping from it. At connection it starts out good but then a popup asks for a password for the user, typing in the password doesn't work - should already have been sent by the client anyway. When I run systemctl restart networking.service on the server SSH suddenly starts working.
openssh-server is running with default configurations.
My SSH client(Bitvise) log says:
15:08:26.493 Started a new SSH2 session. 15:08:26.493 Connecting to SSH2 server 171.xxx.xxx.xxx:22. 15:08:26.493 Connection established. 15:08:26.681 Server version: SSH-2.0-OpenSSH_5.8 <---- 15:08:26.681 First key exchange started. 15:08:27.289 Received a new host key from the server. Algorithm: xxxxxxxxxxx 15:08:27.320 First key exchange completed using ecdh-sha2/nistp521. xxxxxxxxxxx 15:08:27.320 Attempting password authentication. 15:08:28.724 Authentication failed. Remaining authentication methods: 'password'. 15:08:30.581 Authentication aborted on user's request. 15:08:30.596 The SSH2 session has been terminated.
Note the server version SSH-2.0-OpenSSH_5.8
telnet 174.xxx.xxx.xxx 22
responds with SSH-2.0-OpenSSH_5.8
On the server SSH seems to be running just fine:
systemctl status sshd.service ● ssh.service - OpenBSD Secure Shell server Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2017-06-28 11:16:52 CEST; 4h 10min ago Main PID: 598 (sshd) Tasks: 1 (limit: 7372) CGroup: /system.slice/ssh.service └─ 598 /usr/sbin/sshd -D systemd: Starting OpenBSD Secure Shell server... sshd: Server listening on 0.0.0.0 port 22. sshd: Server listening on :: port 22. systemd: Started OpenBSD Secure Shell server.
Status for networking.service shows this
systemctl status networking.service ● networking.service - Raise network interfaces Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled) Active: active (exited) since Wed 2017-06-28 11:16:49 CEST; 4h 10min ago Docs: man:interfaces(5) Process: 471 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=0/SUCCESS) Process: 335 ExecStartPre=/binsh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude=lo)" ] && udevadm settle (code=exited, status=0/SUCCESS) Main PID: 1120 (code=exited, status=0/SUCCESS) Tasks: 0 (limit: 7372) CGroup: /system.slice/networking.service systemd: Starting Raise network interfaces... systemd: Started Raise network interfaces.
After restarting the network service
systemctl restart networking.service
After running this command SSH all of a sudden starts working.
SSH client log says:
15:08:57.179 Started a new SSH2 session. 15:08:57.179 Connecting to SSH2 server 171.xxx.xxx.xxx:22. 15:09:00.205 Connection established. 15:09:00.205 Server version: SSH-2.0-OpenSSH_7.4p1 Debian-10 <---- 15:09:00.205 First key exchange started. 15:09:00.283 Received a new host key from the server. Algorithm: xxxxxxxxxxx 15:09:00.314 First key exchange completed using ecdh-sha2/nistp521. xxxxxxxxxxx 15:09:00.314 Attempting password authentication. 15:09:00.330 Authentication completed. 15:09:00.470 Terminal channel opened.
The odd thing here is that now it shows server version SSH-2.0-OpenSSH_7.4p1 Debian-10
telnet 174.xxx.xxx.xxx 22
responds with SSH-2.0-OpenSSH_7.4p1 Debian-10
systemctl status sshd.service shows same as before
Status for networking.service gives shows this
systemctl status networking.service ● networking.service - Raise network interfaces Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled) Active: active (exited) since Wed 2017-06-28 15:12:49 CEST; 1min 12s ago Docs: man:interfaces(5) Main PID: 1292 (code=exited, status=0/SUCCESS) Tasks: 0 (limit: 7372) CGroup: /system.slice/networking.service systemd: Starting Raise network interfaces... systemd: Started Raise network interfaces.
source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback auto eno1 iface eno1 inet static address 174.xxx.xxx.29 netmask 255.255.255.248 gateway 174.xxx.xxx.25 broadcast 174.xxx.xxx.31 dns-nameservers 22.214.171.124 126.96.36.199
127.0.0.1 localhost.localdomain localhost 127.0.1.1 boris.secnet.sec boris
nameserver 188.8.131.52 nameserver 184.108.40.206
Made a resolv.conf and added nameservers there. Had issues with just having them in /etc/network/interfaces. Tried both with and without the resolv.conf and specifying them in /etc/network/interfaces.
NetworkManager enabled/disabled, no difference in behaviour. No firewall. The server is connected straight to the internet, same goes for my client machine.
So, what happens with SSH when systemctl restart network.services is invoked? Why does it throw back a different SSH server versions before and after the networking service is restarted?
Why won't the networking service do, whatever it does when restarting it manually, at boot?
I'm completely lost on this one, been testing for days. Worked perfectly fine with Debian Wheezy on the same net and interface settings before I upgraded. Made a full reinstall, formatted disk and installed Stretch.
Does anyone have a clue about what the problem might be? Or how to troubleshoot.