Saturday, May 26, 2018

[patch] Re: smtpd.conf new grammar

On 05/26/18 19:18, Edgar Pettijohn III wrote:
>
>> Sorry, I've read the announcements, looked at man pages and examples,
>> but still didn't manage to figure out how to translate "deliver via
>> dovecot
>> lmtp"
>> (to have sieve working) into the new syntax. So far my config was:
>>
>> table vusers ldap:/etc/mail/ldap.conf
>> table vdomains ldap:/etc/mail/ldap.conf
>> table passwd ldap:/etc/mail/ldap.conf
>>
>> accept from local for local virtual <vusers> deliver to lmtp
>> "/var/dovecot/lmtp"
>> accept from any for domain <vdomains> virtual <vusers> deliver to lmtp
>> "/var/dovecot/lmtp"
>>
>>
>> I tried changing those into:
>>
>> action "lmtp-local" mda "/usr/libexec/mail.lmtp -d /var/dovecot/lmtp"
>
> try:
> action "lmtp-local" mda "/usr/libexec/mail.lmtp -d
> unix:/var/dovecot/lmtp -f %{sender}"
>
> However, this does feel odd. I need to switch over as well, but still
> trying to wrap my brain around the new config.
>> virtual <vusers>
>> action "relay" relay
>> match from local for local action "lmtp-local"
>> match from any for domain <vdomains> action "lmtp-local"
>> match from local for any action "relay"
>>
>>
>> but delivery attempts fail with Error ("mail.lmtp: sender must be
>> specified
>> with -f")
>>
>> What would be the proper config for this?
>>   --
>> viq
>
Try this patch. You may need to play with the %%{rcpt.user} bit
depending on your dovecot userdb. It needs more to handle different use
cases.

smtpd.conf bits
action "local" lmtp "unix:/var/dovecot/lmtp"
match for local action "local"


diff -u -p -u -r1.202 parse.y
--- parse.y     25 May 2018 14:10:28 -0000      1.202
+++ parse.y     27 May 2018 03:00:06 -0000
@@ -179,7 +179,7 @@ typedef struct {
 %token HELO HELO_SRC HOST HOSTNAME HOSTNAMES
 %token INCLUDE INET4 INET6
 %token KEY
-%token LIMIT LISTEN LOCAL
+%token LIMIT LISTEN LOCAL LMTP
 %token MAIL_FROM MAILDIR MASK_SRC MASQUERADE MATCH MAX_MESSAGE_SIZE
MAX_DEFERRED MBOX MDA MTA MX
 %token NODSN
 %token ON
@@ -376,6 +376,10 @@ MBOX {
 | EXPAND_ONLY {
        dispatcher->u.local.expand_only = 1;
 } dispatcher_local_options
+| LMTP STRING {
+       asprintf(&dispatcher->u.local.command,
+          "/usr/libexec/mail.lmtp -f %%{sender} -d %s %%{rcpt.user}", $2);
+} dispatcher_local_options

 ;

@@ -1535,6 +1539,7 @@ lookup(char *s)
                { "key",                KEY },
                { "limit",              LIMIT },
                { "listen",             LISTEN },
+               { "lmtp",               LMTP },
                { "local",              LOCAL },
                { "mail-from",          MAIL_FROM },
                { "maildir",            MAILDIR },

Plus a little log porn for you.
May 26 22:07:45 laptop smtpd[38093]: e133b6fee23c0b30 smtp
event=connected address=local host=laptop.my.domain
May 26 22:07:45 laptop smtpd[38093]: e133b6fee23c0b30 smtp event=message
address=local host=laptop.my.domain msgid=39a32d75
from=<edgar@laptop.my.domain> to=<edgar@laptop.my.domain> size=355
ndest=1 proto=ESMTP
May 26 22:07:45 laptop smtpd[38093]: e133b6fee23c0b30 smtp event=closed
address=local host=laptop.my.domain reason=quit
May 26 22:07:45 laptop dovecot: lmtp(9496): Connect from local
May 26 22:07:45 laptop dovecot: lmtp(edgar):
msgid=<e133b6ffd53072e5@laptop.my.domain>: saved mail to INBOX
May 26 22:07:45 laptop dovecot: lmtp(9496): Disconnect from local:
Successful quit
May 26 22:07:45 laptop smtpd[38093]: 0000000000000000 mda event=delivery
evpid=39a32d75b3524ef6 from=<edgar@laptop.my.domain>
to=<edgar@laptop.my.domain> rcpt=<edgar@laptop.my.domain> user=edgar
delay=0s result=Ok stat=Delivered

No comments:

Post a Comment