mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
This patch adds DKIM signing using https://github.com/driusan/dkim tools to the example hook. It also adds an optional integration test to exercise signing and verification, and corresponding documentation.
20 lines
643 B
Bash
Executable File
20 lines
643 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# If authenticated, sign; otherwise, verify.
|
|
#
|
|
# It is not recommended that we fail delivery on dkim verification failures,
|
|
# but leave it to the MUA to handle verifications.
|
|
# https://tools.ietf.org/html/rfc6376#section-2.2
|
|
#
|
|
# We do a verification here so we have a stronger integration test (check
|
|
# encodings/dot-stuffing/etc. works ok), but it's not recommended for general
|
|
# purposes.
|
|
|
|
if [ "$AUTH_AS" != "" ]; then
|
|
DOMAIN=$( echo "$MAIL_FROM" | cut -d '@' -f 2 )
|
|
exec dkimsign -n -hd -key ../.dkimcerts/private.pem \
|
|
-s $(cat "domains/$DOMAIN/dkim_selector") -d "$DOMAIN"
|
|
fi
|
|
|
|
exec dkimverify -txt ../.dkimcerts/dns.txt
|