Bobcares

The day my Postfix/SASL server refused to deliver mail

by | Mar 16, 2014

I encountered this issue one Saturday afternoon, on which I happened to be working. Being a Saturday, I expected a relatively quiet day at the office. This was why, I was initially surprised when our monitoring software reported that there were more than 3500 mails present in one of our servers (say, vm.domain.com) mail queue. Within half an hour, the count had increased to approximately 5000 mails. There goes my quiet Saturday. Sigh.

Before proceeding, I would like to point out that all our servers run on CentOS and use Postfix.

Postfix/SASL troubleshooting

Postfix/SASL troubleshooting

One possible reason for the huge number of mails in the queue could have been a receiving mail server that was down. This would have caused mails to be sent repeatedly and resulted in the mail queue being clogged. We have scripts that check for this sort of thing and delete the mails that are addressed to the problematic mail server. But on this occasion, the scripts did not return any hits.

So now that the usual solution had failed, the next step was to check the mail queue status. This can be done for postfix by using the mailq command.

062A7226A8 734 Sat Mar 1 01:27:59 root@vm.domain.com (delivery
temporarily suspended: SASL authentication failed; cannot 
authenticate to server smtp.mailserver.com[xx.xx.xx.xx$ 
info@efg.com-- 4813 Kbytes in 4797 Requests.

 

 

Hire Bobcares Linux Server Administrators
Get super reliable servers and delighted customers

See how we do it!

 

 

As seen in the above example, all the mails in the queue had failed with the error message SASL authentication failed. Following this, I had a peek inside the server’s mail log file (maillog literally):

Mar 1 01:00:10 vm09 postfix/smtp[4897]: warning: 
SASL authentication failure: No worthy mechs found 
Mar 1 01:00:10 vm09 postfix/smtp[4897]: 3B11A2033E: 
SASL authentication failed; cannot authenticate to server 
smtp.mailserver.com

 

Lo and behold, maillog also thought that something was wrong with the way SASL was set up in the server. Having made my initial diagnosis, I started verifying postfix configurations that were required for the proper functioning of SASL.

Note: postconf is the Postfix configuration utility. Syntax is postconf
<configuration_parameter> When used with the option “-d”, returns the default values of the specified parameter. The option “-n”, returns the value assigned in main.cf (postfix configuration file). This value has more precedence than the default value. The option “-e”, allows you to modify the value of the parameters from the command line. This value will be reset once postfix is restarted.

The following configurations were checked:

smtp_sasl_auth_enable = yes
smtp_sasl_mechanism_filter =
smtp_sasl_password_maps = static:user@domain.com: 
smtp_sasl_security_options = noanonymous

 

None of these settings seemed to be the cause of the issue. I had hit my second dead end.

I decided to look at the issue from a different perspective. For postfix, SASL may be implemented using either Cyrus or Dovecot plug-ins.

> postconf -A
cyrus
...
> postconf -d smtp_sasl_type
smtp_sasl_type = cyrus

 

From this, I could conclude that Cyrus was selected. Next, I set out to check whether the configurations of Cyrus were apt.

Note: The file smptd.conf specifies the method of authentication for Postfix/SASL

> cat /etc/sasl2/smtpd.conf
pwcheck_method: saslauthd
mech_list: plain login

 

saslauthd can use only either PLAIN or LOGIN methods. These settings are default and are fine. Screeeech! That ladies and gentlemen was dead end number three.

By now you may be wondering (like I was at the time), whether I would ever get to the bottom of the issue. Well, I did and here’s how.

Going back to the Cyrus configuration file smtpd.conf, it stated that the mechanisms to be used for SASL authentication was either PLAIN or LOGIN. But for these authentication schemes to work, an additional package cyrus-sasl-plain has to be installed.

I checked the list of installed packages and as suspected, the package was missing.

> rpm -qa | grep cyrus
cyrus-sasl-lib-2.1.23-13.el6_3.1.x86_64
cyrus-sasl-2.1.23-13.el6_3.1.x86_64

 

I installed the package using yum and the mail queue cleared itself within a minute.

> yum install cyrus-sasl-plain
...
> rpm -qi cyrus-sasl-plain-2.1.23-13.el6_3.1.x86_64
.

 

Summary : PLAIN and LOGIN authentication support for Cyrus SASL
Description :The cyrus-sasl-plain package contains the Cyrus SASL plugins which supportPLAIN and LOGIN authentication schemes.

Well what can I say? It’s the last thing that I would have thought off. Next time, it will be the second last.

About the author:

Paul Junior Fernandez is a Systems Engineer at Bobcares.com. He’s a technology buff and likes to spend his free time catching up with friends on and off social media.

0 Comments

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF