After updating my Debian Squeeze to latest stable packages from repository with standard:
# apt-get update && apt-get upgrade
I routinely checked, if afterwards all is fine with Qmail?, just to find out connect to port 25 was hell delayed about 40-50 seconds before qmail responds with standard assigned Mail Greeting.
I Googled long time to see if I can find a post or forum thread discussing, exact issue, but though I found similar discussions I didn't found anything that exactly match problem. Thus I decided to follow the good old experimental try / fail method to figure out what causes it.
elow is pastes from telnet, illustrating delays in Qmail SMTP greeting respond:
# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
I spend about 2 hours, checking Qmail for the standard so common errors, usually causing it to not work properly following my previous article testing qmail installation problems …
After going, through all of possible causes the only clue for problems, were some slowness with spamassassin. This brought me the idea that something is done wrong with spamassassin .I tried disabling, Spamassassin Razon and Pyzor restarting spamd through (in my case done not via the standard start/stop debian script) but through daemontools with svc and qmailctl i.e.:
# svc -d /service/spamd
This doesn't help, so I continued trying to figure out, what is wrong .One assumption for slow qmail-smtpd responce was of course slow DNS resolve issues. I checked /etc/resolv.conf to find out server is configured to use local configured DJBDNS server as first line DNS resolver. I used djbdns for it is simple and easy to configure, however it is a bit obsolete so it was possible bottleneck. After commenting line to use localhost 127.0.0.1
# svc -u /service/spamd
# svc -a /service/spamd
# qmailctl restart
* Stopping qmail-smtpdssl.
* Stopping qmail-smtpd.
* Sending qmail-send SIGTERM and restarting.
* Restarting qmail-smtpd.
* Restarting qmail-smtpdssl.
* Restarting qmail-pop3d.
and settings as primary DNS Google Public DNS 8.8.8.8, problem persisted so problems with hosts resolving was obviously not the problem.
I pondered for about 30 minutes, checking again all logs and checking machine processes. Just to remember before I experienced similar issues caused by unresolving RBL (blacklist IP) hosts. I checked configured SPF records in
(process list) and noticed following 4 hosts;
# ps auxwwf
7190 ? S 0:00 tcpserver -vR -l /var/qmail/control/me -c 30 -u 89 -g 89 -x /etc/tcp.smtp.cdb 0 25 rblsmtpd -t0 -r zen.spamhaus.org -r dnsbl.njabl.org -r dnsbl.sorbs.net -r bl.spamcop.net qmail-smtpd /var/qmail/control/me /home/vpopmail/bin/vchkpw /bin/true
I checked one by one hosts and find out 1st two hosts in line are no longer resolving (blacklist is no longer accessible) as before:
zen.spamhaus.org, dnsbl.njabl.org
DNSBL (DNS blocklist) is configured on this host via /service/qmail-smtpd/run, hence to remove two unresolvable hosts forcing the weird qmail-smtpd connect delay I had to modify in it:
RBL_BAD="zen.spamhaus.org dnsbl.njabl.org dnsbl.sorbs.net bl.spamcop.net"
to
RBL_BAD="dnsbl.sorbs.net bl.spamcop.net"
After a close examinations in mail server config /var/qmail/control/spfrules, found one other Unresolvable SPF Blacklist host configured ;
# cat /var/qmail/control/spfrules
include:spf.trusted-forwarder.org
To move that one I null-ed file:
# cat /dev/null > /var/qmail/control/spfrules
Finally to take affect all changes, launched Qmail start:
# qmailctl restart
Restarting qmail:
* Stopping qmail-smtpdssl.
* Stopping qmail-smtpd.
* Sending qmail-send SIGTERM and restarting.
* Restarting qmail-smtpd.
* Restarting qmail-smtpdssl.
* Restarting qmail-pop3d.
To check all was fine afterwards, again used telnet:
# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 This is Mail Pc-Freak.NET ESMTP
Mail greeting now appears in about 2-3 seconds time.
More helpful Articles

Tags: clue, daemontools, google, google public, mail, pop3d, public dns, qmail installation, razon, responce, slowness, SMTPD, spamd, squeeze, stable packages
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:26.0) Gecko/20100101 Firefox/26.0
Awesome !
View CommentView CommentThanks for this post 🙂
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36
One year later almost to the day, I am reinstalling the server and just bumped into your post again, forgetting I had used it before. I was about to send a thank-you message when I recognised my avatar !!!
Anyway, one year later, thanks again !
View CommentView Comment