Files
infrastructure/kasse-dkim-tomtervel.sh
blandClaude Opus 5.5 302a163fbd tomtervel.no's DNS as DNSControl, and the vel's own DKIM key on kasse
dns/dnsconfig.js is the whole zone for Cloudflare: the site, id and
chat pointing at kasse unproxied, Zoho's MX, SPF for Zoho and kasse,
DMARC reporting, and kasse's DKIM key once it is made.
kasse-dkim-tomtervel.sh makes that key in kasse's rspamd beside the
other domains'. dns/README.md has the token, the first-push check
against the live zone, and the order of the move.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L5fbDmSQSb6u27EiEuwzoM
2026-11-07 15:36:36 +01:00

42 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# Run on kasse (see dns/README.md): rspamd signs mail From @tomtervel.no with its own DKIM key
# (selector "kasse"), beside klingenbergbygg.no and dodre.no. Additive:
# the other domains' signing is untouched. Safe to rerun.
set -euo pipefail
K=/var/lib/rspamd/dkim/tomtervel.no.kasse.key
C=/etc/rspamd/local.d/dkim_signing.conf
sudo cp -n "$C" "$C.before-tomtervel"
if ! sudo test -f "$K"; then
sudo rspamadm dkim_keygen -d tomtervel.no -s kasse -b 2048 -k "$K" | sudo tee /root/tomtervel-dkim-dns.txt >/dev/null
fi
sudo chown rspamd:rspamd "$K"
sudo chmod 600 "$K"
if ! sudo grep -q '"tomtervel.no"' "$C"; then
sudo python3 - "$C" <<'PY'
import sys
p = sys.argv[1]
s = open(p).read()
block = ''' "tomtervel.no" {
path = "/var/lib/rspamd/dkim/tomtervel.no.kasse.key";
selector = "kasse";
}
'''
i = s.rstrip().rfind('}') # the closing brace of domain { ... }
s = s[:i] + block + s[i:]
open(p, 'w').write(s)
PY
fi
sudo rspamadm configtest
sudo systemctl reload rspamd
systemctl is-active rspamd
echo
echo "== dkim_signing.conf"
sudo grep -vE '^\s*(#|$)' "$C"
echo
echo "== Publish this as TXT kasse._domainkey.tomtervel.no (the p= value, joined into one string):"
sudo cat /root/tomtervel-dkim-dns.txt