58c7616401c7ea05a4c93caf02e378f871a79e9f
60
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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 |
||
|
|
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 / lint (pull_request) Successful in 16s
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
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). |
||
|
|
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 / lint (pull_request) Successful in 20s
driver / types (pull_request) Successful in 1m14s
driver / test (3.12) (pull_request) Successful in 1m18s
driver / publish (pull_request) Skipped
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 |
||
|
|
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 / lint (pull_request) Successful in 23s
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
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 |
||
|
|
95e3aa1e26 |
feat(backup): BackupServerDriver, a role base for backup servers (#82)
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 / lint (pull_request) Successful in 15s
driver / standard (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m6s
driver / test (3.13) (pull_request) Successful in 1m7s
driver / test (3.12) (pull_request) Successful in 1m15s
driver / publish (pull_request) Skipped
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. |
||
|
|
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). |
||
|
|
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 |
||
|
|
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 |
||
|
|
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 |
||
|
|
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 / lint (pull_request) Successful in 18s
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
# Conflicts: # CHANGELOG.md |
||
|
|
46c1c9dc4e |
feat: TLS certificates by trust on first use
driver / test (3.13) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Successful in 38s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 1m13s
CI / driver (pull_request) Failing after 3m4s
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 20s
driver / types (pull_request) Failing after 1m10s
driver / test (3.12) (pull_request) Successful in 1m14s
driver / publish (pull_request) Skipped
Devices ship self-signed certificates, so a driver either fails the CA check on every one of them or turns verification off and sends the login to whatever answers on the address. tls_certificates pins the certificate by its SHA-256 fingerprint instead, shaped like ssh_host_keys: the caller passes the fingerprint to expect by port (optional_args["tls_fingerprints"]), the driver refuses any other certificate before a request carries credentials, and every certificate seen goes to optional_args["tls_certificate_observer"]. Without a fingerprint the first certificate is accepted. CertificateCheck checks the certificate in a handshake of its own, then pins a requests session to it (urllib3's assert_fingerprint, direct and through a proxy), so no other host can step in between the check and the login. Refs NAPALM/napalm-hpe-aruba-procurve#17 |
||
|
|
bc17862a44 |
feat(fixes): configure_lldp_agent(interfaces) template
driver / lowest (pull_request) Successful in 30s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 58s
CI / driver (pull_request) Successful in 2m32s
driver / standard (pull_request) Successful in 15s
driver / lint (pull_request) Successful in 12s
driver / types (pull_request) Successful in 57s
driver / test (3.12) (pull_request) Successful in 1m7s
driver / test (3.13) (pull_request) Successful in 56s
driver / publish (pull_request) Skipped
LLDP getters used to install, start and reconfigure lldpd on their own, on every poll. Getters only read now, so starting the agent needs an action the application calls. The template installs the agent through ensure_package, has the driver write the interfaces it runs on, then enables and restarts it through manage_service. The caller names the interfaces: an agent on every interface also advertises on a WAN port. Refs NAPALM/napalm-openwrt#8 |
||
|
|
9f6ffa8a25 |
feat(snmp): let a health profile mark a value unknown
driver / lowest (pull_request) Successful in 35s
driver / build (pull_request) Successful in 27s
driver / security (pull_request) Successful in 1m1s
CI / driver (pull_request) Failing after 2m30s
driver / standard (pull_request) Failing after 15s
driver / lint (pull_request) Successful in 13s
driver / types (pull_request) Successful in 58s
driver / test (3.12) (pull_request) Successful in 1m3s
driver / test (3.13) (pull_request) Successful in 56s
driver / publish (pull_request) Skipped
SnmpValueSpec gains `unknown`. A driver whose device's agent answers a value wrongly says so in its SNMP_HEALTH_PROFILE, and the application reports no value for it instead of the standard reading or a default. OpenBSD's net-snmp reports the CPU as never idle, so a reading of ssCpuIdle shows every OpenBSD host at 100 % (NAPALM/napalm-bsd#7). |
||
|
|
4150570a94 |
feat: VMProvisionIncomplete names the VM a failed creation left behind
driver / test (3.13) (pull_request) Successful in 1m6s
driver / lowest (pull_request) Successful in 37s
driver / build (pull_request) Successful in 35s
driver / security (pull_request) Successful in 1m15s
CI / driver (pull_request) Failing after 3m1s
driver / standard (pull_request) Failing after 17s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m5s
driver / test (3.12) (pull_request) Successful in 1m13s
driver / publish (pull_request) Skipped
create_vm_from_cloud_init raised a plain error once the VM existed, so the caller had no id to remove it by. The new RuntimeError carries vmid and node, with the failure as its cause; a failure before the VM exists raises as before. Refs NAPALM/napalm-proxmox#28 |
||
|
|
cb90fa9835 |
feat: SudoHistoryMixin, the sudo password left in shell histories (NetOrk/netork#1090)
driver / lowest (pull_request) Failing after 33s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m8s
CI / driver (pull_request) Failing after 2m24s
driver / standard (pull_request) Failing after 7s
driver / lint (pull_request) Successful in 20s
driver / types (pull_request) Successful in 1m8s
driver / test (3.12) (pull_request) Failing after 1m9s
driver / test (3.13) (pull_request) Failing after 1m3s
driver / publish (pull_request) Skipped
A driver that typed `echo '<password>' | sudo -S -p "" <command>` into an interactive shell left that line, password and all, in the login user's shell history once per command, and where only the part before the first `&&` ran as root, files root should own were left to the login user. get_history_sudo_lines() counts the lines per history file with grep -c, as the login user, without reading any back. remove_history_sudo_lines() deletes exactly those lines with sed -i, overwrites the backup with shred -u, and as root gives the driver's SUDO_ROOT_FILES back to root:root where each is a regular file, not a link, owned by the login user. It reports each file's lines before and after. Nothing goes to stdin. The driver names the marker and the files and supplies run_command. |
||
|
|
0dc1a598e2 |
Merge remote-tracking branch 'origin/main' into feat/network-target-uplinks
driver / lowest (pull_request) Successful in 32s
driver / test (3.13) (pull_request) Successful in 59s
driver / build (pull_request) Successful in 28s
driver / security (pull_request) Successful in 1m5s
CI / driver (pull_request) Successful in 3m1s
driver / standard (pull_request) Successful in 24s
driver / lint (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m2s
driver / test (3.12) (pull_request) Successful in 1m9s
driver / publish (pull_request) Skipped
# Conflicts: # CHANGELOG.md |
||
|
|
a5b7b540c6 |
feat: NetworkTargetDict.uplinks, the NICs a bridge leaves through (NetOrk/netork#1325)
driver / lowest (pull_request) Successful in 36s
driver / build (pull_request) Successful in 32s
driver / security (pull_request) Successful in 1m12s
CI / driver (pull_request) Successful in 2m47s
driver / standard (pull_request) Successful in 18s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m1s
driver / test (3.12) (pull_request) Successful in 1m3s
driver / test (3.13) (pull_request) Successful in 59s
driver / publish (pull_request) Skipped
A VM on a VLAN-aware bridge without a VLAN tag only gets an address when the switch port behind the bridge carries an untagged network. To find that port, the caller needs the bridge's physical NICs: their LLDP neighbours name the switch and the port. uplinks lists them in groups, one per way out of the bridge: a bond's slaves together, a single NIC alone. A bond is one link, so a caller can let one slave's neighbour speak for the others when lldpd sees only one. Internal, VLAN and virtual ports are no uplinks. A missing key means the driver cannot tell; an empty list is a bridge without uplink. |
||
|
|
874c6c5a92 |
feat: ARP_AGE_UNKNOWN, the age of a neighbour the device does not report
driver / lowest (pull_request) Successful in 31s
driver / build (pull_request) Successful in 35s
driver / security (pull_request) Successful in 1m15s
CI / driver (pull_request) Successful in 3m3s
driver / standard (pull_request) Successful in 17s
driver / lint (pull_request) Successful in 18s
driver / types (pull_request) Successful in 1m12s
driver / test (3.12) (pull_request) Successful in 1m13s
driver / test (3.13) (pull_request) Successful in 1m8s
driver / publish (pull_request) Skipped
NAPALM requires an age on every entry of get_arp_table and get_ipv6_neighbors_table. Many devices do not report one, and drivers filled in 0.0, which means "confirmed just now". ARP_AGE_UNKNOWN (-1.0, as NAPALM's IOS driver reports) is the value for "not reported"; the README states the contract. NetOrk/netork#1327 |
||
|
|
fbd3cf0129 |
chore: Python 3.12 is the floor (NAPALM/driver-standard#6)
driver / lowest (pull_request) Failing after 30s
driver / build (pull_request) Successful in 31s
driver / security (pull_request) Successful in 1m13s
CI / driver (pull_request) Failing after 2m50s
driver / standard (pull_request) Successful in 21s
driver / lint (pull_request) Successful in 14s
driver / types (pull_request) Successful in 1m3s
driver / test (3.12) (pull_request) Successful in 1m2s
driver / test (3.13) (pull_request) Successful in 1m0s
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. |
||
|
|
4d3574cd60 |
feat: shutdown_host and begin_stop_vm, shutting down without waiting
driver / test (3.10) (pull_request) Failing after 6s
driver / test (3.11) (pull_request) Successful in 1m13s
driver / test (3.13) (pull_request) Successful in 1m1s
driver / lowest (pull_request) Successful in 43s
driver / build (pull_request) Successful in 29s
driver / security (pull_request) Successful in 1m8s
CI / driver (pull_request) Failing after 2m41s
driver / lint (pull_request) Successful in 18s
driver / standard (pull_request) Successful in 20s
driver / types (pull_request) Successful in 1m4s
driver / test (3.12) (pull_request) Successful in 1m8s
driver / publish (pull_request) Skipped
HostShutdownMixin.shutdown_host(), on DeviceTypeDriver: a device shuts itself down cleanly through its own means; declared, so hasattr says whether a driver can. There is no forced variant. VmStopRequestMixin.begin_stop_vm(name): ask for a VM's clean shutdown and return at once, for a caller that waits on a timer and reads get_vm_status instead of blocking in stop_vm. No role demands it. For netOrk's graph workflows, which switch a hypervisor off when CI has nothing for it (NetOrk/netork#1636). |
||
|
|
a07ced2df6 |
Merge branch 'main' into feat/apt-proxy-verify
driver / test (3.10) (pull_request) Successful in 50s
driver / test (3.11) (pull_request) Successful in 48s
driver / lowest (pull_request) Successful in 24s
driver / security (pull_request) Successful in 46s
driver / build (pull_request) Successful in 23s
CI / driver (pull_request) Successful in 7m2s
driver / standard (pull_request) Successful in 13s
driver / lint (pull_request) Successful in 1m24s
driver / types (pull_request) Successful in 44s
driver / test (3.12) (pull_request) Successful in 48s
driver / test (3.13) (pull_request) Successful in 41s
driver / publish (pull_request) Skipped
The NAPALM driver standard landed on main (#52, 4.21.1). apt_proxy follows it: builtin generics, strict mypy, complexity 10 at most (parse_apt_proxy, same_proxy_url and the comment-out step split into helpers), 100 % covered. Its TypedDicts live in apt_proxy.py, since models.py is over 1000 lines and may not grow. Version 4.22.0 with its CHANGELOG section. |
||
|
|
d7ec558933 |
feat: AptProxyMixin, what apt fetches through and pointing it at a proxy (NetOrk/netork#1397)
CI / test (3.10) (push) Successful in 31s
CI / test (3.11) (push) Successful in 30s
CI / test (3.13) (push) Successful in 33s
CI / test (3.10) (pull_request) Successful in 30s
CI / test (3.12) (pull_request) Successful in 29s
CI / test (3.13) (pull_request) Successful in 29s
CI / test (3.12) (push) Successful in 30s
CI / test (3.11) (pull_request) Successful in 28s
apt reads apt.conf.d in order and apt.conf last; the last value wins. The Debian installer writes its proxy into apt.conf, Ubuntu's into 90curtin-aptproxy: reading 00proxy alone missed both, and a fix that wrote 00proxy and read it back reported success while apt fetched elsewhere. - get_package_proxy_report(): apt-config dump's proxy, per-host overrides, auto-detect, every line of apt's files that sets it (in reading order, editable or inside a block), the http and https sources. - check_package_proxy(url, expect): a fetch with apt-helper, past any proxy; an HTTP error counts as an answer. - configure_package_proxy(url): write 00proxy, comment out other proxy lines, read apt's proxy back, fetch one InRelease through it. - same_proxy_url(): scheme, host and port, a trailing slash aside. A driver supplies _run_apt_command, _run_apt_root_command and _write_apt_file. Version 4.22.0. |
||
|
|
0475184684 |
chore: adopt the NAPALM driver standard
driver / test (3.10) (pull_request) Successful in 1m43s
driver / test (3.11) (pull_request) Failing after 9m18s
driver / test (3.13) (pull_request) Successful in 1m4s
driver / lowest (pull_request) Failing after 1m38s
driver / security (pull_request) Failing after 4m33s
driver / build (pull_request) Failing after 1m29s
CI / driver (pull_request) Failing after 24m6s
driver / standard (pull_request) Successful in 54s
driver / lint (pull_request) Successful in 50s
driver / types (pull_request) Failing after 1m17s
driver / test (3.12) (pull_request) Failing after 1m20s
driver / publish (pull_request) Skipped
- CI moves to .gitea/workflows/ci.yml and calls the shared driver workflow of NAPALM/driver-standard: conformance, ruff, strict mypy, tests on 3.10-3.13 and at the lowest declared versions, bandit, pip-audit, build, and on a release tag the upload to PyPI. - tests/quality_baseline.json records today's long and complex functions and the one file over 1000 lines; they may shrink, not grow. - Coverage floor 95 % (measured 95.15 %). - CHANGELOG.md starts here; project links point at git.netork.io; the license is the SPDX string PEP 639 wants. |
||
|
|
08296d0d2e |
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). typing.List/Dict/Optional become builtin generics and X | None, imports are sorted, the coding cookies are gone. Two tests that read the source text follow the new spelling. What ruff cannot fix comes in the next commit. |
||
|
|
f77091c489 |
feat: HostFirewallMixin, a Linux host's own netfilter rules (NetOrk/netork#1344)
CI / test (3.10) (push) Successful in 40s
CI / test (3.11) (push) Successful in 25s
CI / test (3.13) (push) Successful in 51s
CI / test (3.10) (pull_request) Successful in 24s
CI / test (3.12) (pull_request) Successful in 27s
CI / test (3.13) (pull_request) Successful in 25s
CI / test (3.12) (push) Successful in 25s
CI / test (3.11) (pull_request) Successful in 26s
get_host_firewall() reads `nft -j list ruleset` as root and returns every chain with its family, table, hook, priority and policy, and every rule as matches and a verdict. Rules iptables-nft wrote show their extensions in nft's JSON only as an opaque `xt`, so the tables iptables manages are taken from iptables-save instead; a legacy iptables is kept beside nft's tables, since both apply. A condition the parse does not model is an `unknown` match with its text, never left out. Without root neither tool can be read, and HostFirewallUnavailable is raised rather than a host without rules. A driver supplies only _run_host_firewall_command(command, privileged=). Version 4.21.0. |
||
|
|
cce26eff44 |
feat: ServicePackagesMixin, which packages a systemd service is (NetOrk/netork#1236)
CI / test (3.10) (push) Failing after 17s
CI / test (3.11) (push) Failing after 14s
CI / test (3.13) (push) Failing after 16s
CI / test (3.10) (pull_request) Failing after 17s
CI / test (3.12) (pull_request) Failing after 20s
CI / test (3.13) (pull_request) Failing after 26s
CI / test (3.12) (push) Failing after 15s
CI / test (3.11) (pull_request) Failing after 15s
get_service_packages() returns, per systemd service, the installed packages it is made of: the one shipping its unit file and the one shipping the binary its ExecStart runs -- not the libraries that binary links against. One read-only command: systemctl show for every loaded service unit, then one dpkg -S for all paths (each also across the /usr merge), or rpm -qf per path. The report is framed; one cut short raises. A driver supplies _run_service_packages_command, as for KernelFactsMixin. Version 4.20.0. |
||
|
|
94bf399d34 |
feat: ssh_host_keys.HostKeyCheck, trust on first use (NetOrk/netork#1167)
CI / test (3.10) (push) Successful in 35s
CI / test (3.11) (push) Successful in 41s
CI / test (3.13) (push) Successful in 33s
CI / test (3.10) (pull_request) Successful in 29s
CI / test (3.12) (pull_request) Successful in 33s
CI / test (3.13) (pull_request) Successful in 40s
CI / test (3.12) (push) Successful in 38s
CI / test (3.11) (pull_request) Successful in 28s
Drivers get the host keys to expect in optional_args["ssh_host_keys"] (by port) and report what they saw through optional_args["ssh_host_key_observer"]. With a known key, any other key is refused before authentication (SshHostKeyMismatch); without one, the first key is accepted. One implementation for paramiko (HostKeyCheck.connect) and netmiko (HostKeyCheck.netmiko + observe). A caller or driver that ignores both keys keeps working as before. Version 4.19.0. |
||
|
|
2bd7bcc77c |
feat: the configuration that says which services run together (4.17.0)
CI / test (3.10) (push) Successful in 29s
CI / test (3.11) (push) Successful in 24s
CI / test (3.13) (push) Successful in 27s
CI / test (3.10) (pull_request) Successful in 26s
CI / test (3.12) (pull_request) Successful in 27s
CI / test (3.13) (pull_request) Successful in 26s
CI / test (3.12) (push) Successful in 27s
CI / test (3.11) (pull_request) Successful in 25s
ServiceClustersMixin.get_service_clusters() -> ServiceClustersDict
{patroni, adguardhome_sync, bunkerweb}: per mechanism the clusters the
host's configuration says it belongs to, each with its members (address,
port, name, role as the mechanism words it, this_host, config_from) and the
unit or container it was read from (source).
- Patroni: scope, name and restapi.connect_address from its YAML, then the
members and roles /cluster lists from the DCS.
- adguardhome-sync: ORIGIN_URL and REPLICA*_URL; the origin pushes to each
replica.
- BunkerWeb: a worker's API_WHITELIST_IP names the manager it admits, a
manager's BUNKERWEB_INSTANCES its workers.
Two hosts answering at one virtual IP prove nothing; this is the evidence
that they run one service (NetOrk/netork#1125). One generic command for
every Linux host, filtered on the host like the virtual IPs' one:
allowlisted fields only, URLs without user:password@, DCS endpoints stay
there. Root first, then without it; None per mechanism is "did not look".
|
||
|
|
9324a5b8f1 |
feat: fix routines as templates with the caller's values; deprecate run_device_action (4.13.0)
CI / test (3.10) (push) Successful in 34s
CI / test (3.11) (push) Successful in 31s
CI / test (3.13) (push) Successful in 27s
CI / test (3.10) (pull_request) Successful in 27s
CI / test (3.12) (pull_request) Successful in 28s
CI / test (3.13) (pull_request) Successful in 27s
CI / test (3.12) (push) Successful in 31s
CI / test (3.11) (pull_request) Successful in 28s
run_device_action was a string dispatch drivers filled with an application's remediations, values hard-coded inside (community "public", the caller's address, a /24 firewall rule). napalm_device_types.fixes declares them as templates instead. A template runs declared steps in order and stops at the first failure (run_fix_steps); the driver implements the steps, or overrides the whole method where its device takes the change in one call; every value comes from the caller. - SnmpAgentMixin.configure_snmp_agent(settings): install, configure, firewall, start. The caller verifies with its own SNMP client. get_management_peer() (optional) says the address the device sees the management connection come from, for choosing allowed_sources. - EnsurePackageMixin.ensure_package(name): install only what is missing. - PackageProxyMixin.configure_package_proxy(url): declared. - ContainerEngineMixin.grant_container_engine_access(user): declared. None is mixed into a role base, so a capability check stays truthful. Closes #33 |
||
|
|
b4c4ec0b0b |
feat: SnmpHealthProfile, the OIDs a driver declares; deprecate HealthMetricsMixin (4.12.0)
CI / test (3.10) (push) Successful in 28s
CI / test (3.11) (push) Successful in 27s
CI / test (3.13) (push) Successful in 30s
CI / test (3.10) (pull_request) Successful in 29s
CI / test (3.12) (pull_request) Successful in 35s
CI / test (3.13) (pull_request) Successful in 33s
CI / test (3.12) (push) Successful in 29s
CI / test (3.11) (pull_request) Successful in 26s
Drivers no longer collect over SNMP (docs/STRUCTURE.md). A driver whose device publishes its health values under OIDs of its own declares them as SNMP_HEALTH_PROFILE: per value either scalars asked in order or a table folded by first, average or max, optionally with a pattern for text answers; memory as total with used or free, or a percentage, in KiB or bytes; and how to read the interfaces. The application polls and computes. HealthMetricsMixin.get_health_metrics now warns that it is deprecated; it goes in 5.0. Closes #32 |
||
|
|
90367c1370 |
feat: an HA pair's DHCP peers and config sync as facts (4.11.0)
CI / test (3.10) (push) Successful in 26s
CI / test (3.11) (push) Successful in 24s
CI / test (3.13) (push) Successful in 26s
CI / test (3.10) (pull_request) Successful in 26s
CI / test (3.12) (pull_request) Successful in 27s
CI / test (3.13) (pull_request) Successful in 25s
CI / test (3.12) (push) Successful in 27s
CI / test (3.11) (pull_request) Successful in 24s
get_dhcp_ha (declared on DhcpServerMixin, optional) is what a DHCP server's own HA configuration says: on or off, this server's peer name, each peer's name, role as the server words it, and HA URL. ConfigSyncMixin.get_config_sync is where a host pushes its configuration and for which services, by the names get_services reports; sync items without a service name stay visible under `unmapped`. A driver mixes it in, no role promises it. Both raise when they could not read. What the facts mean for a pair -- hot standby, which side to write to -- is the caller's (NetOrk/netork#1125). |
||
|
|
0330f17a67 |
fix: keep CARP state knowledge out of the base package (4.10.1)
CI / test (3.10) (push) Successful in 25s
CI / test (3.11) (push) Successful in 24s
CI / test (3.13) (push) Successful in 25s
CI / test (3.10) (pull_request) Successful in 26s
CI / test (3.12) (pull_request) Successful in 26s
CI / test (3.13) (pull_request) Successful in 26s
CI / test (3.12) (push) Successful in 26s
CI / test (3.11) (pull_request) Successful in 24s
carp_virtual_ip() and its state table are CARP protocol knowledge; under the agreed structure (PR #37, docs/STRUCTURE.md) the base package carries only contracts, data shapes and I/O-free reconcilers. They move to the driver that speaks CARP (napalm-opnsense). The contract stays: VirtualIpsDict.carp and VirtualIpDict.holds. Nothing used the helper yet; it was released in 4.10.0 an hour ago. netOrk #1121. |
||
|
|
4f3b88db0e |
feat: CARP addresses as virtual IPs, with their holder in the reading (4.10.0)
CI / test (3.10) (push) Successful in 27s
CI / test (3.11) (push) Successful in 24s
CI / test (3.13) (push) Successful in 25s
CI / test (3.10) (pull_request) Successful in 26s
CI / test (3.12) (pull_request) Successful in 26s
CI / test (3.13) (pull_request) Successful in 26s
CI / test (3.12) (push) Successful in 27s
CI / test (3.11) (pull_request) Successful in 24s
A firewall pair's CARP addresses are a third virtual IP mechanism. Unlike vip-manager and keepalived, a CARP reading says who holds the address: a firewall's interface list need not show it, but CARP's state names the MASTER. - VirtualIpsDict gains carp (NotRequired), VirtualIpDict gains holds (NotRequired; None leaves the holder to the interfaces). - carp_virtual_ip() shapes one address bound to a VHID: MASTER holds, BACKUP stands by, INIT and DISABLED neither run nor hold, an unknown state says nothing. The same for OPNsense and pfSense; a driver supplies the fields. netOrk #1121. |
||
|
|
fde6d717a8 |
feat: SystemIdentityMixin reads a host's SMBIOS identity (4.9.0)
What ties a server to its BMC: the BMC reports the server's serial number and system UUID, the host reads the same values from its DMI tables. Both drivers that read DMI (napalm-linux, napalm-proxmox) had a copy of the shell for it, and neither read the board serial. SystemIdentityMixin.get_system_identity() reads product_uuid, product_serial and board_serial in one framed command and returns them with vendor placeholders empty: a Supermicro board's product serial is 0123456789 on every one of them, others read "To be filled by O.E.M." or "Default string", and many cheap boards share the UUID 03000200-0400-0500-0006-000700080009. is_placeholder_identity() is the same filter for a BMC driver's side. A driver supplies only _run_system_identity_command(command, privileged=); the files are root's. |
||
|
|
a1da0337e2 |
feat: alternative fingerprint rules count once (4.8.0)
Discovery compares drivers by score divided by the most a driver could score, and that maximum summed every positive rule. Rules that never match together, such as one vendor's landing page or another's, made a driver that knows several vendors lose to one that knows none: napalm-redfish's Supermicro landing page scored 6 of 41 and lost to a bare "linux" in the same BMC's SNMP sysDescr, 5 of 18. FingerprintRule gets an optional group. rules_max_weight() sums the positive rules and counts each group once, with its strongest rule. Existing rules have no group and count as before. |
||
|
|
155b5bbbe4 |
feat!: settle the open review questions; release 4.7.0
## feat!: settle the open review questions on roles, diffs, SSH and SNMP - roles: a driver that sets ROLE itself replaces the role it inherits, so a Windows driver on OSDriver is "windows", not also "linux". - os: OSDriver's account listing is get_os_users; NAPALM's get_users has another shape and a runtime stub, so hasattr could not tell. - README: NAPALM's own getters must come from the driver or a mixin listed before the first role base; its stubs win the MRO otherwise. - firewall/DHCP diffs: an empty key, a key given twice, or one more than one live entry holds raises ValueError instead of overwriting by guess; live entries without a key are never matched. - ssh_server: only host key algorithms the host has a key for count as staying; when the keys cannot be read, the host key list is not touched. sshd_config and its copy keep their file mode (GNU and BSD stat), 644 only for a new file. - SNMP: 64-bit ifXTable octets and ifHighSpeed, with the 32-bit counters as fallback for agents without ifXTable. - pyproject: declare typing-extensions, which models.py imports. BREAKING CHANGE: OSDriver.get_users is now get_os_users; diffs raise ValueError on keys that cannot name one entry; plan_ssh_hardening removes no host key algorithm without host_keys. ## fix: tell "could not read" and "does not install" apart in update and VIP readers - package_updates: the dnf security reader records dnf's exit status and raises when it is missing or non-zero, as the apt reader does; a failed dnf no longer reads as "no security advisories". - host_status: an enabled dnf-automatic.timer counts as auto updates only with apply_updates = yes (dnf5's automatic.conf wins over dnf4's); dnf-automatic-install.timer always does. Unattended-upgrades counts only while the program is installed, not from a conffile left behind. - virtual_ips: a host with systemctl but without systemd as PID 1 reads as "did not look" (None), not as "has none". keepalived blocks whose brace is on the next line are read. BREAKING CHANGE: parse_dnf_security expects DNF_SECURITY_COMMAND's __DNF_RC marker and raises ValueError without it. |
||
|
|
e509445572 |
feat: add ManagementControllerDriver for server BMCs
A role base for baseboard management controllers (Supermicro, Dell iDRAC, HPE iLO, Lenovo XCC), reached over Redfish or IPMI, not SSH. It declares, under TYPE_CHECKING only: get_power_state, set_power_state (Redfish ResetType actions), get_hardware_inventory (CPUs, DIMMs, drives, PSUs, NICs, and the server's serial, system UUID and NIC MACs), get_event_log, get_firmware_inventory and get_management_protocols. reboot_host restarts the BMC itself (Manager.Reset), never the managed server, which goes through set_power_state. No HealthMetricsMixin and no command channel; sensors come through NAPALM's get_environment. |
||
|
|
dd8977750d |
chore: Python 3.13, mypy --strict in CI, eight bug fixes, docs
Squashes three changes: ## chore: support Python 3.13 and make mypy --strict pass in CI Add 3.13 to the CI matrix and classifiers, run mypy in CI, fix the 14 strict errors it reported, and correct the README's minimum Python. ## fix: eight bugs found in a full review, each with a regression test - channel: run_on_transport lost output sshd sent after the exit status; it now reads stdout and stderr to EOF before returning. - ssh_server: a failed way back (restore or reload) raised out of harden_ssh_server after the host was touched; it is now reported in the result, with rolled_back False. - host_status: a newer RPM kernel (RHEL, Fedora) was never seen, because its release, not its arch, followed the last "-". - package_updates: an apt line wrapped at a blank lost the blank, and with it the package. - kernel: an empty payload (gzip or base64 missing) read as a report. - listening: "[fe80::1]%eth0:546", as ss prints it, kept its brackets. - ping_sweep: a reply whose "success" was not a dict aborted the sweep. - lag: a member of unknown speed (-1) lowered the LAG's speed. ## docs: bring the README and docstrings in line with the code The firewall worked example showed the runtime stubs the README forbids; the class table missed PhoneDriver and MediaDriver; ConfigLifecycleMixin is mixed in by drivers, not by a role base; services, mac_acl and packages named a class, a key and an exception that do not exist. |
||
|
|
23c352aa8a |
feat: OpenSshServerMixin takes flagged algorithms out of what sshd offers
CI / test (3.10) (push) Successful in 23s
CI / test (3.11) (push) Successful in 22s
CI / test (3.10) (pull_request) Successful in 23s
CI / test (3.12) (pull_request) Successful in 23s
CI / test (3.12) (push) Successful in 23s
CI / test (3.11) (pull_request) Successful in 22s
ssh-audit names algorithms an SSH server should stop offering. Taking them out is the same on every OpenSSH host, so it lives here once: a driver mixes in OpenSshServerMixin and supplies run_command. harden_ssh_server reads the lists sshd really uses (sshd -T), removes the requested algorithms and writes the rest to /etc/ssh/sshd_config.d/00-netork-ssh-hardening.conf -- or, where sshd_config has no Include of that directory, rewrites sshd_config after a copy. It never removes the last algorithm of a list, nor, given the managing client's lists, the last one that client speaks. sshd -t must accept the result and sshd -T must show it; after the reload the caller's verify opens a new session, and if that fails the still-open one puts the previous state back and reloads again. Bumps to 4.5.0. NetOrk/netork#1027 |
||
|
|
c947250179 |
feat: report how full /, /boot and /var are in the host status
CI / test (3.10) (push) Successful in 26s
CI / test (3.11) (push) Successful in 23s
CI / test (3.10) (pull_request) Successful in 23s
CI / test (3.12) (pull_request) Successful in 25s
CI / test (3.12) (push) Successful in 23s
CI / test (3.11) (pull_request) Successful in 26s
A Proxmox host's root filesystem stood at 94 % with about 400 MB free for a week; a kernel upgrade failed on it with "No space left on device" and left dpkg halfway, and nothing had said the disk was full (NetOrk/netork#862). HOST_STATUS_COMMAND now also runs POSIX `df -Pk / /boot /var`, without root. get_host_status() returns `filesystems`: each filesystem once (a directory that is not a mount of its own is the filesystem it lives on), with its mountpoint, total, used and available bytes, or None when df said nothing. `available` is what df says an ordinary user can still write, which on ext4 is less than total minus used. How full is too full is the caller's decision. Version 4.4.0. |
||
|
|
7b44f689bc |
feat: report a dpkg left halfway and when the host's own automatic updates last succeeded
CI / test (3.10) (push) Successful in 1m59s
CI / test (3.11) (push) Successful in 30s
CI / test (3.10) (pull_request) Successful in 39s
CI / test (3.12) (pull_request) Successful in 27s
CI / test (3.12) (push) Successful in 34s
CI / test (3.11) (pull_request) Successful in 23s
An unattended upgrade cut off while it built an initrd left a kernel package half-configured on an Ubuntu host. For three months apt refused every upgrade, while apt.systemd.daily exited quietly and the timers reported success (NetOrk/netork#738). HOST_STATUS_COMMAND now also reads, without root: - dpkg's state the way apt checks it: numbered files left in /var/lib/dpkg/updates, or a package half-installed, unpacked, half-configured, waiting for triggers or flagged for reinstallation. While dpkg, apt, aptitude or unattended-upgrade runs, packages are halfway on purpose, so the answer is then None. - /var/lib/apt/periodic/upgrade-stamp, which apt.systemd.daily touches only after unattended-upgrade succeeded, and the interval of APT::Periodic::Unattended-Upgrade in apt's units. update-success-stamp is not read: every apt-get update touches it, whoever runs it. HostStatusDict gains package_manager_interrupted, interrupted_packages, auto_updates_last_success and auto_updates_interval, all NotRequired. |
||
|
|
37c09d0fa0 |
feat: read the virtual IPs vip-manager and keepalived declare on a host
CI / test (3.10) (push) Successful in 26s
CI / test (3.11) (push) Successful in 24s
CI / test (3.10) (pull_request) Successful in 35s
CI / test (3.12) (pull_request) Successful in 39s
CI / test (3.12) (push) Successful in 26s
CI / test (3.11) (pull_request) Successful in 36s
A virtual IP sits on whichever member holds it right now; a standby's address list shows no trace of it. What every member has is the configuration that declares it, and reading that is the same on every Linux host -- so VirtualIpsMixin.get_virtual_ips() lives here and a driver only carries the command across (NetOrk/netork#829). - vip-manager: every vip-manager.service / vip-manager@*.service unit; the address from a flag (1.x's -ip=${VIP_IP} resolved through the unit's environment), the environment, or the --config YAML (5.x). - keepalived: the virtual_ipaddress(_excluded) entries of every vrrp_instance, with its interface and virtual_router_id; include is followed four levels deep, and a pattern that is no plain path glob is never handed to the root shell. The same files hold the etcd password and auth_pass, so an awk program filters on the host and prints allowlisted fields only. None per mechanism is "did not look", [] a host without it. The command is about 4 kB and goes on an exec channel. Version 4.2.0. |
||
|
|
885c7e1f53 |
feat!: declare the guest agent per guest OS, and share what provisioning needs
CI / test (3.10) (push) Successful in 39s
CI / test (3.11) (push) Successful in 36s
CI / test (3.10) (pull_request) Successful in 32s
CI / test (3.12) (pull_request) Successful in 24s
CI / test (3.12) (push) Successful in 39s
CI / test (3.11) (pull_request) Successful in 23s
GUEST_AGENT_PACKAGES / GUEST_AGENT_RUNCMD described one agent per hypervisor. A hypervisor that provisions FreeBSD and OpenBSD guests needs a different agent per guest, and netOrk has to know which guests a driver can provision at all (NetOrk/netork#794). Both now come from one class-level mapping netOrk reads off the driver class: GUEST_AGENTS = {guest_os: (packages, runcmd)} Its keys are the guests the driver provisions, and create_vm_from_cloud_init(guest_os=...) refuses any other. The base keeps Linux with qemu-guest-agent. New module `provisioning`, generic for every hypervisor: - QEMU_GUEST_AGENTS: the QEMU agent for Linux, FreeBSD and OpenBSD, with package names and service commands verified on FreeBSD 15.1 and OpenBSD 7.9 cloud images (NetOrk/netork#793). - network_config(): cloud-init's network-config v2 with MAC matching, moved here from napalm-vmware. FreeBSD's nuageinit reads no other version. - split_compression(): how a packed image (.xz, .gz, .bz2, .zst) is unpacked. BREAKING CHANGE: GUEST_AGENT_PACKAGES and GUEST_AGENT_RUNCMD are gone; drivers declare GUEST_AGENTS instead. |
||
|
|
e50e497939 |
feat(container-engine): run the engine CLI privileged on request
CI / test (3.10) (push) Successful in 23s
CI / test (3.11) (push) Successful in 23s
CI / test (3.10) (pull_request) Successful in 23s
CI / test (3.12) (pull_request) Successful in 23s
CI / test (3.12) (push) Successful in 24s
CI / test (3.11) (pull_request) Successful in 22s
run_cli() and stream_cli() take privileged=, passed to the driver's run_command()/open_stream(): an engine that refuses the login user can be retried as root, the way the driver gains root for any command. netOrk uses it to retry a refused container start/stop/restart with sudo (NetOrk/netork#773). |
||
|
|
735b683028 |
feat: a public command channel and container engine access
CI / test (3.10) (push) Successful in 25s
CI / test (3.11) (push) Successful in 22s
CI / test (3.10) (pull_request) Successful in 24s
CI / test (3.12) (pull_request) Successful in 22s
CI / test (3.12) (push) Successful in 23s
CI / test (3.11) (pull_request) Successful in 22s
netOrk reached a host's shell through napalm-linux's private `_send`: an interactive PTY with stdout and stderr merged and no exit code. For Docker it went further and opened its own paramiko connections around the driver. This adds the access layer only, no container model (NetOrk/netork#765): - `channel.py`: `CommandChannelMixin` declares `run_command()` (stdout, stderr, exit code) and `open_stream()` (a `ByteStream` to a running command). Declared under TYPE_CHECKING, so hasattr stays truthful. `run_on_transport()` and `open_stream_on_transport()` implement both on a paramiko exec channel for any SSH driver; `ParamikoExecStream` drains stderr on every read so the shared window never stalls. - `container_engine.py`: `ContainerEngineMixin` with `container_engines()` and `open_container_engine()`. The returned `ContainerEngineConnection` opens the engine API over `<binary> system dial-stdio` and runs the CLI with caller-chosen arguments. The driver decides the binary through `_container_engine_binary()`; callers never see the path. - README: why the container model lives in netOrk and not here. Additive; the Docker*Dict declarations stay until netOrk no longer reads them. Version 2.6.0. Refs #17 |
||
|
|
b8b89acee1 |
feat: read the sockets of a host without ss from netstat, and procd's services
OpenWrt has no ss: the listening-socket command fell through to [no-ss]
and the reading raised ListeningSocketsUnavailable. Without ss it now runs
netstat -lntup (busybox and net-tools both), and the cgroups are read for
its PIDs alike.
- netstat names a socket's process as PID/Program; a UDP line has no
state column, "-" is a socket without a process, and net-tools prints
tcp6/udp6 and program names with a space ("sshd: /usr/sbin").
- On OpenWrt the cgroup is /services/<name>/<instance>, so the unit is
the procd service -- a jailed one too, whose PID is not the one procd
reports (dnsmasq under ujail).
- A host with neither tool still raises ListeningSocketsUnavailable.
Checked against a real OpenWrt 25.12.2 access point, and that a Linux and
a Proxmox host still read the same sockets with the longer command.
2.5.0. For netOrk#673.
|
||
|
|
b97ec654a0 |
feat: read what listens on which address, and which service it is, once for every driver
Whether a service is reachable from outside its host is decided by the address it listens on: 0.0.0.0:5432 is, 127.0.0.1:5432 is not. Reading that is the same on every Linux host, so the command and its parse live here once and a driver only carries the command across (ListeningSocketsMixin, _run_listening_sockets_command). One framed round trip: ss -lntup for every listening TCP and bound UDP socket, then /proc/<pid>/cgroup for each process holding one, which names the systemd service (v2, nested slices, v1's name=systemd hierarchy) or the container (docker-<id>.scope, /docker/<id>) it runs in. - Root: only root sees every process. The script goes as one sh -c argument, so a sudo -n prefix covers all of it; when that brings no report back the reading runs again unprivileged and says it is not attributed. - No -H: iproute2 before 4.10 fails on it, which would read as nothing listening. The header is skipped instead. - A host without ss raises ListeningSocketsUnavailable; a report cut short or a failing ss raises ValueError. - The reading is raw: docker-proxy shows up as docker.service, loopback as loopback. What counts as reachable is the consumer's call. 2.4.0. For netOrk#658. |
||
|
|
18676a573f |
feat: say where a pending update comes from, whether it is a security fix, and whether the host needs a reboot
netOrk MVP 5 measures "security updates applied within N days" and starts patch runs inside agreed windows. That needs three things every Linux driver reads the same way, so they live here once: - UpdateDict gains optional `origin` and `security` (None = unknown). - package_updates: APT_UPGRADABLE_COMMAND and parse_apt_upgradable(). apt's suites are the origin; a "-security" suite makes it a security update; several architectures of one package are one entry. The command runs through a pipe with its exit status printed inside the group: through a pseudo-terminal apt drew progress and keypad codes, one of which (ESC >) a screen-scraping read took for a prompt and stopped at. The parser raises ValueError when apt failed or its status never arrived. DNF_SECURITY_COMMAND / parse_dnf_security() / nevra_name() for dnf/yum. - host_status: HOST_STATUS_COMMAND, parse_host_status(), HostStatusMixin (template form, hook _run_host_status_command). reboot_required from /var/run/reboot-required, needs-restarting -r, or a newer kernel of the running flavour (a Raspberry Pi carries two flavours side by side); auto_updates from APT::Periodic::Unattended-Upgrade with its timer, or dnf-automatic. HostStatusDict in models.py. - terminal.strip_terminal_codes(): CSI, OSC and two-character escapes, now also used by the systemd parser. - UpdateMixin: contract refresh_available_updates(); get_available_updates' docstring now states the rule that a reader raises when it cannot read and never returns [] for "don't know". Fixtures are real output from Ubuntu 24.04, Debian 13 / OMV, Raspberry Pi OS and Proxmox VE 9. Version 2.3.0. |
||
|
|
17d8dabb4d |
feat: list systemd services in one round trip and control them, once for every driver
Listing a host's services and starting or stopping one is the same on every host that runs systemd, so the command, its parse, the check of a unit name and the reading of an action's exit status live here once, and a driver supplies only the transport (napalm-linux#7, napalm-proxmox#6): - SYSTEMD_SERVICES_COMMAND: one read-only POSIX sh line. list-unit-files, then one systemctl show over every loaded service unit (Id, Names, LoadState, ActiveState, SubState, UnitFileState, MainPID), and is-enabled only for generated units, whose boot state lives in a SysV script's rc links. Framed; [no-systemd] when /run/systemd/system is missing. Replaces an is-enabled and a show per unit: 0.8 s instead of 6 s on a 180-unit Ubuntu host. - parse_systemd_services(): loaded units except not-found, plus installed unit files that are not loaded; no templates, no aliases (also not the ones older systemd lists as "enabled"). enabled = UnitFileState enabled or enabled-runtime, read from systemctl show and never from list-unit-files' second column, which has had a preset column after it since systemd 245. A report whose end is missing raises ValueError, so a list cut short never reads as services that went away; a host without systemd raises SystemdUnavailable, a NotImplementedError, so a driver can fall back. - unit_name() / service_action_command() / parse_action_result(): template instances, dots, colons and \xHH escapes accepted; a bare template, a leading "-" and anything a shell reads refused. The action runs as "timeout 45 systemctl --no-ask-password <action> -- <unit>.service" with its exit status printed after it; only that status decides, 124 is not called done, and terminal colour codes are dropped. The marker also keeps the output from ever being empty, which a transport that retries on an empty answer would take as a reason to run the action twice. - SystemdServicesMixin, in the template form: get_services() and manage_service() are concrete, _run_service_command(command, *, privileged, timeout) is the driver's hook. Mixed in by the drivers whose host runs systemd, not by OSDriver. Version 2.2.0. |
||
|
|
536ffcf6e1 |
feat: read what a Linux kernel has built and loaded, once for every driver
A kernel CVE's exploitability often hangs on code that is not there: a module neither loaded nor shipped, an option the kernel was built without. netOrk's KB precondition vocabulary asks exactly that (kernel_module, kernel_config). Reading it is the same on every Linux host, so the command and its parse live here and a driver supplies only the transport: - KERNEL_FACTS_COMMAND: one read-only POSIX sh line, no privileges. Release, /proc/modules, modules.builtin, modules.dep and the build configuration (/boot/config-* or /proc/config.gz). The report is framed, gzipped and base64-encoded, so nothing in it can look like a shell prompt to a screen-scraping transport, and ~300 kB of configuration crosses as a fifth. - parse_kernel_facts(): a section the command could not print comes back None, never empty -- "could not read" and "read, and nothing there" must stay apart. - module_name(): no path, no .ko suffix, "-" folded to "_", as the kernel does. - KernelFactsMixin, in the template form: get_kernel_facts() is concrete, _run_kernel_facts_command() is the driver's hook. Mixed in by the drivers that can, not by OSDriver -- a Windows host is an OS driver too, and hasattr(driver, "get_kernel_facts") has to stay truthful. - KernelFactsDict in models.py. Version 2.1.0. |