Strona 1 z 1
Postfix SPAMASSASIN, SPAM folder
: 22 mar 2018, 19:36
autor: kunicki
Witam. Mam problem z konfiguracja Postfixa, Dovecot i Spamassasin tak aby e-maile oznaczone jako SPAM trafiały do folderu SPAM. Podstawowa konfiguracja jest ok bo SPAM oznaczany jest w temacie jako **SPAM** ale nie trafia do folderu SPAM. Czy moge prosić o pomoc w konfiguracji??. Wydaje mi się że problem tkwi w pliku master.cf we wpise:
spamassassin unix - n n - - pipe
flags=Rq user=vmail argv=/usr/bin/spamc -u ${user} -e /usr/sbin/sendmail -oi -f ${sender} ${recipient}
Jak zamieniem ten wpis na :
spamassassin unix - n n - - pipe
flags=DROhu user=vmail:vmail argv=/usr/bin/spamc -f -e
/usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop}
to niestety wiadomości nie dochodzą wcale i w logach jest wpis unknown user.
Re: Postfix SPAMASSASIN, SPAM folder
: 22 mar 2018, 20:27
autor: jacekalex
Ja mam tak:
Spamassassin:
Kod: Zaznacz cały
spamassassin unix - n n - - pipe
flags=Rq user=spamd argv=/usr/bin/spamc -U /var/run/spamd/spamd.sock -u ${user}@${domain} -e /usr/sbin/sendmail -f ${sender} ${recipient}
A do skrzynek wrzuca:
Kod: Zaznacz cały
dovecot unix - n n - - pipe
flags=DRhu user=mail:mail argv=/usr/lib/dovecot/dovecot-lda -f ${sender} -a ${recipient} -d ${user}@${nexthop}
-o syslog_name=dovecot/lda
Do tego domyslna regułka filtra sieve:
cat /etc/dovecot/sieve/default.sieve
Kod: Zaznacz cały
## Generated by Roundcube Webmail SieveRules Plugin ##
require ["fileinto"];
# rule:[Spam]
if anyof (header :contains "X-Spam-Status" "Yes")
{
fileinto "Junk";
}
i chodzi, jak złoto.
Re: Postfix SPAMASSASIN, SPAM folder
: 22 mar 2018, 22:10
autor: kunicki
Dziękuję za odpowiedź
Niestety z tą konfiguracja również u mnie nie działa. Wygląda to tak jakby wiadomości w ogóle nie przechodziły przez dovecot. Może mam nieprawidłową kolejność tych wpisów. Ma to w ogóle znaczenie. Jak możesz to wklej całego configa...
Re: Postfix SPAMASSASIN, SPAM folder
: 22 mar 2018, 22:26
autor: jacekalex
Faktycznie, niekompletna sprawa:
SAmampodpięty tak:
Kod: Zaznacz cały
smtp inet n - y - - smtpd
[b] -o content_filter=spamassassin[/b]
-o receive_override_options=no_address_mappings
-o milter_macro_daemon_name=ORIGINATING
-o smtpd_milters=unix:filtry/opendmarc.sock
-o smtpd_sasl_auth_enable=no
-o smtpd_milters=unix:filtry/clamav-milter.sock
-o milter_default_action=accept
-o syslog_name=postfix/smtpd25
A dovecot tak:
Kod: Zaznacz cały
smtpd_sasl_type = dovecot
....
dovecot_destination_recipient_limit = 1
# local_transport = lmtp:unix:private/dovecot-lmtp
local_transport = dovecot
virtual_transport = dovecot
# virtual_transport = lmtp:unix:private/dovecot-lmtp
opcjonalnie mogę przełączyć transport z dovecot-lda na socket dovecot-lmtp w ciągu minuty.
Re: Postfix SPAMASSASIN, SPAM folder
: 22 mar 2018, 22:43
autor: kunicki
Niestety teraz po dodaniu wpisu local_transport = dovecot , wywala w mail.log błąd:
status=bounced (user unknown)
ten wpis napewno ok
content_filter=spamassassin bo filtrowanie działa, tylko nie wrzuca do folderu.
W dovecot.log nie ma żadnych błędów. Może w dovecot.conf coś mam nie tak?
Re: Postfix SPAMASSASIN, SPAM folder
: 22 mar 2018, 22:53
autor: jacekalex
pojęcia nie mam może cos tam masz nagrabione.
wcześniej dovecot do skrzynek wrzucał maile?
Re: Postfix SPAMASSASIN, SPAM folder
: 22 mar 2018, 22:59
autor: kunicki
szczerze mówiac nie wiem jak to sprawdzić czy idzie to przez dovecot. Maile dochodzą prawidłwo cały czas. Walczę już z tym chyba z miesiąc, wszyskie konfigi namieszane na wszystkie strony.... Ręce mi już opadają... Może wkleiłbyś całe master.cf, main,cf, dovecot.conf. Może coś na ej podstawie wywnioskuje...
U mnie wygłąda to tak:
main.cf
Kod: Zaznacz cały
# Hostname and domain name
myhostname=domena.pl
mydomain=mail.domena.pl
myorigin=$mydomain
smtp_bind_address=moje_ip
#mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
# SSL/TLS certificates
smtpd_tls_cert_file=/etc/postfix/ssl/mailserver.crt
smtpd_tls_key_file=/etc/postfix/ssl/mailserver.key
smtpd_tls_CAfile =/etc/postfix/ssl/cacert.pem
smtpd_use_tls=yes
smtpd_tls_auth_only=no
strict_rfc821_envelopes = yes
disable_vrfy_command = yes
smtpd_helo_required = yes
smtpd_client_restrictions =
smtpd_helo_restrictions =
smtpd_sender_restrictions =
smtpd_recipient_restrictions =
permit_mynetworks,
permit_sasl_authenticated,
reject_unauth_destination,
reject_invalid_hostname,
reject_unauth_pipelining,
reject_non_fqdn_sender,
reject_unknown_sender_domain,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain,
# check_client_access hash:$config_directory/access_client,
# check_sender_access hash:$config_directory/access_sender
permit
spamassasin
virtual_transport = dovecot
home_mailbox = Maildir
dovecot_destination_recipient_limit = 1
smtpd_sasl_auth_enable = yes
compatibility_level = 2
inet_protocols = ipv4
message_size_limit = 100000000
mailbox_size_limit = 1000000000
content_filter = scan:127.0.0.1:10025
receive_override_options = no_address_mappings
master.cf
Kod: Zaznacz cały
#clamav
scan unix - - n - 16 smtp
# -o smtp_data_done_timeout=1200
-o smtp_send_xforward_command=yes
# -o disable_dns_lookups=yes
127.0.0.1:10026 inet n - n - 16 smtpd
-o content_filter=
-o receive_override_options=no_unknown_recipient_checks,no_header_body_checks
-o smtpd_helo_restrictions=
-o smtpd_client_restrictions=
-o smtpd_sender_restrictions=
-o smtpd_recipient_restrictions=permit_mynetworks,reject
-o mynetworks_style=host
-o smtpd_authorized_xforward_hosts=127.0.0.0/8
smtp inet n - n - - smtpd -o content_filter=spamassassin
submission inet n - n - - smtpd -o content_filter=spamassassin
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
-o smtpd_sasl_auth_enable=yes
-o smtpd_reject_unlisted_recipient=no
-o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
-o milter_macro_daemon_name=ORIGINATING
pickup unix n - n 60 1 pickup
cleanup unix n - n - 0 cleanup
qmgr unix n - n 300 1 qmgr
tlsmgr unix - - n 1000? 1 tlsmgr
rewrite unix - - n - - trivial-rewrite
bounce unix - - n - 0 bounce
defer unix - - n - 0 bounce
trace unix - - n - 0 bounce
verify unix - - n - 1 verify
flush unix n - n 1000? 0 flush
proxymap unix - - n - - proxymap
proxywrite unix - - n - 1 proxymap
smtp unix - - n - - smtp
relay unix - - n - - smtp
showq unix n - n - - showq
error unix - - n - - error
retry unix - - n - - error
discard unix - - n - - discard
local unix - n n - - local
#virtual unix - n n - - virtual
lmtp unix - - n - - lmtp
anvil unix - - n - 1 anvil
scache unix - - n - 1 scache
spamassassin unix - n n - - pipe
flags=Rq user=vmail argv=/usr/bin/spamc -u ${user}@${domain} -e /usr/sbin/sendmail -f ${sender} ${recipient}
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/dovecot-lda -f ${sender} -a ${recipient} -d ${user}@${nexthop}
-o syslog_name=dovecot/lda
dovecot.conf
Kod: Zaznacz cały
protocols = imap pop3
listen = *
log_timestamp = "%Y-%m-%d %H:%M:%S "
log_path=/var/log/dovecot.log
#login_process_size = 64
login_greeting = POP ready
mail_location = maildir:~/Maildir
#SSL
ssl = yes
ssl_cert = </etc/postfix/ssl/mailserver.crt
ssl_key = </etc/postfix/ssl/mailserver.key
ssl_ca = </etc/postfix/ssl/cacert.pem
verbose_ssl = yes
userdb {
driver = passwd
}
passdb {
args = %s
driver = pam
}
namespace {
type = private
separator = .
inbox = yes
mailbox Trash {
auto = subscribe
special_use = \Trash
}
mailbox Drafts {
auto = subscribe
special_use = \Drafts
}
mailbox Sent {
auto = subscribe
special_use = \Sent
}
mailbox Junk {
auto = subscribe
special_use = \Junk
}
plugin {
sieve_dir = /etc/dovecot/sieve
}
protocol lda {
auth_socket_path = /var/run/dovecot/auth-master
mail_plugins = $mail_plugins sieve
protocol lmtp {
postmaster_address = email@email.pl
mail_plugins = " sieve "
}
plugin {
sieve = /etc/dovecot/default.sieve
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
Re: Postfix SPAMASSASIN, SPAM folder
: 23 mar 2018, 09:38
autor: kunicki
OK. Wygląda na to że problem rozwiązany. Trzeba było dodać wpis w main.cf :
mailbox_command = /usr/lib/dovecot/dovecot-lda -f “$SENDER” -a “$RECIPIENT”
Nie wiem czemu nie działało to z virtual_transport...
Re: Postfix SPAMASSASIN, SPAM folder
: 23 mar 2018, 09:47
autor: jacekalex
Pewnie dlatego, że nie masz witrualnej domeny i wirtualnych skrzynek.
Poza tym filtry sieve masz jeszcze do zrobienia, bo na razie tam widzę katastrofalne lamerstwo.
Kod: Zaznacz cały
# 2.2.34 (874deae): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.21 (92477967)
# OS: Linux 4.15.11-g1 x86_64 Gentoo Base System release 2.4.1 ext4
# Hostname: domek.domena.tld
auth_default_realm = domena.tld
auth_failure_delay = 1 mins
auth_mechanisms = plain login cram-md5 digest-md5
base_dir = /var/run/dovecot/
default_internal_user = mail
default_login_user = mail
dict {
expire = mysql:/etc/dovecot/expire-sql.conf
quote = mysql:/etc/dovecot/quota-sql.conf
}
first_valid_gid = 8
first_valid_uid = 8
info_log_path = /var/log/dovecot/dovecot.log
last_valid_gid = 8
last_valid_uid = 8
listen = *
login_log_format_elements = pl
mail_gid = 8
mail_location = maildir:/home/domains/%d/%n/.maildir
mail_plugins = sieve quota acl expire
mail_privileged_group = mail
mail_uid = 8
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date ihave spamtest spamtestplus
namespace {
inbox = yes
location =
mailbox Archive {
auto = subscribe
special_use = \Archive
}
mailbox Drafts {
auto = subscribe
special_use = \Drafts
}
mailbox Junk {
auto = subscribe
special_use = \Junk
}
mailbox Sent {
auto = subscribe
special_use = \Sent
}
mailbox Trash {
auto = subscribe
special_use = \Trash
}
prefix =
separator = /
type = private
}
passdb {
args = /etc/dovecot/dovecot-sqlx.conf
driver = sql
}
plugin {
expire = Trash
expire2 = Trash/*
expire3 = Junk
expire4 = Junk/*
expire_dict = proxy::expire
quota = maildir:User quota
quota_rule2 = Trash:storage=+10%%
quota_rule3 = Spam:storage=+20%%
quota_warning = storage=95%% /usr/local/bin/quota-warning.sh 95
quota_warning2 = storage=80%% /usr/local/bin/quota-warning.sh 80
sieve = /home/domains/%d/%n/.dovecot.sieve
sieve_after = /etc/dovecot/sieve/after.sieve
sieve_before = /etc/dovecot/sieve/before.sieve
sieve_default = /etc/dovecot/sieve/default.sieve
sieve_dir = /home/domains/%d/%n/sieve
sieve_extensions = +spamtest +spamtestplus +relational +comparator-i;ascii-numeric
sieve_global_dir = /etc/dovecot/sieve
sieve_vacation_default_period = 1h
sieve_vacation_max_period = 0
sieve_vacation_min_period = 0
trash = /etc/dovecot/dovecot-trash.conf.ext
}
postmaster_address = postmaster@domena.tld
protocols = imap lmtp sieve pop3
service auth-worker {
user = mail
}
service auth {
unix_listener /var/spool/postfix/private/doveauth {
group = doveauth
mode = 0660
user = postfix
}
unix_listener auth-master {
group = mail
mode = 0666
user = mail
}
unix_listener auth-userdb {
group = mail
mode = 0666
user = mail
}
}
service dict {
unix_listener dict {
mode = 0600
user = dovecot
}
}
service doveadm {
inet_listener {
port = 9346
ssl = yes
}
}
service imap-login {
chroot = login
client_limit = 32
process_limit = 32
process_min_avail = 2
service_count = 1
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0660
user = postfix
}
}
service managesieve-login {
chroot = login
client_limit = 64
process_limit = 64
process_min_avail = 2
service_count = 1
}
service pop3-login {
chroot = login
client_limit = 32
inet_listener pop3 {
port = 0
}
process_limit = 32
process_min_avail = 2
service_count = 1
}
ssl_ca = </etc/ssl/serwer/serwerCA.crt
ssl_cert = </etc/ssl/serwer/serwer.crt
ssl_key = # hidden, use -P to show it
ssl_protocols = !SSLv3
userdb {
args = /etc/dovecot/dovecot-sqlx.conf
driver = sql
}
protocol imap {
imap_id_log = imapd
imap_idle_notify_interval = 10 mins
imap_logout_format = bytes=%i/%o
imap_max_line_length = 16 k
mail_plugins = quota imap_quota acl imap_acl trash
ssl = yes
ssl_verify_client_cert = yes
}
protocol pop3 {
mail_plugins = quota acl
pop3_logout_format = top=%t/%p, retr=%r/%b, del=%d/%m, size=%s
pop3_uidl_format = %08Xu%08Xv
ssl = yes
ssl_verify_client_cert = yes
}
protocol lda {
auth_socket_path = /var/run/dovecot/auth-userdb
hostname = domena.tld
lda_original_recipient_header = yes
mail_plugins = sieve quota acl trash
postmaster_address = postmaster@domena.tld
quota_full_tempfail = yes
rejection_reason = Your message to <%t> was automatically rejected:%n%r
rejection_subject = Rejected: %s
sendmail_path = /usr/sbin/sendmail
}
protocol lmtp {
auth_socket_path = /var/run/dovecot/auth-userdb
hostname = domena.tld
mail_plugins = sieve quota acl trash
postmaster_address = postmaster@domena.tld
quota_full_tempfail = yes
rejection_reason = Your message to <%t> was automatically rejected:%n%r
rejection_subject = Rejected: %s
sendmail_path = /usr/sbin/sendmail
}
Mój dovecot - cała konfiguracja.