I have a Raspberry Pi and can access it via SSH (authentication via user password) when my laptop is in the same network. Now I want to access it over the internet.
I already set my router to forward the port to my Raspberry Pi and installed fail2ban to (hopefully) make cracking the password via brute force infeasible.
The weird thing is that I get a different key when accessing the Pi over the internet instead of via LAN:
christoph@christoph-laptop-14-04:~$ ssh-keygen -H -F 192.168.1.92 # Host 192.168.1.92 found: line 9 type ECDSA |1|Zz8zhCYwRu7jKa/bcUTnw/BzGmo=|m2E+0RwiVXcr8lAxbK/W13ZmZUA= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAgUNwcHmVBowUoKvi9iLtoKifh/9qKAj6BNfQsYzYuoXtlYEnTUVLn4XpMYJ9+TMwL23ZDnmJuz8noKK3rFrYg= christoph@christoph-laptop-14-04:~$ ssh-keygen -H -F [my global IP] # Host 184.108.40.206 found: line 10 type ECDSA |1|kEE5HDC1uBkqDN3SpQ8yFvwdj0A=|iDaNuB2Y8d3kIFPqFoXjrERRJ/0= ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBAgUNwcHmVBowUoKvi9iLtoKifh/9qKAj6BNfQsYzYuoXtlYEnTUVLn4XpMYJ9+TMwL23ZDnmJuz8noKK3rFrYg=
Everything but the beginning is the same. So why is the beginning different? Is the IP address encoded into this or something like this?
Another thing that confuses me is that when there was a different key before (I'm obviously unable to connect because the key changed but also) I'm shown this:
ECDSA key fingerprint is ed:47:24:c6:4e:c1:ca:99:d9:77:59:8f:01:12:85:cd
I can figure out the one of my laptop via:
ssh-keygen -l -f /etc/ssh/ssh_host_ecdsa_key.pub
and it comes in the same format. But when I ssh into my Pi and execute the same command, the output is:
256 SHA256:Npy6IbI8vDd4V3iCOcIVEsF4j2bsf9vbWcsf1ti8izE root@christoph-pi (ECDSA)
which doesn't seem to have anything to do with
I first thought that maybe
Npy6IbI8vDd4V3iCOcIVEsF4j2bsf9vbWcsf1ti8izE was a base 64 encoding for
ed:47:24:c6:4e:c1:ca:99:d9:77:59:8f:01:12:85:cd which seems to be in hex coding with each byte separated from the next one with a colon, but the length of
Npy6IbI8vDd4V3iCOcIVEsF4j2bsf9vbWcsf1ti8izE is 43 which isn't an integer multiple of 4, so it's not base64. So what is it?