The REST transport verifies the switch's certificate by its fingerprint (napalm-device-types tls_certificates), the remaining half of #17.
ProcurveApiClient.connect() checks the certificate over HTTPS before the login, pins the session, logs in inside refusing(), and reports the certificate to the observer after a successful login.
_try_api makes one attempt — the silent unverified retry is gone.
TlsCertificateMismatch propagates out of open(): no fallback to SSH or Telnet.
With a pinned certificate and only plain HTTP answering, REST is skipped (api: only plain HTTP answered, the certificate is pinned) and the CLI transports are tried; without a pin, plain HTTP works as before.
No certificate readable (port refused) counts as a failed REST attempt, falling back to the CLI as before.
Changed:ssl_verify / verify_ssl / verify have no effect any more and ProcurveDriver.ssl_verify is gone — netOrk's napalm_ssl_verify defaults to True, so a strict CA check would push every self-signed ProCurve to SSH/Telnet.
Depends on napalm-device-types feat/tls-fingerprint-tofu; raise the floor to the release containing it. Merge with or after #21 (which holds the first half of #17 and leaves it open).
Tested: fixtures only, tests/unit/test_rest_certificate.py (9) and TestNoPlainHttpWhenPinned (2), failed first. pytest 103 passed, ruff, mypy, napalm-standard check/ratchet green (baseline shrinks).
The REST transport verifies the switch's certificate by its fingerprint (napalm-device-types `tls_certificates`), the remaining half of #17.
- `ProcurveApiClient.connect()` checks the certificate over HTTPS before the login, pins the session, logs in inside `refusing()`, and reports the certificate to the observer after a successful login.
- `_try_api` makes one attempt — the silent unverified retry is gone.
- `TlsCertificateMismatch` propagates out of `open()`: no fallback to SSH or Telnet.
- With a pinned certificate and only plain HTTP answering, REST is skipped (`api: only plain HTTP answered, the certificate is pinned`) and the CLI transports are tried; without a pin, plain HTTP works as before.
- No certificate readable (port refused) counts as a failed REST attempt, falling back to the CLI as before.
- **Changed:** `ssl_verify` / `verify_ssl` / `verify` have no effect any more and `ProcurveDriver.ssl_verify` is gone — netOrk's `napalm_ssl_verify` defaults to True, so a strict CA check would push every self-signed ProCurve to SSH/Telnet.
**Depends on** napalm-device-types `feat/tls-fingerprint-tofu`; raise the floor to the release containing it. Merge with or after #21 (which holds the first half of #17 and leaves it open).
Tested: fixtures only, `tests/unit/test_rest_certificate.py` (9) and `TestNoPlainHttpWhenPinned` (2), failed first. pytest 103 passed, ruff, mypy, `napalm-standard check`/`ratchet` green (baseline shrinks).
Closes #17
The REST login never verified the switch in practice: with ssl_verify
off nothing was checked, and with it on a self-signed certificate (the
one every ProCurve ships) failed the CA check and the login was retried
with verification off. Either way the password went to whatever answered
on port 443.
The certificate is now checked by its SHA-256 fingerprint, trust on
first use (napalm-device-types tls_certificates): the caller passes the
fingerprint to expect in optional_args["tls_fingerprints"] and receives
every one seen through optional_args["tls_certificate_observer"]. A
different certificate ends open() with TlsCertificateMismatch before the
password is sent, without trying SSH or Telnet, which would reach the
same host with the same password. The session is pinned to the checked
certificate for every later connection. ssl_verify no longer has an
effect, and the unverified retry is gone.
Closes#17
The probe falls back to HTTP when HTTPS does not answer. For a switch
known by its certificate that is a downgrade anyone who blocks port 443
can force: the login would go out in clear text, unchecked. With a
pinned fingerprint the REST API is skipped then and the CLI transports
are tried; without one, plain HTTP is used as before.
Refs #17
The REST login now checks the certificate before it posts the password
(#17) and then tells a web page from a refused login (#13); the two
login-answer checks moved into _require_login so connect() stays within
the function-length limit. #13's REST tests stand in for the switch's
certificate, since connect() fetches it before the login.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
The REST transport verifies the switch's certificate by its fingerprint (napalm-device-types
tls_certificates), the remaining half of #17.ProcurveApiClient.connect()checks the certificate over HTTPS before the login, pins the session, logs in insiderefusing(), and reports the certificate to the observer after a successful login._try_apimakes one attempt — the silent unverified retry is gone.TlsCertificateMismatchpropagates out ofopen(): no fallback to SSH or Telnet.api: only plain HTTP answered, the certificate is pinned) and the CLI transports are tried; without a pin, plain HTTP works as before.ssl_verify/verify_ssl/verifyhave no effect any more andProcurveDriver.ssl_verifyis gone — netOrk'snapalm_ssl_verifydefaults to True, so a strict CA check would push every self-signed ProCurve to SSH/Telnet.Depends on napalm-device-types
feat/tls-fingerprint-tofu; raise the floor to the release containing it. Merge with or after #21 (which holds the first half of #17 and leaves it open).Tested: fixtures only,
tests/unit/test_rest_certificate.py(9) andTestNoPlainHttpWhenPinned(2), failed first. pytest 103 passed, ruff, mypy,napalm-standard check/ratchetgreen (baseline shrinks).Closes #17