From aaf9ab7ffa576b0fef69ecd9d6f8e38dc8a89864 Mon Sep 17 00:00:00 2001 From: Terra Date: Thu, 13 May 2021 05:59:59 -0700 Subject: [PATCH] testing/nullmailer: various improvements Squashed commit of the following: commit af0dae99cda7c1b0c4fa725aa59a853a65644920 Author: Terra Date: Thu May 13 05:45:50 2021 -0700 commit 975ea029e145c097944f5d42c30c3d1a7882418f Author: Terra Date: Thu May 13 05:45:10 2021 -0700 testing/nullmailer: Add more comprehensive /etc/init.d/nullmailer commit e7b93f65eeed56e6087942d93359f2d8a1199e40 Author: Terra Date: Thu May 13 05:41:56 2021 -0700 testing/nullmailer: Fix install warning regarding missing embedded checksums ref: https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10031 commit 5bec89525c4a4a017d605ac325230cd1a9b6b3ea Author: Terra Date: Thu May 13 05:38:26 2021 -0700 testing/nullmailer: Fix various test issues commit e288818ee33f54c798e2f279cf02612ebe3b51f0 Author: Terra Date: Thu May 13 05:34:55 2021 -0700 testing/nullmailer: Replace remotes.conf with a more descriptive version --- testing/nullmailer/APKBUILD | 22 +++++-- ...ullmailer-2.2-disable-dns-using-test.patch | 26 +++++++++ ...llmailer-2.2-disable-smtp-auth-tests.patch | 57 +++++++++++++++++++ ...ullmailer-2.2-fix-test-racecondition.patch | 29 ++++++++++ testing/nullmailer/nullmailer.initd | 36 +++++++++++- testing/nullmailer/nullmailer.post-deinstall | 8 +++ testing/nullmailer/nullmailer.post-install | 9 +++ testing/nullmailer/nullmailer.pre-install | 0 testing/nullmailer/remotes.conf | 32 ++++++++++- 9 files changed, 210 insertions(+), 9 deletions(-) create mode 100644 testing/nullmailer/nullmailer-2.2-disable-dns-using-test.patch create mode 100644 testing/nullmailer/nullmailer-2.2-disable-smtp-auth-tests.patch create mode 100644 testing/nullmailer/nullmailer-2.2-fix-test-racecondition.patch create mode 100644 testing/nullmailer/nullmailer.post-deinstall create mode 100644 testing/nullmailer/nullmailer.post-install mode change 100755 => 100644 testing/nullmailer/nullmailer.pre-install diff --git a/testing/nullmailer/APKBUILD b/testing/nullmailer/APKBUILD index b15b887963d..30d145e1cdd 100644 --- a/testing/nullmailer/APKBUILD +++ b/testing/nullmailer/APKBUILD @@ -1,8 +1,9 @@ # Contributor: Simon Frankenberger +# Contributor: Terra # Maintainer: Simon Frankenberger pkgname=nullmailer pkgver=2.2 -pkgrel=0 +pkgrel=1 pkgdesc="Simple relay-only mail transport agent" url="https://github.com/bruceg/nullmailer" arch="all" @@ -12,6 +13,9 @@ makedepends="automake autoconf bash" checkdepends="daemontools ucspi-tcp6" source="$pkgname-$pkgver.tar.gz::https://github.com/bruceg/nullmailer/archive/$pkgver.tar.gz fix-tests-catch-port.patch + nullmailer-2.2-disable-dns-using-test.patch + nullmailer-2.2-disable-smtp-auth-tests.patch + nullmailer-2.2-fix-test-racecondition.patch nullmailer.initd adminaddr.conf @@ -20,7 +24,7 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/bruceg/nullmailer/archive/$p " pkgusers="nullmailer" pkggroups="nullmailer" -install="$pkgname.pre-install" +install="$pkgname.pre-install $pkgname.post-install $pkgname.post-deinstall" prepare() { default_prepare @@ -45,11 +49,19 @@ package() { install -Dm0644 "$srcdir/adminaddr.conf" "$pkgdir/etc/nullmailer/adminaddr" install -Dm0644 "$srcdir/defaultdomain.conf" "$pkgdir/etc/nullmailer/defaultdomain" install -Dm0644 "$srcdir/remotes.conf" "$pkgdir/etc/nullmailer/remotes" + + # ref: https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10031 + rm -f "$pkgdir/var/spool/nullmailer/trigger" } -sha512sums="15c070edcf820ad13d8e0b250f73d75e45f592caa039e94fd717226fe09cd0ddc1f165388fab6234f57b340acc5127b54df14f35022858aab971b1f3d4e89e63 nullmailer-2.2.tar.gz +sha512sums=" +15c070edcf820ad13d8e0b250f73d75e45f592caa039e94fd717226fe09cd0ddc1f165388fab6234f57b340acc5127b54df14f35022858aab971b1f3d4e89e63 nullmailer-2.2.tar.gz 499666333703d6b4dfe9afa76f1d4a48ec7faa4a2ca9dbe8aee6737ce98dcf4509b281ebe2fd2ce0b32d3a91b807a8b2dcffe794b70cb5b3ccb10cb7eca713e4 fix-tests-catch-port.patch -e183bf83055ea0d9fd63598329296d9f654f99bea8761b4f9a5961a76b26ae62e4a8a4b92007e12ecd56e8416a3bac87aaff16d575c7079d6ac571e3b8f80595 nullmailer.initd +d16592477612a716a8883ada1f18c34a4add81cfcfdda252705090e1f0b59f22a9bda9fe26bf950a78e21b9a69d20662825461669db72269280b7f82a1f8f8d9 nullmailer-2.2-disable-dns-using-test.patch +fc3bbcd8accd5a37b8292c6fb3e935ab1cd35d4a67bb224eadf48ff54b3b00508d6496e3d40c4546a966ce5dd6c297822a4e76a6b9e69d0ce47dd4e0e3883e47 nullmailer-2.2-disable-smtp-auth-tests.patch +10873e538dbc89e8899047e732515d30108b25fd0ff6bb2fc695f5790a94ac32629f41c470a2fec951357169fead36ee4512f543ad0e02c52f09799334b815c7 nullmailer-2.2-fix-test-racecondition.patch +23d4ef2e6929d852b8f8cad7589b33b8f47bb0dfb7dae74d9cefb3016a45ef77bd32adb059bd0ed22f9fbe076e5345bbbb55ee1d75e8cdf17f58254c9515dde7 nullmailer.initd 93eac7b9fde3c7a2ffe3acdba1dcfccc1e40d94eb9fc7fc6722d3dfaaa3fd4378bf33698ebc0e10e108833251dbfa35fd280d62d865145fe415c431120b11ffe adminaddr.conf 0d3df6c4d710b8e91d40649ca991e7ab424be625cae724f8305d1ed4f2cf8a1b08e07030ee690cea7091a4c0320aae4e2df14e19efbcc54f1875338d883d8809 defaultdomain.conf -9858c4c52057b222c4f4219301adcc8b36e6c7e4ed51af51f887141fba7a639ed52b756eec06776c91f91767006c4592bca0158708acc371a9123d2efd9b6004 remotes.conf" +5ed12f0c212e66330a1a6429ab48020690463f91d19ab3e2ca5bf3b5b486aa7233a9eecacf5130d553a699ad8a60066aa4246e1fe01f0f92c2e6a9f456edee1e remotes.conf +" diff --git a/testing/nullmailer/nullmailer-2.2-disable-dns-using-test.patch b/testing/nullmailer/nullmailer-2.2-disable-dns-using-test.patch new file mode 100644 index 00000000000..0c5939ab004 --- /dev/null +++ b/testing/nullmailer/nullmailer-2.2-disable-dns-using-test.patch @@ -0,0 +1,26 @@ +https://sources.debian.org/data/main/n/nullmailer/1:2.2-3/debian/patches/0006-Disable-DNS-using-test.patch + +From: David Bremner +Date: Wed, 31 Oct 2018 09:18:53 -0300 +Subject: Disable DNS using test. + +This is probably against policy, and causes build failures in pbuilder +--- + test/tests/protocols | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/test/tests/protocols b/test/tests/protocols +index 52209d7..8f67b0a 100644 +--- a/test/tests/protocols ++++ b/test/tests/protocols +@@ -28,8 +28,8 @@ do + + stop server + +- echo "Testing host not found error with $p." +- error 2 protocol $p --host=this.host.can.not.exist 3<$testmail ++# echo "Testing host not found error with $p." ++# error 2 protocol $p --host=this.host.can.not.exist 3<$testmail + + echo "Testing connection refused error with $p." + error 7 protocol $p -p $port --host=localhost 3<$testmail diff --git a/testing/nullmailer/nullmailer-2.2-disable-smtp-auth-tests.patch b/testing/nullmailer/nullmailer-2.2-disable-smtp-auth-tests.patch new file mode 100644 index 00000000000..f66a4841f4f --- /dev/null +++ b/testing/nullmailer/nullmailer-2.2-disable-smtp-auth-tests.patch @@ -0,0 +1,57 @@ +https://sources.debian.org/data/main/n/nullmailer/1:2.2-3/debian/patches/0007-disable-all-smtp-auth-tests.patch + +From: David Bremner +Date: Tue, 25 Dec 2018 08:18:35 +0900 +Subject: disable all smtp-auth tests + +These seem racy in ways that I haven't been able to completely nail down +--- + test/tests/smtp-auth | 32 ++++++++++++++++---------------- + 1 file changed, 16 insertions(+), 16 deletions(-) + +diff --git a/test/tests/smtp-auth b/test/tests/smtp-auth +index 52e12d0..2dc736f 100644 +--- a/test/tests/smtp-auth ++++ b/test/tests/smtp-auth +@@ -1,25 +1,25 @@ + . functions + export HELOHOST=f.q.d.n + +-make-testmail ++# make-testmail + +-start server "tcpserver -1 ::0 0 sh $srcdir/test/authtest-smtp.sh $tmpdir/smtp-result" +-catch-port server ++# start server "tcpserver -1 ::0 0 sh $srcdir/test/authtest-smtp.sh $tmpdir/smtp-result" ++# catch-port server + +-echo 'Testing auth success with smtp' +-echo '250 OK' > $tmpdir/smtp-result +-protocol smtp --host=localhost --port=$port --user=example --pass=example 3<$testmail ++# echo 'Testing auth success with smtp' ++# echo '250 OK' > $tmpdir/smtp-result ++# protocol smtp --host=localhost --port=$port --user=example --pass=example 3<$testmail + +-echo 'Testing auth login success with smtp' +-echo $'350 Go ahead\n250 AUTH' > $tmpdir/smtp-result +-protocol smtp --host=localhost --port=$port --user=example --pass=example --auth-login 3<$testmail ++# echo 'Testing auth login success with smtp' ++# echo $'350 Go ahead\n250 AUTH' > $tmpdir/smtp-result ++# protocol smtp --host=localhost --port=$port --user=example --pass=example --auth-login 3<$testmail + +-echo 'Testing auth temporary failure with smtp' +-echo '450 No' > $tmpdir/smtp-result +-error 16 protocol smtp --host=localhost --port $port --user=example --pass=example 3<$testmail ++# echo 'Testing auth temporary failure with smtp' ++# echo '450 No' > $tmpdir/smtp-result ++# error 16 protocol smtp --host=localhost --port $port --user=example --pass=example 3<$testmail + +-echo 'Testing auth permanent failure with smtp' +-echo '550 No' > $tmpdir/smtp-result +-error 20 protocol smtp --host=localhost --port $port --user=example --pass=example 3<$testmail ++# echo 'Testing auth permanent failure with smtp' ++# echo '550 No' > $tmpdir/smtp-result ++# error 20 protocol smtp --host=localhost --port $port --user=example --pass=example 3<$testmail + +-stop server ++# stop server diff --git a/testing/nullmailer/nullmailer-2.2-fix-test-racecondition.patch b/testing/nullmailer/nullmailer-2.2-fix-test-racecondition.patch new file mode 100644 index 00000000000..8f721d8d8cc --- /dev/null +++ b/testing/nullmailer/nullmailer-2.2-fix-test-racecondition.patch @@ -0,0 +1,29 @@ +https://sources.debian.org/data/main/n/nullmailer/1:2.2-3/debian/patches/0001-Remove-race-conditions-from-tests.patch + +From: Felix Lechner +Date: Sat, 2 Sep 2017 09:57:43 -0300 +Subject: Remove race conditions from tests + +Testing the qmqp protocol fails because the testing server cannot +acquire the lock. This is solved by waiting for the previous +server to exit gracefully and clear the lock. Similarly, wait +before removing temporary directories. + +Forwarded: no +Last-Update: 2017-10-07 +--- + test/tests/protocols | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/test/tests/protocols b/test/tests/protocols +index 0309d12..52209d7 100644 +--- a/test/tests/protocols ++++ b/test/tests/protocols +@@ -54,6 +54,7 @@ do + echo "Testing protocol failure with $p." + error 11 protocol $p -p $port --host=localhost 3<$testmail + stop server ++ wait + done + + stop server diff --git a/testing/nullmailer/nullmailer.initd b/testing/nullmailer/nullmailer.initd index 63e1757d928..cab49d8bfc7 100644 --- a/testing/nullmailer/nullmailer.initd +++ b/testing/nullmailer/nullmailer.initd @@ -7,5 +7,39 @@ description="Nullmailer relay-only MTA" command=/usr/sbin/nullmailer-send depend() { - need net + use net logger +} + +checkconfig() { + local error=0 + local f=/etc/nullmailer/me + if [ ! -s ${f} ]; then + eerror "${f} does not exist" + error=1 + fi + f=/etc/nullmailer/defaultdomain + if [ ! -s ${f} ]; then + eerror "${f} does not exist" + error=1 + fi + if [ ${error} -eq 1 ]; then + einfo "You need to run 'emerge --config nullmailer'!" + fi + if [ -e /service/nullmailer ]; then + eerror "Nullmailer is already running under svscan!" + error=2 + fi + if [ ${error} -ne 0 ]; then + return 1 + else + return 0 + fi +} + +start_pre() { + checkconfig +} + +stop_pre() { + checkconfig # to avoid init.d stopping svscan instance } diff --git a/testing/nullmailer/nullmailer.post-deinstall b/testing/nullmailer/nullmailer.post-deinstall new file mode 100644 index 00000000000..fcd0ff5739d --- /dev/null +++ b/testing/nullmailer/nullmailer.post-deinstall @@ -0,0 +1,8 @@ +#!/bin/sh + +# Remove /var/spool/nullmailer/trigger fifo +# ref: https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10031 +f_trigger=/var/spool/nullmailer/trigger +if [ -p "$f_trigger" ]; then + rm -f "$f_trigger" +fi diff --git a/testing/nullmailer/nullmailer.post-install b/testing/nullmailer/nullmailer.post-install new file mode 100644 index 00000000000..880b3c81de7 --- /dev/null +++ b/testing/nullmailer/nullmailer.post-install @@ -0,0 +1,9 @@ +#!/bin/sh + +# Create /var/spool/nullmailer/trigger fifo +# ref: https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10031 +f_trigger=/var/spool/nullmailer/trigger +if [ ! -p "$f_trigger" ]; then + mkfifo -m660 "$f_trigger" + chown nullmailer:nullmailer "$f_trigger" +fi diff --git a/testing/nullmailer/nullmailer.pre-install b/testing/nullmailer/nullmailer.pre-install old mode 100755 new mode 100644 diff --git a/testing/nullmailer/remotes.conf b/testing/nullmailer/remotes.conf index d35c8fb18bd..b9150c9cfe4 100644 --- a/testing/nullmailer/remotes.conf +++ b/testing/nullmailer/remotes.conf @@ -1,3 +1,29 @@ -# contains the email login configuration on the remote system -#127.0.0.1 smtp -#smtp.gmail.com smtp --auth-login --port=587 --starttls --user=your-name@gmail.com --pass=your-password --starttls +# Format is: HOST PROTOCOL [OPTIONS] +# HOST = IP or DNS +# PROTOCOL = smtp | qmtp +# OPTIONS = [port=NUMBER] [user] [pass] [starttls | ssl [insecure] ] +# +# Examples: +# A standard SMTP server: +# somesendmailserver.domain.com smtp +# +# A qmail server with QMQP setup: +# someqmailserver.domain.com qmqp +# +# A nonstandard SMTP server setup: +# someotherserver.domain.com smtp port=2525 +# +# SMTP server supporting AUTH PLAIN +# mailserver smtp user= pass= +# +# SMTP server supporting AUTH LOGIN +# mailserver smtp user= pass= auth-login +# +# SMTP server with smtps (legacy - use starttls instead) +# mailserver smtp user= pass= port=465 ssl +# +# SMTP server on submission port with starttls +# mailserver smtp user= pass= port=587 starttls +# +# SMTP server on submission port with starttls and self-signed certificate +# mailserver smtp user= pass= port=587 starttls insecure