{"id":35,"date":"2013-01-25T07:42:00","date_gmt":"2013-01-24T21:42:00","guid":{"rendered":"https:\/\/www.serenux.com\/?p=35"},"modified":"2021-01-14T07:45:35","modified_gmt":"2021-01-13T21:45:35","slug":"howto-fix-postgrey-not-working-after-upgrading-from-an-older-version-of-ubuntu-to-a-newer-version","status":"publish","type":"post","link":"https:\/\/www.serenux.com\/index.php\/2013\/01\/25\/howto-fix-postgrey-not-working-after-upgrading-from-an-older-version-of-ubuntu-to-a-newer-version\/","title":{"rendered":"HowTo: Fix Postgrey not working after upgrading from an older version of Ubuntu to a newer version."},"content":{"rendered":"\n<p>Scenario: You\u2019ve got some Postfix mail servers running with Postgrey for anti-spam&nbsp;greylisting. They\u2019re all using older versions of Ubuntu such as 10.04 LTS. You\u2019ve decided that it\u2019s time to upgrade them to the next LTS, Ubuntu 12.04.<\/p>\n\n\n\n<p>You do the upgrade and it goes without a hitch. You restart the server, everything looks good, until you start seeing this message in your server\u2019s mail log:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Jan 23 21:17:58 mymailserver postfix\/smtpd[7976]: connect from somecompany.com[100.200.300.400]\nJan 23 21:17:59 mymailserver postfix\/smtpd[7976]: warning: connect to 127.0.0.1:10023: Connection refused\nJan 23 21:17:59 mymailserver postfix\/smtpd[7976]: warning: problem talking to server 127.0.0.1:10023: Connection refused\nJan 23 21:18:00 mymailserver postfix\/smtpd[7976]: warning: connect to 127.0.0.1:10023: Connection refused\nJan 23 21:18:00 mymailserver postfix\/smtpd[7976]: warning: problem talking to server 127.0.0.1:10023: Connection refused\nJan 23 21:18:00 mymailserver postfix\/smtpd[7976]: NOQUEUE: reject: RCPT from somecompany.com[100.200.300.400]: 451 4.3.5 Server configuration problem; from=&lt;m-1wu7GywwdBK9XOl40cdonjrOvQVbXrSQjrNIttfwaHqBuxTEiR4njb_\nn@bounce.somecompany.com&gt; to=&lt;myrecipient@mycompany.com&gt; proto=ESMTP helo=&lt;mail.somecompany.com&gt;\nJan 23 21:18:05 mymailserver postfix\/smtpd[7976]: disconnect from somecompany.com[100.200.300.400]\nJan 23 21:18:10 mymailserver postfix\/smtpd[7955]: connect from unknown[200.300.400.500]\nJan 23 21:18:11 mymailserver postfix\/smtpd[7955]: warning: connect to 127.0.0.1:10023: Connection refused\nJan 23 21:18:11 mymailserver postfix\/smtpd[7955]: warning: problem talking to server 127.0.0.1:10023: Connection refused\nJan 23 21:18:12 mymailserver postfix\/smtpd[7955]: warning: connect to 127.0.0.1:10023: Connection refused\nJan 23 21:18:12 mymailserver postfix\/smtpd[7955]: warning: problem talking to server 127.0.0.1:10023: Connection refused\nJan 23 21:18:12 mymailserver postfix\/smtpd[7955]: NOQUEUE: reject: RCPT from unknown[200.300.400.500]: 451 4.3.5 Server configuration problem; from=&lt;someone@anothercompany.com&gt; to=&lt;myrecipient@mycompany.com&gt; proto=ESMTP helo=&lt;m\nail.anothercompany.com&gt;\nJan 23 21:18:12 mymailserver postfix\/smtpd[7955]: disconnect from unknown[200.300.400.500]\nJan 23 21:18:17 mymailserver postfix\/smtpd[7976]: connect from mta.ilikecheese.com[300.400.500.600]\nJan 23 21:18:18 mymailserver postfix\/smtpd[7976]: warning: connect to 127.0.0.1:10023: Connection refused\nJan 23 21:18:18 mymailserver postfix\/smtpd[7976]: warning: problem talking to server 127.0.0.1:10023: Connection refused\nJan 23 21:18:19 mymailserver postfix\/smtpd[7976]: warning: connect to 127.0.0.1:10023: Connection refused\nJan 23 21:18:19 mymailserver postfix\/smtpd[7976]: warning: problem talking to server 127.0.0.1:10023: Connection refused\nJan 23 21:18:19 mymailserver postfix\/smtpd[7976]: NOQUEUE: reject: RCPT from mta.ilikecheese.com[300.400.500.600]: 451 4.3.5 Server configuration problem; from=&lt;someone@thatcompany.com&gt; to=&lt;myrecipient@mycompany.com&gt; pro\nto=ESMTP helo=&lt;MTA.thatcompany.com&gt;\nJan 23 21:18:20 mymailserver postfix\/smtpd[7976]: disconnect from mta.thatcompany.com[300.400.500.600]<\/pre>\n\n\n\n<p>You almost have a heart attack \u2013&nbsp;<strong>every single email is bouncing back<\/strong>&nbsp;and it\u2019s clear that it\u2019s something to do with your upgrade. What went wrong? The errors refer to a configuration issue, but you didn\u2019t change any of the&nbsp;configuration&nbsp;in your upgrade!<\/p>\n\n\n\n<p>Closer inspection reveals that for some reason, Postfix is unable pass messages onto Postgrey which is a local service running on port 10023 by default on Ubuntu systems. If you try&nbsp;telnetting&nbsp;to port 10023 on 127.0.0.1 , you also get a \u201cconnection refused\u201d error. So&nbsp;what\u2019s&nbsp;happened?<\/p>\n\n\n\n<p>The answer is that somewhere between Ubuntu 10.04 and Ubuntu 12.04,&nbsp;<em>Postgrey changed the protocol it binds on<\/em>. It now binds to IPv6 instead of IPv4 so we need to make some minor changes to Postfix\u2019s configuration to get Postgrey working again.<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>First up, we need to stop mail being bounced. It\u2019s better to have sending servers pool up\u00a0mail\u00a0a little and then send it all through at once later, so at a Terminal prompt on your server, type in:<br><br><code>$ sudo service postfix stop<\/code><br><\/li><li>Now we need to edit\u00a0Postfix\u2019s configuration file:<br><br><code>$ sudo\u00a0nano \/etc\/postfix\/main.cf<\/code><br><\/li><li>Scroll down until you can see the line inside the \u201csmtp_recipient_restrictions\u201d section that directs Postfix to send mail to Postgrey for checking (or use CTRL+W to search for it), which looks like this:<br><br><code>check_policy_service inet:127.0.0.1:10023,<\/code><br><\/li><li>And now modify that line to look like the following. This will make Postfix pass on the mail to Postgrey using IPv6 instead of IPv4:<br><br><code>check_policy_service inet:::1:10023,<\/code><br><\/li><li>Now on a new line outside of the \u201csmtp_recipient_restrictions\u201d section, add the following line:<br><br><code>inet_protocols=all<\/code><br><\/li><li>Save your changes by pressing CTRL+X, then \u201cY\u201d and then Enter.<br><\/li><li>Now we can restart Postfix with:<br><br><code>$ sudo service postfix restart<\/code><br><\/li><li>Now start tailing your log with the \u201cfollow\u201d parameter using the following command:<br><br><code>$ tail -f \/var\/log\/mail.log<\/code><br><\/li><li>Now send a test email and watch what new information appears in the terminal log. This time the mail should be successfully received and processed as normal.<br><\/li><li>Pat yourself on the back and breath a sigh of relief.<\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Scenario: You\u2019ve got some Postfix mail servers running with Postgrey for anti-spam&nbsp;greylisting. They\u2019re all using older versions of Ubuntu such as 10.04 LTS. You\u2019ve decided that it\u2019s time to upgrade them to the next LTS, Ubuntu 12.04. You do the upgrade and it goes without a hitch. You restart the server, everything looks good, until [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-35","post","type-post","status-publish","format-standard","hentry","category-tutorials"],"_links":{"self":[{"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/posts\/35","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/comments?post=35"}],"version-history":[{"count":1,"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/posts\/35\/revisions"}],"predecessor-version":[{"id":36,"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/posts\/35\/revisions\/36"}],"wp:attachment":[{"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/media?parent=35"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/categories?post=35"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.serenux.com\/index.php\/wp-json\/wp\/v2\/tags?post=35"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}