For security purposes, when you use ssh to connect to a remote host, entries are made in the ~/.ssh/known_hosts file in hashed format.
There is obviously nothing to 'reverse' the hash and get back hostnames.
However, if you know a hostname, what mechanism is used to produce the hash (which looks to be stored in base64 encoded format)?
This would let me (for known hostnames) determine which lines in the known_hosts are important, and which refer to transient machines where the SD card image may have been recycled some time ago.
I envisage something that can read a list of hostnames, generate the hash, and look at the known_hosts file and tell me if it is present.
Alternatively, I can generate a list of defunct hostnames, and run ssh_keygen -R "host", but that doesn't improve my knowledge...![Smile :)]()
I suppose I could locate the source for ssh-keygen and see how it works...
There is obviously nothing to 'reverse' the hash and get back hostnames.
However, if you know a hostname, what mechanism is used to produce the hash (which looks to be stored in base64 encoded format)?
This would let me (for known hostnames) determine which lines in the known_hosts are important, and which refer to transient machines where the SD card image may have been recycled some time ago.
I envisage something that can read a list of hostnames, generate the hash, and look at the known_hosts file and tell me if it is present.
Alternatively, I can generate a list of defunct hostnames, and run ssh_keygen -R "host", but that doesn't improve my knowledge...

I suppose I could locate the source for ssh-keygen and see how it works...
Statistics: Posted by SteveSpencer — Fri Aug 23, 2024 1:18 pm — Replies 0 — Views 22