A sr.ht/go-msgauth/APKBUILD => sr.ht/go-msgauth/APKBUILD +48 -0
@@ 0,0 1,48 @@
+# Maintainer: Drew DeVault <sir@cmpwn.com>
+pkgname=go-msgauth
+pkgver=0.6.1
+pkgrel=0
+pkgdesc="Go utilities for DKIM, DMARC, and Authentication-Results"
+url="https://github.com/emersion/go-msgauth"
+arch="all"
+license="MIT"
+install="$pkgname.pre-install"
+makedepends="go"
+source="
+ $pkgname-$pkgver.tar.gz::https://github.com/emersion/go-msgauth/archive/v$pkgver.tar.gz
+ dkim-milter.confd
+ dkim-milter.initd
+"
+subpackages="$pkgname-openrc"
+
+build() {
+ go mod vendor
+ for bin in dkim-milter dkim-verify dkim-keygen dmarc-lookup
+ do
+ go build \
+ -trimpath \
+ -mod=vendor \
+ -ldflags "-extldflags $LDFLAGS" \
+ ./cmd/$bin
+ done
+}
+
+check() {
+ go test ./...
+}
+
+package() {
+ for bin in dkim-milter dkim-verify dkim-keygen dmarc-lookup
+ do
+ install -Dm755 $bin "$pkgdir"/usr/bin/$bin
+ done
+
+ install -Dm755 "$srcdir"/dkim-milter.initd \
+ "$pkgdir"/etc/init.d/dkim-milter
+ install -Dm644 "$srcdir"/dkim-milter.confd \
+ "$pkgdir"/etc/conf.d/dkim-milter
+}
+
+sha512sums="be6c39203bb2dd772299539a4eeda9adf61da58c7cf2dba09f37cd19a7455984de567a7d1707ad4b14d6fc3366fb65cdeb42c9576c9785b9a56f103f8540776b go-msgauth-0.6.1.tar.gz
+e6249d80ada350a05d647b97617113e966c18f837d3edb9c0a85952dd9076d6b9aa6a2ba30e73baae029c380983f92d40a3148f95b39ad6347a2a4824849700b dkim-milter.confd
+944dcac8b22e113fcdfd67c76f5183f4ad0f320d7888f695c7854bb05eaf71af898eabd5857aff9447602fd9b0cb58ba9029ee878a330e35a19d19bfbf6ee139 dkim-milter.initd"
A sr.ht/go-msgauth/dkim-milter.confd => sr.ht/go-msgauth/dkim-milter.confd +24 -0
@@ 0,0 1,24 @@
+# Address to listen for milter connections on
+#
+# tcp://[ip]:[port]
+# or
+# unix://path/to/socket
+dkim_listen_address=tcp://127.0.0.1:8891
+
+# Space separated list of domains to sign for outgoing mails
+dkim_sign_domains=
+
+# Selector for DNS DKIM key (i.e. $dkim_selector._domainkey TXT)
+dkim_selector=
+
+# Path to DKIM key
+#
+# Generate key:
+# $ dkim-keygen -f /var/lib/dkim/example.key
+#
+# Then configure:
+# dkim_key=/var/lib/dkim/example.key
+dkim_key=
+
+output_log=/var/log/dkim-milter.log
+error_log=/var/log/dkim-milter.log
A sr.ht/go-msgauth/dkim-milter.initd => sr.ht/go-msgauth/dkim-milter.initd +25 -0
@@ 0,0 1,25 @@
+#!/sbin/openrc-run
+name="dkim-milter"
+description="Milter for DKIM signatures and verification"
+supervisor=supervise-daemon
+command=/usr/bin/dkim-milter
+_domains=
+for d in $dkim_sign_domains
+do
+ _domains="$domains -d $d"
+done
+command_args="-l $dkim_listen_address -s $dkim_selector -k $dkim_key $_domains"
+command_user="dkim:dkim"
+
+start_pre() {
+ [ -n "$output_log" ] && checkpath -f "$output_log" \
+ -m 644 -o dkim:dkim
+ [ -n "$error_log" ] && checkpath -f "$error_log" \
+ -m 644 -o dkim:dkim
+ if [ -z "$dkim_sign_domains" ] || [ -z "$dkim_key" ] || [ -z "$dkim_selector" ]
+ then
+ eerror "$RC_SVCNAME is not configured to sign any domains"
+ eerror "Edit /etc/conf.d/$RC_SVCNAME before continuing"
+ eend 1
+ fi
+}
A sr.ht/go-msgauth/go-msgauth.pre-install => sr.ht/go-msgauth/go-msgauth.pre-install +4 -0
@@ 0,0 1,4 @@
+#!/bin/sh
+grep '^dkim' /etc/group >/dev/null || addgroup -S dkim 2>/dev/null
+grep '^dkim' /etc/passwd >/dev/null || adduser -SDh/var/lib/dkim \
+ -s/sbin/nologin -Gdkim -gdkim dkim dkim 2>/dev/null