Postfix - catchall

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Postfix - catchall

Michaux Julien
Hi Everyone,

I'm facing a problem with the way postfix handle my catchall.

I am running Postfix 2.10.1 with Cyrus 2.4.17.
I use virtual_mailbox and virtual_alias to handle mailboxes. Everything works fine with users.
I would like to implement a catchall mailbox (I know it's not a good idea, but this is essential in my business) BUT only for alias that do not already exist.
Everything is flat file.

If I send a mail to [hidden email] , this mail go to user1 mailbox. A mail to [hidden email] go to user1 mailbox.
A mail to [hidden email] should be redirect to the user mailbox I want.

Actually I put something like "@mail.domain.tld  user1" in virtual_alias_maps. The problem is that it actually catches ALL mail that arrive on the server. User1 gets all unknown mails AND user2 mail.

How can user1 receive mail that are normally bounced because of " Recipient address rejected: mailbox does not exist"

Here is my conf :

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
myhostname = mail.domain.tld
myorigin = $myhostname
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
local_recipient_maps = $alias_maps
mydestination = localhost
virtual_transport = error:mailbox does not exist
virtual_mailbox_domains = hash:/etc/postfix/virtual_domains
virtual_mailbox_maps = hash:/etc/postfix/virtual_mailbox
virtual_alias_maps = hash:/etc/postfix/virtual_alias
transport_maps = hash:/etc/postfix/transport
recipient_delimiter = +
smtp_use_tls = yes
smtpd_use_tls = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/mail.domain.tld /fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/mail.domain.tld /privkey.pem
smtp_tls_security_level = may
smtpd_tls_security_level = may
smtp_tls_note_starttls_offer = yes
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes

Virtual_domains :
mail.domain.tld   OK

virtual_mailbox :
[hidden email]  OK
[hidden email]  OK

virtual_alias:
[hidden email] [hidden email]
[hidden email] [hidden email]
[hidden email] [hidden email]

Cordialement / Best Regards,


Julien MICHAUX
Reply | Threaded
Open this post in threaded view
|

Re: Postfix - catchall

Wietse Venema
Michaux Julien:
> Actually I put something like "@mail.domain.tld  user1" in
> virtual_alias_maps. The problem is that it actually catches ALL
> mail that arrive on the server. User1 gets all unknown mails AND
> user2 mail.

To prevent this, create 1:1 aliases for addresses that should not
be aliased.

    [hidden email]  [hidden email]
    [hidden email]  [hidden email]
    [hidden email]  [hidden email]
    [hidden email]  [hidden email]
    @mail.example.com       [hidden email]

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Postfix - catchall

Bill Cole-3
In reply to this post by Michaux Julien
On 27 Mar 2018, at 9:55, Michaux Julien wrote:

> Hi Everyone,
>
> I'm facing a problem with the way postfix handle my catchall.
>
> I am running Postfix 2.10.1 with Cyrus 2.4.17.
> I use virtual_mailbox and virtual_alias to handle mailboxes.
> Everything works fine with users.
> I would like to implement a catchall mailbox (I know it's not a good
> idea, but this is essential in my business) BUT only for alias that do
> not already exist.
> Everything is flat file.
>
> If I send a mail to [hidden email] , this mail go to user1
> mailbox. A mail to [hidden email] go to user1 mailbox.
> A mail to [hidden email] should be redirect to the user mailbox
> I want.
>
> Actually I put something like "@mail.domain.tld  user1" in
> virtual_alias_maps. The problem is that it actually catches ALL mail
> that arrive on the server. User1 gets all unknown mails AND user2
> mail.
>
> How can user1 receive mail that are normally bounced because of "
> Recipient address rejected: mailbox does not exist"

Use a pcre (or regexp) table for virtual_alias_maps. That gives you the
ability to use the order of rules to implement a default for everything
not matched specifically.

When doing that, you probably will eventually want a pcre or regexp
check_recipient_access map to make the catchall a catch-most.