aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-17 15:06:19 -0300
committerEuAndreh <eu@euandre.org>2023-03-17 15:25:29 -0300
commit4dadf12bb8613a610bfd1b6b044cd6b5b4ec8ed3 (patch)
tree0777ec11876fe1567ac25389fafb9dcd81350067
parentqueue.scm: Fix positional argument of dkimproxyout config file (diff)
downloadpackage-repository-4dadf12bb8613a610bfd1b6b044cd6b5b4ec8ed3.tar.gz
package-repository-4dadf12bb8613a610bfd1b6b044cd6b5b4ec8ed3.tar.xz
Makefile: Streamline verification of generated config files
-rw-r--r--.gitignore4
-rw-r--r--Makefile32
-rw-r--r--src/org/euandre/queue.scm14
-rw-r--r--tests/internet/etc/dkimproxyout.conf.in9
-rw-r--r--tests/internet/etc/dovecot.conf.in54
-rw-r--r--tests/internet/etc/postfix/main.cf.in (renamed from tests/internet/main.cf.in)0
-rw-r--r--tests/internet/etc/postfix/master.cf (renamed from tests/internet/master.cf)0
-rw-r--r--tests/internet/etc/sasl2/smtpd.conf3
-rw-r--r--tests/local/etc/postfix/main.cf (renamed from tests/local/main.cf)0
-rw-r--r--tests/local/etc/postfix/master.cf (renamed from tests/local/master.cf)0
10 files changed, 100 insertions, 16 deletions
diff --git a/.gitignore b/.gitignore
index 6b54c16..0275198 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
/result*
-/tests/internet/main.cf
+/tests/internet/etc/postfix/main.cf
+/tests/internet/etc/dkimproxyout.conf
+/tests/internet/etc/dovecot.conf
diff --git a/Makefile b/Makefile
index 26893ea..6ec9c2e 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,14 @@
all: EuAndreh.key guix nix
+test-config-files = \
+ tests/internet/etc/postfix/main.cf \
+ tests/internet/etc/dkimproxyout.conf \
+ tests/internet/etc/dovecot.conf \
+
+derived-assets = \
+ $(test-config-files) \
+
guix: guix-packages guix-services
guix-packages:
@@ -22,17 +30,29 @@ guix-packages:
-f src/org/euandre/packages.scm \
-f src/org/euandre/queue.scm \
+local-files = \
+ /etc/postfix/master.cf \
+ /etc/postfix/main.cf \
+
+internet-files = \
+ $(local-files) \
+ /etc/sasl2/smtpd.conf \
+ /etc/dkimproxyout.conf \
+ /etc/dovecot.conf \
+
guix-services-local:
rm -f result-local
guix system -v3 -Lsrc/ -K -r result-local build tests/local/system.scm
- cmp -s result-local/etc/postfix/master.cf tests/local/master.cf
- cmp -s result-local/etc/postfix/main.cf tests/local/main.cf
+ for f in $(local-files); do \
+ diff -U5 --color=always result-local$$f tests/local$$f; \
+ done
-guix-services-internet: tests/internet/main.cf
+guix-services-internet: $(test-config-files)
rm -f result-internet
guix system -v3 -Lsrc/ -K -r result-internet build tests/internet/system.scm
- cmp -s result-internet/etc/postfix/master.cf tests/internet/master.cf
- cmp -s result-internet/etc/postfix/main.cf tests/internet/main.cf
+ for f in $(internet-files); do \
+ diff -U5 --color=always result-internet$$f tests/internet$$f; \
+ done
guix-services: guix-services-local guix-services-internet
@@ -47,7 +67,7 @@ check:
clean:
rm -rf \
- result* .paku/ deb/ tests/internet/main.cf
+ $(derived-assets) result* .paku/ deb/
public:
diff --git a/src/org/euandre/queue.scm b/src/org/euandre/queue.scm
index 340bc1e..c331cdd 100644
--- a/src/org/euandre/queue.scm
+++ b/src/org/euandre/queue.scm
@@ -1366,13 +1366,15 @@ max_age: 604800
(state-dir dovecot-configuration-state-dir (default "/var/lib/dovecot"))
(hostname dovecot-configuration-hostname (default (gethostname))))
+
+;; FIXME:
+;; mail_plugins
(define (generate-dovecot-config config)
(match-record config <dovecot-configuration>
(mail-in-home? user group auth-worker-group untrusted-user
hostname base-dir state-dir extra-content)
(format #f
- "
-protocols = imap
+ "protocols = imap
default_internal_user = ~a
default_internal_group = ~a
@@ -1390,7 +1392,6 @@ service auth-worker {
group = ~a
}
-
ssl = required
ssl_cert = </etc/letsencrypt/live/~a/fullchain.pem
ssl_key = </etc/letsencrypt/live/~a/privkey.pem
@@ -1403,10 +1404,6 @@ verbose_proctitle = yes
mail_location = maildir:~a:INBOX=~a:LAYOUT=fs
-# FIXME:
-# mail_plugins
-
-
namespace inbox {
inbox = yes
mailbox Drafts {
@@ -1431,8 +1428,7 @@ namespace inbox {
auto = subscribe
}
}
-~a
-"
+~a"
user
group
untrusted-user
diff --git a/tests/internet/etc/dkimproxyout.conf.in b/tests/internet/etc/dkimproxyout.conf.in
new file mode 100644
index 0000000..0059804
--- /dev/null
+++ b/tests/internet/etc/dkimproxyout.conf.in
@@ -0,0 +1,9 @@
+listen 127.0.0.1:10027
+relay 127.0.0.1:10028
+
+domain @HOSTNAME@
+selector dkimproxyout
+
+signature dkim(c=relaxed/relaxed)
+
+keyfile /var/lib/dkimproxyout/private.key
diff --git a/tests/internet/etc/dovecot.conf.in b/tests/internet/etc/dovecot.conf.in
new file mode 100644
index 0000000..6ac013d
--- /dev/null
+++ b/tests/internet/etc/dovecot.conf.in
@@ -0,0 +1,54 @@
+protocols = imap
+
+default_internal_user = dovecot
+default_internal_group = dovecot
+default_login_user = dovenull
+auth_mechanisms = plain login
+auth_username_format = %n
+
+passdb {
+ driver = shadow
+}
+userdb {
+ driver = passwd
+}
+service auth-worker {
+ group = etc-shadow
+}
+
+ssl = required
+ssl_cert = </etc/letsencrypt/live/@HOSTNAME@/fullchain.pem
+ssl_key = </etc/letsencrypt/live/@HOSTNAME@/privkey.pem
+ssl_dh = </var/lib/dovecot/dhparam.pem
+
+base_dir = /var/run/dovecot
+state_dir = /var/lib/dovecot
+
+verbose_proctitle = yes
+
+mail_location = maildir:/var/mail/%u:INBOX=/var/mail/%u:LAYOUT=fs
+
+namespace inbox {
+ inbox = yes
+ mailbox Drafts {
+ special_use = \Drafts
+ auto = subscribe
+ }
+ mailbox Sent {
+ special_use = \Sent
+ auto = subscribe
+ }
+ mailbox Archive {
+ special_use = \Archive
+ auto = subscribe
+ }
+ mailbox Junk {
+ special_use = \Junk
+ auto = subscribe
+ autoexpunge = 30d
+ }
+ mailbox Trash {
+ special_use = \Trash
+ auto = subscribe
+ }
+}
diff --git a/tests/internet/main.cf.in b/tests/internet/etc/postfix/main.cf.in
index 566dbcd..566dbcd 100644
--- a/tests/internet/main.cf.in
+++ b/tests/internet/etc/postfix/main.cf.in
diff --git a/tests/internet/master.cf b/tests/internet/etc/postfix/master.cf
index 5c25fd9..5c25fd9 100644
--- a/tests/internet/master.cf
+++ b/tests/internet/etc/postfix/master.cf
diff --git a/tests/internet/etc/sasl2/smtpd.conf b/tests/internet/etc/sasl2/smtpd.conf
new file mode 100644
index 0000000..af2ac43
--- /dev/null
+++ b/tests/internet/etc/sasl2/smtpd.conf
@@ -0,0 +1,3 @@
+pwcheck_method: saslauthd
+saslauthd_path: /var/run/saslauthd/mux
+log_level: 7
diff --git a/tests/local/main.cf b/tests/local/etc/postfix/main.cf
index f9eee9e..f9eee9e 100644
--- a/tests/local/main.cf
+++ b/tests/local/etc/postfix/main.cf
diff --git a/tests/local/master.cf b/tests/local/etc/postfix/master.cf
index 2cc4b02..2cc4b02 100644
--- a/tests/local/master.cf
+++ b/tests/local/etc/postfix/master.cf