Jul 15

This post is password protected. To view it please enter your password below:


Tagged with:
May 17

วันนี้นั่งเล่น maildrop มา ก็เลยหยิบมาแบ่งปันกันให้คนอื่นได้ใช้นะครับ
อันนี้เป็นไฟล์ mailfilter ซึ่งอยู่ใน /var/vpopmail/domains/example.net/

[code lang='bash']
SHELL="/bin/sh"
import EXT
import HOST
VPOP="| /var/vpopmail/bin/vdelivermail '' bounce-no-mailbox"
VHOME=`/var/vpopmail/bin/vuserinfo -d $EXT@$HOST`

#logfile "/var/log/maildrop.log"
log "=== BEGIN maildrop processing for $EXT@$HOST ==="

if ( $VHOME eq "" )
{
#log " ERROR: VHOME isn't set, falling back to vdelivermail"
#log "=== EXIT === "
to "$VPOP"
}

# make special folder
`test -d $VHOME/Maildir/.Spam`
if( $RETURNCODE == 1 )
{
log " INFO: Make .Spam directory"
`/usr/local/bin/maildirmake -f Spam $VHOME/Maildir`
}
`test -d $VHOME/Maildir/.Drafts`
if( $RETURNCODE == 1 )
{
log " INFO: Make .Drafts directory"
`/usr/local/bin/maildirmake -f Drafts $VHOME/Maildir`
}
`test -d $VHOME/Maildir/.Sent`
if( $RETURNCODE == 1 )
{
log " INFO: Make .Sent directory"
`/usr/local/bin/maildirmake -f Sent $VHOME/Maildir`
}
`test -d $VHOME/Maildir/.Trash`
if( $RETURNCODE == 1 )
{
log " INFO: Make .Trash directory"
`/usr/local/bin/maildirmake -f Trash $VHOME/Maildir`
}

# try filtering it using user-defined rules
`test -r $VHOME/.mailfilter`
if( $RETURNCODE == 0 )
{
#log " INFO: including $VHOME/.mailfilter"
exception {
include $VHOME/.mailfilter
}
}

if (/^X-Spam-Status: *Yes/)
{
# then try delivering it to a Spam folder
exception {
# to "$VPOP"
to "$VHOME/Maildir/.Spam/"
}
# ah well, I guess they'll just have to live with disappointment
exception {
to "$VPOP"
}
}
else
{
exception {
#log " INFO: message is clean"
to "$VPOP"
}
}
[/code]

ต่อจากนั้นแก้ไข /var/vpopmail/domains/example.net/.qmail-default
[code lang='bash']#| /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox
| /usr/local/bin/maildrop /home/vpopmail/domains/example.net/mailfilter[/code]

เป็นอันเสร็จพิธี ใครจะ debug ก็ uncomment logfile ด้วยนะ

อ้างอิง

Tagged with:
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

Tagged with:
Oct 06

เฮ้อ ในที่สรุปการติดตั้งเครื่อง ที่ให้บริการ สำหรับ ระบบ Mail Server ก็สำเร็จเสร็จไปด้วยดี ก็เท่ากับว่าจะมีแหล่งอ้างอิงให้ได้เก็บเป็นข้อมูล
ต่อไปก็คงต้องทำ howto อื่นๆ อีกมากมาย แต่ถ้าเป็นเครื่องให้บริการจริงๆ คงไม่สามารถนำขึ้นมาแสดงให้อ่านได้นะครับ

แต่ว่า ข้อมูลต่างๆ ที่ได้จัดทำขึ้นมานี้ จะ นำไปเป็น Course Training : Mail Server คราวต่อไป (version พัฒนา)
แล้วหลังจาก ลอง เล่น qmail-ldap แล้วจะเอามานำเสนอให้อ่านละกันครับ
ว่าไปแล้วก็ยังมีอีกหลายตัวนะที่ยังไม่ได้จัดทำขึ้นมา

อ้างอิงข้อมูลที่ได้จัดทำขึ้นมานี่ก็ตามนี้เลย เป็น Version: 1.8.1

ช่วงนี้ มีงานหลายอย่างเข้ามาให้เล่น Wiki, Cluster, Load Balance ที่จำเป็นต้องรีบอ่านรีบทำ เพื่อระบบที่มี stability มากที่สุด

Tagged with:
Aug 07

อันดับแรก ต้อง stop qmail ก่อน ด้วย
qmailctl stop
หรืออาจจะเป็นคำสั่งอื่น

แล้วต่อจากนั้นก็ทำการลบ queue

cd /var/mail/queue
find mess info local intd todo remote bounce -type f -print |xargs rm

อย่าลืม start qmail หลังจากทำการลบเสร็จ
qmailctl start

Tagged with:
preload preload preload