I wanted to get rid of some warnings I'm getting when running an automated builds environment (Scrutinizer-CI, to be precise).
Digging here, I've found this solution I can add to the script which prepares the container:
ssh-keyscan -H -p 1234 domain.tld >> ~/.ssh/known_hosts
It looks like this is not the best way to do so. Not sure if that's a matter of security or what, but the warnings about the host is gone.
The problem is that I'm still getting a warning for the IP to which the domain resolve.
I guess that this would sole the problem
ssh-keyscan -H -p 1234 123.231.321.213 >> ~/.ssh/known_hosts
But what if I don't know the IP, or if the host does not always resolve to the same IP?
There is some command/script I could write to resolve the IP and pass it to the above script?