fix(fingerprint): tell a DAL gateway from other Zyxel devices #14

Merged
christianmanivong merged 1 commits from fix/bugs-2026-11-02 into main 2026-11-02 08:12:33 +00:00
Owner

What

Discovery gets one piece of evidence that only a DAL gateway has.

  • PORT_SPECS asks discovery to fetch /getRSAPublickKey on the standard ports 80 and 443, with weight 0: the port answering counts for nothing. This is the DAL key exchange open() logs in with; the gateway answers it without a login (_get_rsa_pubkey() runs before UserLogin), with {"RSAPublicKey": "-----BEGIN PUBLIC KEY-----…"}.
  • HTTP_FINGERPRINT gains FingerprintRule('"rsapublickey"', weight=24.0), the quoted JSON key of that answer. "zyxel" stays mandatory at 7.

Why

The evidence was all vendor-wide: the Zyxel enterprise OID (1.3.6.1.4.1.890), Zyxel OUIs and "zyxel" on the page. Every managed Zyxel device has all three, and after #12 they made up the driver's whole maximum: 28 of 28, "high", for any Zyxel switch, firewall or NAS.

Under discovery's normalisation (score / _max_possible_score, "high" from 0.7), the maximum is now 15 + 6 + 7 + 24 = 52:

Evidence Score Confidence
Zyxel switch: OID + OUI + "zyxel" 28 / 52 = 0.54 medium
DAL gateway: OID + OUI + "zyxel" + answer 52 / 52 = 1.00 high
DAL gateway without SNMP 37 / 52 = 0.71 high
DAL gateway without SNMP, OUI not seen 31 / 52 = 0.60 medium

Why 24: vendor-wide evidence alone stays below "high" with any weight over 12; a gateway without SNMP needs at least 22 to reach it (35 / 50 is exactly 0.70). 24 leaves a margin above that edge.

Why not other markers: the driver's code and fixtures name no landing-page text, and the only model string (VMG4005-B50A) is in a test fixture that is not a recording (README: "not recorded yet"). getBasicInformation answers without a login too, but the driver only relies on it answering JSON; which keys it carries is not established by anything the driver needs to work. The RSA key exchange is: without it the driver cannot log in.

Cost: discovery sends one more GET per scheme to every host it probes on 80/443 (as it already does for /redfish/v1/). On a non-DAL host that is a 404.

Tests

Fixtures only (no device). tests/test_fingerprint.py mirrors netOrk's scoring (OUI 6, OID 15, HTTP rules with mandatory and negative, the maximum via rules_max_weight) and checks the table above, plus the PORT_SPECS (path, weight 0, not mandatory) and that the probed path is the one the driver logs in with. test_vendor_wide_evidence_alone_stays_below_high failed before the change (assert 1.0 < 0.7). The numbers were cross-checked against netOrk's own _score_driver/_max_possible_score on main.

pytest 47 passed, ruff format/check clean, mypy clean, napalm-standard check and ratchet green.

Closes #13

## What Discovery gets one piece of evidence that only a DAL gateway has. - `PORT_SPECS` asks discovery to fetch `/getRSAPublickKey` on the standard ports 80 and 443, with weight 0: the port answering counts for nothing. This is the DAL key exchange `open()` logs in with; the gateway answers it without a login (`_get_rsa_pubkey()` runs before `UserLogin`), with `{"RSAPublicKey": "-----BEGIN PUBLIC KEY-----…"}`. - `HTTP_FINGERPRINT` gains `FingerprintRule('"rsapublickey"', weight=24.0)`, the quoted JSON key of that answer. `"zyxel"` stays mandatory at 7. ## Why The evidence was all vendor-wide: the Zyxel enterprise OID (`1.3.6.1.4.1.890`), Zyxel OUIs and "zyxel" on the page. Every managed Zyxel device has all three, and after #12 they made up the driver's whole maximum: 28 of 28, "high", for any Zyxel switch, firewall or NAS. Under discovery's normalisation (`score / _max_possible_score`, "high" from 0.7), the maximum is now 15 + 6 + 7 + 24 = 52: | Evidence | Score | Confidence | |---|---|---| | Zyxel switch: OID + OUI + "zyxel" | 28 / 52 = 0.54 | medium | | DAL gateway: OID + OUI + "zyxel" + answer | 52 / 52 = 1.00 | high | | DAL gateway without SNMP | 37 / 52 = 0.71 | high | | DAL gateway without SNMP, OUI not seen | 31 / 52 = 0.60 | medium | Why 24: vendor-wide evidence alone stays below "high" with any weight over 12; a gateway without SNMP needs at least 22 to reach it (35 / 50 is exactly 0.70). 24 leaves a margin above that edge. Why not other markers: the driver's code and fixtures name no landing-page text, and the only model string (`VMG4005-B50A`) is in a test fixture that is not a recording (README: "not recorded yet"). `getBasicInformation` answers without a login too, but the driver only relies on it answering JSON; which keys it carries is not established by anything the driver needs to work. The RSA key exchange is: without it the driver cannot log in. Cost: discovery sends one more GET per scheme to every host it probes on 80/443 (as it already does for `/redfish/v1/`). On a non-DAL host that is a 404. ## Tests Fixtures only (no device). `tests/test_fingerprint.py` mirrors netOrk's scoring (OUI 6, OID 15, HTTP rules with mandatory and negative, the maximum via `rules_max_weight`) and checks the table above, plus the `PORT_SPECS` (path, weight 0, not mandatory) and that the probed path is the one the driver logs in with. `test_vendor_wide_evidence_alone_stays_below_high` failed before the change (`assert 1.0 < 0.7`). The numbers were cross-checked against netOrk's own `_score_driver`/`_max_possible_score` on main. pytest 47 passed, ruff format/check clean, mypy clean, `napalm-standard check` and `ratchet` green. Closes #13
christianmanivong added 1 commit 2026-11-02 07:48:04 +00:00
fix(fingerprint): tell a DAL gateway from other Zyxel devices
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m18s
driver / test (3.13) (pull_request) Successful in 4m9s
driver / test (3.12) (pull_request) Successful in 4m28s
driver / lowest (pull_request) Successful in 3m41s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 1m18s
CI / driver (pull_request) Successful in 6m0s
driver / publish (pull_request) Skipped
6f9b91ae9b
The driver's evidence was all vendor-wide: Zyxel's enterprise OID, Zyxel
OUIs and "zyxel" on the web page. Every managed Zyxel device has all
three, and they were the driver's whole maximum, so discovery named any
Zyxel switch this gateway with high confidence.

Discovery now also fetches /getRSAPublickKey on ports 80 and 443, the
DAL key exchange the driver logs in with, without counting the port.
Its "RSAPublicKey" answer weighs 24: vendor-wide evidence alone is 28 of
52 (medium), a gateway 52 of 52, or 37 of 52 without SNMP.

Closes #13
christianmanivong merged commit da9e303e45 into main 2026-11-02 08:12:33 +00:00
christianmanivong deleted branch fix/bugs-2026-11-02 2026-11-02 08:12:33 +00:00
Sign in to join this conversation.