fix: keep the sudo password out of files written as root (0.2.1)
CI / test (3.10) (push) Successful in 27s
CI / test (3.11) (push) Successful in 27s
CI / test (3.12) (push) Successful in 25s
CI / test (3.10) (pull_request) Successful in 29s
CI / test (3.11) (pull_request) Successful in 24s
CI / test (3.12) (pull_request) Successful in 25s

run_command prepended the sudo password to the caller's stdin. A sudo
that does not prompt left it for the command, and fix_snmp's
'cat > snmpd.conf' wrote it as the configuration's first line before
making the file world-readable.

run_command now refuses stdin to a privileged command while a sudo
password is set. fix_snmp stages the configuration in a mktemp file
without privilege, and root installs it next to the target and renames
it over, so nothing root runs follows a symlink.

Closes #8
This commit is contained in:
Christian Manivong committed 2026-10-16 11:48:25 +02:00
1 parent 992bc6d5e9
commit 707e048792
4 files changed
+122 -20

No files matched your search

+11
View File
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [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