Compare commits

...

2 Commits

Author SHA1 Message Date
holger krekel
b441891d1f add postfix instrumented debugging 2023-10-16 22:38:36 +02:00
holger krekel
1c37d1f59b add global debug flag and instrument dovecot with it 2023-10-16 22:29:40 +02:00
3 changed files with 19 additions and 10 deletions

View File

@@ -110,7 +110,7 @@ def _configure_opendkim(domain: str, dkim_selector: str) -> bool:
return need_restart return need_restart
def _configure_postfix(domain: str) -> bool: def _configure_postfix(domain: str, debug: bool = False) -> bool:
"""Configures Postfix SMTP server.""" """Configures Postfix SMTP server."""
need_restart = False need_restart = False
@@ -124,21 +124,20 @@ def _configure_postfix(domain: str) -> bool:
) )
need_restart |= main_config.changed need_restart |= main_config.changed
master_config = files.put( master_config = files.template(
src=importlib.resources.files(__package__) src=importlib.resources.files(__package__).joinpath("postfix/master.cf.j2"),
.joinpath("postfix/master.cf")
.open("rb"),
dest="/etc/postfix/master.cf", dest="/etc/postfix/master.cf",
user="root", user="root",
group="root", group="root",
mode="644", mode="644",
debug=debug,
) )
need_restart |= master_config.changed need_restart |= master_config.changed
return need_restart return need_restart
def _configure_dovecot(mail_server: str) -> bool: def _configure_dovecot(mail_server: str, debug: bool = False) -> bool:
"""Configures Dovecot IMAP server.""" """Configures Dovecot IMAP server."""
need_restart = False need_restart = False
@@ -149,6 +148,7 @@ def _configure_dovecot(mail_server: str) -> bool:
group="root", group="root",
mode="644", mode="644",
config={"hostname": mail_server}, config={"hostname": mail_server},
debug=debug,
) )
need_restart |= main_config.changed need_restart |= main_config.changed
auth_config = files.put( auth_config = files.put(
@@ -215,8 +215,9 @@ def deploy_chatmail(mail_domain: str, mail_server: str, dkim_selector: str) -> N
) )
_install_chatmaild() _install_chatmaild()
dovecot_need_restart = _configure_dovecot(mail_server) debug = False
postfix_need_restart = _configure_postfix(mail_domain) dovecot_need_restart = _configure_dovecot(mail_server, debug=debug)
postfix_need_restart = _configure_postfix(mail_domain, debug=debug)
opendkim_need_restart = _configure_opendkim(mail_domain, dkim_selector) opendkim_need_restart = _configure_opendkim(mail_domain, dkim_selector)
systemd.service( systemd.service(

View File

@@ -4,13 +4,17 @@ protocols = imap lmtp
auth_mechanisms = plain auth_mechanisms = plain
{% if debug == true %}
auth_verbose = yes auth_verbose = yes
auth_debug = yes auth_debug = yes
auth_debug_passwords = yes auth_debug_passwords = yes
auth_verbose_passwords = plain auth_verbose_passwords = plain
auth_cache_size = 100M auth_cache_size = 100M
mail_plugins = quota
mail_debug = yes mail_debug = yes
{% endif %}
mail_plugins = quota
# Authentication for system users. # Authentication for system users.
passdb { passdb {

View File

@@ -9,7 +9,11 @@
# service type private unpriv chroot wakeup maxproc command + args # service type private unpriv chroot wakeup maxproc command + args
# (yes) (yes) (no) (never) (100) # (yes) (yes) (no) (never) (100)
# ========================================================================== # ==========================================================================
smtp inet n - y - - smtpd -v {% if debug == true %}
smtp inet n - y - - smtpd -v
{% else %}
smtp inet n - y - - smtpd
{% endif %}
#smtp inet n - y - 1 postscreen #smtp inet n - y - 1 postscreen
#smtpd pass - - y - - smtpd #smtpd pass - - y - - smtpd
#dnsblog unix - - y - 0 dnsblog #dnsblog unix - - y - 0 dnsblog