CentOS/8/Python 3.14: Difference between revisions
< CentOS
(Created page with "== Python 3.14 with OpenSSL 3 == # Python 3.14 + OpenSSL 3.x on CentOS 8 This guide installs: - OpenSSL 3.x in `/opt/openssl-3` - Python 3.14 in `/opt/python3.14` - Modern TLS support for Python `ssl`, `urllib`, `requests`, and `aiohttp` - Isolation from the OS Python and OpenSSL versions This approach is recommended for environments that use: - Corporate TLS inspection appliances - Internal Artifactory servers - Self-signed enterprise CAs - Modern TLS requirements...") |
|||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
== Python 3.14 with OpenSSL 3 == | == Python 3.14 with OpenSSL 3 == | ||
<markdown> | |||
# Python 3.14 + OpenSSL 3.x on CentOS 8 | # Python 3.14 + OpenSSL 3.x on CentOS 8 | ||
| Line 277: | Line 278: | ||
```python | ```python | ||
import truststore | |||
truststore.inject_into_ssl() | |||
import requests | |||
r = requests.get( | |||
"https://artifactory.company.com", | |||
timeout=30 | |||
) | |||
print(r.status_code) | |||
``` | |||
--- | |||
# 14. Verify Corporate Certificates | |||
Check the complete certificate chain: | |||
```bash | |||
echo | \ | |||
/opt/openssl-3/bin/openssl s_client \ | |||
-connect artifactory.company.com:443 \ | |||
-showcerts | |||
``` | |||
Look for: | |||
```text | |||
Verify return code: 0 (ok) | |||
``` | |||
--- | |||
# 15. Verify Which OpenSSL Python Is Actually Using | |||
```bash | |||
ldd /opt/python3.14/bin/python3.14 | grep ssl | |||
``` | |||
Expected: | |||
```text | |||
libssl.so.3 => /opt/openssl-3/lib64/libssl.so.3 | |||
libcrypto.so.3 => /opt/openssl-3/lib64/libcrypto.so.3 | |||
``` | |||
--- | |||
# Optional: Create Convenience Symlinks | |||
```bash | |||
ln -s /opt/python3.14/bin/python3.14 /usr/local/bin/python3.14 | |||
ln -s /opt/python3.14/bin/pip3.14 /usr/local/bin/pip3.14 | |||
``` | |||
Verify: | |||
```bash | |||
python3.14 --version | |||
pip3.14 --version | |||
``` | |||
--- | |||
# Troubleshooting | |||
## SSL module missing | |||
```python | |||
import ssl | |||
``` | |||
fails with: | |||
```text | |||
ModuleNotFoundError: No module named '_ssl' | |||
``` | |||
Rebuild Python and verify the configure output detects: | |||
```text | |||
checking for OpenSSL ... | |||
``` | |||
and: | |||
```text | |||
_ssl module... yes | |||
``` | |||
--- | |||
## Requests certificate errors | |||
Enable debugging: | |||
```python | |||
import ssl | |||
print(ssl.OPENSSL_VERSION) | |||
print(ssl.get_default_verify_paths()) | |||
``` | |||
Check Certifi: | |||
```python | |||
import certifi | |||
print(certifi.where()) | |||
``` | |||
Test with OS trust store: | |||
```python | |||
import truststore | |||
truststore.inject_into_ssl() | |||
``` | |||
--- | |||
# Final Installed Layout | |||
```text | |||
/opt/openssl-3 | |||
/opt/python3.14 | |||
``` | |||
Benefits: | |||
- Does not interfere with system Python | |||
- Does not interfere with DNF | |||
- Uses OpenSSL 3.x | |||
- Fully supports Python 3.14 TLS features | |||
- Easier troubleshooting of enterprise certificate issues | |||
</markdown> | |||
Latest revision as of 18:07, 27 July 2026
Python 3.14 with OpenSSL 3
Python 3.14 + OpenSSL 3.x on CentOS 8
This guide installs:
- OpenSSL 3.x in
/opt/openssl-3 - Python 3.14 in
/opt/python3.14 - Modern TLS support for Python
ssl,urllib,requests, andaiohttp - Isolation from the OS Python and OpenSSL versions
This approach is recommended for environments that use:
- Corporate TLS inspection appliances
- Internal Artifactory servers
- Self-signed enterprise CAs
- Modern TLS requirements
Python 3.14 requires OpenSSL 1.1.1 or newer for SSL support. 1
1. Install Build Dependencies
dnf groupinstall -y "Development Tools"
dnf install -y \
gcc \
gcc-c++ \
make \
wget \
perl \
perl-IPC-Cmd \
zlib-devel \
bzip2-devel \
libffi-devel \
readline-devel \
sqlite-devel \
xz-devel \
tk-devel \
gdbm-devel \
ncurses-devel
2. Download and Build OpenSSL 3.x
cd /usr/src
wget https://www.openssl.org/source/openssl-3.5.1.tar.gz
tar xf openssl-3.5.1.tar.gz
cd openssl-3.5.1
Configure:
./Configure \
--prefix=/opt/openssl-3 \
--openssldir=/opt/openssl-3 \
shared \
linux-x86_64
Build:
make -j$(nproc)
Install:
make install
Verify:
/opt/openssl-3/bin/openssl version
Expected:
OpenSSL 3.5.x
3. Configure Runtime Linker
Create:
cat >/etc/ld.so.conf.d/openssl3.conf <<EOF
/opt/openssl-3/lib64
EOF
Refresh:
ldconfig
Verify:
ldconfig -p | grep ssl
Expected output should include:
libssl.so.3
libcrypto.so.3
4. Download Python 3.14
cd /usr/src
wget https://www.python.org/ftp/python/3make -j$(nproc)
7. Install Python
make install
Verify:
/opt/python3.14/bin/python3.14 --version
Expected:
Python 3.14.6
8. Verify OpenSSL Integration
/opt/python3.14/bin/python3.14 -c "
import ssl
print(ssl.OPENSSL_VERSION)
"
Expected:
OpenSSL 3.5.x
9. Verify HTTPS Works
/opt/python3.14/bin/python3.14 -c "
import ssl
import urllib.request
print(ssl.OPENSSL_VERSION)
print(urllib.request.urlopen('https://www.python.org').status)
"
Expected:
OpenSSL 3.5.x
200
10. Install Common Packages
/opt/python3.14/bin/pip3.14 install \
requests \
aiohttp \
certifi \
truststore
Verify:
/opt/python3.14/bin/pip3.14 list
11. Verify Requests
import ssl
import requests
print("OpenSSL:", ssl.OPENSSL_VERSION)
r = requests.get(
"https://www.python.org",
timeout=30
)
print(r.status_code)
Expected:
OpenSSL: OpenSSL 3.x.x
200
12. Check Python Trust Stores
Show OpenSSL trust path:
import ssl
print(ssl.get_default_verify_paths())
Show Certifi path:
import certifi
print(certifi.where())
This helps troubleshoot situations where:
curlworks- Browser works
- Python Requests fails
because Requests typically uses Certifi rather than the OS trust store.
13. Force Requests to Use the OS Trust Store
For enterprise environments this is often recommended.
import truststore
truststore.inject_into_ssl()
Example:
import truststore
truststore.inject_into_ssl()
import requests
r = requests.get(
"https://artifactory.company.com",
timeout=30
)
print(r.status_code)
14. Verify Corporate Certificates
Check the complete certificate chain:
echo | \
/opt/openssl-3/bin/openssl s_client \
-connect artifactory.company.com:443 \
-showcerts
Look for:
Verify return code: 0 (ok)
15. Verify Which OpenSSL Python Is Actually Using
ldd /opt/python3.14/bin/python3.14 | grep ssl
Expected:
libssl.so.3 => /opt/openssl-3/lib64/libssl.so.3
libcrypto.so.3 => /opt/openssl-3/lib64/libcrypto.so.3
Optional: Create Convenience Symlinks
ln -s /opt/python3.14/bin/python3.14 /usr/local/bin/python3.14
ln -s /opt/python3.14/bin/pip3.14 /usr/local/bin/pip3.14
Verify:
python3.14 --version
pip3.14 --version
Troubleshooting
SSL module missing
import ssl
fails with:
ModuleNotFoundError: No module named '_ssl'
Rebuild Python and verify the configure output detects:
checking for OpenSSL ...
and:
_ssl module... yes
Requests certificate errors
Enable debugging:
import ssl
print(ssl.OPENSSL_VERSION)
print(ssl.get_default_verify_paths())
Check Certifi:
import certifi
print(certifi.where())
Test with OS trust store:
import truststore
truststore.inject_into_ssl()
Final Installed Layout
/opt/openssl-3
/opt/python3.14
Benefits:
- Does not interfere with system Python
- Does not interfere with DNF
- Uses OpenSSL 3.x
- Fully supports Python 3.14 TLS features
- Easier troubleshooting of enterprise certificate issues