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 wrote it into a world-readable snmpd.conf.
run_command refuses stdin to a privileged command while a sudo password is set (as napalm-linux does).
fix_snmp stages the configuration without privilege (mktemp, umask 077); root installs it next to the target and renames it over.
Temporary names on the host are neutral: /tmp/napalm-bsd-stage.*, *.napalm-tmp.
Tests: the refusal, the password-only stdin, the cases where no password goes first, and that the config reaches the host only through the unprivileged stage.
`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` wrote it into a world-readable `snmpd.conf`.
- `run_command` refuses stdin to a privileged command while a sudo password is set (as napalm-linux does).
- `fix_snmp` stages the configuration without privilege (`mktemp`, umask 077); root installs it next to the target and renames it over.
- Temporary names on the host are neutral: `/tmp/napalm-bsd-stage.*`, `*.napalm-tmp`.
Tests: the refusal, the password-only stdin, the cases where no password goes first, and that the config reaches the host only through the unprivileged stage.
Closes #8. Part of NetOrk/netork#1105 (step 1).
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
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.
run_commandprepended the sudo password to the caller's stdin. A sudo that does not prompt left it for the command, andfix_snmpwrote it into a world-readablesnmpd.conf.run_commandrefuses stdin to a privileged command while a sudo password is set (as napalm-linux does).fix_snmpstages the configuration without privilege (mktemp, umask 077); root installs it next to the target and renames it over./tmp/napalm-bsd-stage.*,*.napalm-tmp.Tests: the refusal, the password-only stdin, the cases where no password goes first, and that the config reaches the host only through the unprivileged stage.
Closes #8. Part of NetOrk/netork#1105 (step 1).