| 導購 | 订阅 | 在线投稿
分享
 
 
 

FreeBSD下Qmail安裝

來源:互聯網  2008-05-31 00:05:00  評論

[PHP]ucspi-tcp

cd /usr/ports/sysutils/ucspi-tcp

make install clean

daemontools

cd /usr/ports/sysutils/daemontools

make install clean

mkdir /var/service

chmod 755 /var/service

ee /etc/rc.conf

svscan_enable="YES"[/PHP]

reboot

驗證daemontools已經正常運行:

[PHP]ps ax | grep svscan[/PHP]

[PHP]cd /usr/ports/mail/qmail

make BARRIER_BIG_TODO_PATCH=yes WITH_QMAILQUEUE_PATCH=yes BARRIER_BIG_CONCURRENCY_PATCH=yes WITH_LOCALTIME_PATCH=yes WITH_QMTPC_PATCH=yes WITH_MAILDIRQUOTA_PATCH=yes WITH_BLOCKEXEC_PATCH=yes WITH_DISCBOUNCES_PATCH=yes WITH_SPF_PATCH=yes install clean

/var/qmail/scripts/enable-qmail

cd /var/qmail/configure

./config-fast domail.com[/PHP]

打auth smtp補丁

[PHP]tar zxvf qmail-1.03.tar.gz

tar zxvf qmail-smtpd-auth-0.31.tar.gz

cp qmail-smtpd-auth-0.31/base64.* qmail-1.03

patch -d qmail-1.03

cd qmail-1.03

fetch http://gadfly.shanji.com/qmail-smtpd/qmail-smtpd.c

fetch http://gadfly.shanji.com/qmail-smtpd/qmail-smtpd.patch

patch -p1

patch -p1

patch -p1

patch -p1

patch -p1

patch -p1

patch -p1

patch -p1

patch -p1

patch

ee qmail-smtpd.c[/PHP]

