OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
"warn_if_reject reject_unlisted_recipient" breaks subsequent "reject_unlisted_recipient"

From: John Tobin (tobinjtcs.tcd.ie)
Date: Wed Apr 09 2008 - 07:09:22 CDT


G'day all,

On our mail system I want to list every restriction we use in
smtpd_recipient_restrictions twice: once with warn_if_reject, and once
without. This will allow me to see all the restrictions that would have
caused a rejection, not just the first.

This works properly for everything except reject_unlisted_sender and
reject_unlisted_recipient - when I have
    warn_if_reject reject_unlisted_recipient, reject_unlisted_recipient
in smtpd_recipient_restrictions unknown recipients are not rejected.

I've reduced smtpd_recipient_restrictions to the minimum required to
trigger the problem without becoming an open relay. The logs below were
generated with debug_peer_level=10, but I can rerun the tests with a
higher level or other debugging options enabled if that helps. I've
been unable to duplicate this behaviour with the very stripped down
main.cf we use for hosts that relay all mail to our central server, but
I can duplicate it on demand on our central mail server. In both cases
I'm using Postfix 2.5.1 on Solaris 10, complied from source with the
following:

make makefiles 'CCARGS=-DDEF_CONFIG_DIR=\"/mail/postfix-2.5.1/etc\" -DHAS_DB -I/opt/csw/bdb43/include -DHAS_CDB -I/usr/local/include -DUSE_TLS -I/opt/csw/include -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\"dovecot\" -DDEF_CLIENT_SASL_TYPE=\"dovecot\" -DHAS_PCRE -I/opt/csw/include' 'AUXLIBS=-L/opt/csw/bdb43/lib -R/opt/csw/bdb43/lib -ldb /usr/local/lib/libcdb.a -L/opt/csw/lib -R/opt/csw/lib -lssl -lcrypto -L/opt/csw/lib -R/opt/csw/lib -lpcre'

/mail/postfix is a symlink to the latest version we're using.

The evidence:

First test: without "warn_if_reject reject_unlisted_recipient" in
smtpd_recipient_restrictions:

* postconf -n output:

address_verify_sender = <>
alias_database = cdb:/mail/postfix/etc/aliases.out
alias_maps = $alias_database, cdb:/mail/postfix/etc/aliases.rt.out, cdb:/mail/mailman/data/aliases, cdb:/mail/mailman-cag/data/aliases
allow_percent_hack = no
allow_untrusted_routing = no
anvil_rate_time_unit = 15
biff = no
bounce_queue_lifetime = 3d
command_directory = /mail/postfix/sbin
config_directory = /mail/postfix/etc
daemon_directory = /mail/postfix/libexec
data_directory = /mail/postfix/data
debug_peer_level = 10
debug_peer_list = 134.226.36.211, 134.226.35.27, [2001:770:10:200:214:22ff:feec:fc4], 87.192.55.104
default_database_type = cdb
disable_vrfy_command = yes
html_directory = /mail/postfix/html
inet_protocols = all
local_recipient_maps = $alias_maps, cdb:/mail/postfix/etc/valid_users
mail_owner = postfix
mail_spool_directory = /mail/spool
mailbox_command = /mail/procmail/bin/procmail -p -t /mail/procmail/etc/procmailrc
mailbox_size_limit = 800200000
mailq_path = /mail/postfix/bin/mailq
manpage_directory = /mail/postfix/man
masquerade_classes = envelope_sender, header_sender, header_recipient
masquerade_domains = cs.tcd.ie
message_size_limit = 15240000
milter_protocol = 6
mydestination = $mydomain, dsg.$mydomain, scss.tcd.ie
mydomain = cs.tcd.ie
myhostname = cs.tcd.ie
mynetworks = 134.226.32.0/19, 127.0.0.1, 10.10.10.0/24, 10.53.0.0/16, [::1]/128, [2001:770:10:200::]/56
myorigin = $mydomain
newaliases_path = /mail/postfix/bin/newaliases
notify_classes = resource, software
parent_domain_matches_subdomains = smtpd_access_maps
queue_directory = /mail/postfix-spool
readme_directory = /mail/postfix/doc
recipient_delimiter = +
sample_directory = /mail/postfix/doc/samples
sendmail_path = /mail/postfix/lib/sendmail
setgid_group = postdrop
smtp_send_xforward_command = yes
smtpd_authorized_verp_clients = 127.0.0.1, 134.226.32.56, [::1], [2001:770:10:200:214:4fff:feb0:ab6c]
smtpd_authorized_xclient_hosts = 127.0.0.1, [::1]
smtpd_authorized_xforward_hosts = 127.0.0.1
smtpd_banner = $myhostname ESMTP
smtpd_client_connection_count_limit = 20
smtpd_client_connection_rate_limit = 10
smtpd_client_restrictions =
smtpd_data_restrictions = check_client_access pcre:/mail/postfix/etc/log_helo.pcre, reject_unauth_pipelining, reject_multi_recipient_bounce,
smtpd_delay_reject = ${stress?no}${stress:yes}
smtpd_discard_ehlo_keywords = etrn, silent-discard
smtpd_etrn_restrictions = reject
smtpd_hard_error_limit = ${stress?5}${stress:20}
smtpd_helo_required = yes
smtpd_recipient_restrictions = reject_unlisted_sender, reject_unlisted_recipient, permit_mynetworks, reject_unauth_destination,
smtpd_reject_unlisted_recipient = yes
smtpd_restriction_classes = check_rbls
smtpd_soft_error_limit = ${stress?5}${stress:20}
smtpd_timeout = ${stress?60}${stress:300}
strict_rfc821_envelopes = yes
swap_bangpath = no
unknown_address_reject_code = 550
virtual_alias_domains = grid.ie, gv2.cs.tcd.ie
virtual_alias_maps = cdb:/mail/postfix/etc/grid.ie-aliases, cdb:/mail/postfix/etc/gv2.cs.tcd.ie-aliases

