Commit Graph
135 Commits
Author SHA1 Message Date
christianmanivong f654076560 feat(apt): read the release each source names, move a file to the host's (NetOrk/netork#2614)
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m6s
CI / driver (pull_request) Successful in 2m28s
driver / standard (pull_request) Successful in 15s
driver / types (pull_request) Successful in 55s
driver / test (3.13) (pull_request) Successful in 1m7s
driver / test (3.12) (pull_request) Successful in 1m16s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 12s
A release upgrade leaves third-party apt sources on the old release, where they
still answer and their packages stop getting updates once the vendor stops
building for it: z2m-house, Ubuntu 24.04, kept Docker's source on focal and never
saw a Docker newer than 28.1.1.

AptReleaseMixin.get_apt_source_releases() reports the host's /etc/os-release and
every enabled source apt reads, one-line and deb822, with its file, line, types,
URI, suites and components. set_apt_source_release(path, release, codename) moves
every suite of release in one of apt's source files to codename, once each new
suite's InRelease or Release is fetched with apt-helper through apt's own proxy;
where the vendor has none, nothing is written. AptProxyMixin brings it, so every
apt driver has it.
2026-11-17 13:31:42 +01:00
christianmanivong 1a7885d22e refactor(firmware): FirmwareOfferDict lives with its contract
driver / test (3.13) (pull_request) Successful in 59s
driver / lowest (pull_request) Successful in 35s
driver / build (pull_request) Successful in 24s
driver / security (pull_request) Successful in 53s
CI / driver (pull_request) Successful in 2m9s
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 16s
driver / types (pull_request) Successful in 50s
driver / test (3.12) (pull_request) Successful in 1m6s
driver / publish (pull_request) Skipped
models.py is over the file limit and may not grow; the offer's two new
fields moved it past its recorded length. It is still importable from
napalm_device_types.models.
2026-11-17 12:35:34 +01:00
christianmanivong 93ba335798 feat(firmware): install the offered firmware through FirmwareUpgradeMixin (NetOrk/netork#2615)
start_firmware_upgrade(version) starts an upgrade the device runs by itself and
restarts at the end of; get_update_progress follows it. The offer says whether
the driver can install it now (installable) and names a later release line it
never crosses to (latest_major_version).
2026-11-17 11:02:51 +01:00
christianmanivong 3422b7d030 Merge remote-tracking branch 'origin/main' into feat/zabbix-agent-native
driver / test (3.13) (pull_request) Successful in 59s
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m2s
CI / driver (pull_request) Successful in 2m38s
driver / standard (pull_request) Successful in 14s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 55s
driver / test (3.12) (pull_request) Successful in 1m10s
driver / publish (pull_request) Skipped
# Conflicts:
#	CHANGELOG.md
2026-11-17 04:55:56 +01:00
christianmanivong 5217c6e333 feat(fixes): ZabbixAgentMixin, a native Zabbix agent for a host without a container engine (NetOrk/netork#2571)
driver / test (3.13) (pull_request) Successful in 1m6s
driver / lowest (pull_request) Successful in 34s
driver / build (pull_request) Successful in 24s
driver / security (pull_request) Successful in 55s
CI / driver (pull_request) Successful in 2m20s
driver / lint (pull_request) Successful in 16s
driver / standard (pull_request) Successful in 18s
driver / types (pull_request) Successful in 49s
driver / test (3.12) (pull_request) Successful in 1m11s
driver / publish (pull_request) Skipped
configure_zabbix_agent(settings) loads the package index where the driver can,
installs ZABBIX_AGENT_PACKAGE from the host's own packages and, where those have
none and settings["release"] names the server's release line, from Zabbix's
repository (the driver's _add_zabbix_repository); then the driver writes the
configuration and opens the firewall, and the service is enabled and restarted.
Settings that do not hold raise ValueError before anything changes.

zabbix_agent.py holds what is the same on every host, without I/O: the settings
check, the agent's configuration with Server, ServerActive, ListenPort and
Hostname set and the rest kept, and the root command that adds Zabbix's
repository for Debian, Ubuntu, Raspberry Pi OS and the RHEL family, in the
layout before and since 7.2. LldpAgentMixin and ZabbixAgentMixin share the
start step (enable_and_restart).
2026-11-17 04:50:42 +01:00
christianmanivong 7051199589 feat(container-engine): reach rootful Podman like Docker (NetOrk/netork#818)
driver / test (3.13) (pull_request) Successful in 1m5s
driver / lowest (pull_request) Successful in 37s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m2s
CI / driver (pull_request) Successful in 2m27s
driver / standard (pull_request) Successful in 19s
driver / types (pull_request) Successful in 55s
driver / test (3.12) (pull_request) Successful in 1m13s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 16s
container_engines() lists Podman with the API podman-libpod, and
open_container_engine("podman") reaches it with podman system dial-stdio
(Podman 4.0 and later). It is the host's rootful Podman: the engine of the
system's containers and of Quadlet's units, whose socket is root's. So the
connection runs every call as root (ContainerEngineConnection.privileged).

An engine is listed only when its CLI names itself on --version:
podman-docker's docker is podman, and listing it as Docker would read the
login user's rootless Podman a second time.
2026-11-16 23:26:55 +01:00
christianmanivong cb0f1cc05c feat(apt): send https sources through the cache in the form it stores (NetOrk/netork#2555)
driver / lowest (pull_request) Successful in 35s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m9s
CI / driver (pull_request) Successful in 2m29s
driver / standard (pull_request) Successful in 19s
driver / types (pull_request) Successful in 58s
driver / test (3.13) (pull_request) Successful in 1m1s
driver / test (3.12) (pull_request) Successful in 1m8s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 15s
apt-cacher-ng tunnels a source fetched over https and stores nothing of it. It
fetches http://HTTPS///<host>/<path> over https itself, with the certificate
verified, and stores it, where port 443 is allowed (AllowUserPorts=80 443).

- apt_sources: cacheable_https_hosts(report), and the root commands that rewrite
  the https sources of .list and deb822 .sources files to that form and back.
  A host apt has credentials for in auth.conf stays on https; the rewrite names
  it in the proxy file as Package-Proxy::Not-Cached, which the report reads.
- configure_package_proxy(url): a step "cache" before "https". It rewrites the
  sources, fetches one of them through url, and turns them all back to https
  where url cannot. The "fetch" step proves the proxy with a plain http source.
- configure_package_proxy(""): the sources go back to https before the proxy
  file goes; without the cache apt would look for a host called HTTPS.
2026-11-15 20:07:27 +01:00
christianmanivong 211d0c02eb feat(updates): PackageIndexMissing, for a host without a package index
driver / test (3.13) (pull_request) Successful in 1m2s
driver / lowest (pull_request) Successful in 36s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 52s
CI / driver (pull_request) Successful in 2m12s
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Successful in 18s
driver / types (pull_request) Successful in 58s
driver / test (3.12) (pull_request) Successful in 1m10s
driver / publish (pull_request) Skipped
OpenWrt keeps its package index in RAM and loses it on every reboot.
get_available_updates() raises then, rightly, but only as a bare
RuntimeError, so a caller cannot tell it from a read that failed and
reports a communication error for a state a refresh cures.

PackageIndexMissing (a RuntimeError, so existing callers still catch it)
names that case; refresh_available_updates() is the way out.

Refs NetOrk/netork#2527
2026-11-14 23:45:38 +01:00
christianmanivong c25f39768f refactor(system-identity): keep SystemIdentityDict with its mixin
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 1m4s
CI / driver (pull_request) Successful in 2m51s
driver / standard (pull_request) Successful in 18s
driver / types (pull_request) Successful in 57s
driver / test (3.13) (pull_request) Successful in 1m6s
driver / test (3.12) (pull_request) Successful in 1m15s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 13s
models.py is over its line limit and may not grow; the dict has no other
user than system_identity.py, as clusters.py and apt_proxy.py keep theirs.

NetOrk/netork#2518
2026-11-13 23:04:18 +01:00
christianmanivong 9ecc6823c8 feat(system-identity): read the system firmware with the identity
driver / test (3.13) (pull_request) Successful in 1m3s
driver / lowest (pull_request) Successful in 39s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 58s
CI / driver (pull_request) Failing after 2m17s
driver / standard (pull_request) Failing after 15s
driver / types (pull_request) Successful in 52s
driver / test (3.12) (pull_request) Successful in 1m11s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 13s
get_system_identity() also reads bios_vendor, bios_version and bios_date
from /sys/class/dmi/id, in the same round trip as the SMBIOS identity.
The date is given as ISO 8601; anything that is no MM/DD/YYYY reads as
empty. Only the vendors' text defaults are placeholders for the firmware:
a version of "1" is a version, unlike a serial of one repeated character.

Output of the three identity fields alone still parses, with the firmware
empty.

NetOrk/netork#2518
2026-11-13 23:00:23 +01:00
christianmanivong 43e0210ff6 feat(config-revisions): declare a device's own configuration history
driver / test (3.13) (pull_request) Successful in 1m12s
driver / lowest (pull_request) Successful in 47s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 3m34s
CI / driver (pull_request) Successful in 5m2s
driver / lint (pull_request) Successful in 13s
driver / standard (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m3s
driver / test (3.12) (pull_request) Successful in 1m18s
driver / publish (pull_request) Skipped
Some devices keep a copy of their configuration for every save and can
go back to one. An application restores a configuration there by
reverting to the revision that holds it; on OPNsense that is the only
way, since its API takes no uploaded config.xml (NetOrk/netork#2511).

ConfigRevisionsMixin declares get_config_revisions() (newest first, as
ConfigRevisionDict) and get_config_revision(revision_id).
revert_config_revision(revision_id) is a template over the driver's
_revert_to_config_revision step: it refuses an id that is not in the
history (UnknownConfigRevision), reads the revision before the revert
can rotate it out, and afterwards checks that the newest revision holds
its configuration (ConfigRevertFailed otherwise), since a device may
report a revert it did not make. config_revision_content(text) is the
hook where a driver leaves out what its device stamps into every save,
so revisions with the same configuration compare equal.

Refs NetOrk/netork#2511
2026-11-13 22:28:30 +01:00
christianmanivong e9da399568 Merge remote-tracking branch 'origin/main' into fix/service-account-replaces 2026-11-13 08:59:48 +01:00
christianmanivong 8e43fe2ed9 feat(log-forwarding): each forwarding rule names its template
driver / test (3.13) (pull_request) Successful in 1m15s
driver / lowest (pull_request) Successful in 40s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Failing after 2m38s
driver / standard (pull_request) Failing after 17s
driver / types (pull_request) Successful in 1m9s
driver / test (3.12) (pull_request) Successful in 1m30s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 16s
A rule's template decides the timestamp it sends: rsyslog's default, RFC 3164,
carries the host's local time without a zone, which a collector such as Graylog
files shifted by the host's UTC offset (NetOrk/netork#493). The rule now says
which template it uses: its own (`@host;Name`, `action(... template="...")`),
else the default set before it (`$ActionForwardDefaultTemplate`, or
`module(load="builtin:omfwd" template="...")` for omfwd actions), else None.
2026-11-12 23:36:38 +01:00
christianmanivong 679584766f feat(accounts): add_service_account takes the keys the new one replaces
driver / test (3.13) (pull_request) Successful in 1m11s
driver / lowest (pull_request) Successful in 46s
driver / build (pull_request) Successful in 38s
driver / security (pull_request) Successful in 1m16s
CI / driver (pull_request) Failing after 2m45s
driver / standard (pull_request) Failing after 18s
driver / types (pull_request) Successful in 1m1s
driver / test (3.12) (pull_request) Successful in 1m19s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 15s
netOrk moves a host from its installation-wide key to its site's
(NetOrk/netork#2462): the old key has to go from its own account, which
remove_local_account_keys refuses (the login's own account, a system
account). With replaces, the old keys go once the new key is in -- never
the new key itself, and not while it could not be added.
2026-11-12 21:55:13 +01:00
christianmanivong 65991d0930 fix(dhcp): a refused subnet no longer stops the rest of the set
driver / test (3.13) (pull_request) Successful in 1m16s
driver / lowest (pull_request) Successful in 41s
driver / build (pull_request) Successful in 35s
driver / security (pull_request) Successful in 1m13s
CI / driver (pull_request) Successful in 3m15s
driver / standard (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m19s
driver / test (3.12) (pull_request) Successful in 1m32s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 16s
apply_dhcp_subnetset called apply_dhcp_subnet for each add and update
and committed only at the end, so one refused write raised before the
commit: the subnets written ahead of it stayed saved but inactive, and
as the device reports them as configured, no later diff committed them.

It now behaves like apply_dhcp_reservationset since 4.35.1: a refused
subnet gets a [failed] line, the others are written, any non-empty diff
is committed, then DhcpApplyError is raised. DhcpApplyError takes an
optional kind ("reservation" by default) for its message.

Closes #113
2026-11-12 19:19:03 +01:00
christianmanivong b4cdcfd347 fix(dhcp): release an address before another reservation takes it
driver / lowest (pull_request) Successful in 45s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m10s
CI / driver (pull_request) Successful in 3m6s
driver / standard (pull_request) Successful in 17s
driver / types (pull_request) Successful in 1m3s
driver / test (3.12) (pull_request) Successful in 1m25s
driver / test (3.13) (pull_request) Successful in 1m13s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 14s
apply_dhcp_reservationset wrote adds first, then updates in the order of
the desired set. Kea keeps addresses unique at each write, so when an
address moved from one reservation to another, the reservation taking it
was refused as a duplicate whenever it came first.

The changes are now ordered (_dhcp_order): an update that moves a
reservation off its address goes before the change that takes that
address, along a chain from its free end, and adds come after every
update. A swap or rotation of addresses has no such order; its changes
are still tried, so a server that checks only at the commit takes them,
and a refused one's [failed] line says it was a swap and with which
reservations. Nothing is moved to a temporary address: the contract
knows no free one, and a failed second write would leave it there.

The diff is computed against one read of the reservations, shared with
diff_dhcp_reservations. Refused rows still do not stop the others, the
rest is committed and DhcpApplyError follows, as since 4.35.1.

Closes #106
2026-11-12 19:07:31 +01:00
christianmanivong f3cb3601a8 feat(updates): the CVEs a host's installed advisories close (4.37.0)
driver / lowest (pull_request) Successful in 40s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 1m0s
CI / driver (pull_request) Successful in 2m29s
driver / standard (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m2s
driver / test (3.13) (pull_request) Successful in 1m11s
driver / test (3.12) (pull_request) Successful in 1m24s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 15s
UpdateMixin declares get_installed_advisory_cves(): per package, the CVEs
the installed security advisories close -- the distribution's word that a
backport is in although the upstream version did not move. The command
(DNF_INSTALLED_CVES_COMMAND, dnf 4, from the cache) and its parser
(parse_dnf_installed_cves) live here for every dnf driver, as the
security read's do. netOrk reads it where its knowledge base holds no
records of the host's release (NetOrk/netork#2394).
2026-11-12 12:09:37 +01:00
christianmanivong cf555d006d fix(host-status): kernel releases compare the way rpm does (4.36.2)
driver / lowest (pull_request) Successful in 42s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 1m3s
CI / driver (pull_request) Failing after 2m32s
driver / standard (pull_request) Failing after 15s
driver / types (pull_request) Successful in 1m5s
driver / test (3.13) (pull_request) Successful in 1m14s
driver / test (3.12) (pull_request) Successful in 1m19s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 13s
_version_key compared the text between numbers as plain strings, so
'.el' outranked '.' and 6.12.0-208.112.5.el9uek counted as newer than
the running 6.12.0-208.112.5.1.el9uek: an Oracle Linux host asked to
reboot into an older kernel, and a reboot never cleared it. The
releases now compare like rpmvercmp: separators only separate, a
number is newer than letters in its place, and '~' comes before
anything. Checked against rpm.labelCompare on Oracle Linux 9.

Closes #109
2026-11-12 11:03:46 +01:00
christianmanivong 304f404567 fix(host-status): an Oracle Linux host's UEK kernels are not an interrupted dnf (4.36.1)
driver / test (3.13) (pull_request) Successful in 1m12s
driver / lowest (pull_request) Successful in 41s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 56s
CI / driver (pull_request) Successful in 2m26s
driver / lint (pull_request) Successful in 16s
driver / standard (pull_request) Successful in 18s
driver / types (pull_request) Successful in 59s
driver / test (3.12) (pull_request) Successful in 1m17s
driver / publish (pull_request) Skipped
The installonly packages were dnf's upstream defaults plus dnf.conf's.
Oracle builds kernel-uek and its parts into libdnf's defaults, and the
UEK packages provide nothing of upstream's list, so every host with more
than one UEK kernel was reported as left halfway. The defaults are now
also asked of the host's libdnf through its Python binding; upstream's
list stays the floor for dnf 5 and yum.

Closes #107
2026-11-12 10:30:48 +01:00
christianmanivong bc47220318 Merge remote-tracking branch 'origin/main' into feat/time-sync-dhcp-ntp-2380
driver / lowest (pull_request) Successful in 1m3s
driver / build (pull_request) Successful in 48s
driver / security (pull_request) Successful in 1m26s
CI / driver (pull_request) Successful in 3m17s
driver / standard (pull_request) Successful in 19s
driver / types (pull_request) Successful in 1m34s
driver / test (3.13) (pull_request) Successful in 1m32s
driver / test (3.12) (pull_request) Successful in 1m52s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 15s
# Conflicts:
#	CHANGELOG.md
#	pyproject.toml
2026-11-11 22:21:34 +01:00
christianmanivong ac38c68feb feat(time-sync): DHCP-provided NTP servers count and are read apart
driver / test (3.13) (pull_request) Successful in 1m29s
driver / lowest (pull_request) Successful in 41s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 3m22s
driver / standard (pull_request) Successful in 17s
driver / types (pull_request) Successful in 1m16s
driver / test (3.12) (pull_request) Successful in 1m33s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 31s
A device that gets the site's time giver through DHCP option 42 is
aligned (NetOrk/netork#2380): most clients already learn it that way.
4.35.0 switched that off on every write -- chrony's DHCP sourcedir was
commented out, and systemd-timesyncd's link servers failed the verify
step -- and folded DHCP's servers into ntp_servers, so an application
could not tell configured from DHCP-provided servers.

TimeSyncDict gains dhcp_ntp_servers (not required): the servers the
device got by DHCP and uses, in its order; [] for none, absent or None
where the driver cannot tell. ntp_servers keeps only the configured ones.

PosixTimeSyncMixin reads chrony's sources from the DHCP client's
sourcedir (CHRONY_DHCP_DIRS, /run/chrony-dhcp by default) as chronyd
reads them, and systemd-timesyncd's LinkNTPServers; ntpd and OpenNTPD
keep DHCP's servers in a configuration of their own, so there it is
unknown. A chrony write now comments out only server, pool and peer
lines and leaves every sourcedir and the DHCP client's files alone. A
DHCP sourcedir that 4.35.0 commented out behind the mark is given back
on the next write, with a restart, so hosts it aligned hear DHCP again.

Version 4.36.0.
2026-11-11 22:08:52 +01:00
christianmanivong c74173523a fix(dhcp): one refused reservation no longer stops the apply
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 38s
driver / security (pull_request) Successful in 1m11s
CI / driver (pull_request) Failing after 2m57s
driver / standard (pull_request) Failing after 22s
driver / types (pull_request) Successful in 1m22s
driver / test (3.12) (pull_request) Successful in 1m28s
driver / test (3.13) (pull_request) Successful in 1m26s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 18s
apply_dhcp_reservationset wrote the diff one reservation at a time and
committed only after the last. A write the device refused -- on
OPNsense, an address in a subnet Kea does not manage -- ended the run
before the commit: every later reservation went unwritten, and the
earlier ones stayed saved but inactive. The next diff read those back as
configured, reported no changes and never committed them.

A refused change now gets a "[failed] <mac> -> <ip>: <reason>" line and
the others are still written. Any non-empty diff commits, also one whose
every write was refused, so writes an interrupted earlier run saved take
effect. DhcpApplyError (a RuntimeError, exported) is raised after the
commit with how many of how many changes were refused.

Refs NetOrk/netork#2381
2026-11-11 22:03:52 +01:00
christianmanivong 073087da69 feat(time-sync): TimeSyncMixin, PosixTimeSyncMixin and the posix_tz helpers
driver / test (3.13) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 26s
driver / security (pull_request) Successful in 1m0s
CI / driver (pull_request) Successful in 2m23s
driver / standard (pull_request) Successful in 19s
driver / lint (pull_request) Successful in 19s
driver / types (pull_request) Successful in 57s
driver / test (3.12) (pull_request) Successful in 1m14s
driver / publish (pull_request) Skipped
netOrk gets one list of NTP servers and a time zone per site and aligns
every device that differs (NetOrk/netork#2360). The contract comes first,
so the drivers can be built against it at the same time (#2361):

TimeSyncMixin declares get_time_sync() -> TimeSyncDict (servers in the
device's order, the zone as an IANA name, synchronised, the client) and
carries configure_time_sync(ntp_servers=None, timezone=None) as a fix
template: None leaves a value alone, the device ends up with exactly the
servers given, and a verify step reads it back. time_sync_writes says
which of the two values a driver writes; anything else, an unknown zone,
a malformed server or an empty list is refused before anything is
written.

PosixTimeSyncMixin implements it over run_command for Linux-like hosts:
one reading as the login user (timedatectl, chrony's configuration and
chronyc, timedatectl show-timesync, ntpd and OpenNTPD), the zone through
timedatectl set-timezone, chrony's servers in a file of their own with
every other source commented out, systemd-timesyncd's in a drop-in that
resets NTP= and empties FallbackNTP=. ntpd and OpenNTPD are read only.

posix_tz moves here from netOrk, so OpenWrt can write the POSIX rule and
a switch the UTC offset and summer-time rule (parse_posix_tz). It reads
the tzdata package, now a dependency.

Release 4.35.0: the drivers that implement it need it on PyPI.
2026-11-11 14:30:36 +01:00
christianmanivong 56e5e82a59 feat(running-backups): the backups running on a device right now
driver / test (3.13) (pull_request) Successful in 1m5s
driver / lowest (pull_request) Successful in 37s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 59s
CI / driver (pull_request) Successful in 2m24s
driver / standard (pull_request) Successful in 19s
driver / types (pull_request) Successful in 1m2s
driver / test (3.12) (pull_request) Successful in 1m15s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 17s
A restart aborts every backup that runs on the device it restarts, and a
guest's restart breaks the backup its hypervisor is taking of it. netOrk
asks right before it restarts a host after patching (NetOrk/netork#2318),
so the reading belongs in the contract first: RunningBackupsMixin declares
get_running_backups(), opt-in like VmStopRequestMixin, so hasattr tells a
caller whether the driver can tell at all.

Release 4.34.0: the drivers that implement it need it on PyPI.
2026-11-10 23:39:17 +01:00
christianmanivong 92891473be fix(host-status): keep models.py at its recorded size, one literal for the dnf query
driver / test (3.13) (pull_request) Successful in 1m5s
driver / lowest (pull_request) Successful in 40s
driver / build (pull_request) Successful in 36s
driver / security (pull_request) Successful in 1m6s
CI / driver (pull_request) Successful in 2m38s
driver / standard (pull_request) Successful in 14s
driver / types (pull_request) Successful in 58s
driver / test (3.12) (pull_request) Successful in 1m11s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 13s
The quality ratchet records models.py at 1454 lines and the new comments
had made it 1460. bandit read the dnf history query, built with an
f-string for its path, as SQL put together from strings (B608); it is a
fixed query, now one literal with the path spelt out, and a test holds
it to DNF_HISTORY.

Refs NetOrk/netork#851
2026-11-07 20:14:11 +01:00
christianmanivong 658f1c8ab2 Merge remote-tracking branch 'origin/main' into feat/interrupted-pm-851
# Conflicts:
#	CHANGELOG.md
2026-11-07 20:14:11 +01:00
christianmanivong 1d71ff8f91 feat(ssh-server): read how sshd lets people log in
driver / test (3.13) (pull_request) Successful in 1m25s
driver / lowest (pull_request) Successful in 44s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 2m48s
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Successful in 17s
driver / types (pull_request) Successful in 1m10s
driver / test (3.12) (pull_request) Successful in 1m32s
driver / publish (pull_request) Skipped
SshServerAuthMixin.get_ssh_server_auth() reads the authentication settings
from sshd -T as root (password, keyboard-interactive, public key, host-based,
GSSAPI, AuthenticationMethods, PermitRootLogin, UsePAM) and, with PAM on, the
modules of sshd's PAM auth stack from /etc/pam.d with its includes followed.
It reports the facts; whether a module is a second factor is the consumer's
call. OpenSshServerMixin carries it and both read sshd -T by the same fixed
command, so every driver that can harden sshd can say this too.

Refs NetOrk/netork#662
2026-11-07 15:09:47 +01:00
christianmanivong 58ed0f0a94 feat(host-status): tell an interrupted dnf, yum, apk or opkg
driver / lowest (pull_request) Successful in 39s
driver / build (pull_request) Successful in 36s
driver / test (3.13) (pull_request) Successful in 2m14s
driver / security (pull_request) Failing after 1m1s
CI / driver (pull_request) Failing after 2m42s
driver / standard (pull_request) Failing after 18s
driver / types (pull_request) Successful in 1m9s
driver / test (3.12) (pull_request) Successful in 1m22s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 17s
get_host_status() read only dpkg's state. It now also reads the rpm
database and dnf's history (or yum's journal), apk's installed database
and opkg's status file, without root, and names the manager it read in
the new package_manager field. While one of them runs, the answer is
unknown, as for dpkg.

Refs NetOrk/netork#851
2026-11-07 14:44:55 +01:00
christianmanivong 98d1dbef4c fix(log-sources): attribute a file only to the process writing it
driver / test (3.13) (pull_request) Successful in 1m8s
driver / lowest (pull_request) Successful in 40s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 59s
CI / driver (pull_request) Successful in 2m25s
driver / standard (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m8s
driver / test (3.12) (pull_request) Successful in 1m15s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 14s
A process that holds a log open only to read it -- CrowdSec's
acquisition, Promtail, rsyslog imfile, a tail -F -- was named as the
file's writer whenever it had the lower pid. The command now reads each
descriptor's flags from /proc/<pid>/fdinfo in the same round trip, and
only an O_WRONLY or O_RDWR holder is the producer. A file only readers
hold stays listed without one; a file only a reader inside a container
holds is its view of a mount and is left out.

Refs: NetOrk/netork#2092
2026-11-06 18:45:31 +01:00
christianmanivong 8557710724 feat: where a host's logs go beyond it (4.31.0)
driver / test (3.13) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m2s
CI / driver (pull_request) Failing after 2m23s
driver / standard (pull_request) Failing after 17s
driver / types (pull_request) Successful in 1m8s
driver / test (3.12) (pull_request) Successful in 1m15s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 16s
get_log_sources() reads, in the same command, whether rsyslog runs, its
forwarding rules (legacy @/@@/:omrelp: and RainerScript omfwd/omrelp,
with selector, ruleset and whether they take every message), its imfile
inputs, and whether the journal reaches it (imjournal, or imuxsock with
journald's ForwardToSyslog; failing a setting, the default the
distribution ships commented out). Returned as `forwarding`;
parse_log_forwarding and parse_rsyslog are public (NetOrk/netork#2053).
2026-11-06 11:06:07 +01:00
christianmanivong 5daba5d37c feat: which logs a host writes, and who writes each (4.30.0)
driver / test (3.13) (pull_request) Successful in 1m11s
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m14s
CI / driver (pull_request) Failing after 2m45s
driver / standard (pull_request) Failing after 19s
driver / types (pull_request) Successful in 1m14s
driver / test (3.12) (pull_request) Successful in 1m18s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 20s
LogSourcesMixin.get_log_sources() reads, in one sh -c call as root, the
units journald holds entries for, the log files running processes hold
open (/proc/<pid>/fd: *.log, *.log.N, anything under /var/log) with size
and last write from stat -L on the descriptor, and the engine's own file
of each container's output as that container's stream. Each file names
the service or container of its first writer from /proc/<pid>/cgroup; a
file a container writes keeps the container's own path.

journald's store, deleted files and a database's write-ahead log
(LevelDB's 000004.log) are left out. Without root it reads again and says
so (attributed: false); a host whose find cannot list open files (busybox)
raises LogSourcesUnavailable rather than reading as no files.

Refs NetOrk/netork#2049
2026-11-05 00:24:24 +01:00
christianmanivong ac49e2b5d4 feat(local-accounts): remove_local_account_keys can clear the password too
driver / test (3.13) (pull_request) Successful in 1m15s
driver / lowest (pull_request) Successful in 39s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m2s
CI / driver (pull_request) Successful in 2m36s
driver / standard (pull_request) Successful in 19s
driver / types (pull_request) Successful in 1m1s
driver / test (3.12) (pull_request) Successful in 1m18s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 16s
A person who deletes their key loses the password that went with it in netOrk, but the devices kept it, and sudo with it. remove_local_account_keys(name, keys, clear_password=True) takes the keys, the password and sudo in one call; the account stays open. Each step runs when another failed.

See NetOrk/netork#2033.
2026-11-04 15:21:01 +01:00
christianmanivong 00452d0d37 feat(local-accounts): replace and remove keys, clear the password
driver / test (3.13) (pull_request) Successful in 1m10s
driver / lowest (pull_request) Successful in 40s
driver / build (pull_request) Successful in 39s
driver / security (pull_request) Successful in 1m16s
CI / driver (pull_request) Successful in 2m44s
driver / lint (pull_request) Successful in 15s
driver / standard (pull_request) Successful in 18s
driver / types (pull_request) Successful in 1m1s
driver / test (3.12) (pull_request) Successful in 1m21s
driver / publish (pull_request) Skipped
A person who replaces a key, deletes one or removes their password had
no way to see that reach the device: add_local_account only ever added
a key and kept the password.

add_local_account takes replaces=[...] (the old keys go, matched by
their base64, the person's own keys stay) and clear_password=True (the
account logs in with a key only and cannot have sudo).
remove_local_account_keys takes keys off an account and leaves it open.
Drivers supply _account_clear_password and may override
_account_drop_keys for a key store of their own.

See NetOrk/netork#2013
2026-11-04 11:47:46 +01:00
christianmanivong a70501ff60 Merge remote-tracking branch 'origin/main' into feature/scheduled-jobs
# Conflicts:
#	CHANGELOG.md
2026-11-03 08:33:52 +01:00
christianmanivong c6d119eb83 fix(scheduled-jobs): a monotonic timer as its unit file says it, OnUnitActiveSec
driver / lowest (pull_request) Successful in 43s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m8s
CI / driver (pull_request) Successful in 2m47s
driver / standard (pull_request) Successful in 14s
driver / types (pull_request) Successful in 57s
driver / test (3.12) (pull_request) Successful in 1m12s
driver / test (3.13) (pull_request) Successful in 1m14s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 13s
systemctl show names a timer's monotonic settings by their properties,
OnUnitActiveUSec=3h; the schedule now reads as the unit file writes it.
Found on a live Ubuntu host.

Refs #86
2026-11-03 08:11:48 +01:00
christianmanivong 847c902193 feat(ssh): SSHD_CONFIG_GENERATED keeps the hardening to the drop-in (#88)
A platform that writes sshd_config from its own database (OpenMediaVault)
had to opt out of harden_ssh_server altogether. Where that generated file
includes /etc/ssh/sshd_config.d, the drop-in is safe; only the fallback
that rewrites sshd_config itself would be undone on the next apply. With
SSHD_CONFIG_GENERATED set, a sshd_config without the include is left alone
and the result says why.
2026-11-03 07:56:46 +01:00
christianmanivong ffbb194300 fix(scheduled-jobs): a file without a last newline no longer swallows the next header
driver / build (pull_request) Successful in 32s
driver / lowest (pull_request) Successful in 41s
driver / security (pull_request) Successful in 1m13s
CI / driver (pull_request) Successful in 2m43s
driver / standard (pull_request) Successful in 15s
driver / types (pull_request) Successful in 1m4s
driver / test (3.12) (pull_request) Successful in 1m6s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 14s
GNU sed keeps a missing final newline, so the next section's header ran
on into the file's last line and its jobs were lost. The report ends
every such file with a newline of its own.

Refs #86
2026-11-03 05:50:44 +01:00
christianmanivong edef6cf07c fix(scheduled-jobs): write a linked crontab through its link, with the target's mode
driver / lowest (pull_request) Successful in 40s
driver / build (pull_request) Successful in 36s
driver / security (pull_request) Successful in 1m8s
CI / driver (pull_request) Successful in 2m54s
driver / standard (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m11s
driver / test (3.12) (pull_request) Successful in 1m25s
driver / test (3.13) (pull_request) Successful in 1m18s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 20s
stat without -L gave the link's own mode, 777, and install replaced the
link with a plain file of that mode: cron ignores a file anyone may write,
so every job in it stopped (/etc/cron.d/vzdump on older PVE links to
/etc/pve/vzdump.cron). The file the link names is written instead.

Refs #86
2026-11-03 05:39:57 +01:00
christianmanivong df476a12f2 feat(scheduled-jobs): the install command, time zone, owners and platform sources are the driver's
driver / lowest (pull_request) Successful in 39s
driver / build (pull_request) Successful in 30s
driver / security (pull_request) Successful in 1m6s
CI / driver (pull_request) Successful in 2m48s
driver / standard (pull_request) Successful in 17s
driver / types (pull_request) Successful in 1m7s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / test (3.12) (pull_request) Successful in 1m12s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 13s
A BSD install takes -D as a destdir, OpenWrt keeps its time zone in uci
and its package database in opkg, and a platform's generated files are its
own; each is a class attribute a driver sets.

Refs #86
2026-11-03 05:33:14 +01:00
christianmanivong 834cb2e0ea fix(scheduled-jobs): an own job goes to /etc/cron.d only where the host has it
driver / lowest (pull_request) Successful in 39s
driver / test (3.13) (pull_request) Successful in 1m21s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m7s
CI / driver (pull_request) Successful in 3m3s
driver / standard (pull_request) Successful in 19s
driver / types (pull_request) Successful in 1m12s
driver / test (3.12) (pull_request) Successful in 1m21s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 15s
BusyBox crond reads no /etc/cron.d, so an Alpine host without systemd
takes the job in the user's crontab instead of a file it would never run.

Refs #86
2026-11-03 05:30:19 +01:00
christianmanivong f573fa53d2 feat(scheduled-jobs): ScheduledJobsMixin and its POSIX implementation (#86)
driver / lowest (pull_request) Successful in 46s
driver / build (pull_request) Successful in 43s
driver / security (pull_request) Successful in 1m27s
CI / driver (pull_request) Successful in 3m11s
driver / standard (pull_request) Successful in 20s
driver / types (pull_request) Successful in 1m16s
driver / test (3.13) (pull_request) Successful in 1m18s
driver / test (3.12) (pull_request) Successful in 1m27s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 23s
What a host runs on its own schedule as one shape: cron lines, run-parts
scripts, anacron, systemd timers, periodic, a platform's own jobs, Windows
tasks. Every job says who owns its definition and what the driver can do
to it; every write names the digest the caller saw and is refused when the
host's definition changed since.

PosixScheduledJobsMixin reads everything in one framed report as root,
switches a cron line behind #napalm-disabled:, a timer by systemctl and a
run-parts script by its execute bit, runs a job now bounded by timeout, and
writes an application's job as a timer where systemd runs, else in
/etc/cron.d or the user's crontab. napalm_device_types.cron parses cron
expressions, gives their next runs and writes them as OnCalendar lines.

get_cron_jobs and CronJobDict go: nothing called them.

Version 4.26.0, so drivers can require it before the release is tagged.

Closes #86
2026-11-03 05:29:27 +01:00
christianmanivong 95e3aa1e26 feat(backup): BackupServerDriver, a role base for backup servers (#82)
driver / test (3.13) (pull_request) Successful in 1m7s
driver / lowest (pull_request) Successful in 30s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 58s
CI / driver (pull_request) Successful in 2m22s
driver / standard (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m6s
driver / test (3.12) (pull_request) Successful in 1m15s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 15s
A backup server keeps datastores, one backup group per source with its
snapshots, and the jobs that keep them healthy: garbage collection,
verify, prune, sync and tape. None of that is a pool, a volume or a
replication job, so it is a role of its own instead of being bent into
StorageDriver. A server that manages its own disks lists StorageDriver
second.

The role declares the reads (datastores, groups with their newest
snapshot, a group's snapshots, jobs, remotes) and the actions (garbage
collection, running a job, verifying, protecting and deleting a
snapshot), which start a task and return its id for get_backup_task.
The shapes live in napalm_device_types.backups.

ClusterStorageDict gains an optional backup_server: which server,
datastore and namespace a hypervisor's backup storage writes to, with
the fingerprint it pins. Matching that to a server is the application's.
2026-11-02 20:46:40 +01:00
christianmanivong 2542081c6f feat(lldp): report the neighbour's chassis MAC in lldp_neighbors
driver / test (3.13) (pull_request) Successful in 1m12s
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 31s
driver / security (pull_request) Successful in 1m13s
CI / driver (pull_request) Failing after 3m1s
driver / standard (pull_request) Successful in 20s
driver / lint (pull_request) Failing after 15s
driver / types (pull_request) Successful in 1m13s
driver / test (3.12) (pull_request) Successful in 1m19s
driver / publish (pull_request) Skipped
An application matches an LLDP neighbour by its chassis MAC first, and
napalm-linux and napalm-netgear report it as mac; the projection did
not, so every driver built on it would have reported neighbours by name
only (NAPALM/napalm-openwrt#31). lldp_neighbors now carries mac, lower
case, when the chassis id is a MAC address (LldpNeighborDict).
2026-11-02 08:50:50 +01:00
christianmanivong 4427be35cc feat(lldp): parse lldpctl keyvalue into one row per neighbour
driver / test (3.13) (pull_request) Successful in 1m3s
driver / lowest (pull_request) Successful in 50s
driver / build (pull_request) Successful in 37s
driver / security (pull_request) Successful in 1m18s
CI / driver (pull_request) Failing after 3m7s
driver / standard (pull_request) Successful in 16s
driver / lint (pull_request) Failing after 16s
driver / types (pull_request) Successful in 1m8s
driver / test (3.12) (pull_request) Successful in 1m18s
driver / publish (pull_request) Skipped
napalm-linux, napalm-openwrt and napalm-proxmox each parsed lldpd's
neighbours on their own, and the copies grouped lines by interface (two
neighbours on one port merged), cut the interface name at its first dot
and looked for chassis.id.value, a key lldpd never prints. The parse
lives here once now: neighbours are split at their via line, the
interface name runs up to the neighbour's first field, ids are read
under the type lldpd prints them with, and a failed lldpctl raises.

The rows project into NAPALM's two LLDP shapes with lldp_neighbors and
lldp_neighbors_detail, the projection part of #10.

Refs #10
2026-11-02 08:42:10 +01:00
christianmanivong f337ae7fb8 fix(updates): read dnf's security advisories from the cached metadata
driver / lowest (pull_request) Successful in 32s
driver / build (pull_request) Successful in 25s
driver / security (pull_request) Successful in 57s
CI / driver (pull_request) Successful in 2m27s
driver / standard (pull_request) Successful in 15s
driver / types (pull_request) Successful in 55s
driver / test (3.12) (pull_request) Successful in 1m2s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 13s
DNF_SECURITY_COMMAND ran `dnf updateinfo list --security`, which downloads
the repositories' metadata first whenever the cached copy has expired. On an
Oracle Linux host on OCI that took longer than netOrk's whole 120 s poll.
It now runs with --cacheonly, as APT_UPGRADABLE_COMMAND reads apt's local
index; refreshing stays `dnf makecache`. Without a cache dnf fails at once,
and the __DNF_RC marker already turns that into "security unknown".

Closes #76
2026-11-02 08:07:48 +01:00
christianmanivong 516fb18c0e Merge remote-tracking branch 'origin/main' into feat/tls-fingerprint-tofu
driver / test (3.13) (pull_request) Successful in 1m14s
driver / lowest (pull_request) Successful in 34s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 59s
CI / driver (pull_request) Failing after 2m34s
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 15s
driver / types (pull_request) Failing after 1m35s
driver / test (3.12) (pull_request) Successful in 1m27s
driver / publish (pull_request) Skipped
# Conflicts:
#	CHANGELOG.md
2026-11-02 00:06:53 +01:00
christianmanivong 51e8c849bb Merge remote-tracking branch 'origin/main' into feat/lldp-agent-template
driver / test (3.13) (pull_request) Successful in 1m6s
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 33s
driver / security (pull_request) Successful in 1m10s
CI / driver (pull_request) Successful in 2m45s
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m6s
driver / test (3.12) (pull_request) Successful in 1m14s
driver / publish (pull_request) Skipped
# Conflicts:
#	CHANGELOG.md
2026-11-02 00:01:46 +01:00
christianmanivong e98d4763f3 Merge remote-tracking branch 'origin/main' into feat/health-profile-unknown
driver / lowest (pull_request) Successful in 40s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m11s
CI / driver (pull_request) Successful in 2m57s
driver / standard (pull_request) Successful in 19s
driver / types (pull_request) Successful in 1m7s
driver / test (3.12) (pull_request) Successful in 1m8s
driver / test (3.13) (pull_request) Successful in 1m9s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 18s
# Conflicts:
#	CHANGELOG.md
2026-11-01 23:56:39 +01:00
christianmanivong f4354f498e refactor: the SNMP health profile shapes in snmp_health_profile.py
models.py is over the file size limit and may not grow; the unknown
key pushed it past its recorded length. SnmpHealthProfile,
SnmpValueSpec, SnmpMemorySpec and SnmpInterfacesSpec move to
napalm_device_types/snmp_health_profile.py. The package exports them
as before and models re-exports them, so existing imports keep working.
The baseline records the smaller models.py.
2026-11-01 23:05:13 +01:00
christianmanivong c9571d59f1 Merge remote-tracking branch 'origin/main' into feat/tls-fingerprint-tofu
# Conflicts:
#	CHANGELOG.md
2026-11-01 23:01:38 +01:00