Jan 23

ช่วงนี้เจอ spammer พยายามส่งเมล์ผ่าน POST ของระบบบ่อยมาก จำเป็นต้องหาวิธีแก้ด่วย ซึ่งแรกๆ ก็ block ด้วย class ของ IP เช่น

deny from xx.0.0.0/8
deny from xx.xx.0.0/16

แต่ก็ยังไม่พอ พบว่าก็ยังมีเข้ามาได้อีก
ก็เลยใช้วิธีที่ block การใช้งาน เฉพาะ User-Agent นั้นๆ โดยเฉพาะ เพราะส่วนใหญ่จะมาคล้ายๆ กัน

SetEnvIfNoCase User-Agent "^xxxxxxxxx" banned
SetEnvIfNoCase User-Agent "xxxxxxxxx" banned

deny from env=banned

แต่ก่อนที่จะใช้ ข้างต้น ต้องสามารถใช้งาน setenvif ก่อนด้วยนะครับ

อ้างถึง

  • http://www.askapache.com/htaccess/fight-blog-spam-with-apache.html
  • http://www.webmasterworld.com/apache/3234357.htm
  • http://www.joomla-downloads.de/forum/profile/showposts/jackdaniels-1514/

written by Mr-San \\ tags: , , , ,

Dec 12

I have fix some problem with my mail server when mail detected with spam in anti-spam gateway, I don’t need to scan again and don’t want to set that ip to RELAYCLIENT in tcp.smtp

With tcp.smtp
x.x.x.x is ip can relay with your mail server and not scan with spamassassin
x.x.x.x:allow,RELAYCLIENT=""

Other case if you want scan with spamassassin you can set with
x.x.x.x:allow,RELAYCLIENT="",QS_SPAMASSASSIN="yes"

But in this case I use
x.x.x.x:allow,BYPASS_SPAMASSASSIN=”on”

And insert this code in /var/qmail/bin/qmail-scanner-queue.pl
if (defined($ENV{'BYPASS_SPAMASSASSIN'})) {
&debug("spamassassin: don't scan as BYPASS_SPAMASSASSIN");
&minidebug("SA: don't scan as BYPASS_SPAMASSASSIN") if (!$scanned);
return;
}

at line 3349 in spamassassin function
and line 3450 in spamassassin_alt function

Don’t forget to rebuid tcp.smtp and make backup with qmail-scanner-queue.pl

written by Mr-San \\ tags: , , ,