@@ -536,7 +536,7 @@ func detectAESAcceleration() bool {
536536// The dialContext function is used to create a connection to the SSH server.
537537// The addr, user, privateKeyPath parameter is used for ssh.ClientConn creation.
538538// The timeoutSeconds parameter specifies the maximum number of seconds to wait.
539- func WaitSSHReady (ctx context.Context , dialContext func (context.Context ) (net.Conn , error ), addr , user , instanceName string , timeoutSeconds int ) error {
539+ func WaitSSHReady (ctx context.Context , dialContext func (context.Context ) (net.Conn , error ), addr , user , _ string , timeoutSeconds int ) error {
540540 ctx , cancel := context .WithTimeout (ctx , time .Duration (timeoutSeconds )* time .Second )
541541 defer cancel ()
542542
@@ -545,16 +545,11 @@ func WaitSSHReady(ctx context.Context, dialContext func(context.Context) (net.Co
545545 if err != nil {
546546 return err
547547 }
548- // Prepare HostKeyCallback
549- hostKeyChecker , err := HostKeyCheckerWithKeysInKnownHosts (instanceName )
550- if err != nil {
551- return err
552- }
553548 // Prepare ssh client config
554549 sshConfig := & ssh.ClientConfig {
555550 User : user ,
556551 Auth : []ssh.AuthMethod {ssh .PublicKeys (signer )},
557- HostKeyCallback : hostKeyChecker ,
552+ HostKeyCallback : ssh . InsecureIgnoreHostKey (), // lgtm[go/insecure-hostkeycallback]
558553 Timeout : 10 * time .Second ,
559554 }
560555 // Wait until the SSH server is available.
@@ -691,23 +686,17 @@ func GenerateSSHHostKeys(instDir, hostname string) (map[string]string, error) {
691686}
692687
693688// ExecuteScriptViaInProcessClient executes the given script on the remote host via in-process SSH client.
694- func ExecuteScriptViaInProcessClient (host string , port int , user , instanceName , script , scriptName string ) (stdout , stderr string , err error ) {
689+ func ExecuteScriptViaInProcessClient (host string , port int , user , _ , script , scriptName string ) (stdout , stderr string , err error ) {
695690 // Prepare signer
696691 signer , err := UserPrivateKey ()
697692 if err != nil {
698693 return "" , "" , err
699694 }
700- // Prepare HostKeyCallback
701- hostKeyChecker , err := HostKeyCheckerWithKeysInKnownHosts (instanceName )
702- if err != nil {
703- return "" , "" , err
704- }
705-
706695 // Prepare ssh client config
707696 sshConfig := & ssh.ClientConfig {
708697 User : user ,
709698 Auth : []ssh.AuthMethod {ssh .PublicKeys (signer )},
710- HostKeyCallback : hostKeyChecker ,
699+ HostKeyCallback : ssh . InsecureIgnoreHostKey (), // lgtm[go/insecure-hostkeycallback]
711700 Timeout : 10 * time .Second ,
712701 }
713702
0 commit comments