-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow internal Certificate Authority
If ca_trust_path is passed into winrm.Protocol, it is generally ignored. This change uses it as well as the possible request environment variables (REQUESTS_CA_BUNDLE and CURL_CA_BUNDLE) to trust a local CA.
- Loading branch information
Thurston Stone
authored and
Thurston Stone
committed
May 24, 2017
1 parent
09a81d5
commit f2efd94
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# coding=utf-8 | ||
import os | ||
from winrm.transport import Transport | ||
|
||
|
||
def test_build_session(): | ||
transport = Transport(endpoint="Endpoint", | ||
server_cert_validation='validate', | ||
username='test', | ||
password='test', | ||
auth_method='basic', | ||
) | ||
os.environ['REQUESTS_CA_BUNDLE'] = 'path_to_REQUESTS_CA_CERT' | ||
session = transport.build_session() | ||
assert(session.verify == 'path_to_REQUESTS_CA_CERT') | ||
del os.environ['REQUESTS_CA_BUNDLE'] | ||
|
||
os.environ['CURL_CA_BUNDLE'] = 'path_to_CURL_CA_CERT' | ||
session = transport.build_session() | ||
assert(session.verify == 'path_to_CURL_CA_CERT') | ||
del os.environ['CURL_CA_BUNDLE'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters