Delivering to virtual_alias_maps only?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Delivering to virtual_alias_maps only?

Marek Kozlowski-2
:-)

Must be simple... but I missed it.
I asked for it in the context on LDAP but I think I may simplify my
question:

Is it possible to accept mail if the recipients address is found in
virtual_alias_maps and reject in all other cases? Let's imagine I have
two entries for virtual_alias_maps:

[hidden email] smithj
[hidden email] jonesj

and I have local users: smithj and jonesj. I'd like emails to

[hidden email]
[hidden email]

to be delivered but emails to:

[hidden email]
[hidden email]

to be rejected. Unfortunately if an email is originating from my system
it is delivered in all cases :-(

Best regards,
Marek


smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Delivering to virtual_alias_maps only?

Wietse Venema
Marek Kozlowski:
> :-)
>
> Must be simple... but I missed it.

The answer is in http://www.postfix.org/ADDRESS_CLASS_README.html.

If you don't want to receive and deliver email for the local class,
set local_recipient_maps to empty, or set the local_transport to
"error:email to this domain is not permitted".

Ditto for other classes: the relay class or the virtual class.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Delivering to virtual_alias_maps only?

Wietse Venema
Wietse Venema:

> Marek Kozlowski:
> > :-)
> >
> > Must be simple... but I missed it.
>
> The answer is in http://www.postfix.org/ADDRESS_CLASS_README.html.
>
> If you don't want to receive and deliver email for the local class,
> set local_recipient_maps to empty, or set the local_transport to
> "error:email to this domain is not permitted".

Note: this means you can't have virtual aliases that have a 'local'
recipient on the right-hand side.

        Wietse

> Ditto for other classes: the relay class or the virtual class.
>
> Wietse
>
Reply | Threaded
Open this post in threaded view
|

Re: Delivering to virtual_alias_maps only?

Viktor Dukhovni
In reply to this post by Marek Kozlowski-2
On Sat, Oct 10, 2020 at 05:15:37PM +0200, Marek Kozlowski wrote:

> Is it possible to accept mail if the recipients address is found in
> virtual_alias_maps and reject in all other cases? Let's imagine I have
> two entries for virtual_alias_maps:

    Following http://www.postfix.org/MULTI_INSTANCE_README.html#quick

        mydestination =
        local_transport = error:5.1.1 Mailbox unavailable
        alias_database =
        alias_maps =
        local_recipient_maps =

    Then:

        indexed = ${default_database_type}:${config_directory}/

        myorigin = example.com
        virtual_mailbox_domains = example.com, example.net, ...

        # You could instead use LMTP to deliver to Dovecot's or similar
        # LMTP server.  In this case, virtual_mailbox_maps RHS value is
        # not significant, any non-empty value indicates a valid user.
        # Also in the same case, the uid and gid maps are not used.
        #
        virtual_transport = virtual

        virtual_mailbox_maps = ${indexed}vmbox
        # Set uid/gid to IMAP server account
        virtual_mailbox_uid_maps = static:12345
        virtual_mailbox_gid_maps = static:12345

    Tables:
        vmbox:
            # Set path layout to match IMAP server configuration
            [hidden email]   /var/spool/virtual/example.com/user1/
            [hidden email]   /var/spool/virtual/example.net/user2/

You could of course add an intermediate mapping via virtual(5), and have
just a single virtual mailbox domain, with the various domains in
virtual alias domains, and something "virtual.invalid" as the mailbox
domain, but it is not clear that the indirection is needed in your
case.

--
    Viktor.