|
CentOS Linux Server Guide |
Postfix Mail System- Step by Step GuidePart 7: Enhance Postfix Mail Server Security by implementing SMTP Authentication using Dovecot SASL |
||||||||||||||||
|
In our Part1-Part6 series, we are elaborating the detail steps to setup a email system for any organization that require a complex solutions such as support multiple domains and virtual users. In following few chapters, we will share with you how to tighten your Postfix mail security system.
Before we begin, let us explain why we need SMTP authentication using SASL (Simple Authentication and Security Layer).
Q: "What is SASL?"
SASL is a access control mechanism that authenticating users using their username and password for Postfix Mail. It provides additional security protection to allow only legitimate users to relay mail thru our mail server.
Q: "How Postfix Mail default security work?"
A: By default, Postfix's mail relay control is only rely on IP address ACL. Under /etc/postfix/main.cf there is a $mynetworks parameter used by Postfix to control mail relay through your mail server. Thus, the IP address the value we entered earlier mynetworks = 192.168.139.0/24, 127.0.0.0/8 is to tell Postfix only allow the range of 192.168.139.0 and localhost to relay and sent email using our mail services. However, no other authentication method performed by Postfix. Q: "Is it necessary for me to enhance the Postfix mail security, can I just use default Postfix security mechanism?Few year ago, if your mail server only allow relay for the IP at the same network, or only allow localhost to sent email then it is unlikely that you need to implement SASL or SMTP AUTH. However, from my experience, implementing SMTP AUTH is minimal mail security you should do. WHY? one of my client's mail server was sending thousands of email per minutes, due to worm infections. Implementing SMTP AUTH will not necessary solve the issue, but at least, those infected PC (no mail client installed) will not pass our mail server. Moreover, if your organization has mobile users , we need a mechanism to authenticate them as trusted users so that they are able to send mail through the mail server. Configuring SASL in postfixSince we are already running dovecot we are using dovecot's SASL support for Postfix rather than the SASL provided by the Cyrus SASL library. Step 1: Add SASL for PostfixTo enable Postfix to use SASL add it at the bottom of the file if the key (the word before the = sign) cannot be found.
Add the following lines to bottom of file. Please make sure that the correct format is parameter = value, and NOT parameter= value
Configuring SASL in dovecot
Warning: Becareful as this section is heavily commented, make a backup copy, just in case...
Step1: Backup Dovecot config file
Step2: Add SASL Support for Dovcot
Next, let us edit the lines in /etc/dovecot.conf
Add in the following lines at the bottom of the under auth_default. My auth default is under line 758
Restart Dovecot and PostfixOk, let us restart both services
Verification on SASL on Dovecot and PostfixRemember that in pervious chapter we add separate log for our Dovecot services?
Here is our setting in /etc/dovecot.conf
Let us check if the auth-worker is running perfectly.
Next let us check if the /var/spool/postfix/private/auth is created. The example below shows that auth is created.
Finally, let us run a quick test if our mail server now accept SMTP AUTH.
Testing SASL SMTP AUTH on Postfix
Great, let us proceed now with SMTP AUTH using telnet.
First, let us encode our password to base64 based value that will be used for "auth plain" later.
Command Syntax: perl -MMIME::Base64 -e 'print encode_base64("\000username\@domain.com\000password");'
Let us use alex@abc.local to sent an email yasmin@xyz.local.
Test 2 Great it work with abc.local domain. Let us see if it works with multiple domain and users.
Verify the email send by Yasmin.
|
||||||||||||||||
|
Back to Step by Step Guide on CentOS Linux Postfix Mail Server |
|
Copyright 2011 http://www.1a-centosserver.com All Rights Reserved All trademarks are the property of their respective owners. Contact Us | Terms of Use | Privacy Policy |