title: postfix check user database to prevent forged address
body: <p>We are facing problem with our mail servers. We have two servers for the mail system, one is POP only (Dovecot installed) and another one is SMTP (postfix, amavis, pyzor, razor installed and sending only). Both the servers install iredmail instance.  MX record in the SMTP one. We have a shared user database on both the servers and configure SASL authentication in the SMTP server. We already stop backscattering by implementing Header Check PCRE. </p>
  
  <p>Now we facing forged address spam sending where user id is <code>something@mydomain.com</code> and our system can pass this mail. Please help me so I can configure a list of usernames (i.e. <code>hash:/etc/postfix/clean_sender</code>) or point to mysql database and if any mail incoming with a username does not match this list, it will discard immediately. </p>
  
  <p>An example of the problems is <a href="https://drive.google.com/file/d/0Byb-DDPKkVcOMTZabnBJOTRxb1E/view?usp=sharing" rel="nofollow">shown in this extract from our logs</a>:</p>
  
  <pre><code>*** ENVELOPE RECORDS active/XXXXX ***
  message_size:    49356      785           1         0           49356
  message_arrival_time: XXXXX
  create_time: XXXXX
  content_filter: smtp-amavis:[127.0.0.1]:10024
  named_attribute: log_ident= XXXXX
  named_attribute: rewrite_context=remote
  sender: u@ XXXXX.com
  named_attribute: log_client_name= XXXXX
  named_attribute: log_client_address= XXXXX
  named_attribute: log_client_port=51472
  named_attribute: log_message_origin= XXXXX
  named_attribute: log_helo_name= XXXXX
  named_attribute: log_protocol_name=ESMTP
  named_attribute: client_name= XXXXX
  named_attribute: reverse_client_name= XXXXX
  named_attribute: client_address= XXXXX
  named_attribute: client_port=51472
  named_attribute: helo_name= XXXXX
  named_attribute: protocol_name=ESMTP
  named_attribute: client_address_type=2
  named_attribute: dsn_orig_rcpt=rfc822;bob.baxter@charles-stanley.co.uk
  original_recipient: 
  recipient: bob.baxter@charles-stanley.co.uk
  </code></pre>
  
  <p></p>
  
  <pre><code>*** MESSAGE CONTENTS active/75C6734077E ***
  Received: from ip245c164.banglalionwimax.com (XXXXX)
          by smtp. XXXXX.com (Postfix) with ESMTP id XXXXX
          for &lt;bob.baxter@charles-stanley.co.uk&gt;; XXXXX
  Message-ID: &lt;7521347.20150606135549@barretthead.com
  Date: XXXXX
  Subject: Wesley, use you personal coupon - nayfeith
  From: "Harris" &lt;fgbagrlidak@e-sil.com&gt;
  To: &lt;bob.baxter@charles-stanley.co.uk&gt;
  MIME-Version: 1.0
  X-Priority: 3
  Precedence: bulk
  Content-Type: multipart/mixed;
   boundary="O74xv3RG7hejSBa3"
  </code></pre>