[aklug] Fun with Postfix testing

Mike alaskabarsalou at gmail.com
Sun Jul 2 10:32:08 AKDT 2017


I'm starting on a journey to use Postfix.  I've been a sendmail user  
for so many years, I just thought it was time to expand my knowledge  
base and move into another favorite of the mail community.

My goal was to test this in a closed environment.  What I mean by that  
is, I don't want to expose it to the internet, but wanted to test it  
as if it was.

This is not a post about setting up Postfix, but of testing.  There  
are plenty of great articles about setting up postfix.

As far as testing goes, to start, I have to at least manage DNS, so  
that responses will return the test box as the mail server instead of  
my current production box.

My first reaction was to use split views with bind.  I started into it  
and because I don't use and manage a bind server everyday, there was  
enough trouble that I decided it was too hard.

I did a couple of searches and came up with dnsmasq.  Lucky for me, it  
is installed by default with my distro (Ubuntu 16.04).

I came across this post:  
https://forums.zextras.com/zimbra-howto/485-setting-up-dnsmasq-instead-bind-bulletproof-internal-dns-resolution-splitdns.html

It is a bit dated, but it provided a lot of good ideas and  
implementation details that were needed.

Another post was this one: https://wiki.archlinux.org/index.php/dnsmasq

This helped me understand that with my install of Ubuntu 16.04,  
NetworkManager was used and that my modifications needed to come from  
there.

I'm only going to talk about the NetworkManager changes I made.

It was VERY easy.

Here is what you will need before you start (entries here are  
contrived for privacy):

The IP of the Mailserver: 192.168.0.5
The name you want to give the mail server: mail.mydomain.com
the domain that you want the dns server to respond to: mydomain.com


All I did was added a file to /etc/NetworkManager/dnsmasq.d/mydomain.com.conf

within that file, and using the two linked articles above, I put this  
in the file:

address=/mail.mydomain.com/192.168.0.5
except-interface=lo
listen-address=192.168.0.5
mx-host=mydomain.com,mail.mydomain.com,10

I restarted the NetworkManager, and all was well!

test it using your favorite dns tool: dig, drill, nslookup

I'd love to get feedback about what others are doing to accomplish  
this sort of testing.

Have a great weekend!

Mike B.





More information about the aklug mailing list