From d703f920775e8877b1fb9e2ae750a23bcc7e9534 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Tue, 27 Nov 2012 10:51:35 +0100 Subject: [PATCH] Disable authentication methods that weren't specified --- lib/ansible/runner/connection_plugins/ssh.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py index 1537f950c5e..772ad46eca1 100644 --- a/lib/ansible/runner/connection_plugins/ssh.py +++ b/lib/ansible/runner/connection_plugins/ssh.py @@ -53,6 +53,12 @@ class Connection(object): self.common_args += ["-o", "Port=%d" % (self.port)] if self.runner.private_key_file is not None: self.common_args += ["-o", "IdentityFile="+self.runner.private_key_file] + if self.runner.remote_pass: + self.common_args += ["-o", "GSSAPIAuthentication=no", + "-o", "PubkeyAuthentication=no"] + else: + self.common_args += ["-o", "KbdInteractiveAuthentication=no", + "-o", "PasswordAuthentication=no"] self.common_args += ["-o", "User="+self.runner.remote_user] return self