server_cert_validation 'ignore' no longer works in 0.3.0
See original GitHub issueThe following no longer works against a self-signed certificate, has server_cert_validation
changed?
from winrm.protocol import Protocol
p = Protocol(
endpoint='https://somewindows:5986/wsman',
transport='ntlm',
username=r'\Admin',
password='ThePassword1',
server_cert_validation='ignore')
shell_id = p.open_shell()
command_id = p.run_command(shell_id, 'ipconfig', ['/all'])
std_out, std_err, status_code = p.get_command_output(shell_id, command_id)
print std_out
p.cleanup_command(shell_id, command_id)
p.close_shell(shell_id)
Traceback (most recent call last): File “winrmtest.py”, line 9, in <module> shell_id = p.open_shell() File “/usr/lib/python2.7/site-packages/winrm/protocol.py”, line 157, in open_shell res = self.send_message(xmltodict.unparse(req)) File “/usr/lib/python2.7/site-packages/winrm/protocol.py”, line 234, in send_message resp = self.transport.send_message(message) File “/usr/lib/python2.7/site-packages/winrm/transport.py”, line 256, in send_message response = self._send_message_request(prepared_request, message) File “/usr/lib/python2.7/site-packages/winrm/transport.py”, line 261, in _send_message_request response = self.session.send(prepared_request, timeout=self.read_timeout_sec) File “/usr/lib/python2.7/site-packages/requests/sessions.py”, line 618, in send r = adapter.send(request, **kwargs) File “/usr/lib/python2.7/site-packages/requests/adapters.py”, line 506, in send raise SSLError(e, request=request) requests.exceptions.SSLError: HTTPSConnectionPool(host=‘123.45.67.89’, port=5986): Max retries exceeded with url: /wsman (Caused by SSLError(SSLError(“bad handshake: Error([(‘SSL routines’, ‘tls_process_server_certificate’, ‘certificate verify failed’)],)”,),))
With:
pip show pywinrm
---
Metadata-Version: 2.0
Name: pywinrm
Version: 0.3.0
Summary: Python library for Windows Remote Management
Home-page: http://github.com/diyan/pywinrm/
Author: Alexey Diyan
Author-email: alexey.diyan@gmail.com
Installer: pip
License: MIT license
Location: /usr/lib/python2.7/site-packages
Requires: six, requests-ntlm, requests, xmltodict
Classifiers:
Development Status :: 4 - Beta
Environment :: Console
Intended Audience :: Developers
Intended Audience :: System Administrators
Natural Language :: English
License :: OSI Approved :: MIT License
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: Implementation :: PyPy
Topic :: Software Development :: Libraries :: Python Modules
Topic :: System :: Clustering
Topic :: System :: Distributed Computing
Topic :: System :: Systems Administration
However this previous release does work
pip show pywinrm
---
Metadata-Version: 2.0
Name: pywinrm
Version: 0.2.2
Summary: Python library for Windows Remote Management
Home-page: http://github.com/diyan/pywinrm/
Author: Alexey Diyan
Author-email: alexey.diyan@gmail.com
Installer: pip
License: MIT license
Location: /usr/lib/python2.7/site-packages
Requires: six, requests-ntlm, requests, xmltodict
Classifiers:
Development Status :: 4 - Beta
Environment :: Console
Intended Audience :: Developers
Intended Audience :: System Administrators
Natural Language :: English
License :: OSI Approved :: MIT License
Programming Language :: Python
Programming Language :: Python :: 2
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: Implementation :: PyPy
Topic :: Software Development :: Libraries :: Python Modules
Topic :: System :: Clustering
Topic :: System :: Distributed Computing
Topic :: System :: Systems Administration
Issue Analytics
- State:
- Created 6 years ago
- Comments:15
Top GitHub Comments
@nitzmahone I appreciate that the bug was fixed so quickly, but any idea when the fix will be available in the published pip package (which, as of time of writing, still says 0.3.0)? This bug really bit me hard, and I’m guessing other folks provisioning Windows boxes with Ansible are similarly affected.
https://github.com/diyan/pywinrm/releases/tag/v0.4.0 was released yesterday.