Remedy to SMTP authentication problem for Virtualmin running on CentOS 6

Remedy to SMTP authentication problem for Virtualmin running on CentOS 6

A few days ago I migrated one of the servers of the company that I am working for from a Debian to a CentOS installation. No the-morning-after calls from customers, no unexpected non-functioning services! Migration was flawless, at least I was thinking so.

Yesterday, a customer called complaining about an e-mail issue. The report wasn't detailed, a phone call whining "my e-mail doesn't work" it was :P I checked IMAP and POP3 protocols, everything was working OK. I thought the customer might be having connection issues or something temporary. Making sure that the server works OK, I moved on. Today the customer called complaining again, unexpectedly. Incidently she said, "I can receive e-mails, but can't send interestingly". Well, I know I shouldn't expect people to know the difference between SMTP and IMAP or POP3, but at least they can be more specific about the problem they are talking about right?

Learning the crucial detail about the issue, I started researching. Luckily, someone else has already encountered this issue and asked for help on Virtualmin forums*. And guess what? Somebody has even offered a working solution :)

Looks like, due to a mis-configuration on Virtualmin's default, SASL authentications wasn't working when the username contains the domain name, like "user@domain.tld". It seemed to be a bug for me, but it has already been discovered but not fixed, strange. Then I thought 'what do I know, may be it's a feature' :P

And here comes the remedy... The solution to this issue is easy as adding a '-r' parameter to saslauthd daemon. To accomplish this on CentOS 6, open the file /etc/sysconfig/saslauthd with your favorite text editor, find the line FLAGS = (it should be near to the end of the file)

FLAGS = "something"

and append the -r parameter to the FLAGS

FLAGS = "something -r"

And then you need to restart the saslauthd to apply the changes of course.

# service saslauthd restart

And done, your users can authenticate with their full username including the domain.