fix(mailserver): Use LMDB maps instead of hash for Alpine Postfix
Alpine Linux's Postfix is compiled with LMDB support, not BerkeleyDB hash support. This caused "Temporary lookup failure" errors on send. Changes: - Changed virtual_alias_maps and virtual_mailbox_maps to lmdb: prefix - Copy resolv.conf to Postfix chroot for DNS resolution - Added `mailctl fix-postfix` command to repair existing installations Root cause: virtual_alias_maps was configured as hash:/etc/postfix/virtual but the hash map type is not supported on Alpine, only lmdb. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
44493ebfe3
commit
ae26317815
@ -63,6 +63,13 @@ _Last updated: 2026-02-06_
|
|||||||
- Fix: Changed to use socat proxy at `172.17.0.1:10143` (plaintext, internal)
|
- Fix: Changed to use socat proxy at `172.17.0.1:10143` (plaintext, internal)
|
||||||
- Updated `mailctl webmail configure` to use proxy instead of direct SSL
|
- Updated `mailctl webmail configure` to use proxy instead of direct SSL
|
||||||
|
|
||||||
|
- **Mail Send 451 "Temporary lookup failure"** — RESOLVED (2026-02-06)
|
||||||
|
- Root cause: Alpine Postfix uses LMDB, not BerkeleyDB hash maps
|
||||||
|
- `virtual_alias_maps = hash:/etc/postfix/virtual` was invalid
|
||||||
|
- Postfix chroot `/var/spool/postfix/etc/resolv.conf` was missing
|
||||||
|
- Fix: Changed setup.sh to use `lmdb:` prefix and copy resolv.conf to chroot
|
||||||
|
- Added `mailctl fix-postfix` command to repair existing installations
|
||||||
|
|
||||||
### Just Completed
|
### Just Completed
|
||||||
|
|
||||||
- **Unified Backup Manager** — DONE (2026-02-05)
|
- **Unified Backup Manager** — DONE (2026-02-05)
|
||||||
|
|||||||
@ -88,9 +88,13 @@ postconf -e 'smtpd_tls_key_file = /etc/ssl/mail/privkey.pem'
|
|||||||
postconf -e 'smtpd_tls_security_level = may'
|
postconf -e 'smtpd_tls_security_level = may'
|
||||||
postconf -e 'smtp_tls_security_level = may'
|
postconf -e 'smtp_tls_security_level = may'
|
||||||
postconf -e 'virtual_mailbox_domains = /etc/postfix/vdomains'
|
postconf -e 'virtual_mailbox_domains = /etc/postfix/vdomains'
|
||||||
postconf -e 'virtual_mailbox_maps = hash:/etc/postfix/vmailbox'
|
# Alpine Postfix uses LMDB, not BerkeleyDB hash
|
||||||
postconf -e 'virtual_alias_maps = hash:/etc/postfix/valias'
|
postconf -e 'virtual_mailbox_maps = lmdb:/etc/postfix/vmailbox'
|
||||||
|
postconf -e 'virtual_alias_maps = lmdb:/etc/postfix/valias'
|
||||||
postconf -e 'virtual_mailbox_base = /var/mail'
|
postconf -e 'virtual_mailbox_base = /var/mail'
|
||||||
|
# Copy resolv.conf to Postfix chroot for DNS lookups
|
||||||
|
mkdir -p /var/spool/postfix/etc
|
||||||
|
cp /etc/resolv.conf /var/spool/postfix/etc/
|
||||||
postconf -e 'virtual_uid_maps = static:1000'
|
postconf -e 'virtual_uid_maps = static:1000'
|
||||||
postconf -e 'virtual_gid_maps = static:1000'
|
postconf -e 'virtual_gid_maps = static:1000'
|
||||||
# Create vmail user
|
# Create vmail user
|
||||||
|
|||||||
@ -284,6 +284,37 @@ cmd_mesh() {
|
|||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# Fix / Repair
|
||||||
|
# ============================================================================
|
||||||
|
|
||||||
|
cmd_fix_postfix() {
|
||||||
|
local container=$(uci_get main.container)
|
||||||
|
container="${container:-mailserver}"
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
# Regenerate LMDB databases
|
||||||
|
[ -f /etc/postfix/vmailbox ] && postmap lmdb:/etc/postfix/vmailbox
|
||||||
|
[ -f /etc/postfix/virtual ] && postmap lmdb:/etc/postfix/virtual
|
||||||
|
|
||||||
|
# Fix Postfix chroot DNS resolution
|
||||||
|
mkdir -p /var/spool/postfix/etc
|
||||||
|
cp /etc/resolv.conf /var/spool/postfix/etc/
|
||||||
|
|
||||||
|
# Reload Postfix
|
||||||
|
postfix reload
|
||||||
|
'
|
||||||
|
|
||||||
|
log "Postfix configuration fixed"
|
||||||
|
log "If you still see 'Temporary lookup failure', restart the container: mailctl restart"
|
||||||
|
}
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# Logs & Diagnostics
|
# Logs & Diagnostics
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
@ -509,6 +540,7 @@ Diagnostics:
|
|||||||
logs [lines] View mail logs
|
logs [lines] View mail logs
|
||||||
test <email> Send test email
|
test <email> Send test email
|
||||||
ssl-status Show SSL cert info
|
ssl-status Show SSL cert info
|
||||||
|
fix-postfix Fix LMDB maps and DNS resolution
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
mailctl install
|
mailctl install
|
||||||
@ -540,6 +572,7 @@ case "${1:-}" in
|
|||||||
logs) shift; cmd_logs "$@" ;;
|
logs) shift; cmd_logs "$@" ;;
|
||||||
test) shift; cmd_test "$@" ;;
|
test) shift; cmd_test "$@" ;;
|
||||||
report) shift; cmd_report "$@" ;;
|
report) shift; cmd_report "$@" ;;
|
||||||
|
fix-postfix) shift; cmd_fix_postfix "$@" ;;
|
||||||
help|--help|-h|'') show_help ;;
|
help|--help|-h|'') show_help ;;
|
||||||
*) error "Unknown command: $1"; show_help >&2; exit 1 ;;
|
*) error "Unknown command: $1"; show_help >&2; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user