question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

server_cert_validation 'ignore' no longer works in 0.3.0

See original GitHub issue

The 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:closed
  • Created 6 years ago
  • Comments:15

github_iconTop GitHub Comments

6reactions
jkodroffcommented, Aug 22, 2018

@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.

3reactions
dentargcommented, Nov 4, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue with "ignore-cert" on latest Windows prebuilt 0.4.0 #86
I recently updated to the latest Windows prebuilt 0.4.0. Have been encountering the following error: "[WARN] NNTP connection failed: self ...
Read more >
Security certificate validation fails - Windows Server
To work around this issue, delete or disable the certificate from the certification path that you don't want to use by following these...
Read more >
Server SSL certificate verification - HTTPie 3.2.1 (latest) docs
To skip the host's SSL certificate verification, you can pass --verify=no (default is yes).
Read more >
Self-signed cert in gitlab gives: 509: certificate signed by ...
Problem Trying to create a release with with a self signed gitlab (13.2) repo and https://docs.gitlab.com/ce/ci/yaml/#release...
Read more >
C# Ignore certificate errors? - Stack Overflow
Add a certificate validation handler. Returning true will allow ignoring the validation error: ServicePointManager .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found