diff --git a/lib/os/class.ISPConfigBaseOS.inc.php b/lib/os/class.ISPConfigBaseOS.inc.php index b3a48279e19ac7bcff787a1e3a75865268acefba..35d3293a8a52c41f34fc509f186545e447dd622d 100644 --- a/lib/os/class.ISPConfigBaseOS.inc.php +++ b/lib/os/class.ISPConfigBaseOS.inc.php @@ -419,6 +419,11 @@ class ISPConfigBaseOS { return $this->exec($cmd); } + protected function enableService($service_name) { + $cmd = $this->getRestartServiceCommand($service_name, 'enable'); + return $this->exec($cmd); + } + protected function isServiceRunning($service_name) { $cmd = $this->getRestartServiceCommand($service_name, 'status'); $result = $this->exec($cmd); diff --git a/lib/os/class.ISPConfigDebian10OS.inc.php b/lib/os/class.ISPConfigDebian10OS.inc.php index c155636b508a01f797118a298de64cc78ba3e20c..ed31ba3945f7c714107b64ab62f232ba60b8f58a 100644 --- a/lib/os/class.ISPConfigDebian10OS.inc.php +++ b/lib/os/class.ISPConfigDebian10OS.inc.php @@ -12,7 +12,7 @@ class ISPConfigDebian10OS extends ISPConfigDebianOS { } public function getRestartServiceCommand($service, $command = 'restart') { - if($command != 'start' && $command != 'stop' && $command != 'status') { + if($command != 'start' && $command != 'stop' && $command != 'enable' && $command != 'status') { $command = 'restart'; } diff --git a/lib/os/class.ISPConfigDebianOS.inc.php b/lib/os/class.ISPConfigDebianOS.inc.php index fb7891d7330ed67be78c9cc4be6d954df7513da4..10d3fd8f323ed8793e699afbd63e8249a8caa3a0 100644 --- a/lib/os/class.ISPConfigDebianOS.inc.php +++ b/lib/os/class.ISPConfigDebianOS.inc.php @@ -75,7 +75,7 @@ class ISPConfigDebianOS extends ISPConfigBaseOS { } public function getRestartServiceCommand($service, $command = 'restart') { - if($command != 'start' && $command != 'stop' && $command != 'status') { + if($command != 'start' && $command != 'stop' && $command != 'enable' && $command != 'status') { $command = 'restart'; } @@ -2022,6 +2022,9 @@ SCRIPTWHITELIST=/usr/bin/lwp-request'; $this->restartService('fail2ban'); + // Fail2Ban is disabled by default on Ubuntu 22.04 and newer. Enabling it on any OS does not hurt. + $this->enableService('fail2ban'); + $this->fixDbconfigCommon(); $this->configureSecureShell();