Skip to content

Commit

Permalink
Disable authentication methods that weren't specified
Browse files Browse the repository at this point in the history
  • Loading branch information
dhozac committed Nov 27, 2012
1 parent 5a33012 commit d703f92
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/ansible/runner/connection_plugins/ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ def connect(self):
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
Expand Down

0 comments on commit d703f92

Please sign in to comment.