[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

help with my opensmtpd-records.scm file

From: jbranso
Subject: help with my opensmtpd-records.scm file
Date: Wed, 08 Dec 2021 18:08:26 +0000

Hey guix!

I am still working on extending guix's current opensmtpd-service with (guix records).

I am getting fairly close to realizing that goal. For example this works:

(display (opensmtpd-configuration->mixed-text-file
(let ([interface "wlp2s0"]
[creds (opensmtpd-table
(name "creds")
(cons "joshua"
[receive-action (opensmtpd-action-local-delivery-configuration
(name "receive")
(method (opensmtpd-maildir-configuration
(pathname "/home/%{rcpt.user}/Maildir")
(junk #t)))
(virtual "vusers"))]
[ (opensmtpd-pki
(domain "")
(cert "opensmtpd.scm")
(key "opensmtpd.scm"))])
(mta-max-deferred 50)
(compression #t)))
(max-message-size "10M")))
(ttl-delay "5d")))
;; this forum help suggests that I listen on and NOT eth0
;; this listens for email from the outside world
(interface interface)
(port 25)
(secure-connection "tls")
;; this lets local users logged into the system via ssh send email
(interface "lo")
(port 25)
(secure-connection "tls")
(interface interface)
(port 465)
(secure-connection "smtps")
(auth creds)
;;(filter )
(interface interface)
(port 587)
(secure-connection "tls-require")
(auth creds)
(matches (list
(action (opensmtpd-action-relay-configuration
(name "send")))
(for (opensmtpd-match-option-configuration
(option "for any")))
(from (opensmtpd-match-option-configuration
(option "from any")))
(auth (opensmtpd-match-option-configuration
(option "auth"))))
(action receive-action)
(from (opensmtpd-match-option-configuration
(option "from any")))
(for (opensmtpd-match-option-configuration
(option "for domain")
(value ""))
;;FIXME/TODO put in a table <vdoms> here
;;"for domain <vdoms>"
(action receive-action)
(for (opensmtpd-match-option-configuration
(option "for local"))))))))))

;; and it outputs:

smtp max-message-size 10M

srs ttl 5d

queue compression

mta max-deferred 50

pki cert "opensmtpd.scm"
pki key "opensmtpd.scm"

listen on wlp2s0 tls port 25 pki
listen on lo tls port 25 pki
listen on wlp2s0 smtps port 465 pki auth <creds>
listen on wlp2s0 tls-require port 587 pki auth <creds>

action "send" relay

action "receive" maildir "/home/%{rcpt.user}/Maildir" junk virtual <vusers>

match from any for any auth action "send"
match from any for domain action "receive"
match for local action "receive"

My question has to do with how I am handling the opensmtpd filters...Some of the opensmtpd filter
commands execute programs. I would like to get some advice about how to let some of the
<opensmtpd-configuration>'s fieldnames be gexps. My current opensmtpd.scm file does so:

(though I am getting some errors with the procedure
create-etc-dkimsign-key-file. I should probable use the guix's etc-service instead). Anyway, Right now I am using a LOT of code like 

(mixed-text-file (string-append variable (string-append (function (string-append (another-function ...))))

I suppose I should instead change this to

(define my-list (list (function ...) (function ...) (list (function (list (function ...) (function ...))))

(mixed-text-file (apply string-append (flatten my-list)))

BUT that doesn't quite answer my issue. It would be helpful to allow some <opensmtpd-configuration>'s
fieldnames accept gexps. How would I allow go about doing that?

I think that the answer would be to use guix's mixed-text-file*, but I am not sure how to do that elegantly...

My current code is here:

Perhaps a more targeted question would be how do I modify the current procedure
opensmtpd-filter-proc-exec->string record to accept gexps? 

Suggestions are most welcome.

My thoughts about the service are here:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]