aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-16 18:09:35 -0300
committerEuAndreh <eu@euandre.org>2023-03-16 18:09:35 -0300
commitd4f6098686c5ff6f207ba87b488742691e38db8d (patch)
treeefa7ab83801427175f773a566c800cd7a6702b01
parentqueue.scm: Add enable-submission? flag to switch Postfix master.cf file (diff)
downloadpackage-repository-d4f6098686c5ff6f207ba87b488742691e38db8d.tar.gz
package-repository-d4f6098686c5ff6f207ba87b488742691e38db8d.tar.xz
queue.scm: Also use enable-submission? flag to switch Postfix main.cf file
-rw-r--r--src/org/euandre/queue.scm67
1 files changed, 41 insertions, 26 deletions
diff --git a/src/org/euandre/queue.scm b/src/org/euandre/queue.scm
index dd281aa..33b4122 100644
--- a/src/org/euandre/queue.scm
+++ b/src/org/euandre/queue.scm
@@ -953,27 +953,9 @@ postlog unix-dgram n - n - 1 postlogd
(key-file hostname)
(or key-file (format #f "/etc/letsencrypt/live/~a~a/privkey.pem" prefix hostname))))
-(define (generate-main.cf config)
- (match-record config <postfix-configuration>
- (postfix mail-in-home? queue-directory data-directory user setgid-group hostname main.cf-extra)
- (format #f
- "
-compatibility_level = 3.6
-
-queue_directory = ~a
-data_directory = ~a
-mail_owner = ~a
-setgid_group = ~a
-
+(define main.cf-internet-extra
+ "
myhostname = ~a
-mydestination = $myhostname, $mydomain, localhost.$mydomain, localhost
-
-alias_maps = hash:/etc/aliases
-# alias_maps = hash:/etc/aliases, static:andreh
-
-header_checks = regexp:{ { /^Received:.*/ IGNORE }, { /^X-Originating-IP:.*/ IGNORE } }
-
-~a
smtpd_use_tls = yes
smtpd_tls_cert_file = ~a
@@ -1001,21 +983,54 @@ debug_peer_list = 127.0.0.1
milter_default_action = accept
# smtpd_milters = FIXME
+")
+(define main.cf-local-extra
+ "
+mynetworks = 127.0.0.0/8
+
+sender_dependent_relayhost_maps = hash:/var/lib/private/postfix/relayhosts-maps
+smtp_sasl_password_maps = hash:/var/lib/private/postfix/sasl-password
+smtp_sasl_auth_enable = yes
+smtp_sasl_security_options = noanonymous
+smtp_tls_security_level = encrypt
+smtp_tls_note_starttls_offer = yes
+smtp_use_tls = yes
+smtp_sender_dependent_authentication = yes
+smtp_sasl_mechanism_filter = login, plain
+")
+;; postfix -> package
+(define (generate-main.cf config)
+ (match-record config <postfix-configuration>
+ (postfix mail-in-home? enable-submission? queue-directory data-directory
+ user setgid-group hostname main.cf-extra)
+ (format #f
+ "compatibility_level = 3.6
+
+queue_directory = ~a
+data_directory = ~a
+mail_owner = ~a
+setgid_group = ~a
+
+header_checks = regexp:{ { /^Received:.*/ IGNORE }, { /^X-Originating-IP:.*/ IGNORE } }
+
~a
-"
+~a~a"
+
queue-directory
data-directory
user
setgid-group
- hostname
(if mail-in-home?
"home_mailbox = Mail/Inbox/"
"mail_spool_directory = /var/mail/")
-
- (cert-for "" config)
- (key-for "" config)
- main.cf-extra)))
+ main.cf-extra
+ (if enable-submission?
+ (format #f main.cf-internet-extra
+ hostname
+ (cert-for "" config)
+ (key-for "" config))
+ (format #f main.cf-local-extra)))))
(define (postfix-etc-files config)
(match-record config <postfix-configuration>