SMTP SERVER

· 3 min read
SMTP SERVER
Photo by Hiroshi Kimura / Unsplash

The need

A long time ago, a client company needed to send a lot of emails. The problem is, when you send this amount of emails in a traditional way, you could be flagged as a spammer.

The Solutions

There are a few solutions to this issue. Some of them are:

  • Cloud-based solutions; There are good online solutions for this. You can use them as an email relay at a minimum cost per email sent. Here some of them:
  • On-Premise solutions; same as cloud-based, there are a lot of paid and open source solutions. The key point is that the solutions need to support DKIM entry to authenticate your server, to prove that you own the domain being used for sending the emails. Here are some examples:

In this post, I will focus on ScrollOut F1, because is easy to install, manage and pretty light.
Like many other email gateways, ScrollOut F1 has these basic features:

  • Email Anti-Virus
  • Additional SMTP ports
  • Different Quarantine per domain

The Pre-installation requirements

Before we proceed to install, we need to have a few things done:

  • DKIM settings

DomainKeys Identified Mail (DKIM) is a modern internet standard for authenticating the delivery chain for email messages. You need to configure the outgoing email server config with the DKIM key on your DNS.

Here an example of DKIM DNS record on O365 settings.

Here the settings in my DNS

  • SPF Records

The Sender Policy Framework (SPF) is another internet standard for authenticating email messages. Unlike DKIM, however, SPF allows recipient ISPs to authenticate the sender listed on the From header of an email message.

SPF record on my DNS

  • Reverse DNS

As a standard, reverse DNS record is the association of an IP to look up a hostname. If you don’t manage your public IP address, you need to ask your ISP to configure your reverse DNS.

  • DMARC

Domain-based Message Authentication, Reporting & Conformance” (DMARC), is an email authentication, policy, and reporting protocol. It builds on the widely deployed SPF and DKIM protocols, adding linkage to the author (“From:”) domain name, published policies for recipient handling of authentication failures, and reporting from receivers to senders, to improve and monitor the protection of the domain from fraudulent email.

DMARC record example

The installation

  1. Download and install Debian server ” Wheezy “

You need a clean fresh install of Debian Wheezy 7.8. you can get your copy from the official page https://cdimage.debian.org/mirror/cdimage/archive/7.8.0-live/amd64/iso-hybrid/.

  1. Install Scrollout F1
apt-get install sudo -y
sudo -i
cd /tmp
sudo apt-get install ca-certificates -yq
wget http://sourceforge.net/projects/scrollout/files/update/scrolloutf1.tar/download -O scrolloutf1.tar
tar -xvf scrolloutf1.tar
chmod 755 /tmp/scrolloutf1/www/bin/*
/tmp/scrolloutf1/www/bin/install.sh

Press-hit ENTER every time you are asked to answer a question. By doing this you will select the default answer

When done, the Graphic User Interface URL address a default Admin password will be displayed.

URL: http(s)://host-ip/ 
User: Admin (default) 
Password: 123456 (default) 
To uninstall run: /var/www/bin/uninstall.sh
  1. DKIM config

To config the DKIM outgoing settings, you need to go to the “/var/www/dkim” and replace the default value in the allkey file with the value of your txt DNS DKIM key that you already config in your DNS, when the “kr1ps.com-dkim.key.pem” file is the private key e.g.:

  • allkeyfile
; key#1 2048 bits, i=dkim, d=kr1ps.com, /var/www/dkim/kr1ps.com-dkim.key.pem
dkim._domainkey.kr1ps.com. 3600 TXT (
"v=DKIM1; p="
"SDFBSSEGFGDOMDNNDN0BAQEFAAOCAQ8AMIIBCgKCAQEA1OAgSmSUcF36HdfuTiu5"
"HGS0vaakzVjQVe+CACr654dsDFF48DDGA444GDUjigq9TGbLQ7LMTsJXL+h19lky"
"234GHSDFH4G-==-DFFGKN,F+IUVHAjsGmhMRb1G5Qvs4RqS34/TjIU1GBqIWUmD8"
"vDTuOuFs/LoVVYKGQ2Qz5iDE/tAHqIOi9ORIkzryK1/zGuosoBprW++n7pg6Q8/c"
"hwyhxQQBayHG65rv8VK2KPHuXu81YlYjGHDpHI5cqvn631LpppylYQSNKJduK2jk"
"SDFFSDSF//SDFGEGGEX2lj9ulg/wKBq71yeCAlQitNSFZQTmvLOj6403LKeVLFQZ"
"YgSDAQAB")

Conclusion

With all of these settings, you will have a pretty healthy local SMTP server capable of sending massive amounts of authenticated e-mails to the outside world.

Enjoy sending email!!!!

Source

  1. http://www.scrolloutf1.com/deploy/install
  2. https://social.technet.microsoft.com/wiki/contents/articles/36796.office-365-enabling-dkim-for-custom-domains.aspx#Advantage_of_DMARC_over_SPF
  3. https://dmarc.org/