{"id":240,"date":"2011-05-12T08:37:15","date_gmt":"2011-05-12T08:37:15","guid":{"rendered":"http:\/\/songoku.homelinux.com\/wordpress\/?p=240"},"modified":"2011-05-12T08:37:15","modified_gmt":"2011-05-12T08:37:15","slug":"smarthost-with-smtp-authentication-with-postfix","status":"publish","type":"post","link":"https:\/\/ndk.sytes.net\/wordpress\/?p=240","title":{"rendered":"Smarthost with SMTP\/TLS authentication with postfix"},"content":{"rendered":"<p>\n\tHi all. If you have for example an email server in your basement it is often blocked due to your dynamic ip address. Well, there is a relatively easy way to get around this. The only thing you have to do is set up an smarthost in your mta (e.g. sendmail, postfix, exim&#8230;).\n<\/p>\n<p>\n\tWhat is a smarthost? A smarthost is an external email server, normally a well known one, where you have an email account, e.g. yahoo or hotmail. So as you guessed from the article title we are doing this now with postfix. Why postfix? Because postfix is really easy to configure and gets the job done like sendmail. This howto only describes how to set up the smarthost not how to install postfix. So here we go.\n<\/p>\n<p>\n\tLet&#39;s say you want to configure the smarthost with postfix on a CentOS machine and send email over port 587, so open the config file and add some lines to your \/etc\/postfix\/main.cf:\n<\/p>\n<pre>\n# vim \/etc\/postfix\/main.cf<\/pre>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\tadd:\n<\/p>\n<pre>\nrelayhost = smarthost.domain.com:587\nsmtp_sasl_auth_enable = yes\n<span style=\"line-height: 1.6em;\">smtp_use_tls = yes<\/span>\n<span style=\"line-height: 1.6em;\">smtp_sasl_password_maps = hash:\/etc\/postfix\/smtp_auth<\/span>\n<span style=\"line-height: 1.6em;\">smtp_sasl_security_options = noanonymous\nsmtp_sasl_tls_security_options = noanonymous<\/span><\/pre>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\tthen we create \/etc\/postfix\/smtp_auth and make the file only readable by root and postfix.\n<\/p>\n<pre>\n# touch \/etc\/postfix\/smtp_auth &amp;&amp; chown root:postfix \/etc\/postfix\/smtp_auth &amp;&amp; chmod 640 \/etc\/postfix\/smtp_auth<\/pre>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\topen the previously created file and add some lines:\n<\/p>\n<pre>\n# vim \/etc\/postfix\/smtp_auth<\/pre>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\tadd:\n<\/p>\n<pre>\nsmarthost.firma.zz       senduser:supersecret<\/pre>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\tnow we have to create a lookup file from that file with\n<\/p>\n<pre>\n# postmap \/etc\/postfix\/smtp_auth (this will create smtp_auth.db)<\/pre>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\tThe postmap command has to be executed after every change to the smtp_auth file, please remember. If you do not so, postfix will never get notified about the changed file.\n<\/p>\n<p>\n\tIf you want your postfix server relay from outside to non-local domains add one of these&nbsp;lines:\n<\/p>\n<pre>\nsmtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination (postfix &lt; 2.10)\nsmtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination (postfix &gt;= 2.10)<\/pre>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\tThe last step is to restart postfix, done!\n<\/p>\n<pre>\n# \/etc\/init.d\/postfix restart<\/pre>\n<p>\n\t&nbsp;\n<\/p>\n<p>\n\thave fun with your private mailserver! \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi all. If you have for example an email server in your basement it is often blocked due to your dynamic ip address. Well, there is a relatively easy way to get around this. The only thing you have to do is set up an smarthost in your mta (e.g. sendmail, postfix, exim&#8230;). What is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,7],"tags":[],"class_list":["post-240","post","type-post","status-publish","format-standard","hentry","category-linuxunix","category-servers"],"_links":{"self":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/240","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=240"}],"version-history":[{"count":0,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/240\/revisions"}],"wp:attachment":[{"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ndk.sytes.net\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}