From 1758f343187f2c85ce6a188714cb1a6ae423d900 Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sat, 11 Apr 2020 19:44:29 -0700 Subject: [PATCH] Don't allow stopping webmin to kill itself 0https://github.com/webmin/webmin/issues/1228 --- init/mass_launchd.cgi | 1 + init/mass_rcs.cgi | 1 + init/mass_start_stop.cgi | 4 +--- init/mass_systemd.cgi | 1 + init/mass_upstarts.cgi | 1 + init/start_stop.cgi | 2 +- 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/init/mass_launchd.cgi b/init/mass_launchd.cgi index ad11c075b..2c8758d56 100755 --- a/init/mass_launchd.cgi +++ b/init/mass_launchd.cgi @@ -17,6 +17,7 @@ $disable = 1 if ($in{'delboot'} || $in{'delboot_stop'}); if ($start || $stop || $restart) { # Starting or stopping a bunch of services + $SIG{'TERM'} = 'ignore'; # Restarting webmin may kill this script $access{'bootup'} || &error($text{'ss_ecannot'}); foreach $s (@sel) { if ($start) { diff --git a/init/mass_rcs.cgi b/init/mass_rcs.cgi index 6733c8be4..a33e1256a 100755 --- a/init/mass_rcs.cgi +++ b/init/mass_rcs.cgi @@ -16,6 +16,7 @@ $disable = 1 if ($in{'delboot'} || $in{'delboot_stop'}); if ($start || $stop) { # Starting or stopping a bunch of services + $SIG{'TERM'} = 'ignore'; # Restarting webmin may kill this script $access{'bootup'} || &error($text{'ss_ecannot'}); foreach $s (@sel) { if ($start) { diff --git a/init/mass_start_stop.cgi b/init/mass_start_stop.cgi index b43d86a51..eb7227413 100755 --- a/init/mass_start_stop.cgi +++ b/init/mass_start_stop.cgi @@ -17,11 +17,9 @@ $disable = 1 if ($in{'delboot'} || $in{'delboot_stop'}); $restart ? $text{'mass_restart'} : $text{'mass_stop'}, ""); -# In case the action was Webmin -$SIG{'TERM'} = 'IGNORE'; - if ($start || $stop || $restart) { # Starting or stopping a bunch of actions + $SIG{'TERM'} = 'ignore'; # Restarting webmin may kill this script &foreign_require("proc", "proc-lib.pl"); $access{'bootup'} || &error($text{'ss_ecannot'}); diff --git a/init/mass_systemd.cgi b/init/mass_systemd.cgi index 6ebd95643..be5d665bb 100755 --- a/init/mass_systemd.cgi +++ b/init/mass_systemd.cgi @@ -17,6 +17,7 @@ $disable = 1 if ($in{'delboot'} || $in{'delboot_stop'}); if ($start || $stop || $restart) { # Starting or stopping a bunch of services + $SIG{'TERM'} = 'ignore'; # Restarting webmin may kill this script $access{'bootup'} || &error($text{'ss_ecannot'}); foreach $s (@sel) { if ($start) { diff --git a/init/mass_upstarts.cgi b/init/mass_upstarts.cgi index 7e0d1991c..f4b0486e0 100755 --- a/init/mass_upstarts.cgi +++ b/init/mass_upstarts.cgi @@ -17,6 +17,7 @@ $disable = 1 if ($in{'delboot'} || $in{'delboot_stop'}); if ($start || $stop || $restart) { # Starting or stopping a bunch of services + $SIG{'TERM'} = 'ignore'; # Restarting webmin may kill this script $access{'bootup'} || &error($text{'ss_ecannot'}); foreach $s (@sel) { if ($start) { diff --git a/init/start_stop.cgi b/init/start_stop.cgi index 8131243d3..116802af5 100755 --- a/init/start_stop.cgi +++ b/init/start_stop.cgi @@ -20,7 +20,7 @@ $action ||= 'stop'; $cmd = $in{'file'}." ".$action; # In case the action was Webmin -$SIG{'TERM'} = sub { }; +$SIG{'TERM'} = 'ignore'; # Run the command print &text('ss_exec', "$cmd"),"

\n";