I have a Chron job running a bash script that then SSH's to a my server. But my server's IP address changes from time to time (my bash script has a way of finding looking up the new IP address). But the problem is that then my bash script gets the "Authenticity of host can't be established ..." warning. I don't want to use
StrictHostKeyChecking=no because of man-in-the-middle attacks. However:
If the RSA key is identical to e.g. an RSA key already in the
known_host file, or an RSA key that I've saved off in some other
MyServersPublicKey file, then I assume it's my server and it just has a new IP.
The warning itself displays the fingerprint of the RSA key from the "unknown" host, not the RSA key itself. I suppose I could save off the RSA key fingerprint of my host and then have my bash script consume the fingerprint from the warning and compare it to the saved off fingerprint. But I'm wondering if anyone knows an easier way.
Do I have to write my own bash script for this, or is there something available?