0

I followed this answer

but the spam emails aren't being delivered to Junk folder

My files: /etc/postfix/master.cf

#
# Postfix master process configuration file.  For details on the format
# of the file, see the master(5) manual page (command: "man 5 master" or
# on-line: http://www.postfix.org/master.5.html).
#
# Do not forget to execute "postfix reload" after editing this file.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (no)    (never) (100)
# ==========================================================================
smtp      inet  n       -       y       -       -       smtpd
  -o content_filter=spamassassin
#smtp      inet  n       -       y       -       1       postscreen
#smtpd     pass  -       -       y       -       -       smtpd
#dnsblog   unix  -       -       y       -       0       dnsblog
#tlsproxy  unix  -       -       y       -       0       tlsproxy
submission inet n       -       y       -       -       smtpd
#  -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_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
smtps     inet  n       -       y       -       -       smtpd
#  -o syslog_name=postfix/smtps
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
#  -o smtpd_reject_unlisted_recipient=no
#  -o smtpd_client_restrictions=$mua_client_restrictions
#  -o smtpd_helo_restrictions=$mua_helo_restrictions
#  -o smtpd_sender_restrictions=$mua_sender_restrictions
#  -o smtpd_recipient_restrictions=
  -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
  -o milter_macro_daemon_name=ORIGINATING
#628       inet  n       -       y       -       -       qmqpd
pickup    unix  n       -       y       60      1       pickup
cleanup   unix  n       -       y       -       0       cleanup
qmgr      unix  n       -       n       300     1       qmgr
#qmgr     unix  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       y       1000?   1       tlsmgr
rewrite   unix  -       -       y       -       -       trivial-rewrite
bounce    unix  -       -       y       -       0       bounce
defer     unix  -       -       y       -       0       bounce
trace     unix  -       -       y       -       0       bounce
verify    unix  -       -       y       -       1       verify
flush     unix  n       -       y       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       y       -       -       smtp
relay     unix  -       -       y       -       -       smtp
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       y       -       -       showq
error     unix  -       -       y       -       -       error
retry     unix  -       -       y       -       -       error
discard   unix  -       -       y       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       y       -       -       lmtp
anvil     unix  -       -       y       -       1       anvil
scache    unix  -       -       y       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
#
# ====================================================================
#
# Recent Cyrus versions can use the existing "lmtp" master.cf entry.
#
# Specify in cyrus.conf:
#   lmtp    cmd="lmtpd -a" listen="localhost:lmtp" proto=tcp4
#
# Specify in main.cf one or more of the following:
#  mailbox_transport = lmtp:inet:localhost
#  virtual_transport = lmtp:inet:localhost
#
# ====================================================================
#
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
#
#cyrus     unix  -       n       n       -       -       pipe
#  user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# ====================================================================
# Old example of delivery via Cyrus.
#
#old-cyrus unix  -       n       n       -       -       pipe
#  flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
#
# ====================================================================
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
#
# Other external delivery methods.
#

spamassassin unix -     n   n   -   -   pipe
    flags=DROhu user=mail:mail argv=/usr/bin/spamc -f -e 
    /usr/lib/dovecot/deliver -f ${sender} -d ${user}@${nexthop} 

/etc/postfix/main.cf

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Raspbian)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# TLS parameters
#smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
#smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
#smtpd_use_tls=yes
#smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
#smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

smtpd_tls_cert_file=/...
smtpd_tls_key_file=/...

smtp_use_tls=yes
smtpd_use_tls=yes
smtpd_tls_loglevel=1
smtpd_tls_received_header=yes
tls_random_source=dev:/dev/urandom
smtp_tls_note_starttls_offer=yes
smtpd_tls_session_cache_timeout=3600s
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
queue_directory=/var/spool/postfix


# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
home_mailbox = Maildir/
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = vxempire.xyz
myorigin = /etc/mailname
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks,permit_auth_destination,permit_sasl_authenticated,reject
alias_maps = hash:/etc/aliases,hash:/var/lib/mailman/data/aliases
alias_database = hash:/etc/aliases, hash:/var/lib/mailman/data/aliases

virtual_alias_domains = vxempire.pw
virtual_alias_maps = hash:/etc/postfix/virtual
mydestination = vxempire.xyz localhost localhost.localdomain
#only the last of the above line added, first three have been working fine

milter_protocol = 2
milter_default_action = accept
smtpd_milters = inet:localhost:12301
non_smtpd_milters = inet:localhost:12301
spamassassin_destination_recipient_limit = 1

/etc/spamassassin/local.cf

 # This is the right place to customize your installation of SpamAssassin.
    #
    # See 'perldoc Mail::SpamAssassin::Conf' for details of what can be
    # tweaked.
    #
    # Only a small subset of options are listed below
    #
