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
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
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
This commit is contained in:
1 parent
f6b3887121
commit
6f9b91ae9b
3 files changed
+133
-7
No files matched your search
@@ -21,7 +21,7 @@ from cryptography.hazmat.primitives.asymmetric import padding as asym_padding
|
||||
from cryptography.hazmat.primitives.asymmetric import rsa
|
||||
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
||||
from napalm.base.exceptions import ConnectionClosedException, ConnectionException
|
||||
from napalm_device_types import FingerprintRule, ResidentialGatewayDriver
|
||||
from napalm_device_types import FingerprintRule, PortSpec, ResidentialGatewayDriver
|
||||
from napalm_device_types.models import (
|
||||
HostDict,
|
||||
NATTranslationDict,
|
||||
@@ -95,12 +95,6 @@ class ZyxelVMGDriver(ResidentialGatewayDriver):
|
||||
DRIVER_NAME = "zyxel"
|
||||
SNMP_OBJECT_ID_PREFIX = "1.3.6.1.4.1.890"
|
||||
OUI_PREFIXES = ["00:13:49", "1C:74:0D", "C8:6C:87", "B0:B2:DC", "28:28:5D"]
|
||||
HTTP_FINGERPRINT = [
|
||||
FingerprintRule("zyxel", weight=7.0, mandatory=True),
|
||||
]
|
||||
#: The DAL accepts a PINGTEST request but its answer carries no reply count or
|
||||
#: round-trip time, so this driver cannot tell an answering host from a silent one.
|
||||
SUPPORTS_PING = False
|
||||
|
||||
_LOGIN_PATH = "UserLogin"
|
||||
_LOGOUT_PATH = "cgi-bin/UserLogout"
|
||||
@@ -108,6 +102,22 @@ class ZyxelVMGDriver(ResidentialGatewayDriver):
|
||||
_BASIC_INFO_PATH = "getBasicInformation"
|
||||
_DAL_PATH = "cgi-bin/DAL"
|
||||
|
||||
#: Discovery also fetches the DAL's key exchange, which answers without a login
|
||||
#: (``open()`` needs it). The port answering is no evidence; the answer is (#13).
|
||||
PORT_SPECS = [
|
||||
PortSpec("http", 80, (f"/{_RSA_KEY_PATH}",), weight=0.0),
|
||||
PortSpec("https", 443, (f"/{_RSA_KEY_PATH}",), weight=0.0),
|
||||
]
|
||||
#: OID, OUI and "zyxel" fit every Zyxel product and stay below "high" together;
|
||||
#: only a DAL gateway answers with an ``RSAPublicKey`` (#13).
|
||||
HTTP_FINGERPRINT = [
|
||||
FingerprintRule("zyxel", weight=7.0, mandatory=True),
|
||||
FingerprintRule('"rsapublickey"', weight=24.0),
|
||||
]
|
||||
#: The DAL accepts a PINGTEST request but its answer carries no reply count or
|
||||
#: round-trip time, so this driver cannot tell an answering host from a silent one.
|
||||
SUPPORTS_PING = False
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
hostname: str,
|
||||
|
||||
Reference in new issue
Block a user