* Transcript from testing with telnet:

Trying 2001:770:10:200:214:4fff:feb0:ab6c...
Connected to smtp.cs.tcd.ie.
Escape character is '^]'.
220 smtp.cs.tcd.ie ESMTP
helo deimos.cs.tcd.ie
250 smtp.cs.tcd.ie
mail from: <tobinjtcs.tcd.ie>
250 2.1.0 Ok
rcpt to: <asdfcs.tcd.ie>
550 5.1.1 <asdfcs.tcd.ie>: Recipient address rejected: User unknown in local recipient table
quit
221 2.0.0 Bye
Connection closed by foreign host.

* Logs

Apr 9 11:50:19 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] connect from deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]
Apr 9 11:50:19 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 134.226.32.0/19
Apr 9 11:50:19 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 127.0.0.1
Apr 9 11:50:19 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 10.10.10.0/24
Apr 9 11:50:19 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 10.53.0.0/16
Apr 9 11:50:19 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? [::1]/128
Apr 9 11:50:19 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? [2001:770:10:200::]/56
Apr 9 11:50:19 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] > deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: 220 smtp.cs.tcd.ie ESMTP
Apr 9 11:50:23 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] < deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: helo deimos.cs.tcd.ie
Apr 9 11:50:23 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] > deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: 250 smtp.cs.tcd.ie
Apr 9 11:50:24 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] < deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: mail from: <tobinjtcs.tcd.ie>
Apr 9 11:50:24 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] > deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: 250 2.1.0 Ok
Apr 9 11:50:26 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] < deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: rcpt to: <asdfcs.tcd.ie>
Apr 9 11:50:26 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] NOQUEUE: reject: RCPT from deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: 550 5.1.1 <asdfcs.tcd.ie>: Recipient address rejected: User unknown in local recipient table; from=<tobinjtcs.tcd.ie> to=<asdfcs.tcd.ie> proto=SMTP helo=<deimos.cs.tcd.ie>
Apr 9 11:50:26 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] > deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: 550 5.1.1 <asdfcs.tcd.ie>: Recipient address rejected: User unknown in local recipient table
Apr 9 11:50:27 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] < deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: quit
Apr 9 11:50:27 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] > deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: 221 2.0.0 Bye
Apr 9 11:50:27 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 134.226.32.0/19
Apr 9 11:50:27 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 127.0.0.1
Apr 9 11:50:27 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 10.10.10.0/24
Apr 9 11:50:27 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 10.53.0.0/16
Apr 9 11:50:27 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? [::1]/128
Apr 9 11:50:27 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? [2001:770:10:200::]/56
Apr 9 11:50:27 relay.cs.tcd.ie postfix/smtpd[4191]: [ID 197553 mail.info] disconnect from deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]

Second test: with "warn_if_reject reject_unlisted_recipient" in
smtpd_recipient_restrictions:

* postconf -n output:

