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

+1 -1
View File
@@ -1,6 +1,6 @@
from netbox.plugins import PluginConfig, get_plugin_config
__version__ = "0.32.0"
__version__ = "0.32.1"
class NetBoxUtilitiesConfig(PluginConfig):
+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
@@ -108,3 +108,14 @@ class FindLatestTest(SimpleTestCase):
self.assertIsNone(result["latest"])
self.assertIn("endoflife.date: timeout", result["errors"])
class SslContextTest(SimpleTestCase):
def test_verifies_certificates_without_strict_x509_checks(self):
import ssl
context = latest.ssl_context()
self.assertEqual(context.verify_mode, ssl.CERT_REQUIRED)
self.assertTrue(context.check_hostname)
self.assertFalse(context.verify_flags & getattr(ssl, "VERIFY_X509_STRICT", 0))
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "netbox-utilities"
version = "0.32.0"
version = "0.32.1"
description = "Navigation, tenant utilities, connection VLANs, partial-width racks, disks, CPU & RAM, switch port export and bulk operations for NetBox 4.6/4.7"
readme = "README.md"
requires-python = ">=3.12"