Next, I will use postfix to add anti-spam methods to prevent sender spoofing configurations. I hope this article will be helpful to you.
Added the following configurations to prevent sender spoofing:
| The Code is as follows: |
Copy code |
| # Smtpd related config Smtpd_recipient_restrictions = Permit_mynetworks, Permit_sasl_authenticated, # Reject_non_fqdn_hostname, Reject_non_fqdn_sender, Reject_non_fqdn_recipient, Reject_unauth_destination, Reject_unauth_pipelining, Reject_invalid_hostname Smtpd_sender_restrictions = Permit_mynetworks, Check_recipient_access hash:/etc/postfix/local_recipient, Permit_sasl_authenticated, Reject_sender_login_mismatch, Reject_authenticated_sender_login_mismatch, Reject_unauthenticated_sender_login_mismatch, Reject_unknown_sender_domain # Smtp auth config here Broken_sasl_auth_clients = yes Smtpd_sasl_auth_enable = yes Smtpd_sasl_security_options = noanonymous |
Supplement:
Configuring extmail does not allow spoofing of non-existent local email addresses to send emails, and does not allow sending emails with counterfeit others' email addresses.
Cd/etc/postfix/
Cat> mysql_virtual_sender_maps.cf <EOF
User = extmail
Password = extmail
Hosts = localhost
Dbname = extmail
Table = mailbox
Select_field = username
Where_field = username
Additional_conditions = AND active = '1'
EOF
Vim main. cf
Smtpd_sender_login_maps =
Mysql:/etc/postfix/mysql_virtual_sender_maps.cf
Smtpd_sender_restrictions =
Permit_mynetworks,
Reject_sender_login_mismatch,
Reject_authenticated_sender_login_mismatch,
Reject_unauthenticated_sender_login_mismatch
Make the configuration take effect
Postfix reload