###########################################################################

#   Add *****SPAM***** to the Subject header of spam e-mails
#
#   Save spam messages as a message/rfc822 MIME attachment instead of
#   modifying the original message (0: off, 2: use text/plain instead)
#


#   Set which networks or hosts are considered 'trusted' by your mail
#   server (i.e. not spammers)
#
# trusted_networks 212.17.35.


#   Set file-locking method (flock is not safe over NFS, but is faster)
#
# lock_method flock


#   Set the threshold at which a message is considered spam (default: 5.0)
#
# required_score 5.0


#   Use Bayesian classifier (default: 1)
#
# use_bayes 1


#   Bayesian classifier auto-learning (default: 1)
#
# bayes_auto_learn 1


#   Set headers which may provide inappropriate cues to the Bayesian
#   classifier
#
# bayes_ignore_header X-Bogosity
# bayes_ignore_header X-Spam-Flag
# bayes_ignore_header X-Spam-Status


#   Whether to decode non- UTF-8 and non-ASCII textual parts and recode
#   them to UTF-8 before the text is given over to rules processing.
#
# normalize_charset 1

#   Some shortcircuiting, if the plugin is enabled
# 
ifplugin Mail::SpamAssassin::Plugin::Shortcircuit
#
#   default: strongly-whitelisted mails are *really* whitelisted now, if the
#   shortcircuiting plugin is active, causing early exit to save CPU load.
#   Uncomment to turn this on
#
# shortcircuit USER_IN_WHITELIST       on
# shortcircuit USER_IN_DEF_WHITELIST   on
# shortcircuit USER_IN_ALL_SPAM_TO     on
# shortcircuit SUBJECT_IN_WHITELIST    on

#   the opposite; blacklisted mails can also save CPU
#
# shortcircuit USER_IN_BLACKLIST       on
# shortcircuit USER_IN_BLACKLIST_TO    on
# shortcircuit SUBJECT_IN_BLACKLIST    on

#   if you have taken the time to correctly specify your "trusted_networks",
#   this is another good way to save CPU
#
# shortcircuit ALL_TRUSTED             on

#   and a well-trained bayes DB can save running rules, too
#
# shortcircuit BAYES_99                spam
# shortcircuit BAYES_00                ham

endif # Mail::SpamAssassin::Plugin::Shortcircuit
use_bayes_rules 1
report_safe 0

In /etc/dovecot/conf.d/10-master.conf i have this

protocols = imap pop3 lmtp sieve

/etc/dovecot/conf.d/90-plugin.conf

##
## Plugin settings
##

# All wanted plugins must be listed in mail_plugins setting before any of the
# settings take effect. See <doc/wiki/Plugins.txt> for list of plugins and
# their configuration. Note that %variable expansion is done for all values.
plugin {
    sieve = /etc/dovecot/sieve/default.sieve
}

/etc/dovecot/conf.d/15-lda.conf

##
## LDA specific settings (also used by LMTP)
##
#lda_mailbox_autosubscribe = no
protocol lda {
  mail_plugins = $mail_plugins sieve
}
/etc/dovecot/conf.d/20-lmtp.conf

##
## LMTP specific settings
##

# Support proxying to other LMTP/SMTP servers by performing passdb lookups.
#lmtp_proxy = no

# When recipient address includes the detail (e.g. user+detail), try to save
# the mail to the detail mailbox. See also recipient_delimiter and
# lda_mailbox_autocreate settings.
#lmtp_save_to_detail_mailbox = no

# Verify quota before replying to RCPT TO. This adds a small overhead.
#lmtp_rcpt_check_quota = no

# Which recipient address to use for Delivered-To: header and Received:
# header. The default is "final", which is the same as the one given to
# RCPT TO command. "original" uses the address given in RCPT TO's ORCPT
# parameter, "none" uses nothing. Note that "none" is currently always used
# when a mail has multiple recipients.
#lmtp_hdr_delivery_address = final

protocol lmtp {
     mail_plugins = $mail_plugins sieve
}

/var/log/mail.log (only things that appears when i send an email)

