Need help?

June 26, 2022 Roberto Puzzanghera 13 comments

This short guide helped a number of people, also newbies in some cases, to successfully install a mail server based on qmail.

In case the informations published here are not sufficiently clear and exhaustive, if you want to address me a comment, an hint or a criticism, don't hesitate to post a comment or to contact me via email!

Anyway, if you don't want to take the trouble to read all the documentation and do it by yourself, because you don't have the time, or you need help concerning the qmail world or even if you want to migrate qmail/vpopmail to postfix and you don't know how to do it, I can offer a consulting service.

Comments

qmail-smtpd: read failed (hang up before quit cmd)

I get hundrets of errors like in the subject:

2021-03-08 12:00:40.257530500 policy_check: remote someone@somedomain.tld -> local user@lokaldomain.com (UNAUTHENTICATED SENDER)
2021-03-08 12:00:40.257532500 qlogenvelope: result=accepted code=250 reason=rcptto detail=chkuser helo=utm.mydomain.com mailfrom=someone@somedomain.tld rcptto=user@lokaldomain.com relay=no rcpthosts=yes size= authuser= authtype= encrypted= sslverified=no localip=xxx.xxx.xxx.xxx localport=25 remoteip=yyy.yyy.yyy.yyy remoteport=57288 remotehost= qp= pid=61565
2021-03-08 12:00:40.257926500 qmail-smtpd: read failed (hang up before quit cmd): someone@somedomain.tld from yyy.yyy.yyy.yyy to edmund.vankann@gut-ev.de helo utm.mydomain.com
2021-03-08 12:00:40.258775500 CHKUSER accepted rcpt: from <someone@somedomain.tld|remoteinfo/auth:|chkuser-identify:> remote <helo:utm.mydomain.com|remotehostname:unknown|remotehostip:yyy.yyy.yyy.yyy> rcpt <user@lokaldomain.com> : found existing recipient
2021-03-08 12:00:40.258778500 policy_check: remote someone@somedomain.tld -> local user@lokaldomain.com (UNAUTHENTICATED SENDER)
2021-03-08 12:00:40.258780500 qlogenvelope: result=accepted code=250 reason=rcptto detail=chkuser helo=utm.mydomain.com mailfrom=someone@somedomain.tld rcptto=user@lokaldomain.com relay=no rcpthosts=yes size= authuser= authtype= encrypted= sslverified=no localip=xxx.xxx.xxx.xxx localport=25 remoteip=yyy.yyy.yyy.yyy remoteport=57284 remotehost= qp= pid=61564
2021-03-08 12:00:40.259192500 qmail-smtpd: read failed (hang up before quit cmd): someone@somedomain.tld from yyy.yyy.yyy.yyy to user@lokaldomain.com helo utm.mydomain.com
2021-03-08 12:00:40.260162500 qmail-smtpd: read failed (hang up before quit cmd): someone@somedomain.tld from yyy.yyy.yyy.yyy to user@lokaldomain.com helo utm.mydomain.comMX-Record in DNS points to IP yyy.yyy.yyy.yyy, a UTM (securepoint), which acts as kind of a mailrelay and which performs checks like SPF, GreetDelay, Virusscanning etc. and mailfiltering based on local rules on the UTM.

One of the checks is to ask qmail server xxx.xxx.xxx.xxx via smtp if the mailbox (here: user@localdomain.com) exists, and if so and all checks are passed, the mail is delivered to qmail via smtp.

So, whats in the log is the communication between UTM (yyy.yyy.yyy.yyy) and qmail (xxx.xxx.xxx.xxx)

There are a lot of lines with "read failed" in the send-log and the mail isn't delivered to the mailbox. I searched the net for this error, but can't find anything.

I'm running other qmail-servers (rather old ones, based on Bill's Linux Qmail Toaster v 0.9.4), there are no such problems; communication between UTM and qmailservers is the same for all servers.

Any idea?

Reply | Permalink

qmail-smtpd: read failed (hang up before quit cmd)

Times ago I did a check and realized that messages from these IPs are regularly delivered. I think they violate the smtp protocol in some way (they close the connection before the final quit).

I don't think this is an error of your MTA and it wouldn't even logged in vanilla qmail

Reply | Permalink

bounce queue too long

I got this bounce:

