open_stream(privileged=True) with a sudo password wrote the password first, for sudo -S. A sudo that does not prompt (NOPASSWD, a cached timestamp) left it on stdin, and it reached the command as the first bytes of the stream. With netOrk reading rootful Podman over sudo podman system dial-stdio (napalm-device-types, same branch name), those bytes go to the Podman API service.
The stream now asks sudo first (sudo -n sh -c true, the shape every privileged command takes) and runs the command through sudo -n when sudo wants no password; only a sudo that asks gets the password. A root login and a driver without a sudo password ask nothing, as before. One extra round trip per privileged stream with a sudo password.
Tests
tests/test_command_channel.py::TestNoPasswordIntoAStream; full suite 430 passed.
Order
Merge after NAPALM/napalm-device-types' PR of the same branch name: test_podman_is_reached_as_root reaches Podman through it, and this repository's CI installs napalm-device-types from main (re-run this PR's CI after that merge).
Prio: P3 -- part of NetOrk/netork#818 (Podman runtime driver), raised to P3 by epic NetOrk/netork#2572.
## What changes
`open_stream(privileged=True)` with a sudo password wrote the password first, for `sudo -S`. A sudo that does not prompt (NOPASSWD, a cached timestamp) left it on stdin, and it reached the command as the first bytes of the stream. With netOrk reading rootful Podman over `sudo podman system dial-stdio` (napalm-device-types, same branch name), those bytes go to the Podman API service.
The stream now asks sudo first (`sudo -n sh -c true`, the shape every privileged command takes) and runs the command through `sudo -n` when sudo wants no password; only a sudo that asks gets the password. A root login and a driver without a sudo password ask nothing, as before. One extra round trip per privileged stream with a sudo password.
## Tests
`tests/test_command_channel.py::TestNoPasswordIntoAStream`; full suite 430 passed.
## Order
Merge after NAPALM/napalm-device-types' PR of the same branch name: `test_podman_is_reached_as_root` reaches Podman through it, and this repository's CI installs napalm-device-types from main (re-run this PR's CI after that merge).
open_stream(privileged=True) with a sudo password wrote the password first,
for sudo -S. A sudo that does not prompt (NOPASSWD, a cached timestamp) left it
on stdin, where it reached the command as the first bytes of the stream: the
Podman API, over sudo podman system dial-stdio. The stream now asks sudo first
(sudo -n sh -c true) and runs the command through sudo -n when it needs no
password.
CI: the one failing test is test_podman_is_reached_as_root (429 passed), because this repository installs napalm-device-types from main, which does not know Podman until NAPALM/napalm-device-types#123 merges. Merge that first, then re-run this CI.
CI: the one failing test is `test_podman_is_reached_as_root` (429 passed), because this repository installs napalm-device-types from main, which does not know Podman until NAPALM/napalm-device-types#123 merges. Merge that first, then re-run this CI.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Prio: P3 -- part of NetOrk/netork#818 (Podman runtime driver), raised to P3 by epic NetOrk/netork#2572.
What changes
open_stream(privileged=True)with a sudo password wrote the password first, forsudo -S. A sudo that does not prompt (NOPASSWD, a cached timestamp) left it on stdin, and it reached the command as the first bytes of the stream. With netOrk reading rootful Podman oversudo podman system dial-stdio(napalm-device-types, same branch name), those bytes go to the Podman API service.The stream now asks sudo first (
sudo -n sh -c true, the shape every privileged command takes) and runs the command throughsudo -nwhen sudo wants no password; only a sudo that asks gets the password. A root login and a driver without a sudo password ask nothing, as before. One extra round trip per privileged stream with a sudo password.Tests
tests/test_command_channel.py::TestNoPasswordIntoAStream; full suite 430 passed.Order
Merge after NAPALM/napalm-device-types' PR of the same branch name:
test_podman_is_reached_as_rootreaches Podman through it, and this repository's CI installs napalm-device-types from main (re-run this PR's CI after that merge).CI: the one failing test is
test_podman_is_reached_as_root(429 passed), because this repository installs napalm-device-types from main, which does not know Podman until NAPALM/napalm-device-types#123 merges. Merge that first, then re-run this CI.