Created attachment 1512763 [details] Patch to set cloexec flags on upsmon and upssched file descriptors Description of problem: I have upssched (spawned from upsmon) setup to call a script that sends mail when an interesting even occurs. I was getting SELinux violations with sendmail being denied read access to /etc/ups/upssched.conf... tracked down the problem to the configuration file descriptor being leaked to my script on fd4, and then read by sendmail. I found that upsmon was leaking descriptors to upssched (which could be a user script instead), and upssched was leaking even more to it's spawned processes. I've created a patch to add FD_CLOEXEC flags to all the files, pipes and sockets opened by upsmon and upssched so that the spawned processes only receive the normal stdio fds. I've also submitted the patch upstream, so hopefully will be fixed in the next release. But it does create very difficult to track down SELinux messages, so I figure it's worth submitting a bug here to fix those. Version-Release number of selected component (if applicable): nut-2.7.4-19 How reproducible: Whenever upsmon spawns a NOTIFYCMD or upssched spawns a CMDSCRIPT Steps to Reproduce: 1. Create a script, and set NOTIFYCMD or CMDSCRIPT to run it 2. Create an event that triggers the script. Actual results: Examine the output of ls -l /proc/$$/fd in the script and see the leaked file descriptors - you could also run: echo test | mail -s test myemail@domain and sendmail (postfix version at least) will generate SELinux violations. Expected results: No leaked descriptors, no SELinux violations. Additional info: I've attached the patch I submitted upstream...I've tested it and it correctly eliminates the leaks.
nut-2.7.4-23.fc28 has been submitted as an update to Fedora 28. https://bodhi.fedoraproject.org/updates/FEDORA-2019-e6bdcc9a22
nut-2.7.4-23.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-4c732996bd
nut-2.7.4-23.fc30 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-26c0784641
nut-2.7.4-23.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-26c0784641
nut-2.7.4-23.fc28 has been pushed to the Fedora 28 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-e6bdcc9a22
nut-2.7.4-23.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report. See https://fedoraproject.org/wiki/QA:Updates_Testing for instructions on how to install test updates. You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-4c732996bd
nut-2.7.4-23.fc28 has been pushed to the Fedora 28 stable repository. If problems still persist, please make note of it in this bug report.
nut-2.7.4-23.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.
nut-2.7.4-23.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.