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