monitoring-plugins/plugins-root
Alvar cef40299a9
OpenBSD: pledge(2) some network-facing checks (#2225)
OpenBSD's pledge(2) system call allows the current process to
self-restrict itself, being reduced to promised pledges. For example,
unless a process says it wants to write to files, it is not allowed to
do so any longer.

This change starts by calling pledge(2) in some network-facing checks,
removing the more dangerous privileges, such as executing other files.

My initial motivation came from check_icmp, being installed as a setuid
binary and (temporarily) running with root privileges. There, the
pledge(2) calls result in check_icmp to only being allowed to interact
with the network and to setuid(2) to the calling user later on.

Afterwards, I went through my most commonly used monitoring plugins
directly interacting with the network. Thus, I continued with
pledge(2)-ing check_curl - having a huge codebase and all -,
check_ntp_time, check_smtp, check_ssh, and check_tcp.

For most of those, the changes were quite similar: start with
network-friendly promises, parse the configuration, give up file access,
and proceed with the actual check.
2026-02-06 12:58:38 +01:00
..
check_dhcp.d Refactor check_dhcp 2025-06-23 12:09:58 +02:00
check_icmp.d More refactoring 2025-09-15 15:49:26 +02:00
t Reapply "check_dhcp: reduce number of tests for weird reasons" 2025-06-23 13:21:25 +02:00
check_dhcp.c Run clang-format again 2025-09-15 12:59:37 +02:00
check_icmp.c OpenBSD: pledge(2) some network-facing checks (#2225) 2026-02-06 12:58:38 +01:00
Makefile.am Add check_dhcp related files to Makefile 2025-06-23 13:02:41 +02:00
pst3.c Run clang-format again 2025-09-15 12:59:37 +02:00