N
N
Nefess2019-07-02 02:56:31
postfix
Nefess, 2019-07-02 02:56:31

Postfix and Spamassassin: why do emails come to the sender?

Help setting up a mail server. If I send a letter from external mail to any address on my mail server, then the sender receives his own letter. At the same time, the recipient also receives his letter.
main.cf

biff = no
append_dot_mydomain = no

readme_directory = no

# TLS parameters
smtp_use_tls = yes
smtpd_use_tls = yes
smtpd_tls_CApath = /etc/ssl/private/certs


smtpd_tls_cert_file=/etc/ssl/private/certs/cert.crt
smtpd_tls_key_file=/etc/ssl/private/certs/device.key

smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_tls_auth_only = yes
smtpd_tls_security_level = may
#smtpd_tls_CAfile = $smtpd_tls_key_file
smtpd_tls_loglevel = 3
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = smtp.domain.su
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost.localdomain, localhost#

#Relay
relay_transport = hash:/etc/postfix/transport
transport_maps = hash:/etc/postfix/transport

#bcc
#sender_bcc_maps = hash:/etc/postfix/sender_bcc
recipient_bcc_maps = hash:/etc/postfix/recipient_bcc

mynetworks = 127.0.0.0/8 192.168.0.0/16
mailbox_size_limit = 0
message_size_limit = 52428800
recipient_delimiter = +
inet_interfaces = all

# Virtual Domain parameters
#virtual_mailbox_domains = domain.su
virtual_mailbox_domains = domain..su
smtpd_sender_login_maps = proxy:ldap:/etc/postfix/ad_sender_login_maps.cf
virtual_mailbox_maps = proxy:ldap:/etc/postfix/ad_virtual_mailbox_maps.cf
virtual_alias_maps = proxy:ldap:/etc/postfix/ad_virtual_group_maps.cf, hash:/etc/postfix/virtual_maps 
virtual_uid_maps = static:1001
virtual_gid_maps = static:1001
virtual_mailbox_base = /var/vmail

# Virtual Transport
dovecot_destination_recipient_limit = 1
virtual_transport = dovecot

#
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth

home_mailbox = Maildir/
mailbox_command = /usr/lib/dovecot/deliver -d $LOGNAME
compatibility_level = 2

#reject_unknown_client

# Restrictions
smtpd_client_restrictions =
 permit_mynetworks
 check_client_access hash:/etc/postfix/client_access
 reject_unknown_client_hostname

mua_client_restrictions =
 check_client_access hash:/etc/postfix/client_access

smtpd_helo_required = yes

smtpd_helo_restrictions =
 permit_mynetworks
 check_helo_access hash:/etc/postfix/helo_access
 reject_invalid_helo_hostname
 reject_non_fqdn_helo_hostname
 reject_unknown_helo_hostname

mua_helo_restrictions =
 check_helo_access hash:/etc/postfix/helo_access
 reject_invalid_helo_hostname

smtpd_sender_restrictions =
 permit_mynetworks
# check_sender_access hash:/etc/postfix/sender_access
# reject_unverified_sender
# permit_sasl_authenticated
# reject_authenticated_sender_login_mismatch
# reject_unknown_sender_domain
 reject_non_fqdn_sender
 reject_unlisted_sender
 reject_unauth_destination

mua_sender_restrictions =
 check_sender_access hash:/etc/postfix/sender_access
 reject_sender_login_mismatch

smtpd_relay_restrictions =
 permit_mynetworks
 permit_sasl_authenticated
 defer_unauth_destination

smtpd_recipient_restrictions =
 permit_mynetworks
 reject_invalid_hostname
 reject_non_fqdn_hostname
 reject_non_fqdn_sender
 reject_non_fqdn_recipient
# reject_unknown_recipient_domain
# reject_unknown_sender_domain
# reject_rbl_client cbl.abuseat.org
# reject_rbl_client bl.spamcop.net
 #reject_rbl_client dnsbl.sorbs.net
 #check_policy_service inet: unix:postgey/socket
 #check_policy_service inet:127.0.0.1:10023
 #check_policy_service inet:127.0.0.1:12340

smtpd_data_restrictions =
 reject_unauth_pipelining
 reject_multi_recipient_bounce

smtpd_etrn_restrictions =
 permit_mynetworks
 reject

disable_vrfy_command = yes
smtpd_discard_ehlo_keywords = vrfy etrn

header_checks = regexp:/etc/postfix/header_checks


milter_protocol = 6
milter_default_action = accept
#smtpd_milters = unix:/var/spool/postfix/var/run/opendkim/opendkim.sock
#non_smtpd_milters = unix:/var/spool/postfix/var/run/opendkim/opendkim.sock
smtpd_milters = local:/var/run/opendkim/opendkim.sock
non_smtpd_milters = local:/var/run/opendkim/opendkim.sock
#smtpd_milters = inet:localhost:8891
#non_smtpd_milters = inet:localhost:8891
#smtpd_milters = inet:127.0.0.1:10023
#non_smtpd_milters = inet:127.0.0.1:10023

#content_filter = scan:[127.0.0.1]:10025
#receive_override_options = no_address_mappings

double_bounce_sender = [email protected]
debug_peer_level = 4

smtputf8_enable = no

compatibility_level=2

spamassassin/local.cf
# rewrite_header Subject *****SPAM*****
rewrite_header Subject [***** SPAM _SCORE_ *****]

# Не использовать сетевые проверки (т.к. делаем это в MTA)
skip_rbl_checks         0
#   Использовать Razor
use_razor2                1
#   Использовать DCC
use_dcc                    1
#use_pyzor              1
#pyzor_path /usr/bin/pyzor

 report_safe 0
 trusted_networks 192.168.0.0/24
 required_score 5.0
 use_bayes 1
 bayes_auto_learn 1
 bayes_ignore_header X-Bogosity
 bayes_ignore_header X-Spam-Flag
 bayes_ignore_header X-Spam-Status

 bayes_min_ham_num 1
 bayes_min_spam_num 1
 report_charset koi8-r
 ok_locales ru en uk

 bayes_path /var/spool/bayes/bayes
 bayes_file_mode 0666

 score SUBJ_FULL_OF_8BITS 0
 score FROM_ILLEGAL_CHARS 0
 score SUBJ_ILLEGAL_CHARS 0
 score HEAD_ILLEGAL_CHARS 0
 score HABEAS_SWE 0
 score FORGED_IMS_TAGS 1
 score BAYES_00 0.0001 0.0001 -2.312 -2.599
 score BAYES_05 0.0001 0.0001 -1.110 -1.110
 score BAYES_20 0.0001 0.0001 -0.740 -0.740
 score BAYES_40 0.0001 0.0001 -0.185 -0.185
 score BAYES_50 0.0001 0.0001 0.001 0.001
 score BAYES_60 0.0001 0.0001 2.0 2.0
 score BAYES_80 0.0001 0.0001 3.0 3.0
 score BAYES_95 0.0001 0.0001 3.5 3.5
 score BAYES_99 0.0001 0.0001 5.0 5.0
 score ALL_TRUSTED -3.360 -3.440 -3.665 -3.800
 score RAZOR2_CHECK 1.000
 score DCC_CHECK 1.000
# score PYZOR_CHECK 1.000
#   Bayesian classifier auto-learning (default: 1)
#
 bayes_auto_learn 1

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question