Merge remote-tracking branch 'origin/main' into fix/rest-cert-tofu-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.
This commit is contained in:
Christian Manivong committed 2026-11-02 00:37:11 +01:00
commit 586632efe0
13 files changed
+517 -75

No files matched your search

+28 -11
View File
@@ -6,6 +6,19 @@ All notable changes to this driver. The format follows
## [Unreleased]
### Changed
- `ssl_verify` (`verify_ssl`, `verify`) no longer has any effect: the REST certificate is
verified by its fingerprint instead. Callers that set it to `True` had their login
retried without verification whenever the self-signed certificate failed the CA check.
- Python 3.12 is the floor (`requires-python = ">=3.12"`): netOrk runs every driver
on 3.12, so 3.10 and 3.11 are no longer tested (NAPALM/driver-standard#6).
- The floor on napalm is 5.1: older releases import `pkg_resources`, which a Python
3.12 venv no longer has.
- The floor on urllib3 is 1.26.5: older releases bundle a `six` that Python 3.12
cannot import.
- The floor on netmiko is 4.3.0: the Telnet login reads the switch's greeting through
a session log object, which older releases do not accept.
### Fixed
- The REST API's certificate is verified. A switch's self-signed certificate is checked
by its SHA-256 fingerprint, not by a CA, with trust on first use:
@@ -20,17 +33,21 @@ All notable changes to this driver. The format follows
HTTP answers, the REST API is skipped and the CLI transports are tried. Blocking port
443 would otherwise downgrade the login to clear text. Without a pin, plain HTTP is
used as before (#17).
### Changed
- `ssl_verify` (`verify_ssl`, `verify`) no longer has any effect: the REST certificate is
verified by its fingerprint instead. Callers that set it to `True` had their login
retried without verification whenever the self-signed certificate failed the CA check.
- Python 3.12 is the floor (`requires-python = ">=3.12"`): netOrk runs every driver
on 3.12, so 3.10 and 3.11 are no longer tested (NAPALM/driver-standard#6).
- The floor on napalm is 5.1: older releases import `pkg_resources`, which a Python
3.12 venv no longer has.
- The floor on urllib3 is 1.26.5: older releases bundle a `six` that Python 3.12
cannot import.
- `cli()` over the REST API returns the command's output. It returned the API's
base64 encoding of it as it came, NUL byte included.
- `configure_snmp_agent` over the REST API opens its temporary SSH session on port 22.
It used `optional_args["port"]`, which names the REST API's port when REST is the
transport, so the SNMP setup failed on switches managed over REST.
- A switch whose Telnet sessions are all taken is reported as such ("the switch has no
free session"), as a connection error. It was reported as an authentication failure,
which pointed at the password.
- A REST API that answers the login with an HTML page is reported as "answered with a
web page instead of JSON", not as a failed login.
- An SSH attempt that failed for another reason than a timeout, such as no common key
exchange algorithm, names that reason instead of "timed out".
- `get_snmp_config` reads the switch's communities over the REST API too. It returned
`None` there, so a switch managed over REST always read as having no SNMP. A read that
fails now raises instead of reading as "no SNMP" (REST transport).
## [0.6.0] - 2026-10-23