Ssh through bastion host (jump host)

Solution 1:

Host key verification failed.

It seems that you have not verified a hostkey of the "bastion" server. You cannot verify it, when the connection is created using ProxyCommand directive.

As you are using OpenSSH 8.1, you can use -J (jump) switch, instead of ProxyCommand directive:

ssh -i remote.pem -i bastion.pem -J user@bastion user@remote

See also Does OpenSSH support multihop login?

With the -J switch, you should get a normal host key verification prompt.


Alternatively, first connect to the "bastion" only to verify its host key:

ssh user@bastion

As you use ssh in some isolated non-interactive environment, you will have to copy the known_hosts file created by the above commands to that environment.

Or use some techniques hinted in ssh command line specify server host key fingerprint.