Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

how to defend my mailserver using by spammer to send email to etc yahoomail , gmail , etc

my mail server now blocked by gmail. already setting to block of all that but still attacked by spammers

below log mail:-

Jun 24 03:29:26 abcd sendmail[13373]: q5NHV7Jm001938: to=<>, ctladdr=<> (525/528), delay=02:58:10, xdelay=00:00:02, mailer=esmtp, pri=3212216, [], dsn=431, stat=Deferred: 452 Too many recipients

I really appreciate for the advice and assistance .

Edited for log mail :

Jun 24 03:29:06 abcd sendmail[13371]: q5NKT6s1013371: from='<>', size=2340, class=0, nrcpts=0,proto=ESMTP, daemon=MTA,
jun 24 03:29:06 abcd sendmail[13372]:q5NKT6wz013372: <>.. User unknown
Jun 24 03:29:06 abcd sendmail[13372]:q5NKT6wZ013372: from=<>, size=3324, class=0,nrcpts, proto=ESMTP, daemon=MTA,
jun 24 03:29:10 abcd sendmail[13373]: grew WorkList for /var/spool/mqueue to 2000
jun 24 03:29:12 abcd sendmail[13373]: grew Worklist for /var/spool/mqueue to 3000
jun 24 03:29:17 abcd sendmail[13375]:q5NKTFYr013375:<>... user unknown
jun 24 03:29:18 abcd sendmail[13375]: q5NKTFYr013375: from=<>, size=0, class=0, nrcpts=0, proto=SMTP, daemon=MTA, []
jun 24 03:29:19 abcd sendmail[13373]: q5NHU5sL001777: to=<>,<>,<>,<>,<>,ctladdr=<> (525/528), delay=02:59:06, xdelay=0 0:00:07, mailer=esmtp, pri=3212216, [], dsn=2.0.0, stat=sent (ok dirdel 4/1)

.. and etc ...

share|improve this question
You should have more in your logs than that. Search for q5NHV7Jm001938 and add all of it to your question. – Ladadadada Jun 28 '12 at 8:19
Is sendmail accessible to the outside world, is sendmail configured to relay all mail, or is relaying locked down? – EightBitTony Jun 28 '12 at 8:42
Dear Ladadadada & EigtBitTony , thankyou for your response , here I have edited the maillog , maybe these more explained – fike Jun 28 '12 at 9:48
up vote 1 down vote accepted

It seems as though this kind of spam that your server is sending is relayed through the web server that you run on the machine. Do you by any chance run a webmail interface like SquirrelMail? If so it is quite probable that at least one account is compromised and is used to send spam. In the case of SquirrelMail I would look at all the _*.conf_ files in the data/ directory where it keeps user specific configuration. I would:

grep -l *.pref

and then locate compromised accounts. For other webmail systems I would do similar searches. Also I would study in order to start erasing spams from the queue.

share|improve this answer
thx adamo , I am using a SquirrelMail, n then I am checking user pref , and nothing found .. – fike Jun 29 '12 at 4:27
By mistake I wrote *.conf in the grep command. It should have been *.pref. I corrected this in the answer above. – adamo Jun 29 '12 at 6:46
right , i have checked in any user pref , but still nothing found – fike Jul 2 '12 at 5:06
Start checking the contents for the .pref files for unusual content then. – adamo Jul 2 '12 at 7:15
Dear Adamo , I just caught, there is spam being sent through my email server. from authenticated user myuser)by with HTTP;Wed, 4 Jul 2012 14:47:39 . n then I cek the pref of myuser , the name changed to : . What I wonder when I chek to my email log there are a several connection to myuser , before they have connected and then relay to my email server through myuser autentication. What kind of spam that attack my mail server ? what should I do. – fike Jul 4 '12 at 10:15

There are 3 options. I'll list them in order of seriousness.

  • Your server is configured reasonably securely, but you're allowing known authenticated users to relay mail through this server from external addresses, and one or more user accounts have had their passwords compromised. You need to gain control of these accounts in the short term, and review if and how you allow authenticated users to use your service in the longer term.

  • Your server is configured in an insecure manner that allows anonymous email relaying. This is really bad, but trivial to fix.

  • Your server is hacked. This is the worst option. See Lucas' answer.

The answer to which one of these is your problem is contained in your logs.

share|improve this answer
Or #4. You're running a web service which sends smtp mail and the web service is being abused (or, some other hosted service which in turn sends smtp mail). – EightBitTony Jun 28 '12 at 9:47
Dear Dj & EigtBitTony , I have edited the maillog , If U see the spam starting with these : 'from=<>' , is there any corelation with it ? – fike Jun 28 '12 at 10:02

If your server is being used to send spam, then it probably got hacked or is set up insecure.

You will need to format the system and reinstall from scratch (if the former is true) AND secure it! So find out how they got in. If you are not able to do this on your own, I suggest getting a professional involved.

Refer to: My server's been hacked EMERGENCY

share|improve this answer
thank you for your response , now I am still figuring out whether my server has been hacked or something else – fike Jun 28 '12 at 9:59

I found the problem stems from my e-mail server vulnerabilities. So I moved to zimbra and activate all the features imaginable. And now I can sleep soundly.

share|improve this answer
I'm glad you feel on top of things now, but you have to be aware that security is a process, not something you just switch on and forget about. No matter what system you run, you need to make sure it's patched up to date in order to remain secure (and there's more to that than just turning on automatic updates and assuming all is well). Even if you go to a hosted email service, you need to make sure your users' passwords are secure or they can still be exploited to some degree. – RobM Nov 13 '12 at 16:59

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.