521f7c5d73daab857dadbed3be926b47652cbe70
13
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
a65a3ed6e3 |
refactor(config): take the revision contract from napalm-device-types
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m0s
driver / test (3.12) (pull_request) Successful in 1m11s
driver / test (3.13) (pull_request) Successful in 1m3s
driver / lowest (pull_request) Successful in 35s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m1s
CI / driver (pull_request) Successful in 2m44s
driver / publish (pull_request) Skipped
napalm-device-types 4.38.0 declares ConfigRevisionsMixin: the listing, the reading, ConfigRevisionDict and the exceptions, and the revert as a template. The driver keeps the device communication: the three backup API calls, the revert step, and config_revision_content(), which leaves out the <revision> block every save writes into config.xml and the indentation between elements. The template reads the newest revision after the revert and checks that it holds the revision's configuration. OPNsense answers "reverted" even when restoreBackup() could not load the file and kept the previous one; that now raises ConfigRevertFailed instead of passing. A refusal of the firewall raises ConfigRevertFailed too. An id the history does not list still never reaches a request path. Refs NetOrk/netork#2511 |
||
|
|
5a20023c54 |
feat(config): list, read and revert the firewall's config revisions
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 17s
driver / types (pull_request) Successful in 57s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / test (3.12) (pull_request) Successful in 1m10s
driver / lowest (pull_request) Successful in 30s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m4s
CI / driver (pull_request) Successful in 2m25s
driver / publish (pull_request) Skipped
OPNsense has no API that takes an uploaded config.xml: the backup API lists the history in /conf/backup, hands out a revision and reverts to one that is already on the firewall. A full replace exists only on the legacy page diag_backup.php. So an application restores a configuration by reverting to the revision that holds it (NetOrk/netork#2511). get_config_revisions() lists the history newest first: id, time in UTC (time_iso is in the firewall's zone), description, user and size. get_config_revision(id) returns one revision's config.xml. revert_config_revision(id) calls revert_backup and refuses an id that is not in the history now; an id that is no file name of the history never reaches a request path. A revert only saves config.xml as a new newest revision: no service is reloaded and the firewall does not reboot. load_replace_candidate is None instead of NAPALM's stub that raised, so a capability check sees that the driver replaces nothing. The helper that finds the newest backup for rollback() moves to the new module, which keeps opnsense.py under its recorded size. Refs NetOrk/netork#2511 |
||
|
|
6fdc3ff2c7 |
feat(time-sync): read the time servers and zone of config.xml (NetOrk/netork#2363)
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m1s
driver / test (3.12) (pull_request) Successful in 1m9s
driver / test (3.13) (pull_request) Successful in 1m3s
driver / lowest (pull_request) Successful in 36s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 58s
CI / driver (pull_request) Successful in 2m33s
driver / publish (pull_request) Skipped
netOrk aligns every device with one list of time servers and a zone per site (NetOrk/netork#2360) through napalm-device-types 4.35.0's TimeSyncMixin. OPNsense keeps both in config.xml, <system><timeservers> and <system><timezone>, set on the legacy pages services_ntpd.php and system_general.php. No API controller reads or writes them, on 26.7 and on master, so get_time_sync() reads them from the configuration download get_config already uses and asks /api/ntpd/service/status whether ntpd follows a system peer. The driver writes neither value: time_sync_writes is empty and configure_time_sync is None. Restoring an edited config.xml or running the initial setup wizard would rewrite far more than the clock, on a box that is often the gateway and its LAN's time server. TIME_SERVERS_MENU and TIME_ZONE_MENU say where a person sets them, as SSH_SETTINGS_MENU does for the SSH algorithms. get_ntp_servers() now returns the same configured list. It read a "peers" field the status endpoint does not have (it answers with ntpq's associations as "rows") and so never found a server. |
||
|
|
b50732c63c |
feat(ssh): say where the SSH algorithm lists are set
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Successful in 18s
driver / types (pull_request) Successful in 1m13s
driver / test (3.13) (pull_request) Successful in 1m13s
driver / test (3.12) (pull_request) Successful in 1m15s
driver / lowest (pull_request) Successful in 40s
driver / build (pull_request) Successful in 37s
driver / security (pull_request) Successful in 1m6s
CI / driver (pull_request) Successful in 2m37s
driver / publish (pull_request) Skipped
OPNsense writes sshd_config from config.xml (<system><ssh>), set on the legacy Administration page; no API controller reads or writes that section (26.1, 26.7, master). The driver cannot harden the SSH server, so it declares, as data, the page and the field of each algorithm list: SSH_SETTINGS_MENU and SSH_SETTINGS_FIELDS, keyed like device-types' SSH_ALGORITHM_CLASSES. An application tells a person what to set there. The CARP master check moves to virtual_ips, next to the CARP reader, so opnsense.py stays under its line ratchet. Refs NetOrk/netork#1769 |
||
|
|
c4ff19ac20 |
feat(scheduled-jobs): the cron jobs of config.xml over the REST API (#43)
driver / standard (pull_request) Successful in 25s
driver / lint (pull_request) Successful in 26s
driver / types (pull_request) Failing after 35s
driver / test (3.13) (pull_request) Failing after 18s
driver / test (3.12) (pull_request) Failing after 21s
driver / lowest (pull_request) Failing after 17s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Failing after 40s
CI / driver (pull_request) Failing after 1m25s
driver / publish (pull_request) Skipped
OPNsense keeps its cron jobs in its configuration and runs each as a configd action, so the POSIX implementation does not fit: the driver has no shell, and a job's command is not a shell line. The cron API reads and writes them instead. get_scheduled_jobs reads every job in one request (/api/cron/settings/get, which carries the selected action rather than its display text). A job another component registered is platform, one written by put_scheduled_job carries the napalm-scheduled-job marker in its description and is application, the rest admin. Every job can be enabled and disabled; only an application's job is edited or deleted. put_scheduled_job takes a configd action as command and refuses one configd does not offer; get_scheduled_job_commands lists them. Running a job now is refused: the API cannot run a configd action. Every write reads the job again and refuses one whose digest changed. Parameters are written one per line and only without blanks, quotes or backslashes: OPNsense up to 26.1 splits them as a shell would, 26.7 takes a line per argument, and only such arguments mean the same to both. Requires napalm-device-types 4.26.0. Closes #43 |
||
|
|
72b4806c65 |
chore: Python 3.12 is the floor (NAPALM/driver-standard#6)
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 52s
driver / lowest (pull_request) Failing after 38s
driver / test (3.12) (pull_request) Successful in 1m18s
driver / test (3.13) (pull_request) Successful in 1m13s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m4s
CI / driver (pull_request) Failing after 2m49s
driver / publish (pull_request) Skipped
netOrk runs every driver in its own containers on Python 3.12, so 3.10 and 3.11 are no longer supported or tested. requires-python, mypy and ruff move to 3.12, along with what ruff's pyupgrade rules then rewrite. |
||
|
|
6e0e206e06 |
chore: adopt the NAPALM driver standard
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 1m38s
driver / test (3.10) (pull_request) Successful in 1m1s
driver / test (3.11) (pull_request) Successful in 52s
driver / test (3.12) (pull_request) Successful in 49s
driver / test (3.13) (pull_request) Successful in 45s
driver / lowest (pull_request) Successful in 29s
driver / security (pull_request) Successful in 47s
driver / build (pull_request) Successful in 22s
CI / driver (pull_request) Successful in 7m11s
driver / publish (pull_request) Skipped
- CI moves to .gitea/workflows/ci.yml and calls the shared driver workflow of NAPALM/driver-standard; .github/ is gone. - setuptools>=77 with the SPDX license string, no License classifier, Python 3.10-3.13 classifiers, napalm-device-types>=4.21.1, a dev extra with floors, links to git.netork.io, LICENSE file, py.typed. - CHANGELOG.md in Keep-a-Changelog form; README names Python 3.10, the Gitea clone URL and the new CI. - mypy strict for the package; exempt for now (52 errors): ha, listening, opnsense, ospf_mixin, ping_mixin, port_forwards, resolver_mixin. Recorded in the quality baseline with the long and complex functions, the 3100-line opnsense.py and one unannotated public method. - Coverage floor 79 % (measured 79.20 %). |
||
|
|
571d9abb5f |
style: ruff format and the lint rules of the driver standard
Mechanical: ruff format, and ruff check --fix with the rule set every NAPALM driver uses (E, F, I, UP, B at line length 100, Python 3.10). What ruff cannot fix comes in the next commit. |
||
|
|
e3ed0f1bdd |
fix: name and version from system_information; a CARP address on its MASTER's interface
CI / test (3.10) (push) Successful in 30s
CI / test (3.11) (push) Successful in 29s
CI / test (3.12) (push) Successful in 30s
CI / test (3.10) (pull_request) Successful in 30s
CI / test (3.11) (pull_request) Successful in 28s
CI / test (3.12) (pull_request) Successful in 29s
get_facts read hostname and version from /api/core/system/status, which on OPNsense 26.7 carries neither: every firewall read as nameless and "unknown", and netOrk kept naming one by its address. /api/diagnostics/system/system_information has both (name is the FQDN, versions[0] "OPNsense 26.7.7-amd64"). The status answer still counts where the new one gives nothing. get_interfaces_ip listed each interface's primary address only, so a CARP address never showed as the holder's. It now lists an address bound to a VHID on the node that is MASTER for it, and leaves it off a BACKUP -- as keepalived puts the address on the master alone. netOrk's VIP badge sits on that interface (netOrk #1121). |
||
|
|
00172f7a69 |
feat: report the firewall's CARP addresses as virtual IPs
CI / test (3.10) (push) Successful in 30s
CI / test (3.11) (push) Successful in 29s
CI / test (3.12) (push) Successful in 30s
CI / test (3.10) (pull_request) Successful in 29s
CI / test (3.11) (pull_request) Successful in 28s
CI / test (3.12) (pull_request) Successful in 30s
get_virtual_ips() reads every address bound to a CARP VHID -- the CARP address and IP aliases on its VHID alike -- from /api/interfaces/overview/export, with this node's CARP state, so the reading says who holds each address. interfaces/vip_settings would list the same addresses with each VHID's CARP password; it is not read. vip_manager and keepalived are Linux mechanisms and are None here. Needs napalm-device-types 4.10.0 (carp_virtual_ip). netOrk #1121. |
||
|
|
2fb1226734 |
feat: report what listens, and which OPNsense service it is
CI / test (3.10) (push) Successful in 40s
CI / test (3.11) (push) Successful in 30s
CI / test (3.12) (push) Successful in 31s
CI / test (3.10) (pull_request) Successful in 29s
CI / test (3.11) (pull_request) Successful in 28s
CI / test (3.12) (pull_request) Successful in 30s
get_listening_sockets reads /api/diagnostics/interface/get_socket_statistics: netstat's sockets with sockstat's user, command and PID, collected by configd as root, so no SSH is needed. A listening socket is one without a peer (*:*); "*" is the any-address of the socket's family. Which service: the socket's unit is a name of the firewall's own service list, so netOrk can match it to the service. The command (cut to ten characters by FreeBSD) matches a service name, the start of one, or one of the daemons whose service is called otherwise (sshd is openssh, the FRR daemons are frr, kea-ctrl-agent is kea-dhcp). lighttpd is the web UI, or the captive portal when it runs as www. WireGuard's sockets belong to the kernel and are told by the listen ports of /api/wireguard/service/show. The fixture is a real OPNsense 26.7.5 firewall's answer, cut down, with documentation addresses. For netOrk#673. |
||
|
|
f934cc0cfa |
feat(ping): implement ping and a batched ping_sweep over the diagnostics API
OPNsense has no synchronous ping endpoint. /api/diagnostics/ping is a job API — create, start, read statistics, stop, remove — so a single ping costs five requests and roughly a second of waiting, which makes the generic per-host sweep from napalm-device-types unusable for a whole subnet. The override exploits what the job API does offer instead: jobs are independent and run on the firewall in parallel, and search_jobs reports all of them in one response. A batch (32 by default) is created and started, waited for once, harvested with a single request and then cleaned up, so waiting time per batch is constant rather than linear in hosts. PING_SWEEP_MAX_TARGETS bounds the sweep as a whole — this runs on production firewalls. Two details the API forces: results are polled, because search_jobs signals the running ping with SIGINFO and then parses whatever it has written so far, so the first read of a healthy host can still show zero probes; and the model's root node is read from /get rather than hardcoded, so a rename in a future OPNsense release cannot silently break job creation. Tested against mocked API responses only — no live device is reachable at the moment, so the endpoint shapes come from the OPNsense sources (PingController, scripts/interfaces/ping.py). |
||
|
|
ae27cd5469 | initial commit |