{"id":23,"date":"2010-02-01T14:46:19","date_gmt":"2010-02-01T13:46:19","guid":{"rendered":"http:\/\/toderu.ro\/blog\/?p=23"},"modified":"2010-02-01T14:46:19","modified_gmt":"2010-02-01T13:46:19","slug":"plesk-the-server-is-saturated-with-spam","status":"publish","type":"post","link":"https:\/\/kb.toderu.ro\/?p=23","title":{"rendered":"plesk \u2013 The server is saturated with SPAM"},"content":{"rendered":"<p>\t\t\t\tThe server is saturated with SPAM. There are many messages in the queue. The mail is sent slowly.<br \/>\nArticle ID: 766<br \/>\nLast Review: Mar,16 2009<br \/>\nAuthor: Daria Taranova<br \/>\nLast updated by: Daria Taranova APPLIES TO:<\/p>\n<p>    * Plesk 7.5.x Reloaded<br \/>\n    * Plesk 9.x for Linux\/Unix<br \/>\n    * Plesk 8.x for Linux\/Unix<\/p>\n<p>Resolution<br \/>\nFirst check that all domains have the option &#8216;Mail to non-existing user&#8217; set to &#8216;reject&#8217; but not to &#8216;forward&#8217;. You can<br \/>\nchange this setting to all domains using &#8220;Group Operations&#8221; in the &#8220;Domains&#8221; tab in Parallels Plesk Control Panel. The<br \/>\noption &#8220;Reject mail to nonexistent user&#8221; is available since Parallels Plesk Panel 7.5.3.<\/p>\n<p>Also, please, check that all the IPs and networks in the white lists are reliable and familiar to you.<\/p>\n<p>Check how many messages are in the queue with Qmail:<\/p>\n<p><code># \/var\/qmail\/bin\/qmail-qstat<br \/>\nmessages in queue: 27645<br \/>\nmessages in queue but not yet preprocessed: 82<\/code><\/p>\n<p>If the queue has too many messages, try to discover the source of SPAM.<\/p>\n<p>If mail is being sent by an authorized user but not from the PHP script, you can run the command below to find the user<br \/>\nthat has sent the most messages (available since Plesk 8.x). Note that you must have the &#8216;SMTP authorization&#8217; activated<br \/>\non the server to see these records:<\/p>\n<p><code># cat \/usr\/local\/psa\/var\/log\/maillog |grep -I smtp_auth |grep -I user |awk '{print $11}' |sort |uniq -c |sort -n<\/code><\/p>\n<p>The path to &#8216;maillog&#8217; may differ depending on the OS you are using.<\/p>\n<p>The next step is to use is &#8220;qmail-qread&#8221;, which can be used to read the message headers:<\/p>\n<p><code># \/var\/qmail\/bin\/qmail-qread<br \/>\n18 Jul 2005 15:03:07 GMT #2996948 9073 <user@domain.com> bouncing<br \/>\ndone remote user1@domain1.com<br \/>\ndone remote user2@domain2.com<br \/>\ndone remote user3@domain3.com<br \/>\n....<\/code><\/p>\n<p>This shows the senders and recipients of messages. If the message contains too many recipients, probably this is spam.<br \/>\nNow try to find this message in the queue by its ID ( # 2996948 in our example):<\/p>\n<p><code># find \/var\/qmail\/queue\/mess\/ -name 2996948<\/code><\/p>\n<p>Examine the message and find the line &#8220;Received&#8221; to find out from where it was sent for the first time, for example, if<br \/>\nyou find:<\/p>\n<p><code>Received: (qmail 19514 invoked by uid 10003); 13 Sep 2005 17:48:22 +0700<\/code><\/p>\n<p>it means that this message was sent via a CGI by user with UID 10003. Using this UID it is possible to find the domain:<\/p>\n<p><code># grep 10003 \/etc\/passwd<\/code><\/p>\n<p>If the &#8216;Received&#8217; line contains a UID of a user &#8216;apache&#8217; (for example invoked by uid 48) &#8211; it means that spam was sent<br \/>\nthrough a PHP script. In this case, you can try to find the spammer using information from spam email (address from\/to<br \/>\nor any other information). It is usually very difficult to discover the source of SPAM. If you are absolutely sure that<br \/>\nthis time there is a script which sends SPAM (tail grows rapidly for no apparent reason), you can use the following<br \/>\nscript to know what PHP scripts are running at this time:<\/p>\n<p><code># lsof +r 1 -p `ps axww | grep httpd | grep -v grep | awk ' { if(!str) { str=$1 } else { str=str\",\"$1}}END{print str}'`<br \/>\n| grep vhosts | grep php<\/code><\/p>\n<p>You can also apply KB article which describes the procedure of discovering which domains are sending mail through PHP<br \/>\nscripts.<\/p>\n<p>Lines in Received section like<\/p>\n<p><code>Received: (qmail 19622 invoked from network); 13 Sep 2005 17:52:36 +0700<br \/>\nReceived: from external_domain.com (192.168.0.1)<\/code><\/p>\n<p>mean that the message has been accepted and delivered via SMTP, and that the sender is an authorized mail user.\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The server is saturated with SPAM. There are many messages in the queue. The mail is sent slowly. Article ID: 766 Last Review: Mar,16 2009 Author: Daria Taranova Last updated by: Daria Taranova APPLIES TO: * Plesk 7.5.x Reloaded * Plesk 9.x for Linux\/Unix * Plesk 8.x for Linux\/Unix Resolution First check that all domains [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,11],"tags":[],"class_list":["post-23","post","type-post","status-publish","format-standard","hentry","category-linux","category-plesk"],"_links":{"self":[{"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/posts\/23","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=23"}],"version-history":[{"count":0,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=\/wp\/v2\/posts\/23\/revisions"}],"wp:attachment":[{"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=23"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=23"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kb.toderu.ro\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=23"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}