Symptoms

During the test, mail is bounced back with the following error:

`Delivery to the following recipient failed permanently: test@domain.com`
`Technical details of permanent failure: PERM\_FAILURE: SMTP Error (state 13): 554 mail server permanently rejected message (#5.3.0)`

Or you see this error in the maillog:

`warning: trouble injecting bounce message, will try later`

Cause

Wrong permissions on qmail-queue files.

Resolution

Connect to the affected qmail node and find where Qmail quota files are stored and check what permissions have files, for example:

# ll /usr/local/qmail/bin/
...
-r-xr-x--- 1 mailnames qmail  65K Mar 21  2017 checkquota
-rwx--x--x 1 qmailq    qmail  39K Mar 21  2017 qmail-queue
-r-xr-x--- 1 mailnames qmail  64K Mar 21  2017 setquota
-rwx--x--x 1 drweb     qmail 196K Apr  4  2017 qmail-queue.override

... Additionally the following files could be presented: ... -r-xr-xr-x 1 root qmail 158268 Sep 13 2004 /var/qmail/bin/qmail-queue.drweb -r-xr-xr-x 1 root qmail 12044 Aug 17 13:57 /var/qmail/bin/qmail-queue.origin ...

The following files should have SUIDs set. Backup following files to the another directory:

# mkdir backup_queue
# cp /usr/local/qmail/bin/{checkquota,qmail-queue,setquota,qmail-queue.override} backup_queue/

Add +s permissions:

# chmod +s /usr/local/qmail/bin/{checkquota,qmail-queue,setquota,qmail-queue.override}

And check:

# ll
...
-r-sr-s--- 1 mailnames qmail  65K Mar 21  2017 checkquota
-rws--s--x 1 qmailq    qmail  39K Mar 21  2017 qmail-queue
-rws--x--x 1 drweb     qmail 196K Apr  4  2017 qmail-queue.override
-r-sr-s--- 1 mailnames qmail  64K Mar 21  2017 setquota
...

You can check sending e-mail using comman-line:

# telnet localhost 25
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 mail.pa.internl.net ESMTP
EHLO localhost
250-mail.pa.internl.net
250-STARTTLS
250-AUTH LOGIN PLAIN
250-AUTH=LOGIN PLAIN
250-PIPELINING
250 8BITMIME
MAIL FROM: test@test.com
250 ok
RCPT TO: name@domain.tld
250 ok
DATA
354 go ahead
test mail2
.
**250 ok 1508959404 qp 12669**
quit
221 mail.pa.internl.net
Connection closed by foreign host.

Internal content