Repository navigation
feat: support opt-in TLS certificate verification - #637
vishalshetagar wants to merge 2 commits into
Conversation
viveksingh-network
left a comment
There was a problem hiding this comment.
Thanks for picking this up so quickly. I've reviewed the change and run the test suite locally (all passing). The implementation matches the approach in #636: default behaviour unchanged, and the context is applied to API calls, keygen, create_from_device() and Panorama-proxied connections.
A couple of suggestions from the operational side, mainly for the docs:
Connecting by IP address: many PAN-OS management certificates are issued for a hostname only. With ssl.create_default_context(), connecting via IP will fail hostname verification unless the certificate includes that IP as a SAN. Worth a sentence in the docs so users don't assume verification is broken.
Device-side setup: it may help to mention that the management certificate is set under Device > Setup > Management > SSL/TLS Service Profile, so users know where the certificate being verified comes from.
Client certificates (#554): the same ssl_context can carry a client certificate via load_cert_chain(), so this PR may also address #554. Possibly worth a one-line doc example.
None of these are blockers. LGTM from my side, pending maintainer review.
|
Thanks @viveksingh-network for the review and suggestions. Added all three documentation updates in e3e0e37: the IP/SAN requirement, the management SSL/TLS Service Profile location, and a load_cert_chain() example. The docs build passes, and I verified client-certificate connections against a local HTTPS server. I haven’t tested that against a live PAN-OS device, so I’m not claiming #554 is fully resolved yet. Please take another look when you have a chance. |
Summary
API connections currently have no supported option to enable TLS certificate verification. This adds
ssl_context=NonetoPanDeviceand passes it topan-python, so callers can opt in throughFirewallorPanorama:Omitting the context or passing
Nonepreserves the current behavior. The pinnedpan-pythonversion already supports this argument, so no dependency change is needed.The context is also passed during API-key generation and through
create_from_device(), including the returned device. Firewall requests routed through Panorama use Panorama's context, since Panorama is the TLS endpoint. Adds regression tests, constructor documentation, and a getting-started example.Closes #636.
Validation
python -m pytest tests --ignore=tests/live -qpassed on both, with 3,138 passed and 723 skipped each.git diff --checkpass. Sphinx builds with the same three warnings as the base revision..flake8configuration with its invalid indentation corrected; the repository configuration is unchanged.No live firewall or Panorama was used for validation.