Setting up postfix for authenticated relay

From BubbaWiki
Jump to navigation Jump to search

This howto should work on both Bubba|TWO and Excito B3. But note that you should most likely only use this howto when your Bubba act as a Router in your lan. Security might be compromised otherwise. You have been warned .
This howto is a short description on howto configure Postfix to accept email for relay when the user authenticates himself. The usecase for this is to be able to use Bubba as an always available mailserver for sending emails when not at home. I myself use this setup and have all my laptops etc configured to send mail via my Bubba at home wherever i am in the world.

Postfix configuration

Start by logging into Bubba via ssh and become root.

Edit the file /etc/postfix/

Locate the lines with:

smtpd_recipient_restrictions =

And add the line:


So the end result looks something like:

smtpd_recipient_restrictions =

Then at the end of the file append:

smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_tls_auth_only = yes

Dovecot configuration

Edit the config file /etc/dovecot/dovecot.conf

Locate the section that starts with:

auth default {

and there  append the following:

   socket listen {
       client {
           path = /var/spool/postfix/private/auth
         mode = 0660
         user = postfix
         group = postfix

Optional, let Postfix listen on another port than the default one

A big problem for most home users is that their ISP blocks all traffic on the default mailserver port (25) and thus our solution won't work. A workaround for this is to let Postfix, our mailserver, listen on an additional non standard port for connections.

To do this edit the file /etc/postfix/

Locate the line that says

smtp      inet  n       -       -       -       -       smtpd

and add the additional line below

20025     inet  n       -       -       -       -       smtpd

This tells Postfix to listen on both the standard smtp port (25) and also on 20025

Restart services

To finnish this up restart Dovecot and Postfix

/etc/init.d/dovecot restart

/etc/init.d/postfix restart

Open ports in the firewall

Finally to be able to use this solution outside your Lan you will have to open upp the corresponding ports in Bubbas firewall.

  • Log in to the web based admin UI as admin.
  • Select Administration
  • SelectNetwork
  • Select Firewall

If you only use the standard port make sure that "Email server (Port 25)" is On. If not click the checkbox and then click update.

Open smtp default port.png

If you decided to also use the extra port above you need to set this up manually. To do so select "Advanced firewall settings", check "Open B3 port" and enter the port you selected in "Public port".

Manually open smtp port.png

Then click "Update" and there should be one additional line in "User defined open / forwarded ports"

Manually opened smtp port.png

Final words

This should be it. Now you should be able to send emails from anywhere using the address and port of your Bubba and the user/password of your local user.

As an example, here is how you should configure Evolution to use this setup. Exchange server and username for your own values. And note how we append the port to use if we don't use default port 25.

Evolution smtp settings.png