feat: read the host's listening sockets through napalm-device-types #14

Merged
christianmanivong merged 1 commits from feat/listening-sockets into master 2026-10-06 16:19:50 +00:00
Owner

LinuxDriver mixes in ListeningSocketsMixin (napalm-device-types 2.4.0, NAPALM/napalm-device-types#7) and supplies _run_listening_sockets_command: privileged through _run_privileged (root login as is, sudo -S with a password, sudo -n without), otherwise _send. The command arrives as one sh -c argument, so sudo covers the whole script; when sudo refuses the mixin reads again unprivileged (attributed: false).

OpenMediaVault and QNAP QTS inherit it; QTS has no ss and raises ListeningSocketsUnavailable.

Requires napalm-device-types>=2.4.0.

Tests: TestGetListeningSockets (root, sudo -n, sudo password, refused sudo → unprivileged). Whole suite: 126 passed.

For NetOrk/netork#658.

`LinuxDriver` mixes in `ListeningSocketsMixin` (napalm-device-types 2.4.0, NAPALM/napalm-device-types#7) and supplies `_run_listening_sockets_command`: privileged through `_run_privileged` (root login as is, `sudo -S` with a password, `sudo -n` without), otherwise `_send`. The command arrives as one `sh -c` argument, so sudo covers the whole script; when sudo refuses the mixin reads again unprivileged (`attributed: false`). OpenMediaVault and QNAP QTS inherit it; QTS has no `ss` and raises `ListeningSocketsUnavailable`. Requires `napalm-device-types>=2.4.0`. Tests: `TestGetListeningSockets` (root, `sudo -n`, sudo password, refused sudo → unprivileged). Whole suite: 126 passed. For NetOrk/netork#658.
christianmanivong added 1 commit 2026-10-06 16:19:40 +00:00
LinuxDriver mixes in ListeningSocketsMixin (napalm-device-types 2.4.0) and
supplies its transport: privileged readings go through _run_privileged --
as they are for a root login, through sudo with a password, sudo -n
without one -- and the rest through _send. The command arrives as one
sh -c argument, so sudo covers the whole script; when sudo refuses, the
mixin reads again without it.

OpenMediaVault and QNAP QTS inherit it; a host without ss raises
ListeningSocketsUnavailable.

For netOrk#658.
christianmanivong merged commit 007590b9bf into master 2026-10-06 16:19:50 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-linux#14