//
you're reading...
Tips'n'Tricks, UNIX/Linux

Qmail open relay

Hey there. This is my first post. Here I will describe what meassures I took to close the relay on a friends qmail.

First of all, my friend aproached me and told me he had trouble sending mail anywhere but locally, so I logged into his server (knowing your friend’s password and root password is really an advantage), and checked out the qmail logs :

I ran the following commands:

tail -f /var/log/qmail/current /var/log/qmail/qmail-smtpd/current

It was pretty obvious to me that this server was being used by more Chinese people than the subway of Beijing (Trust me, I lived there for five month)

Confronting my friend with this he admitted that he had received a notice about being in some sort of spam-list. Well, that figures, doesn’t it?

So I shut down the qmail smtpd server:

qmailctl stop

I quickly discovered that the source of our problem was a missing rcpthosts file, only deleted because he thought it blocked him from sending mail. He had made a backup copy, so I recreated it:

mv rcpthosts.bak rcpthosts

After restarting the server, I found out that thousands of mails were still in the queue. Not wanting to send them out, which is the normail procedure for emptying the queue, I had to delete them manually:

cd /var/qmail/queue
mv remote remote.old
mkdir remote
chown qmails:qmail remote

Now a quick restart of qmail and our troubles were over:

qmailctl start

Discussion

3 thoughts on “Qmail open relay

  1. What is Qmail?

    Posted by Qwerty Maniac | April 11, 2006, 3:43 pm
  2. Qmail is an open source mail transfer agent with pop3 and smtp and much more. In plain English, a piece of software that moves an email either from your inbox to the rest of the world or from the rest of the world to your inbox.
    An open relay is when everyone can send emails to anyone. How is that bad? Well, ten years ago it wasn’t, but along came spam, and now thousands of emails are sent every seconds from other people’s mail servers without them knowing it.

    Posted by eising | April 12, 2006, 6:35 am
  3. Hi eising,
    I have a problem.
    I use qmail for mail server. I set my tcp.smtp like this:
    127.:allow,RELAYCLIENT=””

    But, when someone send email for my mail server by telnet, he can do it. Like this:

    # telnet mail.example.com 25
    Trying 202.129.190.203…
    Connected to mail.example.com (123.45.67.89).
    Escape character is ‘^]’.
    220 example.com ESMTP

    I think it’s dangerous for my mail server because may be someone can send spam or anything else for my mail server and i think it is an open relay. I follow your instruction but the telnet still works. would you please help me how to solve this problem? I mean how to stop sending email by telnet.

    Thank you for your answer.

    Posted by arfie | June 30, 2010, 4:42 am

Leave a comment