Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
b14cae02
Commit
b14cae02
authored
Feb 10, 2015
by
Brian Coca
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10161 from kstrauser/winrm-kerberized
Adds Kerberos authentication to winrm if available
parents
6f568bd6
d9562f9c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
lib/ansible/runner/connection_plugins/winrm.py
+15
-4
No files found.
lib/ansible/runner/connection_plugins/winrm.py
View file @
b14cae02
...
...
@@ -37,6 +37,13 @@ try:
except
ImportError
:
raise
errors
.
AnsibleError
(
"winrm is not installed"
)
HAVE_KERBEROS
=
False
try
:
import
kerberos
HAVE_KERBEROS
=
True
except
ImportError
:
pass
_winrm_cache
=
{
# 'user:pwhash@host:port': <protocol instance>
}
...
...
@@ -47,6 +54,11 @@ def vvvvv(msg, host=None):
class
Connection
(
object
):
'''WinRM connections over HTTP/HTTPS.'''
transport_schemes
=
{
'http'
:
[(
'kerberos'
,
'http'
),
(
'plaintext'
,
'http'
),
(
'plaintext'
,
'https'
)],
'https'
:
[(
'kerberos'
,
'https'
),
(
'plaintext'
,
'http'
),
(
'plaintext'
,
'https'
)],
}
def
__init__
(
self
,
runner
,
host
,
port
,
user
,
password
,
*
args
,
**
kwargs
):
self
.
runner
=
runner
self
.
host
=
host
...
...
@@ -72,11 +84,10 @@ class Connection(object):
if
cache_key
in
_winrm_cache
:
vvvv
(
'WINRM REUSE EXISTING CONNECTION:
%
s'
%
cache_key
,
host
=
self
.
host
)
return
_winrm_cache
[
cache_key
]
transport_schemes
=
[(
'plaintext'
,
'https'
),
(
'plaintext'
,
'http'
)]
# FIXME: ssl/kerberos
if
port
==
5985
:
transport_schemes
=
reversed
(
transport_schemes
)
exc
=
None
for
transport
,
scheme
in
transport_schemes
:
for
transport
,
scheme
in
self
.
transport_schemes
[
'http'
if
port
==
5985
else
'https'
]:
if
transport
==
'kerberos'
and
not
HAVE_KERBEROS
:
continue
endpoint
=
urlparse
.
urlunsplit
((
scheme
,
netloc
,
'/wsman'
,
''
,
''
))
vvvv
(
'WINRM CONNECT: transport=
%
s endpoint=
%
s'
%
(
transport
,
endpoint
),
host
=
self
.
host
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment