Merge pull request #10530 from Icinga/kill-drop-permissions

Send signals as Icinga user in safe-reload and logrotate
This commit is contained in:
Julian Brost 2025-10-08 14:29:27 +02:00 committed by GitHub
commit ce600ce01c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 4 additions and 2 deletions

View file

@ -43,7 +43,7 @@ if [ ! -e "$ICINGA2_PID_FILE" ]; then
fi
pid=`cat "$ICINGA2_PID_FILE"`
if ! kill -HUP "$pid" >/dev/null 2>&1; then
if ! "$DAEMON" internal signal --sig SIGHUP --pid "$pid" >/dev/null 2>&1; then
echo "Error: Icinga not running"
exit 7
fi

View file

@ -6,7 +6,7 @@
missingok
notifempty@LOGROTATE_CREATE@
postrotate
/bin/kill -USR1 $(cat @ICINGA2_INITRUNDIR@/icinga2.pid 2> /dev/null) 2> /dev/null || true
@CMAKE_INSTALL_FULL_SBINDIR@/icinga2 internal signal --sig SIGUSR1 --pid "$(cat @ICINGA2_INITRUNDIR@/icinga2.pid 2> /dev/null)" 2> /dev/null || true
endscript
}

View file

@ -57,6 +57,8 @@ int InternalSignalCommand::Run(const boost::program_options::variables_map& vm,
return kill(vm["pid"].as<int>(), SIGCHLD);
if (signal == "SIGHUP")
return kill(vm["pid"].as<int>(), SIGHUP);
if (signal == "SIGUSR1")
return kill(vm["pid"].as<int>(), SIGUSR1);
Log(LogCritical, "cli") << "Unsupported signal \"" << signal << "\"";
#else