Bug 1671353 - http.client doesn't support Post-Handshake Authentication (TLS 1.3)
Summary: http.client doesn't support Post-Handshake Authentication (TLS 1.3)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: python3
Version: 8.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: 8.0
Assignee: Charalampos Stratakis
QA Contact: Lukáš Zachar
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-01-31 13:23 UTC by Branislav Náter
Modified: 2019-11-05 22:03 UTC (History)
7 users (show)

Fixed In Version: python3-3.6.8-13.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-05 22:03:43 UTC
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Python 37440 None None None 2019-07-01 10:20:34 UTC
Red Hat Product Errata RHSA-2019:3520 None None None 2019-11-05 22:03:58 UTC

Description Branislav Náter 2019-01-31 13:23:51 UTC
Description of problem:
http.client doesn't support Post-Handshake Authentication (TLS 1.3)

Version-Release number of selected component (if applicable):
platform-python-3.6.8-1.el8

How reproducible:
$ sudo python3 tls13.py 
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access /test
on this server.<br />
Reason: Cannot perform Post-Handshake Authentication.<br /></p>
</body></html>

$ cat /etc/httpd/conf.d/test.conf 
<Location "/test">
  SSLVerifyClient require
</Location>

$ cat tls13.py 
import ssl
import socket
from http.client import HTTPSConnection

hostname = socket.getfqdn()

ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
ctx.load_default_certs()
ctx.load_cert_chain('/etc/pki/tls/certs/admin.crt', '/etc/pki/tls/private/admin.key')

conn = HTTPSConnection(hostname, context=ctx)
conn.request('GET', '/test')
print(conn.getresponse().read().decode('utf-8'))

Comment 1 Christian Heimes 2019-02-01 12:44:22 UTC
For backward compatibility PHA is disabled by default. Please try again with:

ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
ctx.load_default_certs()
ctx.load_cert_chain('/etc/pki/tls/certs/admin.crt', '/etc/pki/tls/private/admin.key')
ctx.post_handshake_auth = True  # <<<<< enable PHA

conn = HTTPSConnection(hostname, context=ctx)
conn.request('GET', '/test')
print(conn.getresponse().read().decode('utf-8'))

Comment 7 Petr Viktorin 2019-03-11 13:33:33 UTC
Did the example above help?

Comment 9 Petr Viktorin 2019-05-21 13:12:28 UTC
Branislav, did the example above help? Do you need anything from our side?

Comment 13 Christian Heimes 2019-07-01 10:20:34 UTC
Upstream bug https://bugs.python.org/issue37440 and upstream fix https://github.com/python/cpython/commit/d1bd6e79da1ee56dc1b902d804216ffd267399db address the issue and enable PHA by default.

Comment 19 errata-xmlrpc 2019-11-05 22:03:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2019:3520


Note You need to log in before you can comment on or make changes to this bug.