{"id":6067,"date":"2016-07-27T08:34:04","date_gmt":"2016-07-27T00:34:04","guid":{"rendered":"http:\/\/rmohan.com\/?p=6067"},"modified":"2016-07-27T08:36:34","modified_gmt":"2016-07-27T00:36:34","slug":"qmhandle-2","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=6067","title":{"rendered":"qmHandle"},"content":{"rendered":"<p>#compter les mails dans la liste d&#8217;attente<br \/>\n\/var\/qmail\/bin\/qmail-qstat<\/p>\n<p>#qmHandle lister les mails (l : liste, c : couleur)<br \/>\nqmHandle -l -c <\/p>\n<p>#stop qmail<br \/>\n\/etc\/init.d\/qmail stop<\/p>\n<p>#pour lister<br \/>\nqmail-remove -p @domainesuspect.com<\/p>\n<p>#pour lister et remove (l&#8217;ordre des param\u00e8tres compte)<br \/>\nqmail-remove -r -p @domainesuspect.com <\/p>\n<p>#start qmail<br \/>\n\/etc\/init.d\/qmail stop<\/p>\n<p>#forcer traitement de file d&#8217;attente<br \/>\nqmHandle -a #ne fontionne pas des masses<br \/>\n\/usr\/local\/psa\/admin\/bin\/mailqueuemng -a<\/p>\n<p>#modifier SMTPROUTES http:\/\/kb.parallels.com\/fr\/115531<br \/>\n\/etc\/init.d\/qmail stop<br \/>\nvi \/var\/qmail\/control\/smtproutes<\/p>\n<p>#saisir<br \/>\nmondomaine.fr:smtp.different.fr<br \/>\n#enregistrer avec :wq<\/p>\n<p>\/etc\/init.d\/qmail start<br \/>\n\/etc\/init.d\/xineted restart<\/p>\n<p>#Qmail spam prevention:<\/p>\n<p>Start Qmail<\/p>\n<p>    \/etc\/init.d\/qmail start<br \/>\n    \/etc\/init.d\/xinetd start<\/p>\n<p>Stop Qmail<\/p>\n<p>    \/etc\/init.d\/qmail stop<br \/>\n    \/etc\/init.d\/xinetd stop<\/p>\n<p>The server is overloaded with SPAM. There are many messages in queue. Mail is delivered slowly.<br \/>\nftp:\/\/download1.swsoft.com\/Plesk\/Plesk9.2\/Doc\/en-US\/plesk-9.0-unix-advanced-administration-guide\/index.htm?fileName=61674.htm<\/p>\n<p>Many email messages are sent from PHP scripts on the server. How can I find what domains these scripts are running on?<\/p>\n<p>[http:\/\/kb.swsoft.com\/article_22_1711_en.html](http:\/\/kb.swsoft.com\/article_22_1711_en.html)<\/p>\n<p>Qmail var log location<\/p>\n<p>    \/usr\/local\/psa\/var\/log\/maillog<\/p>\n<p>View the log in realtime<\/p>\n<p>    tail -f \/usr\/local\/psa\/var\/log\/maillog<\/p>\n<p>Check qmail que size<\/p>\n<p>    \/var\/qmail\/bin\/qmail-qstat<\/p>\n<p>###qmHandle<\/p>\n<p>Install qmhandle<\/p>\n<p>    wget http:\/\/jaist.dl.sourceforge.net\/sourceforge\/qmhandle\/qmhandle-1.3.2.tar.gz<br \/>\n    tar xvzf qmhandle-1.3.2.tar.gz<br \/>\n    chmod 777 qmhandle-1.3.2\/qmHandle<\/p>\n<p>Edit the file, uncomment the following lines, and comment out the default version<\/p>\n<p>    #my ($stopqmail) = &#8216;\/etc\/init.d\/qmail stop&#8217;;<br \/>\n    #my ($startqmail) = &#8216;\/etc\/init.d\/qmail start&#8217;;<\/p>\n<p>the move it to &#8220;`\/usr\/local\/sbin\/&#8220;`<\/p>\n<p>    mv qmhandle-1.3.2\/qmHandle \/usr\/local\/sbin\/qmHandle<\/p>\n<p>Show current queue stats:<\/p>\n<p>    qmHandle -s<\/p>\n<p>List messages in the mail queue:<\/p>\n<p>    qmHandle -l<\/p>\n<p>Get extended info about the Queue.<\/p>\n<p>    \/usr\/local\/sbin\/qmHandle -l -c<\/p>\n<p>List messages in the mail queue while counting how many have the same subject:<\/p>\n<p>    qmHandle -l|grep Subject|sort| uniq -c|sort -n<\/p>\n<p>List SMTP authorized senders from mail log and count how many emails they&#8217;ve sent:<\/p>\n<p>    cat \/usr\/local\/psa\/var\/log\/maillog |grep -I smtp_auth | grep -I &#8216;SMTP user&#8217; | awk &#8216;{print $8}&#8217; | sort |uniq -c |sort -n<\/p>\n<p>List IP Addresses that have failed SMTP authentication and count them<\/p>\n<p>    cat \/usr\/local\/psa\/var\/log\/maillog | grep -I smtp_auth | grep -I FAILED | awk &#8216;{print $13}&#8217; | sort | uniq -c | sort -n<\/p>\n<p>Read a message in the queue:<\/p>\n<p>    qmHandle -m123456789<\/p>\n<p>Delete a message based on subject:<\/p>\n<p>    qmHandle -S&#8217;failure notice&#8217;<br \/>\n    qmHandle -S&#8217;Order Tracking&#8217;<br \/>\n    qmHandle -S&#8217;Tracking Service&#8217;<br \/>\n    qmHandle -S&#8217;Shipping Detail&#8217;<br \/>\n    qmHandle -S&#8217;Order Detail&#8217;<br \/>\n    qmHandle -S&#8217;Shipping Info&#8217;<br \/>\n    qmHandle -S&#8217;Shipping Information&#8217;<br \/>\n    qmHandle -S&#8217;Order Shipped&#8217;<br \/>\n    qmHandle -S&#8217;Order Information&#8217;<br \/>\n    qmHandle -S&#8217;Shipping Service&#8217;<br \/>\n    qmHandle -S&#8217;Tracking Detail&#8217;<br \/>\n    qmHandle -S&#8217;Tracking Info&#8217;<br \/>\n    qmHandle -S&#8217;Tracking Information&#8217;<\/p>\n<p>Queue up several subjects for deletion<\/p>\n<p>    qmHandle -S&#8217;failure notice&#8217; ; qmHandle -S&#8217;Order Tracking&#8217; ; qmHandle -S&#8217;Tracking Service&#8217;<\/p>\n<p>Delete specific spam emails<\/p>\n<p>    qmHandle -H&#8217;smilesbymartin.com&#8217;<br \/>\n    qmHandle -H&#8217;federalwaydentist.net&#8217;<br \/>\n    qmHandle -H&#8217;bbjp.net&#8217;<br \/>\n    qmHandle -H&#8217;periozone.com&#8217;<\/p>\n<p>To delete the entire Queue (pretty slow if it&#8217;s huge)<\/p>\n<p>    qmHandle -D<\/p>\n<p>To delete the entire Queue as files then start qmail back up (probably faster)<\/p>\n<p>    service qmail stop &#038;&#038; find \/var\/qmail\/queue\/{mess,intd,local,remote,todo,info}\/ -type f -exec rm {} \\; &#038;&#038; service qmail start<\/p>\n<p>For looking at the queue to see if any more obvious crap addresses.<\/p>\n<p>    \/var\/qmail\/bin\/qmail-qread | less<\/p>\n<p>###Find incoming vector<\/p>\n<p>should help you find some results of which account(s) are being used.<br \/>\n&#8220;`cat \/usr\/local\/psa\/var\/log\/maillog | grep &#8220;smtp_auth&#8221;&#8220;`<br \/>\n&#8220;`cat \/usr\/local\/psa\/var\/log\/maillog | grep &#8220;spammer\u2019s IP&#8221;&#8220;`<br \/>\n&#8220;`cat \/usr\/local\/psa\/var\/log\/maillog | grep &#8220;202.64.64.68&#8221;&#8220;`<\/p>\n<p>### completely rebuild all mail boxes on server (use with caution, and be patient)<\/p>\n<p>[Plesk article for command](http:\/\/kb.parallels.com\/en\/944)<\/p>\n<p>    \/usr\/local\/psa\/admin\/sbin\/mchk &#8211;without-spam<\/p>\n<p>### See actively running scripts<\/p>\n<p>    lsof +r 1 -p `ps axww | grep httpd | grep -v grep | awk &#8216; { if(!str) { str=$1 } else { str=str&#8221;,&#8221;$1}}END{print str}&#8217;` | grep vhosts | grep php<\/p>\n<p>### Turn off email for a domain in Plesk<\/p>\n<p>    \/usr\/local\/psa\/bin\/mail &#8211;off roadsidemultimedia.com<\/p>\n<p>### Block an IP Address<\/p>\n<p>    sudo iptables -I INPUT -s 88.2.145.216 -j DROP<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#compter les mails dans la liste d&#8217;attente \/var\/qmail\/bin\/qmail-qstat<\/p>\n<p>#qmHandle lister les mails (l : liste, c : couleur) qmHandle -l -c <\/p>\n<p>#stop qmail \/etc\/init.d\/qmail stop<\/p>\n<p>#pour lister qmail-remove -p @domainesuspect.com<\/p>\n<p>#pour lister et remove (l&#8217;ordre des param\u00e8tres compte) qmail-remove -r -p @domainesuspect.com <\/p>\n<p>#start qmail \/etc\/init.d\/qmail stop<\/p>\n<p>#forcer traitement de file d&#8217;attente qmHandle -a [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6067"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6067"}],"version-history":[{"count":2,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6067\/revisions"}],"predecessor-version":[{"id":6073,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/6067\/revisions\/6073"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6067"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6067"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6067"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}