From c18a4afae3cd43e83ccfeb94adc1da5bfbee239c Mon Sep 17 00:00:00 2001 From: Patrick ZAJDA Date: Fri, 8 Sep 2023 19:56:20 +0200 Subject: [PATCH 1/2] Use systemd service instead of init.d to start and stop SSH in Monit sshd config Signed-off-by: Patrick ZAJDA --- setup_monit.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup_monit.php b/setup_monit.php index 3744a63..9cc315d 100644 --- a/setup_monit.php +++ b/setup_monit.php @@ -253,8 +253,8 @@ check file fail2ban_log with path /var/log/fail2ban.log if ($service == 'sshd') { $conf='check process sshd with pidfile /var/run/sshd.pid group sshd - start program = "/etc/init.d/ssh start" - stop program = "/etc/init.d/ssh stop" + start program = "/bin/systemctl start ssh" + stop program = "/bin/systemctl stop ssh" if failed host localhost port 22 with proto ssh then restart if 5 restarts with 5 cycles then timeout depend on sshd_bin @@ -500,4 +500,4 @@ foreach ($services as $confFile) { shell_exec('systemctl restart monit'); print('[INFO] Your Monit admin password is ' . $monitpw . "\n"); -?> \ No newline at end of file +?> -- GitLab From 25da7d89f748e15d57f1021cbff80e45711fe4b4 Mon Sep 17 00:00:00 2001 From: Patrick ZAJDA Date: Sat, 9 Sep 2023 17:35:48 +0200 Subject: [PATCH 2/2] Use /usr/bin/systemctl instead of /bin/systemctl Signed-off-by: Patrick ZAJDA --- setup_monit.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup_monit.php b/setup_monit.php index 9cc315d..5e4d275 100644 --- a/setup_monit.php +++ b/setup_monit.php @@ -253,8 +253,8 @@ check file fail2ban_log with path /var/log/fail2ban.log if ($service == 'sshd') { $conf='check process sshd with pidfile /var/run/sshd.pid group sshd - start program = "/bin/systemctl start ssh" - stop program = "/bin/systemctl stop ssh" + start program = "/usr/bin/systemctl start ssh" + stop program = "/usr/bin/systemctl stop ssh" if failed host localhost port 22 with proto ssh then restart if 5 restarts with 5 cycles then timeout depend on sshd_bin -- GitLab