From 340c8bd156c7aa0ba80cd031ade3642a270a382f Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Tue, 16 May 2023 11:37:18 -0700 Subject: [PATCH] email: Use drop-in config component for /etc files Signed-off-by: Sunil Mohan Adapa Reviewed-by: James Valleroy --- debian/freedombox.maintscript | 17 +++++++++++++ plinth/modules/email/__init__.py | 24 ++++++++++++++++++- .../conf-available/email-freedombox.conf | 0 .../dovecot/conf.d/05-freedombox-passdb.conf | 0 .../dovecot/conf.d/05-freedombox-userdb.conf | 0 .../dovecot/conf.d/15-freedombox-auth.conf | 0 .../dovecot/conf.d/15-freedombox-mail.conf | 0 .../dovecot/conf.d/90-freedombox-lmtp.conf | 0 .../conf.d/90-freedombox-mailboxes.conf | 0 .../dovecot/conf.d/90-freedombox-master.conf | 0 .../etc/dovecot/conf.d/90-freedombox-tls.conf | 0 .../dovecot/conf.d/95-freedombox-sieve.conf | 0 .../dovecot/conf.d/freedombox-ldap.conf.ext | 0 .../freedombox-sieve-after/sort-spam.sieve | 0 .../fail2ban/jail.d/dovecot-freedombox.conf | 0 .../etc/postfix/freedombox-aliases.cf | 0 .../etc/rspamd/local.d/freedombox-logging.inc | 0 .../local.d/freedombox-milter-headers.conf | 0 .../etc/rspamd/local.d/freedombox-redis.conf | 0 19 files changed, 40 insertions(+), 1 deletion(-) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/apache2/conf-available/email-freedombox.conf (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/dovecot/conf.d/05-freedombox-passdb.conf (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/dovecot/conf.d/05-freedombox-userdb.conf (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/dovecot/conf.d/15-freedombox-auth.conf (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/dovecot/conf.d/15-freedombox-mail.conf (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/dovecot/conf.d/90-freedombox-lmtp.conf (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/dovecot/conf.d/90-freedombox-mailboxes.conf (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/dovecot/conf.d/90-freedombox-master.conf (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/dovecot/conf.d/90-freedombox-tls.conf (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/dovecot/conf.d/95-freedombox-sieve.conf (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/dovecot/conf.d/freedombox-ldap.conf.ext (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/dovecot/freedombox-sieve-after/sort-spam.sieve (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/fail2ban/jail.d/dovecot-freedombox.conf (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/postfix/freedombox-aliases.cf (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/rspamd/local.d/freedombox-logging.inc (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/rspamd/local.d/freedombox-milter-headers.conf (100%) rename plinth/modules/email/data/{ => usr/share/freedombox}/etc/rspamd/local.d/freedombox-redis.conf (100%) diff --git a/debian/freedombox.maintscript b/debian/freedombox.maintscript index 88289e70a..78145b884 100644 --- a/debian/freedombox.maintscript +++ b/debian/freedombox.maintscript @@ -88,6 +88,23 @@ rm_conffile /etc/plinth/modules-enabled/wireguard 23.10~ rm_conffile /etc/plinth/modules-enabled/wordpress 23.10~ rm_conffile /etc/plinth/modules-enabled/zoph 23.10~ rm_conffile /etc/apache2/conf-available/deluge-plinth.conf 23.10~ +rm_conffile /etc/dovecot/conf.d/15-freedombox-mail.conf 23.10~ +rm_conffile /etc/dovecot/conf.d/05-freedombox-passdb.conf 23.10~ +rm_conffile /etc/dovecot/conf.d/95-freedombox-sieve.conf 23.10~ +rm_conffile /etc/dovecot/conf.d/05-freedombox-userdb.conf 23.10~ +rm_conffile /etc/dovecot/conf.d/90-freedombox-mailboxes.conf 23.10~ +rm_conffile /etc/dovecot/conf.d/freedombox-ldap.conf.ext 23.10~ +rm_conffile /etc/dovecot/conf.d/90-freedombox-tls.conf 23.10~ +rm_conffile /etc/dovecot/conf.d/90-freedombox-master.conf 23.10~ +rm_conffile /etc/dovecot/conf.d/90-freedombox-lmtp.conf 23.10~ +rm_conffile /etc/dovecot/conf.d/15-freedombox-auth.conf 23.10~ +rm_conffile /etc/dovecot/freedombox-sieve-after/sort-spam.sieve 23.10~ +rm_conffile /etc/rspamd/local.d/freedombox-logging.inc 23.10~ +rm_conffile /etc/rspamd/local.d/freedombox-redis.conf 23.10~ +rm_conffile /etc/rspamd/local.d/freedombox-milter-headers.conf 23.10~ +rm_conffile /etc/apache2/conf-available/email-freedombox.conf 23.10~ +rm_conffile /etc/fail2ban/jail.d/dovecot-freedombox.conf 23.10~ +rm_conffile /etc/postfix/freedombox-aliases.cf 23.10~ rm_conffile /etc/gitweb-freedombox.conf 23.10~ rm_conffile /etc/apache2/conf-available/gitweb-freedombox.conf 23.10~ rm_conffile /etc/apache2/conf-available/gitweb-freedombox-auth.conf 23.10~ diff --git a/plinth/modules/email/__init__.py b/plinth/modules/email/__init__.py index e9dd2a2a0..4f8d88bc6 100644 --- a/plinth/modules/email/__init__.py +++ b/plinth/modules/email/__init__.py @@ -8,6 +8,7 @@ from django.utils.translation import gettext_lazy as _ import plinth.app from plinth import cfg, frontpage, menu +from plinth.config import DropinConfigs from plinth.daemon import Daemon from plinth.modules.apache.components import Webserver from plinth.modules.backups.components import BackupRestore @@ -52,7 +53,7 @@ class EmailApp(plinth.app.App): app_id = 'email' - _version = 2 + _version = 3 def __init__(self): """Initialize the email app.""" @@ -100,6 +101,27 @@ class EmailApp(plinth.app.App): conflicts_action=Packages.ConflictsAction.REMOVE) self.add(packages) + dropin_configs = DropinConfigs('dropin-configs-email', [ + '/etc/apache2/conf-available/email-freedombox.conf', + '/etc/dovecot/conf.d/05-freedombox-passdb.conf', + '/etc/dovecot/conf.d/05-freedombox-userdb.conf', + '/etc/dovecot/conf.d/15-freedombox-auth.conf', + '/etc/dovecot/conf.d/15-freedombox-mail.conf', + '/etc/dovecot/conf.d/90-freedombox-lmtp.conf', + '/etc/dovecot/conf.d/90-freedombox-mailboxes.conf', + '/etc/dovecot/conf.d/90-freedombox-master.conf', + '/etc/dovecot/conf.d/90-freedombox-tls.conf', + '/etc/dovecot/conf.d/95-freedombox-sieve.conf', + '/etc/dovecot/conf.d/freedombox-ldap.conf.ext', + '/etc/dovecot/freedombox-sieve-after/sort-spam.sieve', + '/etc/fail2ban/jail.d/dovecot-freedombox.conf', + '/etc/postfix/freedombox-aliases.cf', + '/etc/rspamd/local.d/freedombox-logging.inc', + '/etc/rspamd/local.d/freedombox-milter-headers.conf', + '/etc/rspamd/local.d/freedombox-redis.conf', + ]) + self.add(dropin_configs) + listen_ports = [(25, 'tcp4'), (25, 'tcp6'), (465, 'tcp4'), (465, 'tcp6'), (587, 'tcp4'), (587, 'tcp6')] daemon = Daemon('daemon-email-postfix', 'postfix', diff --git a/plinth/modules/email/data/etc/apache2/conf-available/email-freedombox.conf b/plinth/modules/email/data/usr/share/freedombox/etc/apache2/conf-available/email-freedombox.conf similarity index 100% rename from plinth/modules/email/data/etc/apache2/conf-available/email-freedombox.conf rename to plinth/modules/email/data/usr/share/freedombox/etc/apache2/conf-available/email-freedombox.conf diff --git a/plinth/modules/email/data/etc/dovecot/conf.d/05-freedombox-passdb.conf b/plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/05-freedombox-passdb.conf similarity index 100% rename from plinth/modules/email/data/etc/dovecot/conf.d/05-freedombox-passdb.conf rename to plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/05-freedombox-passdb.conf diff --git a/plinth/modules/email/data/etc/dovecot/conf.d/05-freedombox-userdb.conf b/plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/05-freedombox-userdb.conf similarity index 100% rename from plinth/modules/email/data/etc/dovecot/conf.d/05-freedombox-userdb.conf rename to plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/05-freedombox-userdb.conf diff --git a/plinth/modules/email/data/etc/dovecot/conf.d/15-freedombox-auth.conf b/plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/15-freedombox-auth.conf similarity index 100% rename from plinth/modules/email/data/etc/dovecot/conf.d/15-freedombox-auth.conf rename to plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/15-freedombox-auth.conf diff --git a/plinth/modules/email/data/etc/dovecot/conf.d/15-freedombox-mail.conf b/plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/15-freedombox-mail.conf similarity index 100% rename from plinth/modules/email/data/etc/dovecot/conf.d/15-freedombox-mail.conf rename to plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/15-freedombox-mail.conf diff --git a/plinth/modules/email/data/etc/dovecot/conf.d/90-freedombox-lmtp.conf b/plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/90-freedombox-lmtp.conf similarity index 100% rename from plinth/modules/email/data/etc/dovecot/conf.d/90-freedombox-lmtp.conf rename to plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/90-freedombox-lmtp.conf diff --git a/plinth/modules/email/data/etc/dovecot/conf.d/90-freedombox-mailboxes.conf b/plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/90-freedombox-mailboxes.conf similarity index 100% rename from plinth/modules/email/data/etc/dovecot/conf.d/90-freedombox-mailboxes.conf rename to plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/90-freedombox-mailboxes.conf diff --git a/plinth/modules/email/data/etc/dovecot/conf.d/90-freedombox-master.conf b/plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/90-freedombox-master.conf similarity index 100% rename from plinth/modules/email/data/etc/dovecot/conf.d/90-freedombox-master.conf rename to plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/90-freedombox-master.conf diff --git a/plinth/modules/email/data/etc/dovecot/conf.d/90-freedombox-tls.conf b/plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/90-freedombox-tls.conf similarity index 100% rename from plinth/modules/email/data/etc/dovecot/conf.d/90-freedombox-tls.conf rename to plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/90-freedombox-tls.conf diff --git a/plinth/modules/email/data/etc/dovecot/conf.d/95-freedombox-sieve.conf b/plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/95-freedombox-sieve.conf similarity index 100% rename from plinth/modules/email/data/etc/dovecot/conf.d/95-freedombox-sieve.conf rename to plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/95-freedombox-sieve.conf diff --git a/plinth/modules/email/data/etc/dovecot/conf.d/freedombox-ldap.conf.ext b/plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/freedombox-ldap.conf.ext similarity index 100% rename from plinth/modules/email/data/etc/dovecot/conf.d/freedombox-ldap.conf.ext rename to plinth/modules/email/data/usr/share/freedombox/etc/dovecot/conf.d/freedombox-ldap.conf.ext diff --git a/plinth/modules/email/data/etc/dovecot/freedombox-sieve-after/sort-spam.sieve b/plinth/modules/email/data/usr/share/freedombox/etc/dovecot/freedombox-sieve-after/sort-spam.sieve similarity index 100% rename from plinth/modules/email/data/etc/dovecot/freedombox-sieve-after/sort-spam.sieve rename to plinth/modules/email/data/usr/share/freedombox/etc/dovecot/freedombox-sieve-after/sort-spam.sieve diff --git a/plinth/modules/email/data/etc/fail2ban/jail.d/dovecot-freedombox.conf b/plinth/modules/email/data/usr/share/freedombox/etc/fail2ban/jail.d/dovecot-freedombox.conf similarity index 100% rename from plinth/modules/email/data/etc/fail2ban/jail.d/dovecot-freedombox.conf rename to plinth/modules/email/data/usr/share/freedombox/etc/fail2ban/jail.d/dovecot-freedombox.conf diff --git a/plinth/modules/email/data/etc/postfix/freedombox-aliases.cf b/plinth/modules/email/data/usr/share/freedombox/etc/postfix/freedombox-aliases.cf similarity index 100% rename from plinth/modules/email/data/etc/postfix/freedombox-aliases.cf rename to plinth/modules/email/data/usr/share/freedombox/etc/postfix/freedombox-aliases.cf diff --git a/plinth/modules/email/data/etc/rspamd/local.d/freedombox-logging.inc b/plinth/modules/email/data/usr/share/freedombox/etc/rspamd/local.d/freedombox-logging.inc similarity index 100% rename from plinth/modules/email/data/etc/rspamd/local.d/freedombox-logging.inc rename to plinth/modules/email/data/usr/share/freedombox/etc/rspamd/local.d/freedombox-logging.inc diff --git a/plinth/modules/email/data/etc/rspamd/local.d/freedombox-milter-headers.conf b/plinth/modules/email/data/usr/share/freedombox/etc/rspamd/local.d/freedombox-milter-headers.conf similarity index 100% rename from plinth/modules/email/data/etc/rspamd/local.d/freedombox-milter-headers.conf rename to plinth/modules/email/data/usr/share/freedombox/etc/rspamd/local.d/freedombox-milter-headers.conf diff --git a/plinth/modules/email/data/etc/rspamd/local.d/freedombox-redis.conf b/plinth/modules/email/data/usr/share/freedombox/etc/rspamd/local.d/freedombox-redis.conf similarity index 100% rename from plinth/modules/email/data/etc/rspamd/local.d/freedombox-redis.conf rename to plinth/modules/email/data/usr/share/freedombox/etc/rspamd/local.d/freedombox-redis.conf