Koozali.org: home of the SME Server

SME as "internal" smathost mail server

Offline Knuddi

  • *
  • 540
  • +0/-0
    • http://www.scanmailx.com
SME as "internal" smathost mail server
« on: October 31, 2005, 09:35:32 PM »
I have three branches in my company each located in their own country. The brances are all connected via VPN to the main office. All incomming emails are entering into the main office (xyz.com) and are on a per users basis autoforwarded to the branch mail server (SME as well). The branches have their own domain such as xzy.dk and zyx.se.

What I would like to acheive is that all the branches use the main branch office for outgoing messages as well and kind of use the main office mail server as a smart host or "Internet provides mail server" in SME language. Since the branch domains are not local the the main office mail server it doesn't want to be a smarthost and if I change /var/qmail/control/rcpthosts to accept email from these then it stores locally (all branch users are known in the main office).

How do I do this?

Offline Knuddi

  • *
  • 540
  • +0/-0
    • http://www.scanmailx.com
SME as "internal" smathost mail server
« Reply #1 on: October 31, 2005, 09:44:28 PM »
And it should also be noticed that on the main mail server I have modified /var/qmail/control/smtproutes to route email to the branch server via a specific IP address that are by the way local IP addresses (xyz.dk:192.168.22.33).

Offline crazybob

  • *****
  • 894
  • +0/-0
    • Stalzer R&D
SME as "internal" smathost mail server
« Reply #2 on: November 01, 2005, 06:07:01 AM »
Knuddi,

   I have no ideas about what you are trying, but have a couple of quick questions about your VPN.

Are you using OpenVPN? If so are you using server to server and if you are could you share a sample of the client script for your SME servers?

Thanks

Bob
If you think you know whats going on, you obviously have no idea whats going on!

Offline Knuddi

  • *
  • 540
  • +0/-0
    • http://www.scanmailx.com
SME as "internal" smathost mail server
« Reply #3 on: November 01, 2005, 09:51:38 AM »
Crazybob,

I was looking for help and not to give :-D

Anyways, its quite simply and Yes I naturally use OpenVPN, and almost the same as for client-server setup. Simply install all the same modules on the client as on the server. Only create keys on the server though.

In the server.conf file remove the two lines:

auth-user-pass-verify ./validate.sh via-env
client-disconnect ./logoff.sh

and in the client.conf file remove:
auth-user-pass

and place the client keys in the /etc/openvpn directory instead of c:/program files/openvpn/config.

The only tricky part might then be to get the route tables configured correctly in both ends so that all users on the client net can see resources on the server side network.

Offline crazybob

  • *****
  • 894
  • +0/-0
    • Stalzer R&D
SME as "internal" smathost mail server
« Reply #4 on: November 01, 2005, 01:22:03 PM »
Knuddi,

  Thanks for the info.

Bob
If you think you know whats going on, you obviously have no idea whats going on!

Offline smeghead

  • *
  • 563
  • +0/-0
SME as "internal" smathost mail server
« Reply #5 on: November 01, 2005, 07:02:14 PM »
.. would backup MX by domain work here (there is a contrib around to do this).

Set the main office to either primary of secondary (depending on your requirements) for receipt of email and set ISP mail server to point to main office (smarthost) mail server.

This also give some redundancy as the backup MX is presumably on a different class C.

PS - had to come up with something here just as a small token for all your sterling script work :-)
..................

Offline Knuddi

  • *
  • 540
  • +0/-0
    • http://www.scanmailx.com
SME as "internal" smathost mail server
« Reply #6 on: November 01, 2005, 09:50:28 PM »
Using MX for this will not work as I want to ensure all email are going through my secure channels.

It actually turned out to be easy.... I just had to add the branch local IP range as a local network for the rules to be configured correctly. Now all my incomming as well as outgoing email is going through my main server and I am able to distribute incomming mail to appropriate branch servers.

Offline mrjhb3

  • *
  • 1,188
  • +0/-0
    • John Bennett Services
SME as "internal" smathost mail server
« Reply #7 on: November 02, 2005, 02:38:48 AM »
Knuddi,

Can you further explain/clear up for me, your setup a little bit more?  You have 3 offices connected together via VPN.  How are you autoforwarding the e-mail to the correct branch office?  Do you have all of your users defined on the main branch server, then simply setup their e-mail to forward to a specified email address? Branch offices are setup to send outgoing mail to the main office?  If so, did you have to make any other modifications for the main server to accept the mail from the branch servers, other than putting them in the local networks?  Finally, did you have to add the other two domains to your etc/hosts file in the main branch so that it would know how to resolve the branches, then the smtproutes so it would know where to send the data?

I hope I'm kind of close.

Thanks,

JB
......

Offline Knuddi

  • *
  • 540
  • +0/-0
    • http://www.scanmailx.com
SME as "internal" smathost mail server
« Reply #8 on: November 02, 2005, 02:26:23 PM »
All users are defined in main office and mail from main office to branches are forwarded or a per user basis to a new address jkn@main.com -> jkn@branch.com. In order to ensure this is done via VPN link and not over internet i have added a line to smtproutes:
branch.com:[192.168.x.y]
Where the IP address is the branch mail server. The same goes for brach offices where smtproutes is set as:
main.com:[192.168.z.q]

Also for branch office I configure to use delegate mail server which is the IP of main.com mail server.

No changes needed for /etc/hosts

Offline mrjhb3

  • *
  • 1,188
  • +0/-0
    • John Bennett Services
SME as "internal" smathost mail server
« Reply #9 on: November 02, 2005, 02:47:59 PM »
Thanks for that Jesper.

JB
......

Offline kruhm

  • *
  • 680
  • +0/-0
SME as "internal" smathost mail server
« Reply #10 on: November 06, 2005, 06:54:08 PM »
lol -ask a question and still gives help. way to go!

Quote
What I would like to acheive is that all the branches use the main branch office for outgoing messages...

Email clients at your branch offices should be able to use the the main office as outgoing. Just make sure the branch offices are in the LOCAL NETWORKS of your main office. You may have to use the ip address for outgoing.

As for the whole server at the main smarthosting for the branches...hmmmm...

Offline Knuddi

  • *
  • 540
  • +0/-0
    • http://www.scanmailx.com
SME as "internal" smathost mail server
« Reply #11 on: November 06, 2005, 08:16:11 PM »
Well if I let them use the main branch server thay will see long response time for sending emails. The now send and receive via their local server and this local server uses the main branch for outgoint emails. Its the way it should work and it does :-)