<user@domain.com>:
CNAME lookup failed temporarily. (#4.4.3)
I'm not going to try again; this message has been in the queue too long.

any idea?

Reply | Permalink

bounce queue too long

DNS records are wrong or not set up correctly or inaccessible, or your server is trying to retrieve ANY dns records, which produces a very large response from the DNS that may overflow your response buffer. In this case the any-to-cname patch would help. Are you using my combined patch?

Reply | Permalink

DKIM on Qmail

Hi,

I have qmail running on CentOS 7.x. It was installed per Life With Qmail. It is working fine.

I need to add DKIM.

I assumed that I could simply add the dkim-netqmail-1.06 patch on top of the patches I initially added (qmail-1.03.errno.patch
qmail-1.03.qmail_local.patch
qmail-0.0.0.0.patch
qmail-1.03.qmtpd-netstring.patch
qmail-103.patch)

When I did that I got the following errors:

Hunk #2 FAILED at 18.
Hunk #3 FAILED at 42.
Hunk #4 FAILED at 63.
3 out of 4 hunks FAILED -- saving rejects to file dns.c.rej

Hunk #1 FAILED at 23.
Hunk #2 succeeded at 35 (offset -11 lines).
Hunk #3 succeeded at 83 (offset -11 lines).
Hunk #4 succeeded at 109 (offset -11 lines).
Hunk #5 succeeded at 129 (offset -11 lines).
1 out of 5 hunks FAILED -- saving rejects to file qmail.c.rej

Hunk #3 FAILED at 73.
Hunk #5 succeeded at 171 with fuzz 2.
1 out of 8 hunks FAILED -- saving rejects to file qmail-pop3d.c.rej

Hunk #3 FAILED at 66.
1 out of 4 hunks FAILED -- saving rejects to file qmail-popup.c.rej

I went ahead and ran make, and got this:

make
( cat warn-auto.sh; \
echo CC=\'`head -1 conf-cc`\'; \
echo LD=\'`head -1 conf-ld`\' \
) > auto-ccld.sh
cat auto-ccld.sh make-load.sh > make-load
chmod 755 make-load
cat auto-ccld.sh find-systype.sh > find-systype
chmod 755 find-systype
./find-systype > systype
( cat warn-auto.sh; ./make-load "`cat systype`" ) > load
chmod 755 load
cat auto-ccld.sh make-compile.sh > make-compile
chmod 755 make-compile
( cat warn-auto.sh; ./make-compile "`cat systype`" ) > \
compile
chmod 755 compile
( ( ./compile tryvfork.c && ./load tryvfork ) >/dev/null \
2>&1 \
&& cat fork.h2 || cat fork.h1 ) > fork.h
rm -f tryvfork.o tryvfork
./compile qmail-local.c
./compile qmail.c
qmail.c: In function ‘qmail_open’:
qmail.c:38:13: error: ‘pic’ undeclared (first use in this function)
qq->fdc = pic[0]; close(pic[1]);
^
qmail.c:38:13: note: each undeclared identifier is reported only once for each function it appears in
make: *** [qmail.o] Error 1

Clearly I am not doing something correctly. Do I need to simply start over? Eliminate one or more of the other patches? Something else?

I am grateful for any ideas.

Thorpe

Reply | Permalink

DKIM on Qmail

Hi, the DKIM patch is intended to be applied over a fresh netqmail. In this case, before compiling, you have to open those .rej files, look what went wrong during the patch process and then manually correct the source.

Edit: Perhaps it could be easier to apply DKIM firstly, and then add all the other extra patches not included already in netqmail

Reply | Permalink

DKIM on Qmail

Hi Roberto,

Thank you for the reply and insights. 

I have DKIM working, which turned out to be simpler than I was making it. 

Thank you.

Thorpe

Reply | Permalink

Qmail Alias

Hello,

i installed qmail with your tutorial and everything ist working fine exept of the aliases.

I want that when i write an Email to an adress that qmail triggers a script which i run with an command in the alias:

|/path/to/the/script/script.sh&

But that doesn't work. Can you help me?

kind regards

Tim

Reply | Permalink

Qmail Alias

Hi, I suppose you are inserting that line in your .qmail files... what error do you get?

Reply | Permalink

Adding qmail to supervisord

Hi,

I am trying to dockerize qmail.

Installling daemontools kills the container(send sig hup 1 which kills init script) + it tries to change innittab. I tried commenting out that part. Compiled qmail and related services + patch. But. now I am having issue adding this to supervirsord.I tried adding all running services related to qmail from a working installation but looks I am doing this wrong:

----

018-05-26 15:31:09,785 INFO exited: qmail-pop3d (exit status 126; not expected) 2018-05-26 15:31:09,786 INFO exited: tcpserver-smtpd (exit status 111; not expected) 2018-05-26 15:31:09,787 INFO exited: qmail-smtpd (exit status 126; not expected)

--

I am getting this for al except svscan and svscanboot.

Reply | Permalink

Adding qmail to supervisord

Sorry, I'm not familiar with supervisord

Reply | Permalink

mail not delivered in mailbox follow up

after looking in my send log i see failure:

Sorry,_no_mailbox_here_by_that_name._(#5.1.1)/ 

but the mailbox is there.

it looks like it can not find my mailbox what could be wrong in the configuration.

Reply | Permalink

mail not delivered in mailbox follow up

Hi, you should provide more details... at least the complete qmail-send log

Are you strictly following my guide? Which lda are you using? dovecot or vpopmail?

And since I received a lot of messages about the missing log@domain mailbox, sorry if I ask, but are you sure that the missing mailbox is the recipient and not the log@yourdomain?

Reply | Permalink