On Thu, Apr 08, 2021 at 10:25:24AM +0300, Reio Remma wrote:
> On 08.04.2021 09:48, Tom Szilagyi wrote:
> > I can provoke this on two occasions:
> > 
> > 1. User does not exist:
> > 
> > Apr 8 08:03:45 mail smtpd[26476]: 5d56b355f19e7a92 mda delivery
> > evpid=9d6aa2bcd0d53c97 from=<t...@example.com>
> > to=<nosuchaddr...@example.com> rcpt=<nosuchaddr...@example.com>
> > user=vmail delay=10s result=TempFail stat=Error (temporary failure:
> > "mail.lmtp: LMTP server error: 550 5.1.1 <nosuchaddr...@example.com>
> > User doesn't exist: nosuchaddr...@example.com")
> 
> Does this not mean, that the user exists in OpenSMTPD, but doesn't exist in
> LMTP side? That's a server problem and should be resolved, making it a
> temporary error. Unless you haven't set up the users database in your
> OpenSMTPD and just send everything to your LMTP server.

The virtuals I have direct OpenSMTPD to deliver everything under the
domain to Dovecot via LMTP, so the user resolution should happen on
the other side of LMTP only (if I understand things correctly).

I have this in /etc/mail/virtuals:

@example.com vmail

My perspective is that since LMTP gives a clear indication that the
user does not exist, OpenSMTPD should honor that and bounce the
incoming mail back to the sender (so they get immediate feedback).
But maybe I am misunderstanding things and this is not a supported
setup?

> 
> > 2. User quota is full:
> > 
> > Apr 8 07:45:39 mail smtpd[1517]: 65b4cb1b1ad15fa4 mda delivery
> > evpid=3a1e3c3302257a66 from=<t...@example.com>
> > to=<iamf...@example.com> rcpt=<iamf...@example.com> user=vmail
> > delay=10s result=TempFail stat=Error (temporary failure: "mail.lmtp:
> > LMTP server error: 552 5.2.2 <t...@example.com> Quota exceeded
> > (mailbox for user is full)")
> 
> Quota may be resolved in the next minute by the user, so it's also not a
> permanent error.

I would strongly prefer to treat it as one. Users with the propensity
to fill up their mailbox will have the propensity to fill up the rest
of my system. They get ample heads up from the system before their
quota runs out. I do not want to allocate any resources on them (queue
space, retries) on top of their already existing quota.

Is there an option to change this behaviour and treat permanent errors
(SMTP 5xx) like ... permanent errors? Or do I have to implement tricks
like programmatically removing them from the user database when their
mailbox is filled (and re-add them when they clean up)?

> 
> > Local delivery is handed over to Dovecot via:
> >    action "domain_mail" lmtp "/var/dovecot/lmtp" rcpt-to virtual <virtuals>
> 
> My config rejects no-existing users immediately within the SMTP connection:
> 
> match from any for domain <domains> rcpt-to <recipients> action deliver_lmtp
> 
> action deliver_lmtp lmtp "/var/run/dovecot/lmtp" rcpt-to virtual <virtuals>
> userbase <userinfo>
> 
> Do you have user checking in your match rule?

At the moment, I only match on domains:

match from any for domain <domains> action "domain_mail"

Maybe I could do what you did here, and that would probably solve one
of my problems (but not the other). So I guess my more general
question still stands: is there a way to make OpenSMTPD honor
permanent failures as such? Or am I completely up the wrong alley
here? Is this behaviour (retrying in the face of permanent errors) a
bug or a feature of OpenSMTPD?

Many thanks,
Tom

Reply via email to