Added dkim key backup
This commit is contained in:
@@ -20,6 +20,8 @@ class Backup:
|
||||
||--> custom
|
||||
|--> { (copy of) /etc/amavis/conf.d/99-custom }
|
||||
|--> { (copy of) /etc/postfix/custom_whitelist.cidr }
|
||||
|--> { (copy of) dkim folder }
|
||||
|--> {dkim.pem}...
|
||||
||--> databases
|
||||
|--> modoboa.sql
|
||||
|--> { amavis.sql }
|
||||
@@ -70,9 +72,11 @@ class Backup:
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
shutil.rmtree(os.path.join(path, "custom"),ignore_errors=False)
|
||||
shutil.rmtree(os.path.join(path, "custom"),
|
||||
ignore_errors=False)
|
||||
shutil.rmtree(os.path.join(path, "mails"), ignore_errors=False)
|
||||
shutil.rmtree(os.path.join(path, "databases"), ignore_errors=False)
|
||||
shutil.rmtree(os.path.join(path, "databases"),
|
||||
ignore_errors=False)
|
||||
else:
|
||||
utils.printcolor(
|
||||
"Error, backup dir not clean.", utils.RED
|
||||
@@ -139,6 +143,7 @@ class Backup:
|
||||
|
||||
def custom_config_backup(self):
|
||||
"""Custom config :
|
||||
- DKIM keys: {{keys_storage_dir}}
|
||||
- Amavis : /etc/amavis/conf.d/99-custom
|
||||
- Postwhite : /etc/postwhite.conf
|
||||
Feel free to suggest to add others!"""
|
||||
@@ -148,6 +153,15 @@ class Backup:
|
||||
custom_path = os.path.join(
|
||||
self.backup_path, "custom")
|
||||
|
||||
# DKIM Key
|
||||
if (self.config.has_option("opendkim", "enabled") and
|
||||
self.config.getboolean("opendkim", "enabled")):
|
||||
dkim_keys = self.config.get(
|
||||
"opendkim", "keys_storage_dir", fallback="/var/lib/dkim")
|
||||
shutil.copytree(dkim_keys, os.path.join(custom_path, "dkim"))
|
||||
utils.printcolor(
|
||||
"DKIM keys saved!", utils.GREEN)
|
||||
|
||||
# AMAVIS
|
||||
if (self.config.has_option("amavis", "enabled") and
|
||||
self.config.getboolean("amavis", "enabled")):
|
||||
|
||||
Reference in New Issue
Block a user