From b7f3eb9613a9630dca1b7099184eb4181c84429b Mon Sep 17 00:00:00 2001 From: CyberMind-FR Date: Thu, 5 Feb 2026 12:36:28 +0100 Subject: [PATCH] fix(mailserver): Fix mydestination conflict with virtual domains mydestination included $mydomain which caused "User unknown in local recipient table" errors because Postfix treated the domain as local instead of virtual. Changes: - Remove $mydomain from mydestination in setup.sh - Update fix-postfix command to also fix this issue - Ensure vdomains file is properly created Co-Authored-By: Claude Opus 4.5 --- .../files/usr/lib/mailserver/container.sh | 3 ++- .../files/usr/sbin/mailctl | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/package/secubox/secubox-app-mailserver/files/usr/lib/mailserver/container.sh b/package/secubox/secubox-app-mailserver/files/usr/lib/mailserver/container.sh index 4a915c99..d8fe9010 100644 --- a/package/secubox/secubox-app-mailserver/files/usr/lib/mailserver/container.sh +++ b/package/secubox/secubox-app-mailserver/files/usr/lib/mailserver/container.sh @@ -77,7 +77,8 @@ echo "disable_plaintext_auth = no" >> /etc/dovecot/dovecot.conf # Configure postfix postconf -e 'myhostname = MAIL_HOSTNAME' postconf -e 'mydomain = MAIL_DOMAIN' -postconf -e 'mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain' +# Don't include $mydomain in mydestination - it conflicts with virtual_mailbox_domains +postconf -e 'mydestination = $myhostname, localhost.$mydomain, localhost' postconf -e 'inet_interfaces = all' postconf -e 'home_mailbox = Maildir/' postconf -e 'smtpd_sasl_type = dovecot' diff --git a/package/secubox/secubox-app-mailserver/files/usr/sbin/mailctl b/package/secubox/secubox-app-mailserver/files/usr/sbin/mailctl index 813e6a27..0a04ede4 100644 --- a/package/secubox/secubox-app-mailserver/files/usr/sbin/mailctl +++ b/package/secubox/secubox-app-mailserver/files/usr/sbin/mailctl @@ -291,13 +291,22 @@ cmd_mesh() { cmd_fix_postfix() { local container=$(uci_get main.container) container="${container:-mailserver}" + local domain=$(uci_get main.domain) log "Fixing Postfix configuration..." # Fix LMDB maps (Alpine doesn't support hash maps) - lxc-attach -n "$container" -- sh -c ' - postconf -e "virtual_mailbox_maps = lmdb:/etc/postfix/vmailbox" - postconf -e "virtual_alias_maps = lmdb:/etc/postfix/virtual" + lxc-attach -n "$container" -- sh -c " + # Use LMDB instead of hash (Alpine Postfix) + postconf -e 'virtual_mailbox_maps = lmdb:/etc/postfix/vmailbox' + postconf -e 'virtual_alias_maps = lmdb:/etc/postfix/virtual' + postconf -e 'virtual_mailbox_domains = /etc/postfix/vdomains' + + # Don't include domain in mydestination (conflicts with virtual) + postconf -e 'mydestination = \\\$myhostname, localhost.\\\$mydomain, localhost' + + # Ensure vdomains file exists + echo '$domain' > /etc/postfix/vdomains # Regenerate LMDB databases [ -f /etc/postfix/vmailbox ] && postmap lmdb:/etc/postfix/vmailbox @@ -309,10 +318,10 @@ cmd_fix_postfix() { # Reload Postfix postfix reload - ' + " log "Postfix configuration fixed" - log "If you still see 'Temporary lookup failure', restart the container: mailctl restart" + log "If you still see errors, restart the container: mailctl restart" } # ============================================================================