SMTP Config

Introduction

This manual describes the procedure to configure and install an SMTP service suitable for the GBDS Email Notification Service on Ubuntu Linux. This procedure was tested on Ubuntu 20.04 LTS.

Sending Emails

To send emails locally, set these on the enotifier.setting table:

mail.smtp.host = localhost
mail.smtp.port = 25

Postfix

Install and configure Postfix. To install, run the following command:

sudo apt update
sudo DEBIAN_PRIORITY=low apt install postfix

The installation will begin. Configure the installation with the following:

  • General type of mail configuration: Internet Site

  • System mail name: alpha-01.pd.griaule

  • Root and postmaster mail recipient: <linux-account-name>

  • Other destinations to accept mail for: localhost.$myhostname, localhost, $mydomainname

  • Force synchronous updates on mail queue?: No

  • Local networks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

  • Mailbox size limit: 0

  • Local address extension character: +

  • Internet protocols to use: all

Access the main.cf file at /etc/postfix/ and modify the following:

If needed, the main.cf file can be used to modify the configurations done in the installation process.

Enable postfix on the firewall, then restart the service. Install the mailutils package and enable port 80 on the firewall. Those can be done with:

Reconfigure postfix:

TLS Self-signed key

To operate the service needs a self-signed certificated key. To create one and move it in the correct location run the following commands:

Access the main.cf file at /etc/postfix/ and modify the following:

Then, reload and restart postfix.

SPF and DKIM

For authentication to work, SPF and DKIM must be configured:

SPF

Include DNS TXT value on the DNS domain control panel.

  • Name/Host/Alias: @ or leave blank.

  • Time to Live (TTL): 3600 or leave the default.

  • Value/Answer/Destination: v=spf1 ip4:x.x.x.x ~all (where x.x.x.x is your server IP).

When configuring the Name/Host/Alias, control panel may indicate other preferable DNS records for your domain. Verify the best fit for your environment. If needed, contact Griaule Support Team for more information.

DKIM

Generate DKIM public and private keys on: https://dkimcore.org/tools/keys.html

Copy private key as dkim-private.pem to /etc/ssl/certs

Include DNS TXT value.

  • Name/Host/Alias: mail._domainkey

  • Value: v=DKIM1; h=sha256; k=rsa; t=y; p=<public value on site generated>

Access the main.cf file at /etc/postfix/ and modify the following:

Then, reload and restart postfix.

OpenDKIM

To install OpenDKIM, run:

Open the opendkim.conf at /etc/ and edit the following:

Then open the opendkim file at /etc/default/ and modify as shown:

To apply the changes, restart postfix and opendkim.

SASL

The Simple Authentication and Security Layer configuration makes postfix send emails using known relay hosts on port 25 to authenticate properly, preventing emails from being marked as spam.

Open main.cf at etc/postfix and modify:

Then, go to /etc/postfix/ and open the saslpass file and edit:

The password needed is a new app-generated password. This is generated in the Gmail account security settings.

To finish the configuration, run the following:

Last updated

Was this helpful?