Bug 1671353

Summary: http.client doesn't support Post-Handshake Authentication (TLS 1.3)
Product: Red Hat Enterprise Linux 8 Reporter: Branislav Náter <bnater>
Component: python3Assignee: Charalampos Stratakis <cstratak>
Status: CLOSED ERRATA QA Contact: Lukáš Zachar <lzachar>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.0CC: bnater, cheimes, cstratak, jkejda, mnalband, pviktori, vstinner
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: python3-3.6.8-13.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-11-05 22:03:43 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

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):

How reproducible:
$ sudo python3 tls13.py 
<title>403 Forbidden</title>
<p>You don't have permission to access /test
on this server.<br />
Reason: Cannot perform Post-Handshake Authentication.<br /></p>

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

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

hostname = socket.getfqdn()

ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
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')

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_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')

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.