Hello, I am looking for help with postfix. When i receive mail it is delivered to mail queue almost instantly but then it stays in mail queue for about 6 minutes till it is delivered to intended mailboxes. Calmv and greylisting is disabled, spamassasin is enabled but does not really catch spam, also flushing mail queue does nothing. What can be done to prevent mail from staying in the mail queue for such a long time. Postfix main.cf and master.cf below.
OpenVZ, VPS with Centos 7, and webmin/virtualmin installed.
Thank you!
/etc/postfix/main.cf (not including commented lines)
=======================================================================================================================================
queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
inet_interfaces = all
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost, hostname.com
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdro
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.10.1/samples
readme_directory = /usr/share/doc/postfix-2.10.1/README_FILES
virtual_alias_maps = hash:/etc/postfix/virtual
sender_bcc_maps = hash:/etc/postfix/bcc
sender_dependent_default_transport_maps = hash:/etc/postfix/dependent
mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME
home_mailbox = Maildir/
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination
smtp_tls_security_level = may
mailbox_size_limit = 0
allow_percent_hack = no
smtpd_tls_cert_file = /etc/postfix/postfix.cert.pem
smtpd_tls_key_file = /etc/postfix/postfix.key.pem
smtpd_tls_CAfile = /etc/postfix/postfix.ca.pem
smtpd_tls_security_level = may
smtpd_tls_mandatory_protocols = !SSLv2, !SSLv3
=======================================================================================================================================
/etc/postfix/master.cf (not including commented lines)
=======================================================================================================================================
smtp inet n - n - - smtpd -o smtpd_sasl_auth_enable=yes
smtps inet n - n - - 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=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
=======================================================================================================================================
Howdy,
When a message is "stuck" in the mail queue, there's often an error message of some sort associated with it... if you run "mailq", do you see any errors or warnings listed next to the message?
-Eric
Hello, Eric thanks for responding! Running "mailq" did not show any errors or warning just the normal info, messages just sat there for a long time, but i found these errors in maillog:
========================================================================================
spamc[4030]: connect to spamd on ::1 failed, retrying (#1 of 3): Connection refused
spamc[4030]: connect to spamd on 127.0.0.1 failed, retrying (#1 of 3): Connection timed out
spamc[4030]: connect to spamd on ::1 failed, retrying (#2 of 3): Connection refused
spamc[4030]: connect to spamd on 127.0.0.1 failed, retrying (#2 of 3): Connection timed out
spamc[4030]: connect to spamd on ::1 failed, retrying (#3 of 3): Connection refused
spamc[4030]: connect to spamd on 127.0.0.1 failed, retrying (#3 of 3): Connection timed out
spamc[4030]: connection attempt to spamd aborted after 3 retries
========================================================================================
So i googled a bit and found that i should create file - /etc/mail/spamassassin/spamc.conf with contents "-d 127.0.0.1" to force spamassassin to use ipv4 only i guess? This solution worked and mail is processed at acceptable speed. I really do not know why and how, but it worked.
But spamassassin still does not filter spam, no X-Spam entries in mail headers. Sorry for changing the question, but can you help me debug this problem or should i create new topic? Maillog does not show any records associated with spamd or spamc anymore, postfix config files have not changed either.
Thanks!
Edit:
So i found these entries in procmail.log:
========================================================================================
From "sender" Tue Jun 18 05:27:58 2019
Subject: Re: Tests
Folder:path/to/file some numbers
Time:1560850108 From: "sender" To: "receiver" User: "receiver's username" Size:6181 Dest: /path/to/file Mode:None
Timeout connecting to lookup-domain-daemon.pl
Line not terminated with a newline in /etc/mail/spamassassin/spamc.conf <------ fail created by me
procmail: Error while writing to "/bin/spamc"
procmail: Rescue of unfiltered data succeeded
========================================================================================
Howdy,
I see this error here:
Timeout connecting to lookup-domain-daemon.pl
I'm actually wondering if the problem with both this and SpamAssassin is that the services stopped running... if your server is a bit low on resources, the Linux kernel could have killed off the processes to keep the server alive.
You can restart the lookup-domain process with this command:
service lookup-domain restart