Mail internal relay / shared namespace config

Nethserver 7.9 : Mail

Can NethServer handle a shared namespace / do internal relay for non-local users?

For example, users mailboxes are split between two separate mail servers, Nethserver and OtherServer.

UserA@example.com (on NethServer) sends mail to UserB@example.com (on Nethserver) and it works. Both are local to NethServer

UserA@example.com (on NethServer) sends mail to UserC@example.com (on OtherServer) and Nethserver rejects it with an unknown user message, cos it has no idea who UserC is.

Is there a configuration to get NethServer to relay any messages for @example.com users it doesn’t know about to another server to handle?

I have this working on another mail system that involved a bit of messing about with setting the real mail domain to non-authoritative and a connector to relay any messages for non-local @example.com uses up to a central mail hub, and that works nicely.

I have tried to configure a relay, but it rejects the check, even though the credentials are good as proven with the smarthost config so not sure what’s going on there, or if it’s even relevant to this.

If it needs to be done directly in postfix that’s fine although I have a lot of reading to do on that (and a large part of the reason for playing with Nethserver is keep away from detailed config of things people write entire textbooks about!)

Many thanks,
-Richard

Imo relay would be the way to go if it’s giving errors maybe the external server is refusing it due to security policies check the logs might help also make sure you can ping the mail server from your nethserver a lot of problems are caused by resolution issues

1 Like

For what it’s worth, problem solved with a native Postfix & Dovecot server using Postfix virtual_transport. Postfix uses LDAP bind to AD to get users routing to Dovecot or to send on elsewhere, Dovecot uses separate LDAP bind for authentication of incoming IMAPS/SMTPS. It was a fun learning experience, and the old mail server is now being decomissioned. Win.

Unfortunately trying to convert that into the NethServer templates is a task I don’t relish. Coupled with the AD component having so many issues joining the main domains, and if made a domain of its own lost all config every reboot made it impossible and in the end I gave up trying to figure out what the problem was. Maybe one day I’ll revisit this.

Thanks anyways.

Maybe this can help:

Create the directory /etc/e-smith/templates-custom/etc/postfix/main.cf

mkdir -p /etc/e-smith/templates-custom/etc/postfix/main.cf

Move to the newly created directory

cd /etc/e-smith/templates-custom/etc/postfix/main.cf

Create the 99sender file

vi 99sender

In 99sender enter the following commands

#
# Custom
# 99sender
#

smtpd_reject_unlisted_recipient = no

You must then enter the external mail addresses related to the local domain by indicating the MX host of the domain to which they are to be sent

Create the directory /etc/e-smith/templates-custom/etc/postfix/transport

mkdir -p /etc/e-smith/templates-custom/etc/postfix/transport

Move to newly create directory

cd /etc/e-smith/templates-custom/etc/postfix/transport

Create the 30forward file

vi 30forward

In 30forward enter the following commands

#
# Custom
# 30forward
#

localemaildomain.tld      local:
externalemail1@localemaildomain.tld       smtp:mx.localemaildomain.tld:25
externalemail2@localemaildomain.tld       smtp:mx.localemaildomain.tld:25

Where

  • localemaildomain.tld is the domain whose mail the server handles
  • externalemail1@localemaildomain.tld and externalemail2@localemaildomain.tld are the mailboxes on external server but with the same domain
  • mx.localemaildomain.tld is the mx record that points to the external server that contains the associated mailbox

Finally apply the changes with the command

signal-event nethserver-mail-server-update

5 Likes