address_verify_sender = <>
alias_database = cdb:/mail/postfix/etc/aliases.out
alias_maps = $alias_database, cdb:/mail/postfix/etc/aliases.rt.out, cdb:/mail/mailman/data/aliases, cdb:/mail/mailman-cag/data/aliases
allow_percent_hack = no
allow_untrusted_routing = no
anvil_rate_time_unit = 15
biff = no
bounce_queue_lifetime = 3d
command_directory = /mail/postfix/sbin
config_directory = /mail/postfix/etc
daemon_directory = /mail/postfix/libexec
data_directory = /mail/postfix/data
debug_peer_level = 10
debug_peer_list = 134.226.36.211, 134.226.35.27, [2001:770:10:200:214:22ff:feec:fc4], 87.192.55.104
default_database_type = cdb
disable_vrfy_command = yes
html_directory = /mail/postfix/html
inet_protocols = all
local_recipient_maps = $alias_maps, cdb:/mail/postfix/etc/valid_users
mail_owner = postfix
mail_spool_directory = /mail/spool
mailbox_command = /mail/procmail/bin/procmail -p -t /mail/procmail/etc/procmailrc
mailbox_size_limit = 800200000
mailq_path = /mail/postfix/bin/mailq
manpage_directory = /mail/postfix/man
masquerade_classes = envelope_sender, header_sender, header_recipient
masquerade_domains = cs.tcd.ie
message_size_limit = 15240000
milter_protocol = 6
mydestination = $mydomain, dsg.$mydomain, scss.tcd.ie
mydomain = cs.tcd.ie
myhostname = cs.tcd.ie
mynetworks = 134.226.32.0/19, 127.0.0.1, 10.10.10.0/24, 10.53.0.0/16, [::1]/128, [2001:770:10:200::]/56
myorigin = $mydomain
newaliases_path = /mail/postfix/bin/newaliases
notify_classes = resource, software
parent_domain_matches_subdomains = smtpd_access_maps
queue_directory = /mail/postfix-spool
readme_directory = /mail/postfix/doc
recipient_delimiter = +
sample_directory = /mail/postfix/doc/samples
sendmail_path = /mail/postfix/lib/sendmail
setgid_group = postdrop
smtp_send_xforward_command = yes
smtpd_authorized_verp_clients = 127.0.0.1, 134.226.32.56, [::1], [2001:770:10:200:214:4fff:feb0:ab6c]
smtpd_authorized_xclient_hosts = 127.0.0.1, [::1]
smtpd_authorized_xforward_hosts = 127.0.0.1
smtpd_banner = $myhostname ESMTP
smtpd_client_connection_count_limit = 20
smtpd_client_connection_rate_limit = 10
smtpd_client_restrictions =
smtpd_data_restrictions = check_client_access pcre:/mail/postfix/etc/log_helo.pcre, reject_unauth_pipelining, reject_multi_recipient_bounce,
smtpd_delay_reject = ${stress?no}${stress:yes}
smtpd_discard_ehlo_keywords = etrn, silent-discard
smtpd_etrn_restrictions = reject
smtpd_hard_error_limit = ${stress?5}${stress:20}
smtpd_helo_required = yes
smtpd_recipient_restrictions = warn_if_reject reject_unlisted_sender, warn_if_reject reject_unlisted_recipient, reject_unlisted_sender, reject_unlisted_recipient, permit_mynetworks, reject_unauth_destination,
smtpd_reject_unlisted_recipient = yes
smtpd_restriction_classes = check_rbls
smtpd_soft_error_limit = ${stress?5}${stress:20}
smtpd_timeout = ${stress?60}${stress:300}
strict_rfc821_envelopes = yes
swap_bangpath = no
unknown_address_reject_code = 550
virtual_alias_domains = grid.ie, gv2.cs.tcd.ie
virtual_alias_maps = cdb:/mail/postfix/etc/grid.ie-aliases, cdb:/mail/postfix/etc/gv2.cs.tcd.ie-aliases

* Transcript from testing with telnet:

Trying 2001:770:10:200:214:4fff:feb0:ab6c...
Connected to smtp.cs.tcd.ie.
Escape character is '^]'.
220 smtp.cs.tcd.ie ESMTP
helo deimos.cs.tcd.ie
250 smtp.cs.tcd.ie
mail from: <tobinjtcs.tcd.ie>
250 2.1.0 Ok
rcpt to: <asdfcs.tcd.ie>
250 2.1.5 Ok
quit
221 2.0.0 Bye
Connection closed by foreign host.

* Logs

