aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthieu Valleton <mvalleton@seos.fr>2025-10-01 15:59:27 +0000
committerRobert Clausecker <fuz@FreeBSD.org>2025-10-05 13:44:07 +0000
commit0404ac4cad9ba5fd3bd86872e65fa16265eac3e1 (patch)
tree161dceff62b6e849700acf4f5a5f52806b44d1d4
parent47bb7f2e7fee8d801ba9f697316c9040555603ec (diff)
mail/opensmtpd-filter-dkimsign: DKIM filter for OpenSMTPd
This filter adds a DKIM signature to emails sent through OpenSMTPd. The rsa and ed25519 signing algorithms are supported, as well as the simple and relaxed canonicalization algorithms. The filter can sign emails for several domains, selecting them according to the from-header, but can only use a single selector, managing multiple selectors must be done at the OpenSMTPd level. It depends on the libopensmtpd port. An example of a minimal configuration for signing outgoing emails for domain "example.com" and selector "_selector" would be: filter "dkimsign" proc-exec "filter-dkimsign -d example.com -s _selector \ -k /usr/local/etc/smtpd/dkim/private.key" user _smtpd group _smtpd And then you can apply that filter to the mail that needs to be signed: listen on lo0 filter dkimsign WWW: https://imperialat.at/dev/filter-dkimsign/ PR: 283823
-rw-r--r--mail/Makefile1
-rw-r--r--mail/opensmtpd-filter-dkimsign/Makefile36
-rw-r--r--mail/opensmtpd-filter-dkimsign/distinfo3
-rw-r--r--mail/opensmtpd-filter-dkimsign/pkg-descr20
4 files changed, 60 insertions, 0 deletions
diff --git a/mail/Makefile b/mail/Makefile
index aba4803ad97c..092979a16662 100644
--- a/mail/Makefile
+++ b/mail/Makefile
@@ -290,6 +290,7 @@
SUBDIR += opensmtpd-extras-table-redis
SUBDIR += opensmtpd-extras-table-socketmap
SUBDIR += opensmtpd-extras-table-sqlite
+ SUBDIR += opensmtpd-filter-dkimsign
SUBDIR += opensmtpd-filter-rspamd
SUBDIR += opensmtpd-filter-senderscore
SUBDIR += opensmtpd-table-sqlite
diff --git a/mail/opensmtpd-filter-dkimsign/Makefile b/mail/opensmtpd-filter-dkimsign/Makefile
new file mode 100644
index 000000000000..802c3786498c
--- /dev/null
+++ b/mail/opensmtpd-filter-dkimsign/Makefile
@@ -0,0 +1,36 @@
+PORTNAME= filter-dkimsign
+DISTVERSION= 0.5
+CATEGORIES= mail
+MASTER_SITES= https://imperialat.at/releases/
+PKGNAMEPREFIX= opensmtpd-
+
+MAINTAINER= mvalleton@seos.fr
+COMMENT= Library for writing opensmtpd filters
+WWW= https://imperialat.at/dev/filter-dkimsign/
+
+LICENSE= ISCL
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+LIB_DEPENDS= libevent.so:devel/libevent \
+ libopensmtpd.so:mail/libopensmtpd
+
+MAKEFILE= Makefile.gnu
+USES= gmake localbase ssl
+PLIST_FILES= libexec/opensmtpd/filter-dkimsign \
+ share/man/man8/filter-dkimsign.8.gz
+
+# LDFLAGS used by gmake during build
+# MANDIR and BINDIR used by make during install
+MAKE_ARGS= BINDIR=${LOCALBASE}/libexec/opensmtpd \
+ MANDIR=${LOCALBASE}/share/man/man \
+ MK_DEBUG_FILES=no
+
+# Makefile.gnu's install target uses Linux-specific install options so we
+# have to use the OpenBSD Makefile instead. Thus, it's easier to just do
+# it manually.
+do-install:
+ ${MKDIR} ${STAGEDIR}${PREFIX}/libexec/opensmtpd
+ ${INSTALL_PROGRAM} ${WRKSRC}/filter-dkimsign ${STAGEDIR}${PREFIX}/libexec/opensmtpd/
+ ${INSTALL_MAN} ${WRKSRC}/filter-dkimsign.8.gz ${STAGEDIR}${PREFIX}/share/man/man8
+
+.include <bsd.port.mk>
diff --git a/mail/opensmtpd-filter-dkimsign/distinfo b/mail/opensmtpd-filter-dkimsign/distinfo
new file mode 100644
index 000000000000..f89f58056d2c
--- /dev/null
+++ b/mail/opensmtpd-filter-dkimsign/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1735833837
+SHA256 (filter-dkimsign-0.5.tar.gz) = a5b4ec3af5ecb42351a0b5459bdd0f32c00ec55c23050b5f46dfaed8e321974b
+SIZE (filter-dkimsign-0.5.tar.gz) = 23709
diff --git a/mail/opensmtpd-filter-dkimsign/pkg-descr b/mail/opensmtpd-filter-dkimsign/pkg-descr
new file mode 100644
index 000000000000..2096b86e4bb6
--- /dev/null
+++ b/mail/opensmtpd-filter-dkimsign/pkg-descr
@@ -0,0 +1,20 @@
+This filter adds a DKIM signature to emails sent through OpenSMTPd.
+The rsa and ed25519 signing algorithms are supported, as well as the
+simple and relaxed canonicalization algorithms.
+
+The filter can sign emails for several domains, selecting them
+according to the from-header, but can only use a single selector,
+managing multiple selectors must be done at the OpenSMTPd level.
+
+It depends on the libopensmtpd port.
+
+
+An example of a minimal configuration for signing outgoing emails for
+domain "example.com" and selector "_selector" would be:
+
+filter "dkimsign" proc-exec "filter-dkimsign -d example.com -s _selector \
+ -k /usr/local/etc/smtpd/dkim/private.key" user _smtpd group _smtpd
+
+And then you can apply that filter to the mail that needs to be signed:
+
+listen on lo0 filter dkimsign