Better configuration

This commit is contained in:
Spitap
2023-04-04 23:17:49 +02:00
committed by Antoine Nguyen
parent 45870e20ef
commit 1423fe0e6e
11 changed files with 218 additions and 22 deletions

View File

@@ -24,7 +24,10 @@ class Rspamd(base.Installer):
"local.d/spf.conf",
"local.d/worker-controller.inc",
"local.d/worker-normal.inc",
"local.d/worker-proxy.inc"]
"local.d/worker-proxy.inc",
"local.d/greylist.conf",
"local.d/milter_headers.conf",
"local.d/metrics.conf"]
@property
def config_dir(self):
@@ -51,11 +54,9 @@ class Rspamd(base.Installer):
def get_config_files(self):
"""Return appropriate config files."""
_config_files = self.config_files
if self.config.get("clamav", "enabled"):
if self.config.getboolean("clamav", "enabled"):
_config_files.append("local.d/antivirus.conf")
if self.app_config["dnsbl"]:
_config_files.append("local.d/greylisting.conf")
if not self.app_config["dnsbl"]:
if self.app_config["dnsbl"].lower() == "true":
_config_files.append("local.d/rbl.conf")
return _config_files
@@ -71,8 +72,16 @@ class Rspamd(base.Installer):
_context["controller_password"] = password
else:
_context["controller_password"] = controller_password
_context["greylisting_disabled"] = "" if not self.app_config["greylisting"] else "#"
if not self.app_config["greylisting"]:
_context["postwhite_enabled"] = "#"
return _context
def post_run(self):
"""Additional tasks."""
if self.config("clamav", "enabled"):
install("clamav", self.config, self.upgrade, self.archive_path)
def custom_backup(self, path):
"""Backup custom configuration if any."""
custom_config_dir = os.path.join(self.config_dir,