Local delivery and relaying

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

Local delivery and relaying

Jan Ceuleers
Hi

I'm a new Postfix user, having just switched from sendmail (which I set
up years ago and then forgot how).

I want my Postfix server to locally deliver emails for my own accounts
and those of my housemates, but relay all others. So for example:

Locally deliver these:
        [hidden email]
        [hidden email]
        [hidden email]
        [hidden email]

But relay all other destinations to the smart host.

I'm currently using the virtual_alias_domains feature, but this tries to
locally deliver all accounts within example1.net, example2.net and
example3.net. What I want is local delivery only of the accounts listed
in the virtual_alias_maps file, and relaying of all other destinations,
regardless of whether their domain.

I've done a lot of googling but could not find the answer (probably
because I don't know what search terms to use).

Any hints would be gratefully received.

Thanks, Jan
Reply | Threaded
Open this post in threaded view
|

Re: Local delivery and relaying

Wietse Venema
Jan Ceuleers:
> Hi
>
> I'm a new Postfix user, having just switched from sendmail (which I set
> up years ago and then forgot how).
>
> I want my Postfix server to locally deliver emails for my own accounts
> and those of my housemates, but relay all others. So for example:

See "Delivering some but not all accounts locally"
http://www.postfix.org/STANDARD_CONFIGURATION_README.html#some_local

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Local delivery and relaying

Jan Ceuleers
On 14/12/15 12:43, Wietse Venema wrote:

> Jan Ceuleers:
>> Hi
>>
>> I'm a new Postfix user, having just switched from sendmail (which I set
>> up years ago and then forgot how).
>>
>> I want my Postfix server to locally deliver emails for my own accounts
>> and those of my housemates, but relay all others. So for example:
>
> See "Delivering some but not all accounts locally"
> http://www.postfix.org/STANDARD_CONFIGURATION_README.html#some_local

Thank you for your reply.

I had seen that section in the docs, but I'm afraid I don't understand
it. I'm already using virtual_alias_maps; this file contains the mapping
of the email addresses I or my housemates own to local usernames. What I
need is for emails locally sent to accounts not listed in
virtual_alias_maps but within one of my virtual_alias_domains to be sent
to the relay_host rather than being rejected as undeliverable.

Here is my configuration:

/etc/postfix/main.cf
====================

smtpd_banner = $myhostname ESMTP $mail_name
biff = no

append_dot_mydomain = no

readme_directory = no

smtpd_tls_cert_file=/etc/ssl/certs/postfix.pem
smtpd_tls_key_file=/etc/ssl/private/postfix.pem
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_security_level = may
smtpd_tls_loglevel = 1
smtpd_tls_mandatory_ciphers = high
smtpd_tls_mandatory_exclude_ciphers = aNULL, MD5
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3

myhostname = zotac.xperim.be
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = zotac.xperim.be, localhost.xperim.be, localhost,
smtpserver.xperim.be zotac
relayhost = smtp.myisp.be
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
mailbox_command = procmail -a "$EXTENSION"
inet_protocols = ipv4
mynetworks = 127.0.0.0/8 192.168.1.0/24 192.168.122.0/24

virtual_alias_domains = computer.org myisp.be gmail.com
virtual_alias_maps = hash:/etc/postfix/virtual
smtpd_sasl_type = dovecot
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth

smtpd_recipient_restrictions = permit_mynetworks,
permit_sasl_authenticated, reject_unauth_destination

local_recipient_maps =


/etc/postfix/virtual
====================
[hidden email]       user1
[hidden email]            user1
[hidden email]         user2
[hidden email]     user2
[hidden email]        user1
[hidden email]        user1
[hidden email]       user1


Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: Local delivery and relaying

Wietse Venema
Jan Ceuleers:

> On 14/12/15 12:43, Wietse Venema wrote:
> > Jan Ceuleers:
> >> Hi
> >>
> >> I'm a new Postfix user, having just switched from sendmail (which I set
> >> up years ago and then forgot how).
> >>
> >> I want my Postfix server to locally deliver emails for my own accounts
> >> and those of my housemates, but relay all others. So for example:
> >
> > See "Delivering some but not all accounts locally"
> > http://www.postfix.org/STANDARD_CONFIGURATION_README.html#some_local
>
> Thank you for your reply.
>
> I had seen that section in the docs, but I'm afraid I don't understand
> it. I'm already using virtual_alias_maps; this file contains the mapping

The idea is that you can have virtual alias mappings, even when
the address is NOT in a virtual alias domain.

virtual_alias_maps is just a global mapping; it just so happens that
this same mechanism is also used to implement virtual_alias_domains.

Perhaps Postfix's idea of "economy of mechanism" is putting you on
the wrong track.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Local delivery and relaying

Jan Ceuleers
On 14/12/15 15:12, Wietse Venema wrote:
> The idea is that you can have virtual alias mappings, even when
> the address is NOT in a virtual alias domain.
>
> virtual_alias_maps is just a global mapping; it just so happens that
> this same mechanism is also used to implement virtual_alias_domains.

Thank you very much; the solution was not to define any
virtual_alias_domains.

What you say makes perfect sense, but what I was misled by is that the
docs don't mention the possibility of using a virtual_alias_maps file
without also setting virtual_alias_domains.

Anyway, I hope that my question and your solution will help future
similarly-afflicted users.

Thanks again, Jan