0

I've set up a mail server with postfix and dovecot on a virtual machine running debian 7. At first I basically made a seperate network with a host-only adapter , so host and guest were in the same network. 192.168.56.0/24 Network

Everything worked fine, I could send mails between those 2 pcs but now I want to change the setup.

I want to use a NAT adapter and port forwarding to reach the email server from other pc's aswell.192.168.153.0/24 Network

I have pretty much no idea what to do besides forwarding those ports, in the VM settings. For example what network is now part of mynetworks=? What is my hostname? (hostname of the host or of the guestmachine?) What else do I have to change to make it working?

myhostname = test.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = test.example.com, localhost.example.com, localhost
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 192.168.56.0/24 192.168.153.0/24
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
home_mailbox = Maildir/
mailbox_command = 
masegaloeh
  • 18,236
  • 10
  • 57
  • 106
chosen
  • 13
  • 1
  • 5

1 Answers1

2
  1. Mynetworks is not the best choice for allowing relaying, as it is quite easy to fake. In your case it is not a huge problem, but in general, unless you have complete control over who can obtain an IP in your mynetworks range, it is best to avoid including anything besides localhost.

  2. Myhostname is obviously the name of the mail server itself, basically how you'd like the mail server to announce itself to the world, and often used as a check by remote servers (does the hostname match MX records, RDNS, and so forth).

  3. To make it work, the way you have set it up now should be functional. The settings are not ideal for an internet facing host, but for a simple testing server inside a VM, it should do what you need.

NickW
  • 10,263
  • 1
  • 20
  • 27
  • I've managed to test it and it works.. kinda but I'm okay with it. I have to use testmail@localhost to connect and send mails. And regarding ideal settings, thanks for the advice but this is indeed a completely local network without any internet access. – chosen Jan 30 '15 at 14:37
  • Yeah, I'd be the first to admit its far from ideal in terms of functionality, I'd probably set up some virtual users, and quite a few things, but that would end up being a lot of work with a limited ROI, at least in your case.. – NickW Feb 03 '15 at 17:17