Jan 24 17:53:30 vxempire dovecot: imap-login: Login: user=<qorg>, method=PLAIN, rip=82.213.215.199, lip=192.168.1.150, mpid=3540, TLS, session=<7hzcDDeA5txS1dfH>
Jan 24 17:53:30 vxempire dovecot: imap(qorg): Logged out in=91 out=1037
Jan 24 17:53:56 vxempire postfix/smtpd[3548]: connect from mail-lj1-f180.google.com[209.85.208.180]
Jan 24 17:53:56 vxempire postfix/smtpd[3548]: Anonymous TLS connection established from mail-lj1-f180.google.com[209.85.208.180]: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)
Jan 24 17:53:56 vxempire postfix/smtpd[3548]: B97561F840: client=mail-lj1-f180.google.com[209.85.208.180]
Jan 24 17:53:56 vxempire postfix/cleanup[3556]: B97561F840: message-id=<CAFj-oU733e6ZP+zV8-e+9pFWwHg0oUxE_werUgBWfKGxQo64Bg@mail.gmail.com>
Jan 24 17:53:56 vxempire opendkim[644]: B97561F840: mail-lj1-f180.google.com [209.85.208.180] not internal
Jan 24 17:53:56 vxempire opendkim[644]: B97561F840: not authenticated
Jan 24 17:53:56 vxempire opendkim[644]: B97561F840: DKIM verification successful
Jan 24 17:53:56 vxempire opendkim[644]: B97561F840: s=20161025 d=gmail.com SSL
Jan 24 17:53:56 vxempire postfix/qmgr[3187]: B97561F840: from=<foo@gmail.com>, size=2797, nrcpt=1 (queue active)
Jan 24 17:53:57 vxempire spamd[2852]: spamd: connection from ::1 [::1]:51346 to port 783, fd 5
Jan 24 17:53:57 vxempire postfix/smtpd[3548]: disconnect from mail-lj1-f180.google.com[209.85.208.180] ehlo=2 starttls=1 mail=1 rcpt=1 data=1 quit=1 commands=7
Jan 24 17:53:57 vxempire spamd[2852]: spamd: setuid to spamd succeeded
Jan 24 17:53:57 vxempire spamd[2852]: spamd: processing message <CAFj-oU733e6ZP+zV8-e+9pFWwHg0oUxE_werUgBWfKGxQo64Bg@mail.gmail.com> for spamd:1014
Jan 24 17:54:12 vxempire spamd[2852]: spamd: identified spam (1000.2/4.0) for spamd:1014 in 15.2 seconds, 2863 bytes.
Jan 24 17:54:12 vxempire spamd[2852]: spamd: result: Y 1000 - DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,GTUBE,HTML_MESSAGE,TVD_SPACE_RATIO,T_SPF_HELO_TEMPERROR scantime=15.2,size=2863,user=spamd,uid=1014,required_score=4.0,rhost=::1,raddr=::1,rport=51346,mid=<CAFj-oU733e6ZP+zV8-e+9pFWwHg0oUxE_werUgBWfKGxQo64Bg@mail.gmail.com>,autolearn=no autolearn_force=no
Jan 24 17:54:12 vxempire postfix/pipe[3557]: B97561F840: to=<qorg@vxempire.xyz>, relay=spamassassin, delay=16, delays=0.25/0.03/0/15, dsn=2.0.0, status=sent (delivered via spamassassin service)
Jan 24 17:54:12 vxempire postfix/pickup[3186]: 3ED231F86B: uid=1014 from=<foo@gmail.com>
Jan 24 17:54:12 vxempire postfix/qmgr[3187]: B97561F840: removed
Jan 24 17:54:12 vxempire postfix/cleanup[3556]: 3ED231F86B: message-id=<CAFj-oU733e6ZP+zV8-e+9pFWwHg0oUxE_werUgBWfKGxQo64Bg@mail.gmail.com>
Jan 24 17:54:12 vxempire opendkim[644]: 3ED231F86B: no signing table match for 'foo@gmail.com'
Jan 24 17:54:12 vxempire opendkim[644]: 3ED231F86B: s=20161025 d=gmail.com SSL error:04091068:rsa routines:int_rsa_verify:bad signature
Jan 24 17:54:12 vxempire opendkim[644]: 3ED231F86B: bad signature data
Jan 24 17:54:12 vxempire postfix/qmgr[3187]: 3ED231F86B: from=<foo@gmail.com>, size=4009, nrcpt=1 (queue active)
Jan 24 17:54:12 vxempire postfix/local[3567]: 3ED231F86B: to=<qorg@vxempire.xyz>, relay=local, delay=0.2, delays=0.15/0.04/0/0.01, dsn=2.0.0, status=sent (delivered to maildir)
Jan 24 17:54:12 vxempire postfix/qmgr[3187]: 3ED231F86B: removed
Jan 24 17:54:12 vxempire spamd[2835]: prefork: child states: II

Is any configuration file wrong? If you need an extra configuration file, please ask for it Thanks for reading

doveconf -n: https://pastebin.com/EmTvBkfJ

  • Do you have any sieve rules that would put the spam into the Junk folder? – wurtel Jan 25 at 8:55
  • Yes, i have, i forgot to write it on there, but you can see it in this file /etc/dovecot/conf.d/90-plugin.conf – qorg11 Jan 25 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.