Apr 9 11:52:44 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] connect from deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]
Apr 9 11:52:44 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 134.226.32.0/19
Apr 9 11:52:44 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 127.0.0.1
Apr 9 11:52:44 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 10.10.10.0/24
Apr 9 11:52:44 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 10.53.0.0/16
Apr 9 11:52:44 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? [::1]/128
Apr 9 11:52:44 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? [2001:770:10:200::]/56
Apr 9 11:52:44 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] > deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: 220 smtp.cs.tcd.ie ESMTP
Apr 9 11:52:47 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] < deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: helo deimos.cs.tcd.ie
Apr 9 11:52:47 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] > deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: 250 smtp.cs.tcd.ie
Apr 9 11:52:48 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] < deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: mail from: <tobinjtcs.tcd.ie>
Apr 9 11:52:48 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] > deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: 250 2.1.0 Ok
Apr 9 11:52:49 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] < deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: rcpt to: <asdfcs.tcd.ie>
Apr 9 11:52:49 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] NOQUEUE: reject_warning: RCPT from deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: 550 5.1.1 <asdfcs.tcd.ie>: Recipient address rejected: User unknown in local recipient table; from=<tobinjtcs.tcd.ie> to=<asdfcs.tcd.ie> proto=SMTP helo=<deimos.cs.tcd.ie>
Apr 9 11:52:49 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] permit_mynetworks: deimos.cs.tcd.ie 2001:770:10:200:214:22ff:feec:fc4
Apr 9 11:52:49 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 134.226.32.0/19
Apr 9 11:52:49 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 127.0.0.1
Apr 9 11:52:49 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 10.10.10.0/24
Apr 9 11:52:49 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 10.53.0.0/16
Apr 9 11:52:49 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? [::1]/128
Apr 9 11:52:49 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? [2001:770:10:200::]/56
Apr 9 11:52:49 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] permit_inet_interfaces: deimos.cs.tcd.ie 2001:770:10:200:214:22ff:feec:fc4
Apr 9 11:52:49 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] D8B47F3D1A: client=deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]
Apr 9 11:52:49 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] > deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: 250 2.1.5 Ok
Apr 9 11:52:51 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] < deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: quit
Apr 9 11:52:51 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] > deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]: 221 2.0.0 Bye
Apr 9 11:52:51 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 134.226.32.0/19
Apr 9 11:52:51 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 127.0.0.1
Apr 9 11:52:51 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 10.10.10.0/24
Apr 9 11:52:51 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? 10.53.0.0/16
Apr 9 11:52:51 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? [::1]/128
Apr 9 11:52:51 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] match_hostaddr: 2001:770:10:200:214:22ff:feec:fc4 ~? [2001:770:10:200::]/56
Apr 9 11:52:51 relay.cs.tcd.ie postfix/smtpd[4516]: [ID 197553 mail.info] disconnect from deimos.cs.tcd.ie[2001:770:10:200:214:22ff:feec:fc4]

As you can see from the logs, warn_if_reject successfully converts the
rejection to a warning, but the second check does not cause a rejection.

master.cf (stripped of comments) just in case:

smtp inet n - n - 500 smtpd
    -o content_filter=smtp-amavis:[127.0.0.1]:10024
        -o myhostname=smtp.cs.tcd.ie
localhost:11025 inet n - n - - smtpd
        -o myhostname=relay.cs.tcd.ie
        -o content_filter=
        -o local_recipient_maps=
        -o relay_recipient_maps=
        -o smtpd_restriction_classes=
        -o smtpd_delay_reject=no
        -o smtpd_client_restrictions=permit_mynetworks,reject
        -o smtpd_helo_restrictions=
        -o smtpd_sender_restrictions=
        -o smtpd_recipient_restrictions=permit_mynetworks,reject
        -o mynetworks_style=host
        -o mynetworks=127.0.0.0/8,[::1]/128
        -o soft_bounce=yes
        -o strict_rfc821_envelopes=no
        -o smtpd_error_sleep_time=0
        -o smtpd_soft_error_limit=1001
        -o smtpd_hard_error_limit=1000
        -o smtpd_client_connection_count_limit=0
        -o smtpd_client_connection_rate_limit=0
        -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
        -o disable_mime_output_conversion=yes
pickup fifo n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr fifo n - n 300 1 qmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
flush unix n - n 1000? 0 flush
smtp unix - - n - - smtp
smtp-amavis unix - - n - 5 smtp
        -o smtp_data_done_timeout=1200
        -o smtp_send_xforward_command=yes
        -o disable_dns_lookups=yes
        -o max_use=20
showq unix n - n - - showq
error unix - - n - - error
local unix - n n - 10 local
virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
relay unix - - n - - smtp
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
proxymap unix - - n - - proxymap
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
discard unix - - n - - discard
tlsmgr unix - - n 1000? 1 tlsmgr
retry unix - - n - - error
proxywrite unix - - n - 1 proxymap

Thanks for reading, hopefully you can help.

--
John Tobin
"Lisp has all the visual appeal of oatmeal with fingernail clippings
mixed in." -- Larry Wall