{"id":243,"date":"2019-03-30T16:16:22","date_gmt":"2019-03-30T16:16:22","guid":{"rendered":"https:\/\/hostry.com\/blog\/?p=243"},"modified":"2019-04-12T06:27:01","modified_gmt":"2019-04-12T06:27:01","slug":"spam-filtering-smtp-header","status":"publish","type":"post","link":"https:\/\/hostry.com\/blog\/spam-filtering-smtp-header\/","title":{"rendered":"Spam Filtering Based on SMTP Header"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Spam. Spam is incessant; therefore, each responsible mail administrator should keep up with spam filtering methods based on their headers\u2019 <strong>SMTP <\/strong>analysis. In this article we use the <strong>Postfix <\/strong>server for <strong>MTA <\/strong>server configuration.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"537\" height=\"364\" src=\"https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/03\/SMTP-Scheme1.jpg\" alt=\"\" class=\"wp-image-262\" srcset=\"https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/03\/SMTP-Scheme1.jpg 537w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/03\/SMTP-Scheme1-450x305.jpg 450w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/03\/SMTP-Scheme1-300x203.jpg 300w\" sizes=\"auto, (max-width: 537px) 100vw, 537px\" \/><figcaption> <br>MTA (Mail Transfer Agent) is the main component of the Internet mail transfer system<\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">All in all, this article\u2019s information is targeted at those administrators who seek to establish a highly efficient spam filter. It also contains essential information for those who use e-mail a lot and want to understand how the electronic correspondence mechanisms operate.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this article we assume that the Postfix mail server is used as <strong>MTA<\/strong>, but generally speaking it considers more of a theoretical approach. The Postfix options have to be specified in the relevant * _restriction parameters of the configuration file, for more information, refer to the <strong>Postfix <\/strong>configuration guide.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">At a glance: SMTP protocol <\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The main task of the <a href=\"https:\/\/en.wikipedia.org\/wiki\/Simple_Mail_Transfer_Protocol\" target=\"_blank\" rel=\"noopener\">SMTP (Simple Mail Transfer Protocol)<\/a> protocol is to ensure the electronic mail (e-mail) transfer. To operate via <strong>SMTP protocol<\/strong>, the client establishes a <strong>TCP connection<\/strong> with the server through port 25. After that the client and <strong>SMTP <\/strong>server exchange information until the connection is closed or terminated. The major procedure in <strong>SMTP <\/strong>is Mail Procedure. It is followed by Mail Forwarding procedures, mailbox names checking and mail groups listing. The very first procedure opens the transmit channel, while the last one is to closes it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">SMTP commands communicate to the server what operation the client requires. These commands consist of keywords followed by one or more parameters. The keyword contains 4 characters and is separated from the argument by one or more spacebars. Each command line ends with CRLF symbols. Here is the syntax for all the SMTP protocol commands (SP &#8211; spacebar):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>HELO &lt;SP> &lt;domain> &lt;CRLF>\nMAIL &lt;SP> FROM:&lt;reverse-path> &lt;CRLF>\nRCPT &lt;SP> TO:&lt;forward-path> &lt;CRLF>\nDATA &lt;CRLF>\nRSET &lt;CRLF>\nSEND &lt;SP> FROM:&lt;reverse-path> &lt;CRLF>\nSOML &lt;SP> FROM:&lt;reverse-path> &lt;CRLF>\nSAML &lt;SP> FROM:&lt;reverse-path> &lt;CRLF>\nVRFY &lt;SP> &lt;string> &lt;CRLF>\nEXPN &lt;SP> &lt;string> &lt;CRLF>\nHELP &lt;SP> &lt;string> &lt;CRLF>\nNOOP &lt;CRLF>\nQUIT &lt;CRLF><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">A typical <strong>SMTP <\/strong>server response contains a response number followed by subsidiary text separated by a spacebar. The response number serves as a server status indicator.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"> E-mail Sending<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Let us, for instance, consider connecting to an <strong>SMTP server <\/strong>through <strong>port 25<\/strong>. Now you have to send a HELLO command and our IP address to the server: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C: HELLO 235.193.31.127\nS: 250 smtp.example.com is ready<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">When sending mail, we transfer some required data (sender, receiver and the message itself):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C: MAIL FROM: &lt;user1> specify the sender\nS: 250 OK\nC: RCPT TO: &lt;user2@example.com> specify the receiver\nS: 250 OK<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Indicate to the server that we are going to transmit the messge contents (header and message body)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C: DATA\nS: 354 Start mail input; end with &lt;CRLF>. &lt;CRLF><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">message transfer has to be completed with CRLF.CRLF symbols<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>S: 250 OK\nC: From: User1 &lt;user1@example.com>\nC: To: User2 &lt;user2@example.com>\nC: Subject: Hello My Friend<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">between the message header and its text there is not one CRLF pair but two. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>C: Hello User2.\nC: How do you do!<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">complete transmission with CRLF.CRLF<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>S: 250 OK<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now to complete the operation we send the QUIT command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>S: QUIT\nC: 221 smtp.example.com is closing transmit channel<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And now let us consider the procedure of a client connecting to your mail server. The mail server capabilities contain a mechanism for e-mail check based only on the <strong>SMTP<\/strong> message headers taken from the address information.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As you already know, e-mail is transferred between mail servers via <strong>SMTP<\/strong>. SMTP communication begins with three requisite headers: HELO, MAIL FROM and RCPT TO. The implication is that before beginning data transfer, the server first introduces itself with HELO, then it reports the return sender address MAIL FROM and then the recipient address RCPT TO. These three headers form the signature on an electronic envelope, and most of the spam can be eliminated via their analysis. Survey of the&nbsp; MAIL FROM header rejects most of the attempts to transfer something to my server, that is, the letters are refused even before actual receiving, which considerably eases things off.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Let&#8217;s check the order of steps you need to take to reject emails that are obviously spam.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"> DNS Service <\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Initially, at the onset of the Internet, the message was delivered directly to the <strong>Nodes <\/strong>indicated in the mail address. In order to deliver a letter to user1@example.com, the mail server determined the IP address exemple.com and attempted to send an email to the determined IP. The appearance of <strong>MX records<\/strong> has solved many complications of such mailing process organization. Some programs still work with A records, but mail server organization requires at least one <strong>MX record<\/strong> for one domain.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"767\" height=\"349\" src=\"https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/03\/DNS-Scheme1.jpg\" alt=\"\" class=\"wp-image-264\" srcset=\"https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/03\/DNS-Scheme1.jpg 767w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/03\/DNS-Scheme1-450x205.jpg 450w, https:\/\/hostry.com\/blog\/wp-content\/uploads\/2019\/03\/DNS-Scheme1-300x137.jpg 300w\" sizes=\"auto, (max-width: 767px) 100vw, 767px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">MX records contain server addresses to which e-mails for the specified domain should be delivered. To eliminate spam, <strong>SPF <\/strong>(Sender Policy Framework) technology is also taken to; the following entry indicates the <strong>DNS addresses<\/strong> of possible sender servers from the specified domain.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For a more detailed introduction to the SPF technology, refer to <strong>RFC 4408<\/strong> <a href=\"https:\/\/tools.ietf.org\/html\/rfc4408#section-3\" target=\"_blank\" rel=\"noopener\">https:\/\/tools.ietf.org\/html\/rfc4408#section-3<\/a> . The next SPF record tells that emails can only be recieved from the servers listed in the MX records for your domain.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>v=spf1 +mx ~all<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">It looks like <em>\u2018fairy dust\u2019<\/em> that ensures that the spam problem is eliminated once and for all. All that is lacking is to enable strict filtering based on <strong>SPF <\/strong>and fix the spat of the detestable spam forever. It should be noted though that letters can get through retractors and thus <strong>SPF-based<\/strong> hard filtering is extremely undesirable. Be sure to add an <strong>SPF record<\/strong> to your domain, and enable SPF checking on your mail servers. As for the information on setting up SPF for <strong>Postfix<\/strong>, the Google search system has everything you may require.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A few more words about the <a href=\"https:\/\/hostry.com\/products\/dns\/\">DNS records<\/a>, the DNS master records are &#8220;A&#8221; records that transform domain name in the IP address. There are also <strong>CNAME<\/strong> records that contain an aliasing to an already existing domain name. These are the major records of the domain name system, but not all the users are aware of the so-called <strong>PTR reverse record<\/strong>, which translates the IP address into a domain name. If you follow these two rules, messages from your mail server are less likely to be seen as spam.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As for your domain name, there must be an <strong>&#8220;A&#8221; record<\/strong>, and a PTR record that allow to recognize by the host name IP address, and by IP again the host name. For a MX record, you must always specify the host name for which an A record is specified. It is forbidden to use IP records or the aliasing CNAME in MX.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Ignoring any of these rules causes some of the emails coming from your domain being recognized as spam.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Keep an Eye for the Client.<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">At the initialization of the SMTP session, you get the client\u2019s IP address and therefore you can deduce some conclusions on its basis. The next option includes checking the PTR record of the client.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><span class=\"highlighted\">reject_unknown_client_hostname<\/span><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This option determines that if the IP address that initiates connection is resolved to the name via PTR, therefore this name must be resolved back to the client IP of the person who established the connection.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The following option provides a less tight constraint.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><span class=\"highlighted\">reject_unknown_reverse_client_hostname<\/span><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This option only checks for a <strong>PTR<\/strong> record, without looking for the existence of a corresponding<strong>&#8220;A&#8221;<\/strong>  record.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The next trick allows you to eliminate a great part of incoming spam. For this you have to make sure that your server does not responds to the client immediately, but with a short delay. Spammers do not have queue time, and a common SMTP server never breaks the connection without waiting for at least a couple of seconds. Upon receiving a request for a connection from a client, a little delay will be very helpful, since the connection is already established and there is communication between a client and a server, and delays cannot force the client to disconnect.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The timeout during the connection is activated by the command<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><span class=\"highlighted\">sleep seconds<\/span><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The optimal time is around 20 seconds, as after the 30th second of waiting Postfix considers by default that the server to be unavailable.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"> Check Introduction<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Before trasnitting a letter to your mail server, the transfer begins with a HELO introduction. If the FQDN of a sender is not specified in HELO, we can beyond a doubt refuse its acceptance. It requires the following options<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>reject_invalid_helo_hostname\nreject_non_fqdn_helo_hostname<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first one prohibits the reception of letters from hosts introducing themselves with incorrect syntax, the second \u2013 from those hosts that send non-FQDN in a HELO request.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, the non-FQDN is only transmitted by the most unwitting spammers, and it is not so difficult to introduce as gmail.com. Here is the next option for such an occasion.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>reject_unknown_helo_hostname<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This option prohibits receiving letters from those servers that are introduced with an address that had not been added to<strong>&#8220;A&#8221;<\/strong> <strong> or MX record<\/strong>. SMTP clients have to to strictly adhere to <strong>RFC 5321<\/strong> and begin a session with the EHLO (HELO) command and submit their full domain name <strong>(FQDN)<\/strong> or full IP address in case of absence of a domain name. Since mail servers on the Internet cannot go without a domain name, all of the above options can be established without hesitation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Sender Verification <\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After the server has introduced itself, the program turns to to the sender&#8217;s address, which also contains useful information. There is a misconception that both sender&#8217;s address and the server itself always belong to the same domain. It is not true; a single mail server can serve several domains.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the sender\u2019s address contains a non-existent domain, or an address that is nothing but a random charset or even an empty space, the letter should obviously be banned. The following options are used to reject such messages.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>reject_non_fqdn_sender\nreject_unknown_sender_domain<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The first option will reject the request if the domain in the MAIL FROM address line does not comply with the FQDN, as it is required by the RFC. The second option will reject the message if there are no <strong>&#8220;A&#8221; and MX DNS<\/strong> records in the <strong>MAIL FROM<\/strong> address line, or if the address contains an incorrect MX record, for example, a record with a <strong>MX<\/strong> name of zero length.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next we are going to request the server of the specified sender address for the existence of a user with such an address. This allows us to verify that the return address actually exists.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Verification is performed as follows, our server initiates a reciprocal SMTP session, attempting to send an email to the sender&#8217;s address. If it is sending <strong>RCPT TO<\/strong> is successful with this address, i.e. if the receiving server does not suddenly declare that the specified mailbox is nonexistent, it is considered a valid one. The data (that is, the message),of course, is not to be transmitted during verification, the session is terminated after RCPT TO.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>reject_unverified_sender<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">It follows from the above mentioned, that for each address you send an email from your domain, there must be a mailbox on your server. Otherwise, these messages will fail the return address verification on the receiving side and, accordingly, will not be delivered to the receiver.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you plan to issue a newsletter, always create mailboxes for all addresses you send your message from. If somehow you do not want to receive letters to a particular address, send them to it to \/ dev \/ null, but you are obliged to receive messages.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">How to Verify a Recipient! <\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The following directive serves to verify the header of the recipient envelope for information actually being an email address.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>reject_non_fqdn_recipient<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The next step is to prohibit receive email from nonexistent addresses. To achieve this, you have to first create a list of serviced boxes, then introduce Postfix to it through one of the * _recipient_maps parameters of the configuration file, and then you can use the configuration file parameter<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>smtpd_reject_unlisted_recipient = yes<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"> or a disabling option that has the same effect:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>reject_unlisted_recipient<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Thus, Postfix stops recieving emails for serviced domains where there is no mailbox for the recipient. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The open transmit of letters through your Postfix we prohibit, leaving only the opportunity to receive letters to known addresses. For these purpose serves the option<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>reject_unauth_destination<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Thus, we prohibit sending of letters to all unregistered users, except for those that have passed authorization or have been added to permit_mynetworks. It is strongly recommended to use this option, otherwise you risk to get in the <strong>DNSBL (RBL)<\/strong> &#8211; Domain Name Service-based Block List.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Based on the analysis of the three envelope headers, you can eliminate a huge amount of spam. Next, consider the following mechanism to combat spam.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Postgrey <\/strong>&#8211; implementation of gray lists for spam filtering.<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Greylist (gray list) is an effective instrument in combating spam. The method is based on the fact that when a mail server receives a message, the server does not accept it, gives a warning of temporary unavailability, and takes the sender\u2019s coordinates in a special list. If the sender&#8217;s mail server is configured correctly, soon there will be a second attempt to send the same message, which this time will be processed by our mail server. Information about whether to accept or reject the letter is taken from the database of temporary lists. The first time we reject, if the same mail comes the second time, then we accept it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">As practice shows, 50-70% of spam software usually makes only 1 delivery sample, so this method can safely halve junk mailing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Cons of the greylist technique: <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li> The delivery time for messages increases, sometimes this period is significant, it all depends on the settings of the senders&#8217; mail servers; <\/li><li> If the sender&#8217;s mail server is configured incorrectly, it will not attempt to deliver the message again. Alas, sometimes it happens, though not very often. <\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\"> Blocklists<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Using blocklists or the so-called <strong>DNSBL (RBL)<\/strong> &#8211; Domain Name Service-based Block List, can cut off the lion&#8217;s share of spam that arrives to your mail server. In these lists, the nodes are logged absolutely randomly and there are no guarantees that a valid host will not happen to be included there (where, perhaps, a spamming virus has been settled for some period of time, but even though the virus has been eliminated, or still easier and much more real, a single external IP for a large network in which the spammer ha dug a foxhole). The second reason is more trivial: the filtering mechanism proposed above is much more efficient than any DNSBL and does not rely on unverified data from third parties. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We have considered the main mechanisms for combating spam, now it is time to examine our servers from the outside to avoid our own spamming.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>For mail server administrators:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Always make MX records referring to &#8220;A&#8221;.<\/li><li>The A record for the mail server should always have a mirrored <strong>PTR record<\/strong>.<\/li><li>The host from the <strong>HELO <\/strong>header should have an <strong>&#8220;A&#8221; <\/strong>or <strong>MX record<\/strong>.<\/li><li>Always create <strong>SPF <\/strong>recordings (yes, this is just not necessary, but just a good tone rule).<\/li><li> For all messages sent from the accepted domain, a return address should always exist and receive mail.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>  For those who send mail: <\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Always send mail only with a valid return address.<\/li><li>Never send mail from a domain that is not under your control without checking the SPF rules.<\/li><li>Never send mail through incorrectly configured <strong>SMTP <\/strong>servers. Check the server for <a href=\"https:\/\/hostry.com\/products\/dns\/\">DNS records<\/a> using dig or nslookup utilities.  <\/li><\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Summary<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">By all means, the settings above\nwill not eliminate all the spam. It is likely that you will need additional context\nfilter that will analyze the content of the messages, for example,\nSpamassassin.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, keep in mind the description we provided you with in this article when configuring mail, since the above parameters can reduce the server load in comparison with contextual filters only, and provide excellent additional filtering. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You have to decide for yourself which restrictions you are ready to put on your server and which ones are not yet acceptable to you. The verifications above are taken a dim view of by many. However, all of them are used on real <strong>SMTP <\/strong>servers in the Internet, and even if you turn on each and every one of them, you will not be alone. Therefore, if you notice a server that is configured incorrectly, do not hesitate to send a message to the administrator on this issue, perhaps you will be able help him or her to avoid complaints from those users whose correspondence has not been sent propery. And never forget that cracked hosts can be added to the whitelist to allow receiving mail from them without verification.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Comments on Postfix options<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">First, as it has already been mentioned, all the above options must be specified in one of the four * _restrictions parameters of the <strong>Postfix <\/strong>configuration file related to the <strong>SMTP <\/strong>session headers. The first one, smtpd_client_restrictions, is responsible for verifying the client\u2019s IP address, the remaining three &#8211; smtpd_helo_restrictions, smtpd_sender_restrictions and smtpd_recipient_restrictions &#8211; for the corresponding <strong>SMTP headers<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this case, note that all four\nparameters should be implemented sequentially, and if the message is rejected\nat least by one, it is not accepted at all and the sender receives an error notification.\nHowever, the permit rules cancel further verification only on this particular\nparameter, and Postfix proceeds to the next. Therefore, if the letter\nsuccessfully passed the examination by smtpd_client_restrictions, it can easily\nbe flunked out by smtpd_helo_restrictions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Moreover, modern Postfix versions by default reject the letter no earlier than they reach the RCPT TO command. Thus you can always see the full information about the letter \u2013 who is it from and to who is the supposed receiver. Do not attempt to change this in <strong>Postfix<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Finally, it is possible to test any reject_ * option without actually rejecting the messages. For this purpose, specify the warn_if_reject option before it in the corresponding parameter of the <strong>Postfix <\/strong>configuration file. Thus in case of a bun, a reject_warning notification will be added to the log file, but the letter will not be rejected. For more information about possible prohibitory options and parameters of the Postfix configuration file turn to the official documentation. <\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>Spam. Spam is incessant; therefore, each responsible mail administrator should keep up with spam filtering methods based on their headers\u2019 SMTP analys&#8230;<\/p>\n","protected":false},"author":1,"featured_media":323,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-243","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-system-admin"],"read_time":11,"_links":{"self":[{"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/posts\/243","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/comments?post=243"}],"version-history":[{"count":20,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/posts\/243\/revisions"}],"predecessor-version":[{"id":266,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/posts\/243\/revisions\/266"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/media\/323"}],"wp:attachment":[{"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/media?parent=243"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/categories?post=243"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hostry.com\/blog\/wp-json\/wp\/v2\/tags?post=243"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}