{"id":168,"date":"2015-06-17T11:43:37","date_gmt":"2015-06-17T11:43:37","guid":{"rendered":"http:\/\/star.genuinewebhost.com\/~linuxguru\/tutorial\/?p=168"},"modified":"2025-07-10T03:16:15","modified_gmt":"2025-07-10T03:16:15","slug":"enabling-postfix-smtp-authentication-using-dovecot","status":"publish","type":"post","link":"http:\/\/shijuvarghese.com\/?p=168","title":{"rendered":"Enabling postfix SMTP authentication using Dovecot"},"content":{"rendered":"<p>If you configure postfix in a default manner as posted in my previous posts, mail relay will be disabled. This is a security feature since you will not want people to misuse your SMTP server to send mails to people without you having any control. Spammers hand hackers will be constantly searching for mail servers on the net to use them, and send spam emails to users.<\/p>\n<p>By default, your postfix SMTP severs will be able to send and receive emails within the virtuals domains hosted with your servers.<\/p>\n<p>One way to control who should have access to send mail to outside hosts is based on the list of users who have mailboxes in the server (example : postfix SMTP server) itself, and who can get authenticated using the authentication mechanism used by the pop3 server, in our case the dovecot.<\/p>\n<p>The way to configure it is as follows:<\/p>\n<p>Edit the dovecot configuration file<\/p>\n<ul>\n<li><strong>vi \/etc\/dovecot\/conf.d\/10-master.conf<\/strong><\/li>\n<li>#Postfix smtp-auth<\/li>\n<li>unix_listener \/var\/spool\/postfix\/private\/auth {<\/li>\n<li>mode = 0660<\/li>\n<li>user = postfix<\/li>\n<li>group = postfix<\/li>\n<li>}<\/li>\n<\/ul>\n<p>Edit the postfix configuration file:<\/p>\n<ul>\n<li>]# <strong>vi \/etc\/postfix\/main.cf<\/strong><\/li>\n<li>smtpd_sasl_type = dovecot<\/li>\n<li>smtpd_sasl_path = private\/auth<\/li>\n<li>smtpd_sasl_auth_enable = yes<\/li>\n<li>broken_sasl_auth_clients = yes<\/li>\n<li>smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination<\/li>\n<\/ul>\n<p>Restart the mail services:<\/p>\n<ul>\n<li><strong>systemctl restart postfix<\/strong><\/li>\n<li><strong>systemctl restart dovecot<\/strong><\/li>\n<\/ul>\n<p>Verify if the authentication by a telent session<\/p>\n<p>~]# <strong>telnet localhost 25<\/strong><br \/>\nTrying ::1&#8230;<br \/>\nConnected to localhost.<br \/>\nEscape character is &#8216;^]&#8217;.<br \/>\n220 &lt;my hostname&gt; ESMTP Postfix<br \/>\nehlo <strong>&lt;my hostname&gt;<\/strong><br \/>\n250-&lt;my hostname&gt;<br \/>\n250-PIPELINING<br \/>\n250-SIZE 10240000<br \/>\n250-VRFY<br \/>\n250-ETRN<br \/>\n<strong><em>250-AUTH PLAIN LOGIN<br \/>\n250-AUTH=PLAIN LOGIN<\/em><\/strong><br \/>\n250-ENHANCEDSTATUSCODES<br \/>\n250-8BITMIME<br \/>\n250 DSN<br \/>\nquit<br \/>\n221 2.0.0 Bye<br \/>\nConnection closed by foreign host.<\/p>\n<p>Note: If you are using mail clients such as squirrelMail, ensure that configuration is done on the client so that SMTP authentication mechanism is enabled there too<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>If you configure postfix in a default manner as posted in my previous posts, mail relay will be disabled. This is a security feature since <a class=\"mh-excerpt-more\" href=\"http:\/\/shijuvarghese.com\/?p=168\" title=\"Enabling postfix SMTP authentication using Dovecot\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":1819,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,7],"tags":[],"class_list":["post-168","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-postfix"],"_links":{"self":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/168","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=168"}],"version-history":[{"count":8,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions"}],"predecessor-version":[{"id":346,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/posts\/168\/revisions\/346"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=\/wp\/v2\/media\/1819"}],"wp:attachment":[{"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=168"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shijuvarghese.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}