[PHP]將函數straynewline中的451改爲553(// 當你的服務器收到無效格式的郵件時,會發送:"I am not going to accept that message at the moment,you can try again later",對方服務器收到後,幾秒鍾後又會發送同樣的郵件給你,造成多次的重複。改爲553後,你的服務器將直接發送:"I am not going to accept that message,don't try sending it again.",告訴對方的服務器不要再發這封無效的信件。)

void die_alarm() { out("451 超時. (#4.4.2)\r\n"); flush(); _exit(1); }

void die_nomem() { out("421 內存溢出. (#4.3.0)\r\n"); flush(); _exit(1); }

void die_control() { out("421 無法讀取控制文件. (#4.3.0)\r\n"); flush(); _exit(1); }

void die_ipme() { out("421 無法判斷發信IP地址. (#4.3.0)\r\n"); flush(); _exit(1); }

void straynewline() { out("451 如有疑問請發郵件到: xiwu518@163.com\r\n"); flush(); _exit(1); }

void err_bmf() { out("553 對不起您的郵件地址在我的黑名單裏. (#5.7.1)\r\n"); }

void err_nogateway() { out("553 對不起,您所發送的郵件不在服務器允許的範圍內. (#5.7.1)\r\n"); }

void err_unimpl() { out("502 命令執行失敗. (#5.5.1)\r\n"); }

void err_syntax() { out("555 語法錯誤. (#5.5.4)\r\n"); }

out("214 WelCome To: http://www.domail.com\r\n");

out("354 繼續.\r\n");

if (databytes) if (!bytestooverflow) { out("552 對不起,郵件大小超出服務器允許接受的範圍. (#5.3.4)\r\n"); return; }[/PHP]

[PHP]make qmail-smtpd

cd /var/qmail/bin

mv qmail-smtpd qmail-smtpd.auth

cd -

cp qmail-smtpd /var/qmail/bin/qmail-smtpd

mkdir /var/log/qmail

cd /var/log/qmail

mkdir qmail-send qmail-smtpd qmail-pop3d

chown -R qmaill:wheel /var/log/qmail

chmod -R 750 /var/log/qmail

mkdir /var/qmail/supervise

cd /var/qmail/supervise

mkdir -p qmail-smtpd/log qmail-send/log qmail-pop3d/log

chmod +t qmail-smtpd qmail-send qmail-pop3d

ln -s /var/qmail/supervise/* /var/service/[/PHP]

maildrop

[PHP]tar -xjvf maildrop-1.8.1.tar.bz2

cd maildrop-1.8.1

./configure --prefix=/usr/local --exec-prefix=/usr/local --enable-maildrop-uid=root --enable-maildrop-gid=vchkpw --enable-maildirquota

make

make install-strip

make install-man[/PHP]

qmail啓動腳本

[PHP]ee /var/qmail/supervise/qmail-pop3d/run

#!/bin/sh

PATH=/var/qmail/bin:/usr/local/bin:/usr/bin:/bin

export PATH

exec tcpserver -H -R -v -c100 0 110 qmail-popup domail.com \

/home/vpopmail/bin/vchkpw qmail-pop3d Maildir 2%26amp;1[/PHP]

[PHP]ee /var/qmail/supervise/qmail-pop3d/log/run

#!/bin/sh

PATH=/var/qmail/bin:/usr/local/bin:/usr/bin:/bin

export PATH

exec setuidgid qmaill multilog t s100000 n20 /var/log/qmail/qmail-pop3d 2%26amp;1[/PHP]

[PHP]ee /var/qmail/supervise/qmail-smtpd/run

#!/bin/sh

QMAILDUID=`id -u vpopmail`

NOFILESGID=`id -g vpopmail`

MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`

LOCAL=`head -1 /var/qmail/control/me`

if [ -z "$QMAILDUID" -o -z "$NOFILESGID" -o -z "$MAXSMTPD" -o -z "$LOCAL" ]; then

echo QMAILDUID, NOFILESGID, MAXSMTPD, or LOCAL is unset in

echo /var/qmail/supervise/qmail-smtpd/run

exit 1

fi

if [ ! -f /var/qmail/control/rcpthosts ]; then

echo "No /var/qmail/control/rcpthosts!"

echo "Refusing to start SMTP listener because it'll create an open relay"

exit 1

fi

exec /usr/local/bin/softlimit -m 40000000 \

/usr/local/bin/tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \

-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \

/usr/local/bin/rblsmtpd \

-r cblplus.anti-spam.org.cn \

-r relays.ordb.org \

/var/qmail/bin/qmail-smtpd \

/home/vpopmail/bin/vchkpw /usr/bin/true 2%26amp;1[/PHP]

[PHP]ee /var/qmail/supervise/qmail-smtpd/log/run

#!/bin/sh

PATH=/var/qmail/bin:/usr/local/bin:/usr/bin:/bin

export PATH

exec setuidgid qmaill multilog t s100000 n20 /var/log/qmail/qmail-smtpd 2%26amp;1[/PHP]

[PHP]ee /var/qmail/supervise/qmail-send/run

#!/bin/sh

exec /var/qmail/rc[/PHP]

[PHP]ee /var/qmail/supervise/qmail-send/log/run

#!/bin/sh

PATH=/var/qmail/bin:/usr/local/bin:/usr/bin:/bin

export PATH

exec setuidgid qmaill multilog t s100000 n20 /var/log/qmail/qmail-send 2%26amp;1[/PHP]

[PHP]ee /var/qmail/rc

#!/bin/sh

exec env - PATH="/var/qmail/bin:$PATH" \

qmail-start "`cat /var/qmail/control/defaultdelivery`"[/PHP]

[PHP]ee /usr/bin/qmailctl

#!/bin/sh

# description: the qmail MTA

PATH=/var/qmail/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin

export PATH

QMAILDUID=`/usr/bin/id -u qmaild`

NOFILESGID=`/usr/bin/id -g qmaild`

case "$1" in

start)

echo "Starting qmail..."

echo ""

if svok /var/service/qmail-send ; then

svc -u /var/service/qmail-send /var/service/qmail-send/log

echo "Starting qmail-send"

else

echo "qmail-send supervise not running"

fi

if svok /var/service/qmail-smtpd ; then

svc -u /var/service/qmail-smtpd /var/service/qmail-smtpd/log

echo "Starting qmail-smtpd"

else

echo "qmail-smtpd supervise not running"

fi

if svok /var/service/qmail-pop3d ; then

svc -u /var/service/qmail-pop3d /var/service/qmail-pop3d/log

echo "Starting qmail-pop3d"

else

echo "qmail-pop3d supervise not running"

fi

if [ -d /var/lock/subsys ]; then

touch /var/lock/subsys/qmail

fi

;;

stop)

echo "Stopping qmail..."

echo ""

echo " qmail-smtpd"

svc -d /var/service/qmail-smtpd /var/service/qmail-smtpd/log

echo " qmail-send"

svc -d /var/service/qmail-send /var/service/qmail-send/log

echo " qmail-pop3d"

svc -d /var/service/qmail-pop3d /var/service/qmail-pop3d/log

if [ -f /var/lock/subsys/qmail ]; then

rm /var/lock/subsys/qmail

fi

;;

stat)

svstat /var/service/qmail-send

svstat /var/service/qmail-send/log

svstat /var/service/qmail-smtpd

svstat /var/service/qmail-smtpd/log

svstat /var/service/qmail-pop3d

svstat /var/service/qmail-pop3d/log

qmail-qstat

;;

doqueue|alrm|flush)

echo "Flushing timeout table and sending ALRM signal to qmail-send."

/var/qmail/bin/qmail-tcpok

svc -a /var/service/qmail-send

;;

queue)

qmail-qstat

qmail-qread

;;

reload|hup)

echo "Sending HUP signal to qmail-send."

svc -h /var/service/qmail-send

;;

pause)

echo "Pausing qmail-send"

svc -p /var/service/qmail-send

echo "Pausing qmail-smtpd"

svc -p /var/service/qmail-smtpd

echo "Pausing qmail-pop3d"

svc -p /var/service/qmail-pop3d

;;

cont)

echo "Continuing qmail-send"

svc -c /var/service/qmail-send

echo "Continuing qmail-smtpd"

svc -c /var/service/qmail-smtpd

echo "Continuing qmail-pop3d"

svc -c /var/service/qmail-pop3d

;;

restart)

echo "Restarting qmail:"

echo "* Stopping qmail-smtpd."

svc -d /var/service/qmail-smtpd /var/service/qmail-smtpd/log

echo "* Sending qmail-send SIGTERM and restarting."

svc -t /var/service/qmail-send /var/service/qmail-send/log

echo "* Sending qmail-pop3d SIGTERM and restarting."

svc -t /var/service/qmail-pop3d /var/service/qmail-pop3d/log

echo "* Restarting qmail-smtpd."

svc -u /var/service/qmail-smtpd /var/service/qmail-smtpd/log

;;

cdb)

tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp

chmod 644 /etc/tcp.smtp.cdb

echo "Reloaded /etc/tcp.smtp."

;;

help)

cat

stop -- stops mail service (smtp connections refused, nothing goes out)

start -- starts mail service (smtp connection accepted, mail can go out)

pause -- temporarily stops mail service (connections accepted, nothing leaves)

cont -- continues paused mail service

stat -- displays status of mail service

cdb -- rebuild the tcpserver cdb file for smtp

restart -- stops and restarts smtp, sends qmail-send a TERM %26amp; restarts it

doqueue -- schedules queued messages for immediate delivery

reload -- sends qmail-send HUP, rereading locals and virtualdomains

queue -- shows status of queue

alrm -- same as doqueue

flush -- same as doqueue

hup -- same as reload

HELP

;;

*)

echo "Usage: $0 {start|stop|restart|doqueue|flush|reload|stat|pause|cont|cdb|queue|help}"

exit 1

;;

esac

exit 0

[/PHP]

[PHP]chmod 755 /var/qmail/rc /usr/bin/qmailctl

chmod 751 /var/qmail/supervise/qmail-pop3d/run

chmod 751 /var/qmail/supervise/qmail-pop3d/log/run

chmod 751 /var/qmail/supervise/qmail-smtpd/run

chmod 751 /var/qmail/supervise/qmail-smtpd/log/run

chmod 751 /var/qmail/supervise/qmail-send/run

chmod 751 /var/qmail/supervise/qmail-send/log/run

echo ./Maildir /var/qmail/control/defaultdelivery

echo 255 /var/qmail/control/concurrencyremote

chmod 644 /var/qmail/control/concurrencyremote

echo 30 /var/qmail/control/concurrencyincoming

chmod 644 /var/qmail/control/concurrencyincoming

ln -s /usr/bin/qmailctl /usr/local/etc/rc.d/qmail.sh

echo '127.0.0.1:allow,RELAYCLIENT=""' /etc/tcp.smtp

qmailctl cdb[/PHP]

[PHP]設置管理員的郵箱地址。發往root/postmaster/mailer-daemon地址的郵件將會由定義的管理員郵箱接收。

cd /var/qmail/alias

echo "webmaster@domail.com" .qmail-postmaster

echo "webmaster@domail.com" .qmail-mailer-daemon

echo "webmaster@domail.com" .qmail-root

chmod 644 /var/qmail/alias/.qmail*

echo postmaster /var/qmail/control/bouncefrom \\ 投遞失敗發送者

echo domail.com /var/qmail/control/helohost \\ 主機名

echo '# reject containing invalid characters, brackets or multiple @' /var/qmail/control/badmailto

echo '[!%#:\*\^]' /var/qmail/control/badmailto

echo '[\(\)]' /var/qmail/control/badmailto

echo '[\{\}]' /var/qmail/control/badmailto

echo '@.*@' /var/qmail/control/badmailto

echo 8192000 /var/qmail/control/databytes \\ 接收郵件的最大容量 (0=無限制)

echo 300 /var/qmail/control/concurrencylocal \\ 本地同時投遞郵件的數目

mv /usr/sbin/sendmail /usr/sbin/sendmail.old

chmod 0 /usr/sbin/sendmail.old

ln -s /var/qmail/bin/sendmail /usr/lib/sendmail

ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail

qmailctl start

qmailctl stat[/PHP]

應該看到類似的信息

[PHP]/service/qmail-send: up (pid 29956) 2 seconds

/service/qmail-send/log: up (pid 29960) 2 seconds

/service/qmail-smtpd: up (pid 29963) 2 seconds

/service/qmail-smtpd/log: up (pid 29968) 2 seconds

/service/qmail-pop3d: up (pid 29971) 2 seconds

/service/qmail-pop3d/log: up (pid 29972) 2 seconds

messages in queue: 0

messages in queue but not yet preprocessed: 0[/PHP]

vpopmail

[PHP]mkdir -p /home/vpopmail/etc

pw groupadd vchkpw -g 89

pw useradd vpopmail -u 89 -g 89 -d /home/vpopmail -s /nonexistent

chown vpopmail:vchkpw /home/vpopmail/etc

echo "localhost|0|mail|passwd|mailserver" /home/vpopmail/etc/vpopmail.mysql

chown vpopmail:vchkpw /home/vpopmail/etc/vpopmail.mysql

chmod 640 /home/vpopmail/etc/vpopmail.mysql

在MySQL裏添加vpopmail的帳號

mysql -uroot -p

create database emailserver;

grant select,insert,update,delete,create,drop on mailserver.* to mail@localhost identified by "passwd";

flush privileges;

quit

tar zxvf vpopmail-5.4.10.tar.gz

cd vpopmail-5.4.10

./configure --enable-incdir=/usr/include/mysql --enable-libdir=/usr/lib/mysql --enable-logging=p --disable-passwd --disable-domain-quotas --enable-auth-module=mysql --enable-auth-logging --enable-sql-logging --disable-mysql-limits --enable-many-domains --disable-clear-passwd --enable-sqwebmail-pass --enable-valias

make

make install-strip[/PHP]

[PHP]設置默認域

echo "domail.com" /home/vpopmail/etc/defaultdomain

添加域

/home/vpopmail/bin/vadddomain domail.com passwd

添加用戶

/home/vpopmail/bin/vadduser -q 52428800S webmaster@domail.com passwd

會自動往表vpopmail中添加用戶數據,用戶添加到默認的域裏面。如果要添加到其他的虛擬域,用戶名要帶域名,如果不成功的話,則必須先刪除創建的域,./vdeldomain 域名 不要使用手工操作mysql刪除域和用戶帳號(除非你特別熟悉),否則會引起系統帳戶的紊亂

設置郵箱容量達到90%的警告信息

ee /home/vpopmail/domains/.quotawarn.msg

郵件發送人: 管理員

郵件地址: webmaster@domail.com

郵件收件人: 郵箱用戶

郵件主題: 郵箱空間警告

郵件協議版本: 1.0

郵件類型: text/html; charset=gb2312

郵件編碼: base64

您的郵箱空間已經達到90%.如果想繼續使用,請刪除一些信件.

如果需要幫助,請聯系管理員:

郵件地址 : webmaster@domail.com

設置郵箱已滿的警告信息

ee /home/vpopmail/domains/.over-quota.msg

"因爲用戶的郵箱空間已滿,所以郵件被拒收."

touch /home/vpopmail/domains/domail.com/.qmailadmin-limits

ee /home/vpopmail/domains/domail.com/.qmailadmin-limits

內容爲:

quota 1000 #域總容量不能超過1000M

maxmsgcount 1000 #域郵箱用戶最多1000個

chmod 600 .qmailadmin-limits

[/PHP]

autorespond

[PHP]cd /usr/ports/mail/autorespond

make install clean[/PHP]

ezmlm

[PHP]tar -xvzf ezmlm-0.53.tar.gz

tar -xvzf ezmlm-idx-0.42.tar.gz

cp -rf ezmlm-idx-0.42/* ezmlm-0.53/

cd ezmlm-0.53

patch

chmod u+x makelang

make

make man

make ch_GB

make setup[/PHP]

qmailadmin

[PHP]tar -xvzf qmailadmin-1.2.7.tar.gz

cd qmailadmin-1.2.7

./configure --enable-htmldir=/usr/local/www --enable-cgibindir=/usr/local/www/cgi-bin --enable-vpopuser=vpopmail --enable-autoresponder-bin=/usr/local/bin --enable-ezmlmdir=/usr/local/bin/ezmlm --enable-maxusersperpage=20 --enable-maxaliasesperpage=20 --enable-modify-quota --disable-ezmlm-mysql --enable-domain-autofill

make

make install-strip

cd /usr/local/share/qmailadmin/lang

mv en en.bak

cp zh-cn en[/PHP]

tnef

[PHP]cd /usr/ports/converters/tnef

make install clean[/PHP]

qmail-remove

[PHP]cd /usr/ports/mail/qmail-remove

make install clean

查看隊列

/usr/local/sbin/qmail-remove -q /var/qmail/queue

刪除隊列

/usr/local/sbin/qmail-remove -r[/PHP]

courier-authlib

[PHP]tar -xjvf courier-authlib-0.56.tar.bz2

cd courier-authlib-0.56

./configure --without-authpam --without-authldap --without-authpwd --without-authmysql --without-authpgsql --without-authshadow --without-authuserdb --without-authcustom --without-authcram --with-authvchkpw

make

make install

make install-configure

ee /usr/local/etc/authlib/authdaemonrc

authmodulelist="authvchkpw"

authmodulelistorig="authvchkpw"

daemons=2

cp /usr/local/sbin/authdaemond /usr/local/etc/rc.d/authdaemond.sh

chmod 755 /usr/local/etc/rc.d/authdaemond.sh

mkdir -p /var/lock/subsys/

/usr/local/etc/rc.d/authdaemond.sh start[/PHP]

查看進程

[PHP]ps -aef |grep authlib[/PHP]

測試

[PHP]/usr/local/sbin/authtest webmaster@domail.com passwd[/PHP]

courier-imap

[PHP]cd courier-imap-4.0.3

./configure --prefix=/usr/local --exec-prefix=/usr/local --without-authdaemon --with-authvchkpw --without-authldap --disable-root-check --with-ssl CPPFLAGS=-I/usr/local/include CFLAGS="-DHAVE_OPEN_SMTP_RELAY -DHAVE_VLOGAUTH"

make

make install-strip

cp courier-imap.sysvinit /usr/local/etc/rc.d/courier-imap.sh

chmod 755 /usr/local/etc/rc.d/courier-imap.sh

mkdir -p /var/lock/subsys

cd /usr/local/etc

cp imapd.dist imapd

cp imapd-ssl.dist imapd-ssl

ee imapd.cnf

CN=domail.com

emailAddress=postmaster@domail.com

/usr/local/sbin/mkimapdcert

ee imapd

IMAPDSTART=YES

ee imapd-ssl

IMAPDSSLSTART=YES

/usr/local/etc/rc.d/courier-imap.sh start[/PHP]

SpamAssassin

[PHP]cd /usr/ports/devel/p5-Time-HiRes

make install clean

cd /usr/ports/dns/p5-Net-DNS

make install clean

cd /usr/ports/textproc/p5-PodParser

make install clean

cd /usr/ports/textproc/p5-Parse-Syslog

make install clean

cd /usr/ports/math/p5-Statistics-Distributions

make install clean

tar xzf Mail-SpamAssassin-3.0.4.tar.gz

cd Mail-SpamAssassin-3.0.4

perl Makefile.PL

make

make install

cd /etc/mail/spamassassin

env LANG=C ee local.cf

required_score 6.0

rewrite_header Subject ****這是一封垃圾郵件****

report_safe 1

use_bayes 1

skip_rbl_checks 0

ok_languages zh en ko

ok_locales en ko zh

score HEAD_ILLEGAL_CHARS 0

score SUBJ_ILLEGAL_CHARS 0

score DATE_IN_PAST_03_06 0

score UPPERCASE_25_50 0

score UPPERCASE_50_75 0

score UPPERCASE_75_100 0

score X_MSMAIL_PRIORITY_HIGH 0

score X_PRIORITY_HIGH 0

score TO_TXT 100

score RATWARE_HASH_2 100

score RATWARE_HASH_2_V2 100

score BAYES_99 0.1

score BAYES_80 0.1

score BAYES_60 0.1

score FROM_ILLEGAL_CHARS 0.1

score MIME_BASE64_TEXT 0.1

score NO_RDNS_DOTCOM_HELO 0.1

score CHINA_HEADER 0.1

score NO_REAL_NAME 0.2

score HTML_MESSAGE 0.2

score MIME_HTML_ONLY 0.2

score MIME_HTML_ONLY_MULTI 0.2

score FORGED_MUA_OUTLOOK 0.2

score FORGED_HOTMAIL_RCVD 0.2

score FORGED_OUTLOOK_TAGS 0.2

score MAILTO_TO_SPAM_ADDR 0.2[/PHP]

下載新的垃圾郵件地址列表文件

[PHP]cd /usr/local/share/spamassassin

fetch http://anti-spam.org.cn/rules/sa/55_diy_score.cf[/PHP]

建立SpamAssassin的學習系統

[PHP]/usr/local/bin/sa-learn --rebuild -D -p user_prefs[/PHP]

查看自學習的數據信息

[PHP]/usr/local/bin/sa-learn --dump all[/PHP]

qmail與SpamAssassin結合

[PHP]cd Mail-SpamAssassin-3.0.4/spamc

cc -O -o qmail-spamc qmail-spamc.c

install -m 755 qmail-spamc /var/qmail/bin

ln -s /var/qmail/bin/qmail-queue /usr/bin/qmail-queue[/PHP]

啓動spamd

[PHP]/usr/local/bin/spamd --daemonize --pidfile /var/run/spamd.pid[/PHP]

[PHP]ee /etc/rc.local

/usr/local/bin/spamd --daemonize --pidfile /var/run/spamd.pid[/PHP]

qmail-scanner

[PHP]pw groupadd qscand -g 90

pw useradd qscand -c "Qmail-Scanner Account" -u 90 -g 90 -s /bin/false

tar zxvf qmail-scanner-1.25.tgz

cd qmail-scanner-1.25

./configure --admin webmaster --domain domail.com --notify sender,admin --local-domains domail.com --archive yes --add-dscr-hdrs yes --redundant yes --debug yes --unzip yes --scanners clamscan,fast_spamassassin --install[/PHP]

應該有類似提示

[PHP]perlscanner: generate new DB file from /var/spool/qmailscan/quarantine-attachments.txt

perlscanner: total of 9 entries[/PHP]

[PHP]chown -R qscand:qscand /var/spool/qmailscan

ee /etc/tcp.smtp

127.0.0.1.:allow,RELAYCLIENT="",QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"

:allow,QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"[/PHP]

[PHP]ee /var/qmail/bin/qmail-scanner-queue.pl

my $V_FROMNAME='管理員';

my $clamscan_options="-r -m --mbox --unzip --unrar --unzoo --lha --disable-summary --max-recursion=10 --max-space=1000000";

my $spamc_subject='疑爲垃圾郵件';

qmailctl cdb

qmailctl stop

qmailctl start

qmailctl stat[/PHP]

設置郵件服務器過濾掉一些病毒附件(注:添加文件格式時要手動輸入,空格用TAB鍵補齊!!!)

[PHP]ee /var/spool/qmailscan/quarantine-attachments.txt

.exe 0 系統不允許接收EXE格式的附件

.vbs 0 系統不允許接收VBS格式的附件

.lnk 0 系統不允許接收LNK格式的附件

.scr 0 系統不允許接收SCR格式的附件

.wsh 0 系統不允許接收WSH格式的附件

.hta 0 系統不允許接收HTA格式的附件

.pif 0 系統不允許接收PIF格式的附件

.cpl 0 系統不允許接收CPL格式的附件

.sql 0 系統不允許接收SQL格式的附件

.php 0 系統不允許接收PHP格式的附件

.asp 0 系統不允許接收ASP格式的附件

.com 0 系統不允許接收COM格式的附件

.bat 0 系統不允許接收BAT格式的附件[/PHP]

編輯完成後,運行

[PHP]/var/qmail/bin/qmail-scanner-queue.pl -g[/PHP] 即時生效。

用qmail封mail from

[PHP]ee /var/qmail/control/badmailfrom

這個控制文件實現拒收郵件功能的,每一個地址要單獨一行。而且,不用重起qmail就能生效。例如

rpnai@yahoo.com -----限制一個特定的用戶

@sina.com -----限制整個域中的郵件[/PHP]

注:Qmail啓動腳本有點問題(啓動時會提示[PHP]qmail-**** supervise not running[/PHP] ),但是不影響使用。有心有力的朋友幫忙修改一下,謝謝!因爲使用ports牽掣到安裝目錄等問題,所以部分程序采用手動編譯。

這個方法中啓動腳本有點問題。目前解決辦法就是daemontools不通過ports安裝。[PHP]mkdir -p /package

chmod 1755 /package

cp daemontools-0.76.tar.gz /package

cd /package

tar zxvf daemontools-0.76.tar.gz

cd /package/admin/daemontools-0.76

package/install

rm -r /package/daemontools-0.76.tar.gz[/PHP]

然後將方法裏所有與/var/service有關的連接改成/service,同時將啓動腳本裏的/var/service也改成/service即可。

http://www.toping.net/bbs/htm_data/2/0507/175.html

[PHP]ucspi-tcp cd /usr/ports/sysutils/ucspi-tcp make install clean daemontools cd /usr/ports/sysutils/daemontools make install clean mkdir /var/service chmod 755 /var/service ee /etc/rc.conf svscan_enable="YES"[/PHP] reboot 驗證daemontools已經正常運行: [PHP]ps ax | grep svscan[/PHP] [PHP]cd /usr/ports/mail/qmail make BARRIER_BIG_TODO_PATCH=yes WITH_QMAILQUEUE_PATCH=yes BARRIER_BIG_CONCURRENCY_PATCH=yes WITH_LOCALTIME_PATCH=yes WITH_QMTPC_PATCH=yes WITH_MAILDIRQUOTA_PATCH=yes WITH_BLOCKEXEC_PATCH=yes WITH_DISCBOUNCES_PATCH=yes WITH_SPF_PATCH=yes install clean /var/qmail/scripts/enable-qmail cd /var/qmail/configure ./config-fast domail.com[/PHP] 打auth smtp補丁 [PHP]tar zxvf qmail-1.03.tar.gz tar zxvf qmail-smtpd-auth-0.31.tar.gz cp qmail-smtpd-auth-0.31/base64.* qmail-1.03 patch -d qmail-1.03 cd qmail-1.03 fetch http://gadfly.shanji.com/qmail-smtpd/qmail-smtpd.c fetch http://gadfly.shanji.com/qmail-smtpd/qmail-smtpd.patch patch -p1 patch -p1 patch -p1 patch -p1 patch -p1 patch -p1 patch -p1 patch -p1 patch -p1 patch ee qmail-smtpd.c[/PHP] [PHP]將函數straynewline中的451改爲553(// 當你的服務器收到無效格式的郵件時,會發送:"I am not going to accept that message at the moment,you can try again later",對方服務器收到後,幾秒鍾後又會發送同樣的郵件給你,造成多次的重複。改爲553後,你的服務器將直接發送:"I am not going to accept that message,don't try sending it again.",告訴對方的服務器不要再發這封無效的信件。) void die_alarm() { out("451 超時. (#4.4.2)\r\n"); flush(); _exit(1); } void die_nomem() { out("421 內存溢出. (#4.3.0)\r\n"); flush(); _exit(1); } void die_control() { out("421 無法讀取控制文件. (#4.3.0)\r\n"); flush(); _exit(1); } void die_ipme() { out("421 無法判斷發信IP地址. (#4.3.0)\r\n"); flush(); _exit(1); } void straynewline() { out("451 如有疑問請發郵件到: xiwu518@163.com\r\n"); flush(); _exit(1); } void err_bmf() { out("553 對不起您的郵件地址在我的黑名單裏. (#5.7.1)\r\n"); } void err_nogateway() { out("553 對不起,您所發送的郵件不在服務器允許的範圍內. (#5.7.1)\r\n"); } void err_unimpl() { out("502 命令執行失敗. (#5.5.1)\r\n"); } void err_syntax() { out("555 語法錯誤. (#5.5.4)\r\n"); } out("214 WelCome To: http://www.domail.com\r\n"); out("354 繼續.\r\n"); if (databytes) if (!bytestooverflow) { out("552 對不起,郵件大小超出服務器允許接受的範圍. (#5.3.4)\r\n"); return; }[/PHP] [PHP]make qmail-smtpd cd /var/qmail/bin mv qmail-smtpd qmail-smtpd.auth cd - cp qmail-smtpd /var/qmail/bin/qmail-smtpd mkdir /var/log/qmail cd /var/log/qmail mkdir qmail-send qmail-smtpd qmail-pop3d chown -R qmaill:wheel /var/log/qmail chmod -R 750 /var/log/qmail mkdir /var/qmail/supervise cd /var/qmail/supervise mkdir -p qmail-smtpd/log qmail-send/log qmail-pop3d/log chmod +t qmail-smtpd qmail-send qmail-pop3d ln -s /var/qmail/supervise/* /var/service/[/PHP] maildrop [PHP]tar -xjvf maildrop-1.8.1.tar.bz2 cd maildrop-1.8.1 ./configure --prefix=/usr/local --exec-prefix=/usr/local --enable-maildrop-uid=root --enable-maildrop-gid=vchkpw --enable-maildirquota make make install-strip make install-man[/PHP] qmail啓動腳本 [PHP]ee /var/qmail/supervise/qmail-pop3d/run #!/bin/sh PATH=/var/qmail/bin:/usr/local/bin:/usr/bin:/bin export PATH exec tcpserver -H -R -v -c100 0 110 qmail-popup domail.com \ /home/vpopmail/bin/vchkpw qmail-pop3d Maildir 2%26amp;1[/PHP] [PHP]ee /var/qmail/supervise/qmail-pop3d/log/run #!/bin/sh PATH=/var/qmail/bin:/usr/local/bin:/usr/bin:/bin export PATH exec setuidgid qmaill multilog t s100000 n20 /var/log/qmail/qmail-pop3d 2%26amp;1[/PHP] [PHP]ee /var/qmail/supervise/qmail-smtpd/run #!/bin/sh QMAILDUID=`id -u vpopmail` NOFILESGID=`id -g vpopmail` MAXSMTPD=`cat /var/qmail/control/concurrencyincoming` LOCAL=`head -1 /var/qmail/control/me` if [ -z "$QMAILDUID" -o -z "$NOFILESGID" -o -z "$MAXSMTPD" -o -z "$LOCAL" ]; then echo QMAILDUID, NOFILESGID, MAXSMTPD, or LOCAL is unset in echo /var/qmail/supervise/qmail-smtpd/run exit 1 fi if [ ! -f /var/qmail/control/rcpthosts ]; then echo "No /var/qmail/control/rcpthosts!" echo "Refusing to start SMTP listener because it'll create an open relay" exit 1 fi exec /usr/local/bin/softlimit -m 40000000 \ /usr/local/bin/tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \ -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \ /usr/local/bin/rblsmtpd \ -r cblplus.anti-spam.org.cn \ -r relays.ordb.org \ /var/qmail/bin/qmail-smtpd \ /home/vpopmail/bin/vchkpw /usr/bin/true 2%26amp;1[/PHP] [PHP]ee /var/qmail/supervise/qmail-smtpd/log/run #!/bin/sh PATH=/var/qmail/bin:/usr/local/bin:/usr/bin:/bin export PATH exec setuidgid qmaill multilog t s100000 n20 /var/log/qmail/qmail-smtpd 2%26amp;1[/PHP] [PHP]ee /var/qmail/supervise/qmail-send/run #!/bin/sh exec /var/qmail/rc[/PHP] [PHP]ee /var/qmail/supervise/qmail-send/log/run #!/bin/sh PATH=/var/qmail/bin:/usr/local/bin:/usr/bin:/bin export PATH exec setuidgid qmaill multilog t s100000 n20 /var/log/qmail/qmail-send 2%26amp;1[/PHP] [PHP]ee /var/qmail/rc #!/bin/sh exec env - PATH="/var/qmail/bin:$PATH" \ qmail-start "`cat /var/qmail/control/defaultdelivery`"[/PHP] [PHP]ee /usr/bin/qmailctl #!/bin/sh # description: the qmail MTA PATH=/var/qmail/bin:/bin:/usr/bin:/usr/local/bin:/usr/local/sbin export PATH QMAILDUID=`/usr/bin/id -u qmaild` NOFILESGID=`/usr/bin/id -g qmaild` case "$1" in start) echo "Starting qmail..." echo "" if svok /var/service/qmail-send ; then svc -u /var/service/qmail-send /var/service/qmail-send/log echo "Starting qmail-send" else echo "qmail-send supervise not running" fi if svok /var/service/qmail-smtpd ; then svc -u /var/service/qmail-smtpd /var/service/qmail-smtpd/log echo "Starting qmail-smtpd" else echo "qmail-smtpd supervise not running" fi if svok /var/service/qmail-pop3d ; then svc -u /var/service/qmail-pop3d /var/service/qmail-pop3d/log echo "Starting qmail-pop3d" else echo "qmail-pop3d supervise not running" fi if [ -d /var/lock/subsys ]; then touch /var/lock/subsys/qmail fi ;; stop) echo "Stopping qmail..." echo "" echo " qmail-smtpd" svc -d /var/service/qmail-smtpd /var/service/qmail-smtpd/log echo " qmail-send" svc -d /var/service/qmail-send /var/service/qmail-send/log echo " qmail-pop3d" svc -d /var/service/qmail-pop3d /var/service/qmail-pop3d/log if [ -f /var/lock/subsys/qmail ]; then rm /var/lock/subsys/qmail fi ;; stat) svstat /var/service/qmail-send svstat /var/service/qmail-send/log svstat /var/service/qmail-smtpd svstat /var/service/qmail-smtpd/log svstat /var/service/qmail-pop3d svstat /var/service/qmail-pop3d/log qmail-qstat ;; doqueue|alrm|flush) echo "Flushing timeout table and sending ALRM signal to qmail-send." /var/qmail/bin/qmail-tcpok svc -a /var/service/qmail-send ;; queue) qmail-qstat qmail-qread ;; reload|hup) echo "Sending HUP signal to qmail-send." svc -h /var/service/qmail-send ;; pause) echo "Pausing qmail-send" svc -p /var/service/qmail-send echo "Pausing qmail-smtpd" svc -p /var/service/qmail-smtpd echo "Pausing qmail-pop3d" svc -p /var/service/qmail-pop3d ;; cont) echo "Continuing qmail-send" svc -c /var/service/qmail-send echo "Continuing qmail-smtpd" svc -c /var/service/qmail-smtpd echo "Continuing qmail-pop3d" svc -c /var/service/qmail-pop3d ;; restart) echo "Restarting qmail:" echo "* Stopping qmail-smtpd." svc -d /var/service/qmail-smtpd /var/service/qmail-smtpd/log echo "* Sending qmail-send SIGTERM and restarting." svc -t /var/service/qmail-send /var/service/qmail-send/log echo "* Sending qmail-pop3d SIGTERM and restarting." svc -t /var/service/qmail-pop3d /var/service/qmail-pop3d/log echo "* Restarting qmail-smtpd." svc -u /var/service/qmail-smtpd /var/service/qmail-smtpd/log ;; cdb) tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp chmod 644 /etc/tcp.smtp.cdb echo "Reloaded /etc/tcp.smtp." ;; help) cat stop -- stops mail service (smtp connections refused, nothing goes out) start -- starts mail service (smtp connection accepted, mail can go out) pause -- temporarily stops mail service (connections accepted, nothing leaves) cont -- continues paused mail service stat -- displays status of mail service cdb -- rebuild the tcpserver cdb file for smtp restart -- stops and restarts smtp, sends qmail-send a TERM %26amp; restarts it doqueue -- schedules queued messages for immediate delivery reload -- sends qmail-send HUP, rereading locals and virtualdomains queue -- shows status of queue alrm -- same as doqueue flush -- same as doqueue hup -- same as reload HELP ;; *) echo "Usage: $0 {start|stop|restart|doqueue|flush|reload|stat|pause|cont|cdb|queue|help}" exit 1 ;; esac exit 0 [/PHP] [PHP]chmod 755 /var/qmail/rc /usr/bin/qmailctl chmod 751 /var/qmail/supervise/qmail-pop3d/run chmod 751 /var/qmail/supervise/qmail-pop3d/log/run chmod 751 /var/qmail/supervise/qmail-smtpd/run chmod 751 /var/qmail/supervise/qmail-smtpd/log/run chmod 751 /var/qmail/supervise/qmail-send/run chmod 751 /var/qmail/supervise/qmail-send/log/run echo ./Maildir /var/qmail/control/defaultdelivery echo 255 /var/qmail/control/concurrencyremote chmod 644 /var/qmail/control/concurrencyremote echo 30 /var/qmail/control/concurrencyincoming chmod 644 /var/qmail/control/concurrencyincoming ln -s /usr/bin/qmailctl /usr/local/etc/rc.d/qmail.sh echo '127.0.0.1:allow,RELAYCLIENT=""' /etc/tcp.smtp qmailctl cdb[/PHP] [PHP]設置管理員的郵箱地址。發往root/postmaster/mailer-daemon地址的郵件將會由定義的管理員郵箱接收。 cd /var/qmail/alias echo "webmaster@domail.com" .qmail-postmaster echo "webmaster@domail.com" .qmail-mailer-daemon echo "webmaster@domail.com" .qmail-root chmod 644 /var/qmail/alias/.qmail* echo postmaster /var/qmail/control/bouncefrom \\ 投遞失敗發送者 echo domail.com /var/qmail/control/helohost \\ 主機名 echo '# reject containing invalid characters, brackets or multiple @' /var/qmail/control/badmailto echo '[!%#:\*\^]' /var/qmail/control/badmailto echo '[\(\)]' /var/qmail/control/badmailto echo '[\{\}]' /var/qmail/control/badmailto echo '@.*@' /var/qmail/control/badmailto echo 8192000 /var/qmail/control/databytes \\ 接收郵件的最大容量 (0=無限制) echo 300 /var/qmail/control/concurrencylocal \\ 本地同時投遞郵件的數目 mv /usr/sbin/sendmail /usr/sbin/sendmail.old chmod 0 /usr/sbin/sendmail.old ln -s /var/qmail/bin/sendmail /usr/lib/sendmail ln -s /var/qmail/bin/sendmail /usr/sbin/sendmail qmailctl start qmailctl stat[/PHP] 應該看到類似的信息 [PHP]/service/qmail-send: up (pid 29956) 2 seconds /service/qmail-send/log: up (pid 29960) 2 seconds /service/qmail-smtpd: up (pid 29963) 2 seconds /service/qmail-smtpd/log: up (pid 29968) 2 seconds /service/qmail-pop3d: up (pid 29971) 2 seconds /service/qmail-pop3d/log: up (pid 29972) 2 seconds messages in queue: 0 messages in queue but not yet preprocessed: 0[/PHP] vpopmail [PHP]mkdir -p /home/vpopmail/etc pw groupadd vchkpw -g 89 pw useradd vpopmail -u 89 -g 89 -d /home/vpopmail -s /nonexistent chown vpopmail:vchkpw /home/vpopmail/etc echo "localhost|0|mail|passwd|mailserver" /home/vpopmail/etc/vpopmail.mysql chown vpopmail:vchkpw /home/vpopmail/etc/vpopmail.mysql chmod 640 /home/vpopmail/etc/vpopmail.mysql 在MySQL裏添加vpopmail的帳號 mysql -uroot -p create database emailserver; grant select,insert,update,delete,create,drop on mailserver.* to mail@localhost identified by "passwd"; flush privileges; quit tar zxvf vpopmail-5.4.10.tar.gz cd vpopmail-5.4.10 ./configure --enable-incdir=/usr/include/mysql --enable-libdir=/usr/lib/mysql --enable-logging=p --disable-passwd --disable-domain-quotas --enable-auth-module=mysql --enable-auth-logging --enable-sql-logging --disable-mysql-limits --enable-many-domains --disable-clear-passwd --enable-sqwebmail-pass --enable-valias make make install-strip[/PHP] [PHP]設置默認域 echo "domail.com" /home/vpopmail/etc/defaultdomain 添加域 /home/vpopmail/bin/vadddomain domail.com passwd 添加用戶 /home/vpopmail/bin/vadduser -q 52428800S webmaster@domail.com passwd 會自動往表vpopmail中添加用戶數據,用戶添加到默認的域裏面。如果要添加到其他的虛擬域,用戶名要帶域名,如果不成功的話,則必須先刪除創建的域,./vdeldomain 域名 不要使用手工操作mysql刪除域和用戶帳號(除非你特別熟悉),否則會引起系統帳戶的紊亂 設置郵箱容量達到90%的警告信息 ee /home/vpopmail/domains/.quotawarn.msg 郵件發送人: 管理員 郵件地址: webmaster@domail.com 郵件收件人: 郵箱用戶 郵件主題: 郵箱空間警告 郵件協議版本: 1.0 郵件類型: text/html; charset=gb2312 郵件編碼: base64 您的郵箱空間已經達到90%.如果想繼續使用,請刪除一些信件. 如果需要幫助,請聯系管理員: 郵件地址 : webmaster@domail.com 設置郵箱已滿的警告信息 ee /home/vpopmail/domains/.over-quota.msg "因爲用戶的郵箱空間已滿,所以郵件被拒收." touch /home/vpopmail/domains/domail.com/.qmailadmin-limits ee /home/vpopmail/domains/domail.com/.qmailadmin-limits 內容爲: quota 1000 #域總容量不能超過1000M maxmsgcount 1000 #域郵箱用戶最多1000個 chmod 600 .qmailadmin-limits [/PHP] autorespond [PHP]cd /usr/ports/mail/autorespond make install clean[/PHP] ezmlm [PHP]tar -xvzf ezmlm-0.53.tar.gz tar -xvzf ezmlm-idx-0.42.tar.gz cp -rf ezmlm-idx-0.42/* ezmlm-0.53/ cd ezmlm-0.53 patch chmod u+x makelang make make man make ch_GB make setup[/PHP] qmailadmin [PHP]tar -xvzf qmailadmin-1.2.7.tar.gz cd qmailadmin-1.2.7 ./configure --enable-htmldir=/usr/local/www --enable-cgibindir=/usr/local/www/cgi-bin --enable-vpopuser=vpopmail --enable-autoresponder-bin=/usr/local/bin --enable-ezmlmdir=/usr/local/bin/ezmlm --enable-maxusersperpage=20 --enable-maxaliasesperpage=20 --enable-modify-quota --disable-ezmlm-mysql --enable-domain-autofill make make install-strip cd /usr/local/share/qmailadmin/lang mv en en.bak cp zh-cn en[/PHP] tnef [PHP]cd /usr/ports/converters/tnef make install clean[/PHP] qmail-remove [PHP]cd /usr/ports/mail/qmail-remove make install clean 查看隊列 /usr/local/sbin/qmail-remove -q /var/qmail/queue 刪除隊列 /usr/local/sbin/qmail-remove -r[/PHP] courier-authlib [PHP]tar -xjvf courier-authlib-0.56.tar.bz2 cd courier-authlib-0.56 ./configure --without-authpam --without-authldap --without-authpwd --without-authmysql --without-authpgsql --without-authshadow --without-authuserdb --without-authcustom --without-authcram --with-authvchkpw make make install make install-configure ee /usr/local/etc/authlib/authdaemonrc authmodulelist="authvchkpw" authmodulelistorig="authvchkpw" daemons=2 cp /usr/local/sbin/authdaemond /usr/local/etc/rc.d/authdaemond.sh chmod 755 /usr/local/etc/rc.d/authdaemond.sh mkdir -p /var/lock/subsys/ /usr/local/etc/rc.d/authdaemond.sh start[/PHP] 查看進程 [PHP]ps -aef |grep authlib[/PHP] 測試 [PHP]/usr/local/sbin/authtest webmaster@domail.com passwd[/PHP] courier-imap [PHP]cd courier-imap-4.0.3 ./configure --prefix=/usr/local --exec-prefix=/usr/local --without-authdaemon --with-authvchkpw --without-authldap --disable-root-check --with-ssl CPPFLAGS=-I/usr/local/include CFLAGS="-DHAVE_OPEN_SMTP_RELAY -DHAVE_VLOGAUTH" make make install-strip cp courier-imap.sysvinit /usr/local/etc/rc.d/courier-imap.sh chmod 755 /usr/local/etc/rc.d/courier-imap.sh mkdir -p /var/lock/subsys cd /usr/local/etc cp imapd.dist imapd cp imapd-ssl.dist imapd-ssl ee imapd.cnf CN=domail.com emailAddress=postmaster@domail.com /usr/local/sbin/mkimapdcert ee imapd IMAPDSTART=YES ee imapd-ssl IMAPDSSLSTART=YES /usr/local/etc/rc.d/courier-imap.sh start[/PHP] SpamAssassin [PHP]cd /usr/ports/devel/p5-Time-HiRes make install clean cd /usr/ports/dns/p5-Net-DNS make install clean cd /usr/ports/textproc/p5-PodParser make install clean cd /usr/ports/textproc/p5-Parse-Syslog make install clean cd /usr/ports/math/p5-Statistics-Distributions make install clean tar xzf Mail-SpamAssassin-3.0.4.tar.gz cd Mail-SpamAssassin-3.0.4 perl Makefile.PL make make install cd /etc/mail/spamassassin env LANG=C ee local.cf required_score 6.0 rewrite_header Subject ****這是一封垃圾郵件**** report_safe 1 use_bayes 1 skip_rbl_checks 0 ok_languages zh en ko ok_locales en ko zh score HEAD_ILLEGAL_CHARS 0 score SUBJ_ILLEGAL_CHARS 0 score DATE_IN_PAST_03_06 0 score UPPERCASE_25_50 0 score UPPERCASE_50_75 0 score UPPERCASE_75_100 0 score X_MSMAIL_PRIORITY_HIGH 0 score X_PRIORITY_HIGH 0 score TO_TXT 100 score RATWARE_HASH_2 100 score RATWARE_HASH_2_V2 100 score BAYES_99 0.1 score BAYES_80 0.1 score BAYES_60 0.1 score FROM_ILLEGAL_CHARS 0.1 score MIME_BASE64_TEXT 0.1 score NO_RDNS_DOTCOM_HELO 0.1 score CHINA_HEADER 0.1 score NO_REAL_NAME 0.2 score HTML_MESSAGE 0.2 score MIME_HTML_ONLY 0.2 score MIME_HTML_ONLY_MULTI 0.2 score FORGED_MUA_OUTLOOK 0.2 score FORGED_HOTMAIL_RCVD 0.2 score FORGED_OUTLOOK_TAGS 0.2 score MAILTO_TO_SPAM_ADDR 0.2[/PHP] 下載新的垃圾郵件地址列表文件 [PHP]cd /usr/local/share/spamassassin fetch http://anti-spam.org.cn/rules/sa/55_diy_score.cf[/PHP] 建立SpamAssassin的學習系統 [PHP]/usr/local/bin/sa-learn --rebuild -D -p user_prefs[/PHP] 查看自學習的數據信息 [PHP]/usr/local/bin/sa-learn --dump all[/PHP] qmail與SpamAssassin結合 [PHP]cd Mail-SpamAssassin-3.0.4/spamc cc -O -o qmail-spamc qmail-spamc.c install -m 755 qmail-spamc /var/qmail/bin ln -s /var/qmail/bin/qmail-queue /usr/bin/qmail-queue[/PHP] 啓動spamd [PHP]/usr/local/bin/spamd --daemonize --pidfile /var/run/spamd.pid[/PHP] [PHP]ee /etc/rc.local /usr/local/bin/spamd --daemonize --pidfile /var/run/spamd.pid[/PHP] qmail-scanner [PHP]pw groupadd qscand -g 90 pw useradd qscand -c "Qmail-Scanner Account" -u 90 -g 90 -s /bin/false tar zxvf qmail-scanner-1.25.tgz cd qmail-scanner-1.25 ./configure --admin webmaster --domain domail.com --notify sender,admin --local-domains domail.com --archive yes --add-dscr-hdrs yes --redundant yes --debug yes --unzip yes --scanners clamscan,fast_spamassassin --install[/PHP] 應該有類似提示 [PHP]perlscanner: generate new DB file from /var/spool/qmailscan/quarantine-attachments.txt perlscanner: total of 9 entries[/PHP] [PHP]chown -R qscand:qscand /var/spool/qmailscan ee /etc/tcp.smtp 127.0.0.1.:allow,RELAYCLIENT="",QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl" :allow,QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl"[/PHP] [PHP]ee /var/qmail/bin/qmail-scanner-queue.pl my $V_FROMNAME='管理員'; my $clamscan_options="-r -m --mbox --unzip --unrar --unzoo --lha --disable-summary --max-recursion=10 --max-space=1000000"; my $spamc_subject='疑爲垃圾郵件'; qmailctl cdb qmailctl stop qmailctl start qmailctl stat[/PHP] 設置郵件服務器過濾掉一些病毒附件(注:添加文件格式時要手動輸入,空格用TAB鍵補齊!!!) [PHP]ee /var/spool/qmailscan/quarantine-attachments.txt .exe 0 系統不允許接收EXE格式的附件 .vbs 0 系統不允許接收VBS格式的附件 .lnk 0 系統不允許接收LNK格式的附件 .scr 0 系統不允許接收SCR格式的附件 .wsh 0 系統不允許接收WSH格式的附件 .hta 0 系統不允許接收HTA格式的附件 .pif 0 系統不允許接收PIF格式的附件 .cpl 0 系統不允許接收CPL格式的附件 .sql 0 系統不允許接收SQL格式的附件 .php 0 系統不允許接收PHP格式的附件 .asp 0 系統不允許接收ASP格式的附件 .com 0 系統不允許接收COM格式的附件 .bat 0 系統不允許接收BAT格式的附件[/PHP] 編輯完成後,運行 [PHP]/var/qmail/bin/qmail-scanner-queue.pl -g[/PHP] 即時生效。 用qmail封mail from [PHP]ee /var/qmail/control/badmailfrom 這個控制文件實現拒收郵件功能的,每一個地址要單獨一行。而且,不用重起qmail就能生效。例如 rpnai@yahoo.com -----限制一個特定的用戶 @sina.com -----限制整個域中的郵件[/PHP] 注:Qmail啓動腳本有點問題(啓動時會提示[PHP]qmail-**** supervise not running[/PHP] ),但是不影響使用。有心有力的朋友幫忙修改一下,謝謝!因爲使用ports牽掣到安裝目錄等問題,所以部分程序采用手動編譯。 這個方法中啓動腳本有點問題。目前解決辦法就是daemontools不通過ports安裝。[PHP]mkdir -p /package chmod 1755 /package cp daemontools-0.76.tar.gz /package cd /package tar zxvf daemontools-0.76.tar.gz cd /package/admin/daemontools-0.76 package/install rm -r /package/daemontools-0.76.tar.gz[/PHP] 然後將方法裏所有與/var/service有關的連接改成/service,同時將啓動腳本裏的/var/service也改成/service即可。 http://www.toping.net/bbs/htm_data/2/0507/175.html
󰈣󰈤
王朝萬家燈火計劃
期待原創作者加盟
 
 
 
>>返回首頁<<
 
 
 
 
 熱帖排行
 
王朝網路微信公眾號
微信掃碼關註本站公眾號 wangchaonetcn
 
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有