Hi Postfix community,

I faced issue with splitting emails via local filter and destination_recipient_limit = 1 under low memory condition which result in duplicated emails in queue.

From what I can see in logs:

- warning: process /usr/libexec/postfix/smtp pid 1039 killed by signal 9
- warning: private/smtpsplit socket: malformed response
- warning: /usr/local/libexec/postfix/smtpd: bad command startup -- throttling

From what I observe it goes as:

1. Postfix get email with multiple rcpts

2. taking couple of rcpts (depending on settings, 3 by default) and creates new email in queue per each recipient

3. reach OOM

4. new emails stay in queue, but original email not get rcpt marked as "done", as result on next queue rerun they will be spitted again resulting in duplicated messages

I expect that when email get queued as new email original email receive 250 OK and mark email as "done", but looks like it not the case.

Maybe somebody know a secure way to avoid such situation? Or only possible way it to never face OOM, which honestly can be complicated at traffic spikes like email bombing, etc.

Can be reproduced in docker with mem limit f.e. 100mb by send one email with 50 rcpts with next configuration:

1. Extra main.cf:

milter_default_action = tempfail
smtpd_milters = inet:rspamd-proxy:11332
header_checks = regexp:/etc/postfix/header_checks
milter_header_checks = regexp:/etc/postfix/milter_header_checks
smtp_header_checks = regexp:/etc/postfix/smtp_header_checks
smtpsplit_destination_recipient_limit = 1

2. Extra master.cf:

smtpsplit  unix  -       -       n       -       -       smtp
        -o syslog_name=postfix-split
        -o smtp_send_xforward_command=yes
        -o disable_mime_output_conversion=yes
        -o smtp_generic_maps=
        -o smtp_header_checks=
127.0.0.1:5025 inet n  -       n       -        -      smtpd
        -o syslog_name=postfix-after-split
        -o content_filter=
        -o cleanup_service_name=cleanupsplit
        -o receive_override_options=no_unknown_recipient_checks
        -o smtpd_helo_restrictions=
        -o smtpd_client_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_relay_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o mynetworks=127.0.0.0/8
        -o smtpd_authorized_xforward_hosts=127.0.0.0/8
        -o smtpd_tls_security_level=none
        -o smtpd_data_restrictions=
cleanupsplit  unix  n       -       n       -       0       cleanup
        -o header_checks=

3. /etc/postfix/header_checks and /etc/postfix/smtp_header_checks content:

/^x-postfix-split:.*/   STRIP

4. /etc/postfix/milter_header_checks content:

/^x-postfix-split:\s+required/ FILTER  smtpsplit:127.0.0.1:5025

5. Configure Rspamd or other milter to add "X-Postfix-Split: Required"

--
Thanks,
Dmytro Alieksieiev
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to