fix: accept firewall CA certificates in the online version check

Python 3.13 enables VERIFY_X509_STRICT, which rejects CA certificates of
TLS-inspecting firewalls ("Basic Constraints of CA cert not marked
critical") that curl and requests accept. The version check still verifies
certificates and host names against the system CA store, only without the
strict X.509 checks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MrBlakeandClaude Opus 5.5 committed 2026-11-27 11:29:44 +01:00
1 parent 2c35147dca
commit f426283e10
4 files changed
+27 -3

No files matched your search

+14 -1
View File
@@ -13,6 +13,7 @@ dependency; lookup() adds HTTP, NetBox's HTTP_PROXIES and the Django cache.
import hashlib
import json
import re
import ssl
import threading
import time
import urllib.error
@@ -169,8 +170,20 @@ def user_agent():
return f"netbox-utilities/{__version__} (software version check)"
def ssl_context():
"""
Certificates are verified against the system CA store, like curl and requests do.
Python 3.13 turned on VERIFY_X509_STRICT, which rejects CA certificates of many TLS-inspecting
firewalls ("Basic Constraints of CA cert not marked critical") that the rest of the system accepts.
"""
context = ssl.create_default_context()
context.verify_flags &= ~getattr(ssl, "VERIFY_X509_STRICT", 0)
return context
def opener():
handlers = []
handlers = [urllib.request.HTTPSHandler(context=ssl_context())]
try:
from django.conf import settings