1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Legacy Python certificate validation fixed (#470) (#1576)

* Legacy Python certificate validation fixed

* added changelog fragment

* removed blank line for sanity checks

* Update changelogs/fragments/470-spacewalk-legacy-python-certificate-validation.yaml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update changelogs/fragments/470-spacewalk-legacy-python-certificate-validation.yaml

Co-authored-by: jpe <petz.johannes@afb.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
(cherry picked from commit df9f0741b5)

Co-authored-by: Johannes Petz <PetzJohannes@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2021-01-03 11:37:40 +01:00 committed by GitHub
parent 1552bae77b
commit 3fa4a9c073
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- rhn_channel - Python 2.7.5 fails if the certificate should not be validated. Fixed this by creating the correct ``ssl_context`` (https://github.com/ansible-collections/community.general/pull/470).

View file

@ -135,7 +135,7 @@ def main():
try: # Python 2.7.9 and newer
ssl_context = ssl.create_unverified_context()
except AttributeError: # Legacy Python that doesn't verify HTTPS certificates by default
ssl._create_default_context = ssl._create_unverified_context
ssl_context = ssl._create_unverified_context()
else: # Python 2.7.8 and older
ssl._create_default_https_context = ssl._create_unverified_https_context