Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-39342: Expose X509_V_FLAG_ALLOW_PROXY_CERTS in ssl module #18011

Merged
merged 2 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Doc/library/ssl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,13 @@ Constants

.. versionadded:: 3.4

.. data:: VERIFY_ALLOW_PROXY_CERTS

Possible value for :attr:`SSLContext.verify_flags` to enables proxy
certificate verification.

.. versionadded:: 3.10

.. data:: VERIFY_X509_TRUSTED_FIRST

Possible value for :attr:`SSLContext.verify_flags`. It instructs OpenSSL to
Expand Down
2 changes: 2 additions & 0 deletions Lib/test/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,8 @@ def test_verify_flags(self):
self.assertEqual(ctx.verify_flags, ssl.VERIFY_CRL_CHECK_CHAIN)
ctx.verify_flags = ssl.VERIFY_DEFAULT
self.assertEqual(ctx.verify_flags, ssl.VERIFY_DEFAULT)
ctx.verify_flags = ssl.VERIFY_ALLOW_PROXY_CERTS
self.assertEqual(ctx.verify_flags, ssl.VERIFY_ALLOW_PROXY_CERTS)
# supports any value
ctx.verify_flags = ssl.VERIFY_CRL_CHECK_LEAF | ssl.VERIFY_X509_STRICT
self.assertEqual(ctx.verify_flags,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Expose ``X509_V_FLAG_ALLOW_PROXY_CERTS`` as
:data:`~ssl.VERIFY_ALLOW_PROXY_CERTS` to allow proxy certificate validation
as explained in
https://www.openssl.org/docs/man1.1.1/man7/proxy-certificates.html.
2 changes: 2 additions & 0 deletions Modules/_ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -6181,6 +6181,8 @@ sslmodule_init_constants(PyObject *m)
X509_V_FLAG_CRL_CHECK|X509_V_FLAG_CRL_CHECK_ALL);
PyModule_AddIntConstant(m, "VERIFY_X509_STRICT",
X509_V_FLAG_X509_STRICT);
PyModule_AddIntConstant(m, "VERIFY_ALLOW_PROXY_CERTS",
X509_V_FLAG_ALLOW_PROXY_CERTS);
#ifdef X509_V_FLAG_TRUSTED_FIRST
PyModule_AddIntConstant(m, "VERIFY_X509_TRUSTED_FIRST",
X509_V_FLAG_TRUSTED_FIRST);
Expand Down