fix(install): correct SpamAssassin service name and resolve PowerDNS port 53 conflict
On Ubuntu 24.04 the SpamAssassin service unit is 'spamd', not 'spamassassin'. The old 'systemctl enable spamassassin' call exited with an error because the unit file does not exist, killing the install due to set -euo pipefail. Also moved the systemd-resolved stub listener disable to a dedicated step that runs before the package installation step. Previously it ran inside the PowerDNS config block — after apt had already tried (and failed) to restart pdns during post-install because systemd-resolved was still holding port 53.
This commit is contained in:
+15
-8
@@ -146,6 +146,18 @@ if ! step_done "nodejs"; then
|
|||||||
fi
|
fi
|
||||||
success "Node.js $(node --version) ready"
|
success "Node.js $(node --version) ready"
|
||||||
|
|
||||||
|
# ── Disable systemd-resolved stub listener (frees port 53 for PowerDNS) ─────
|
||||||
|
step "Freeing port 53 for PowerDNS"
|
||||||
|
if ! step_done "resolved_stub"; then
|
||||||
|
# Ubuntu 24.04 runs systemd-resolved with a stub listener on 127.0.0.53:53.
|
||||||
|
# PowerDNS's apt post-install restart fails if this is still active.
|
||||||
|
sed -i 's/#DNSStubListener=yes/DNSStubListener=no/' /etc/systemd/resolved.conf 2>/dev/null || true
|
||||||
|
sed -i 's/^DNSStubListener=yes/DNSStubListener=no/' /etc/systemd/resolved.conf 2>/dev/null || true
|
||||||
|
systemctl restart systemd-resolved 2>/dev/null || true
|
||||||
|
mark_done "resolved_stub"
|
||||||
|
fi
|
||||||
|
success "Port 53 freed"
|
||||||
|
|
||||||
# ── Install all services in one pass ─────────────────────────────────────────
|
# ── Install all services in one pass ─────────────────────────────────────────
|
||||||
step "Installing web stack (Apache, PHP, Exim, Dovecot, PowerDNS, MariaDB)"
|
step "Installing web stack (Apache, PHP, Exim, Dovecot, PowerDNS, MariaDB)"
|
||||||
if ! step_done "packages"; then
|
if ! step_done "packages"; then
|
||||||
@@ -344,10 +356,6 @@ setuid=pdns
|
|||||||
setgid=pdns
|
setgid=pdns
|
||||||
PDNS
|
PDNS
|
||||||
|
|
||||||
# Disable systemd-resolved on port 53 to avoid conflict
|
|
||||||
sed -i 's/#DNSStubListener=yes/DNSStubListener=no/' /etc/systemd/resolved.conf 2>/dev/null || true
|
|
||||||
systemctl restart systemd-resolved 2>/dev/null || true
|
|
||||||
|
|
||||||
systemctl enable pdns
|
systemctl enable pdns
|
||||||
systemctl start pdns
|
systemctl start pdns
|
||||||
|
|
||||||
@@ -431,10 +439,9 @@ success "Dovecot configured"
|
|||||||
# ── Configure SpamAssassin ────────────────────────────────────────────────────
|
# ── Configure SpamAssassin ────────────────────────────────────────────────────
|
||||||
step "Configuring SpamAssassin"
|
step "Configuring SpamAssassin"
|
||||||
if ! step_done "spamassassin"; then
|
if ! step_done "spamassassin"; then
|
||||||
sed -i 's/ENABLED=0/ENABLED=1/' /etc/default/spamassassin 2>/dev/null || true
|
# Ubuntu 24.04: service unit is 'spamd', not 'spamassassin'
|
||||||
sed -i 's/CRON=0/CRON=1/' /etc/default/spamassassin 2>/dev/null || true
|
systemctl enable spamd
|
||||||
systemctl enable spamassassin
|
systemctl start spamd
|
||||||
systemctl start spamassassin
|
|
||||||
mark_done "spamassassin"
|
mark_done "spamassassin"
|
||||||
fi
|
fi
|
||||||
success "SpamAssassin configured"
|
success "SpamAssassin configured"
|
||||||
|
|||||||
Reference in New Issue
Block a user