mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-03 23:41:21 +00:00 
			
		
		
		
	utils/ssh: Only try SSH keys if no password is supplied.
By default parmaiko attempts to search for SSH keys even when connecting with a password. Ensure this is disabled to prevent issues where non-valid keys are found on the host when connecting using password authentication.
This commit is contained in:
		@@ -350,6 +350,8 @@ class SshConnection(SshConnectionBase):
 | 
				
			|||||||
            policy = RejectPolicy
 | 
					            policy = RejectPolicy
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            policy = AutoAddPolicy
 | 
					            policy = AutoAddPolicy
 | 
				
			||||||
 | 
					        # Only try using SSH keys if we're not using a password
 | 
				
			||||||
 | 
					        check_ssh_keys = not self.password
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        with _handle_paramiko_exceptions():
 | 
					        with _handle_paramiko_exceptions():
 | 
				
			||||||
            client = SSHClient()
 | 
					            client = SSHClient()
 | 
				
			||||||
@@ -362,6 +364,8 @@ class SshConnection(SshConnectionBase):
 | 
				
			|||||||
                password=self.password,
 | 
					                password=self.password,
 | 
				
			||||||
                key_filename=self.keyfile,
 | 
					                key_filename=self.keyfile,
 | 
				
			||||||
                timeout=self.timeout,
 | 
					                timeout=self.timeout,
 | 
				
			||||||
 | 
					                look_for_keys=check_ssh_keys,
 | 
				
			||||||
 | 
					                allow_agent=check_ssh_keys
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return client
 | 
					            return client
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user