@@ -60,6 +60,8 @@ def initialize(options, logger:)
6060 @host_public_key = options . fetch ( :host_public_key , nil )
6161 @verify_host = options . fetch ( :verify_host , nil )
6262 @client_private_key_file = settings . ssh_identity_key_file
63+ @client_ca_known_hosts_file = settings . ssh_ca_known_hosts_file
64+ @client_cert_file = Proxy ::RemoteExecution ::Ssh . cert_file if File . exist? ( Proxy ::RemoteExecution ::Ssh . cert_file )
6365
6466 @local_working_dir = options . fetch ( :local_working_dir , settings . local_working_dir )
6567 @socket_working_dir = options . fetch ( :socket_working_dir , settings . socket_working_dir )
@@ -154,9 +156,14 @@ def establish_ssh_options
154156 ssh_options << "-o User=#{ @ssh_user } "
155157 ssh_options << "-o Port=#{ @ssh_port } " if @ssh_port
156158 ssh_options << "-o IdentityFile=#{ @client_private_key_file } " if @client_private_key_file
159+ ssh_options << "-o CertificateFile=#{ @client_cert_file } " if @client_cert_file
157160 ssh_options << "-o IdentitiesOnly=yes"
158- ssh_options << "-o StrictHostKeyChecking=accept-new"
159- ssh_options << "-o UserKnownHostsFile=#{ prepare_known_hosts } " if @host_public_key
161+ ssh_options << "-o StrictHostKeyChecking=#{ @client_ca_known_hosts_file ? 'yes' : 'accept-new' } "
162+ if @host_public_key
163+ ssh_options << "-o UserKnownHostsFile=#{ prepare_known_hosts } "
164+ elsif @client_ca_known_hosts_file
165+ ssh_options << "-o UserKnownHostsFile=#{ @client_ca_known_hosts_file } "
166+ end
160167 ssh_options << "-o LogLevel=#{ ssh_log_level ( true ) } "
161168 ssh_options << "-o ControlMaster=auto"
162169 ssh_options << "-o ControlPath=#{ socket_file } "
0 commit comments