Files
napalm-bsd/CHANGELOG.md
T
Christian Manivong fd1d90c88c
driver / lint (pull_request) Successful in 14s
driver / standard (pull_request) Successful in 17s
driver / types (pull_request) Successful in 1m0s
driver / test (3.13) (pull_request) Successful in 59s
driver / test (3.12) (pull_request) Successful in 1m6s
driver / lowest (pull_request) Successful in 32s
driver / build (pull_request) Successful in 31s
driver / security (pull_request) Successful in 1m2s
CI / driver (pull_request) Successful in 2m18s
driver / publish (pull_request) Skipped
fix(ssh): a refused RSA/ECDSA key is an authentication failure (NetOrk/netork#2512)
open() handed the key file netOrk passes in key_file to paramiko as
key_filename. For a key file, SSHClient._auth tries the key as every key
type and keeps only the last error, so a host turning down an RSA or ECDSA
key raised "SSH to <host> failed: encountered RSA key, expected OPENSSH
key" instead of "Authentication failed.", which pointed at the key rather
than at the host that refused it. Ed25519 keys were not affected: they are
the last type tried.

The key is now loaded once with its own type (PKey.from_path) and passed
as pkey=, as netOrk's own SSH sessions do since NetOrk/netork#2480. A key
file that cannot be read raises ConnectionException before anything is
dialled.

Tested against an in-process SSH server on loopback, with RSA, ECDSA and
Ed25519 keys refused and accepted.
2026-11-14 00:04:32 +01:00

170 lines
9.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- `get_ssh_server_auth()` on FreeBSD and OpenBSD, through napalm-device-types'
`SshServerAuthMixin` (4.32.0): whether sshd takes passwords, keyboard-interactive or keys,
its `AuthenticationMethods`, `PermitRootLogin` and, on FreeBSD, the modules of sshd's PAM
`auth` stack. Needs root for `sshd -T` (NetOrk/netork#662).
- Personal accounts on FreeBSD follow what the person changes (NetOrk/netork#2013):
`add_local_account(..., replaces=[...])` takes the old keys out of the account's key
files as the new one goes in, `remove_local_account_keys` takes deleted keys out and
leaves the account open, and `add_local_account(..., clear_password=True)` removes the
password (`chpass -p '*'`): the account logs in with its key only and has no sudo.
Keys the person added on the host stay.
- A deleted key can take the password with it on FreeBSD (NetOrk/netork#2033): through
napalm-device-types' `remove_local_account_keys(..., clear_password=True)` the keys go
as the person, the password goes (`chpass -p '*'`), and so do the sudo rule and
`wheel`. The account stays open.
### Changed
- Needs napalm-device-types 4.29.0.
### Added
- Scheduled jobs on FreeBSD and OpenBSD (NetOrk/netork#1933, #27), through
napalm-device-types' `PosixScheduledJobsMixin`: `get_scheduled_jobs()` reads
`/etc/crontab` and the user crontabs in `/var/cron/tabs`, on FreeBSD also
`/etc/cron.d`, `/usr/local/etc/cron.d` and every `periodic` script in
`/etc/periodic` and `/usr/local/etc/periodic` (`kind="periodic"`, enabled by its
`periodic.conf` knob), in one round trip as root; `manage_scheduled_job()`
enables, disables or runs one now (a periodic script by
`sysrc -f /etc/periodic.conf`); `put_scheduled_job()` and `delete_scheduled_job()`
write and remove an application's own job: a file in `/etc/cron.d` on FreeBSD,
marked lines in the user's crontab on OpenBSD. Another user's job runs through
`su -m` with its script on `/bin/sh`'s stdin, as neither BSD's `su` takes a shell.
- netOrk's own account with a fixed uid on FreeBSD (NetOrk/netork#1817):
`_account_create_with_uid` makes it with `pw useradd -u <uid> -m -w no`.
- Personal accounts on FreeBSD (NetOrk/netork#1793), through napalm-device-types'
`LocalAccountsMixin`: `get_local_accounts()`, `add_local_account()` and
`lock_local_account()` with `pw useradd -m -w no`, `chpass -p` for the password hash,
`pw lock`/`pw unlock` and `pw groupmod -d`. A locked account carries `*LOCKED*`, which
sshd refuses a key login too; the sudo rule goes to `/usr/local/etc/sudoers.d`.
Checked on FreeBSD 15.1 over SSH with sudo -S (sshd with `UsePAM no`, as nuageinit
sets it). OpenBSD does not offer it yet. Requires the napalm-device-types release with
`LocalAccountsMixin`.
### Changed
- The floor on napalm-device-types is 4.26.0, the first release with what this driver
uses (`PosixScheduledJobsMixin`).
- Python 3.12 is the floor (`requires-python = ">=3.12"`): netOrk runs every driver
on 3.12, so 3.10 and 3.11 are no longer tested (NAPALM/driver-standard#6).
- The floor on napalm is 5.1: older releases import `pkg_resources`, which a Python
3.12 venv no longer has.
### Fixed
- A host turning down an RSA or ECDSA key is an authentication failure:
`open()` raises `ConnectionException("SSH to <host> failed: Authentication failed.")`.
The key went to paramiko as `key_filename`, which tries a key file as every key type
and keeps the last error, so the refusal read "encountered RSA key, expected OPENSSH
key". The key is now loaded once as its own type and passed as `pkey`; a key file that
cannot be read raises `ConnectionException` before anything is dialled
(NetOrk/netork#2512).
- An OpenBSD host no longer reads as 100 % busy (#7). net-snmp on OpenBSD answers
`ssCpuIdle` with 0 on an idle machine, so `OpenBSDDriver` declares the CPU unknown
in its `SNMP_HEALTH_PROFILE` (`{"cpu": {"unknown": True}}`), and the application
reports no CPU figure. Memory, swap and load are read as before. Requires the
napalm-device-types release with `SnmpValueSpec.unknown`.
- FreeBSD and OpenBSD hosts are in the role `bsd`, one key for both (#10). They
inherited `OSDriver`'s `linux`, so an application that shows or branches on the
role treated them as Linux hosts. An application that keys on `linux` for every
general-purpose host has to accept `bsd` as well.
- `get_listening_sockets()` raises when the reading without root fails as well
(`sockstat` on FreeBSD, `netstat` on OpenBSD). It returned an empty list, which
read as a host where every port had closed.
- `get_arp_table()` reports an unknown age as `-1.0` (napalm-device-types'
`ARP_AGE_UNKNOWN`). It reported the time until the entry *expires* (FreeBSD's
`expires in N seconds`, OpenBSD's `Expire` column), which is no age: an entry
refreshed a second ago looked 20 minutes old (NetOrk/netork#1327).
### Removed
- `get_cron_jobs()`: it read the system crontab and the login user's own only, without
root, and missed `/etc/cron.d`, every other user and FreeBSD's periodic scripts.
`get_scheduled_jobs()` replaces it.
## [0.5.0] - 2026-10-23
The first release on PyPI.
### Changed
- The drivers follow the NAPALM driver standard
(https://git.netork.io/NAPALM/driver-standard): CI on Gitea runs ruff, mypy, the
tests on Python 3.10–3.13 and at the lowest declared versions, bandit, pip-audit and
a build check, and a release tag publishes to PyPI. The package now ships `py.typed`.
Python 3.10 stays the floor. napalm-device-types now comes from PyPI, 4.21.1 or later.
### Security
- The SSH host key is verified (NetOrk/netork#1167). `open()` takes the key to expect from `optional_args["ssh_host_key"]` and refuses any other one before it logs in (`SshHostKeyMismatch`); without one it accepts the first key. Every key it sees goes to `optional_args["ssh_host_key_observer"]`. Replaces paramiko's `AutoAddPolicy`. Requires napalm-device-types 4.19.0; version 0.4.0.
## [0.3.0] - 2026-10-17
### Changed
- **Breaking:** `run_device_action("fix_snmp")` is gone. The drivers implement
napalm-device-types 4.13's `configure_snmp_agent(settings)` template instead, and
the caller supplies every value: one `rocommunity` line per allowed source, contact
and location as given. No community, contact or location of an application is built
in any more. pf and ipfw rules are left to the operator. Requires
napalm-device-types 4.13.0 or later.
- `get_snmp_config` no longer assumes the community `public` when the file names none.
### Added
- `get_management_peer()`: the address the host sees the SSH connection come from.
- `ensure_package(name)` from the base package.
## [0.2.1] - 2026-10-16
### Fixed
- A sudo password no longer ends up in `snmpd.conf`. `run_command` sent the
password and the data on the same stdin, and a sudo that does not prompt
(NOPASSWD, a cached timestamp) left the password for `cat`, which wrote it
as the first line of a file then made world-readable (#8). `run_command` now
refuses stdin to a privileged command while a sudo password is set, and
`fix_snmp` stages the configuration without privilege before root installs
it, without following a symlink at the target.
## [0.2.0] - 2026-10-13
### Changed
- `get_users` is now `get_os_users`, as napalm-device-types 4.7 names it on
`OSDriver`; the return shape is unchanged. NAPALM's own `get_users` has
another shape and a stub on every driver, so a poll asking `hasattr` could
not tell the two apart. Requires napalm-device-types 4.7.1 or later.
## [0.1.0]
### Added
- `FreeBSDDriver` (`freebsd`) and `OpenBSDDriver` (`openbsd`) on a shared
`BsdDriver`: SSH over exec channels (no PTY, real exit codes), root through
`sudo -S` with the password on stdin.
- Read side (NetOrk/netork#798): facts (SMBIOS through `kenv` on FreeBSD,
`hw.*` sysctls on OpenBSD; uptime from `kern.boottime`), interfaces and
their addresses (`ifconfig -a`), routes (`netstat -rn`), ARP (`arp -an`),
users and groups, processes (`ps … lstart`), cron jobs (system crontab and
the login user's).
- `get_listening_sockets()` in the shape of `ListeningSocketsMixin`: FreeBSD
through `sockstat`, OpenBSD through `fstat` as root and `netstat -an`
without, which the reading reports as `attributed: False`.
- Packages: `get_packages`, `install_package`, `uninstall_package`. FreeBSD's
install bootstraps pkg on a classic system that never had it.
- Updates: `get_available_updates`, with VuXML's verdict as `security` on
FreeBSD and base-system patches as one `base-system` entry (OpenBSD
`syspatch`, classic FreeBSD `freebsd-update`). A reader that cannot read
raises instead of returning no updates (#4).
- Services: `get_services` and `manage_service` (start, stop, restart,
enable, disable) through `service` and `rcctl`.
- SNMP: `run_device_action("fix_snmp")` installs net-snmp, writes the same
configuration netOrk uses on Linux, starts the agent and asks it for
sysDescr; `get_snmp_config` reports a running agent's community and port.
- `get_host_status` (napalm-device-types' `HostStatusMixin`): on FreeBSD,
"reboot required" when the installed kernel differs from the running one.
- `first_boot_pending()`: whether a FreeBSD host is still in its first boot
(`/firstboot`), so netOrk can wait before setting up a new VM
(NetOrk/netork#795).
- Parsers tested on output recorded from FreeBSD 15.1 (hand-installed and
cloud image) and OpenBSD 7.9 (NetOrk/netork#793).