ºìÁªLinuxÃÅ»§
Linux°ïÖú

ÔÚLinuxÏ°²×°Óʼþ·þÎñÆ÷Qmail

·¢²¼Ê±¼ä:2006-10-28 01:21:15À´Ô´:ºìÁª×÷Õß:cxtt228
¹¦ÄÜÁбí
SMTP·þÎñÆ÷:SMTP-AUTHÈÏÖ¤(Plain,Login,CRAM-MD5)£¬TLS(SSL)Ö§³Ö
POP3·þÎñÆ÷:CRAM-MD5£¬APOP£¬ºÍSSLÖ§³Ö
IMAP·þÎñÆ÷:TLS(SSL)Ö§³Ö
²¡¶¾ºÍÀ¬»øÓʼþ¼ì²â
×Ô¶¯»Ø¸´
ÓʼþÁбí
Web¹ÜÀí
ͨ¹ýWebÏÔʾͳ¼ÆÐÅÏ¢
WebMail
MRTG



°²×°×¼±¸
°²×°»·¾³
Õâ¸ö°²×°¹ý³Ì»ù±¾ÉÏÄãÖ»ÐèÒª¸´ÖÆÕ³Ìù¾Í¿ÉÒÔÍê³É.ÎÒÔÚRedHatÉÏ°²×°³É¹¦£¬ÆäËûϵͳ»¹Ã»ÊÔ¹ý.

ΪÁË·½±ã°²×°ÎÒÔÚ°²×°Redhat3.0ʱѡÁËapache¡¢php¡¢mysql£¬×¢Òâ mysql-develºÍmysql-server¿ª·¢°üÒ»¶¨Òª×°ÉÏ.ÁíÍâ´ó¼ÒÔÚ°²×°LINUXʱһ¶¨Òª×°ÉÏÈí¼þ¿ª·¢ºÍÄں˿ª·¢Á½¸öÈí¼þ×飬ÕâÑù¿ÉÒÔ±ÜÃâ²»±ØÒªµÄÓÉÓÚ±àÒë»·¾³µÄÎÊÌâ¶øµ¼Öµİ²×°ÎÊÌ⣬Õâµã¶ÔÓÚLINUX ÐÂÊÖÓÌΪÖØÒª¡£°²×°ÏµÍ³ºó£¬Ò»°ãÁíÐè°²×°php-mysqlÕâ¸ö°ü£¬ÔÚ°²×°¹âµúµÚÈýÕÅ¡£AS3.0°²×°ºó£¬²¢Ã»ÓÐmysql-serverÈí¼þ°ü£¬Ðè×ÔÐÐÏÂÔØ°²×°£¬Îª·½±ã´ó¼Ò£¬mysql-serverÈí¼þ°üÎÒÒѾ­ÓëËùÓÐÈí¼þ·ÅÔÚÒ»¸ö°üÖС£

ҪȷÈÏÏÂÃæµÄÈí¼þÊÇ·ñÒѾ­°²×°£º

rpm -q httpd
rpm -q php
rpm -q php-mysql
rpm -q mysql
rpm -q mysql-server
rpm -q mysql-devel
rpm -q gdbm
rpm -q gdbm-devel
rpm -q openssl
rpm -q openssl-devel
rpm -q stunnel
rpm -q krb5-devel


Èç¹ûÄ㻹ûÓа²×°, ÇëÏÈ°²×°ËüÃÇ. Äã¿ÉÒÔµ½°²×°¹âÅÌ»òÊÇÔÚÕâÀïÕÒµ½ËüÃǵÄRPM°ü http://www.rpmfind.net.
Æô¶¯mysql server:
# /etc/rc.d/init.d/mysqld start
ÉèÖÃmysql root¿ÚÁ
# mysqladmin -u root password ¡®xukixu¡¯(ÉèÖÃÄãµÄÃÜÂë)

mysqlµÄÍ·ÎļþºÍ¿âÎļþ·Ö±ðÔÚ/usr/include/mysqlºÍ/usr/lib/mysql¡£
°²×°ÍêRedhat3.0ºó£¬ÐÞ¸Ä/etc/httpd/conf/httpd.conf£¬Ê¹web·þÎñÕý³£ÆôÓã¬ÎªmysqlÌí¼ÓrootÓû§µÄÃÜÂë¡£Èç¹ûÉèÖÃÁË·À»ðǽ£¬Òª´ò¿ª·þÎñÆ÷µÄwww 80¡¢smtp 25ºÍpop3 110Èý¸ö¶Ë¿Ú¡£



¼ì²éDNSÉèÖÃ
ÔÚ¿ªÊ¼Ö®Ç°£¬È·±£ÕýÈ·ÉèÖÃÁËDNS MX¼Ç¼.ÀýÈçʹÓÃ"domain.com"×÷ΪÓʼþÓò£¬¶ÔMX¼Ç¼½øÐвâÊÔ£º

ÔÚLinuxÏ£º

# host -t mx domain.com
domain.com. mail is handled by 10 mail.domain.com.
# host -t a mail.domain.com
mail.domain.com. has address xxx.xxx.xxx.xxx

ÔÚWindowsÏ£º

C:\>nslookup
Default Server: ns.domain.com
Address: xxx.xxx.xxx.xxx
>set type=mx
>domain.com
domain.com MX preference = 10, mail exchanger = mail.domain.com
mail.domain.com internet address = xxx.xxx.xxx.xxx
>exit

жÔØÒÑÓеÄÓʼþϵͳ
È·ÈÏûÓÐSMTP/POP/IMAP·þÎñÔÚÔËÐÐ:

/etc/init.d/sendmail stop
netstat -na | grep 25
netstat -na | grep 110
netstat -na | grep 143
ntsysv

ɾ³ýÒÑÓеÄSMTP/POP/IMAPÈí¼þ:

rpm -e --nodeps sendmail
rpm -e --nodeps postfix

ÏÂÔØÈí¼þ
ÎÄÖÐËùÓõÄÈí¼þ£º

netqmail-1.05.tar.gz
daemontools-0.76.tar.gz
daemontools-0.76.errno.patch
autorespond-2.0.5.tar.gz
toaster-scripts-0.6.tar.gz
qmail-toaster-0.6-1.patch.bz2
ezmlm-0.53.tar.gz
ezmlm-idx-0.42.tar.gz
courier-imap-2.2.2.20040207.tar.bz2
igenus_2.0.2_20040901_release.tgz
mysql-server-3.23.58-1.i386.rpm
qmailadmin-1.2.3.tar.gz
chkuser-0.6.mysql.patch
ucspi-tcp-0.88.a_record.patch
ucspi-tcp-0.88.errno.patch
ucspi-tcp-0.88.nobase.patch
ucspi-tcp-0.88.tar.gz
vpopmail-5.4.7.tar.gz
qmailadmin-1.2.3.tar.gz
vqadmin-2.3.6.tar.gz
Mail-SpamAssassin-3.0.1.tar.gz
clamav-0.80.tar.gz
qmail-scanner-1.22.tgz
qms-analog-0.3.4.tar.gz
maildrop-1.7.0.tar.bz2
tnef-1.2.3.1.tar.gz
qmailanalog-0.70.tar.gz
qmailanalog-0.70.errno.patch
qlogtools-3.1.tar.gz
qlogtools_errno.patch
zlib-1.1.4.tar.gz
libpng-1.2.7.tar.gz
gd-1.8.3.tar.gz
mrtg-2.10.15.tar.gz
qmailmrtg7-4.0.tar.gz
igenus_admin_0.1.tgz
isoqlog-2.1.1.tar.gz


ÎÒ°ÑÏÂÎÄÖÐËùÌáµ½µÄÈí¼þ´ò³ÉÁËÒ»¸ö°ü,ÏÂÔصØַΪ:http://www.xuki.org/qmail_2.0.tar.g...?ݸöÈËÏ°¹ß°É¡?

tar -xzf netqmail-1.05.tar.gz
cd netqmail-1.05
./collate.sh

×¢Ò⣺./collate.shÕâÒ»²½²»ÒªÍü



--------------------------------------------------------------------------------

°²×°Èí¼þ

daemontools
daemontoolsÊÇÒ»¸öÊÕ¼¯¹ÜÀíUNIX½ø³ÌµÄ¹¤¾ß.ÓÃËüÀ´¼àÌýqmail-send,qmail-smtpd,qmail-pop3d.

°²×°£º
cd /home/pkg
tar -zxvf daemontools-0.76.tar.gz
cd admin/daemontools-0.76
patch -p1 < /home/pkg/netqmail-1.05/other-patches/daemontools-0.76.errno.patch
package/install
# ÑéÖ¤daemontoolsÒѾ­Õý³£ÔËÐУº
sleep 5
ps ax | grep svscan

ucspi-tcp

ucspi-tcp°üÀ¨tcpserverºÍtcpclient,Ò»¸öÃüÁîÐй¤¾ßÀ´½¨Á¢client-serverÓ¦ÓóÌÐò.

°²×°£º

cd /home/pkg
tar zxvf ucspi-tcp-0.88.tar.gz
cd ucspi-tcp-0.88
patch -p1 < ../ucspi-tcp-0.88.a_record.patch
patch -p1 < ../ucspi-tcp-0.88.errno.patch
patch -p1 < ../ucspi-tcp-0.88.nobase.patch
make
make setup check



qmail



Õâ¸ötoaster²¹¶¡£¬ÊÇÏÂÃæÕ⼸¸ö²¹¶¡µÄ×éºÏ:

smtp auth 0.4.2

qmail-queue (to allow for virus scanners)

maildir++ patch

support oversize dns packets (not necessary if you use dnscache)

mfcheck (check that the envelope sender has a dns entry)

tarpit delay

qregex (regular expression matching in badmailfrom and badmailto)

big concurrency (set the spawn limit above 255)



°²×°:

mkdir /var/qmail
groupadd nofiles
useradd -g nofiles -d /var/qmail/alias alias
useradd -g nofiles -d /var/qmail qmaild
useradd -g nofiles -d /var/qmail qmaill
useradd -g nofiles -d /var/qmail qmailp
groupadd qmail
useradd -g qmail -d /var/qmail qmailq
useradd -g qmail -d /var/qmail qmailr
useradd -g qmail -d /var/qmail qmails

# ÔÚÕâÀï°ÑvpopmailÓû§Ò²¼ÓÉÏ
groupadd -g 89 vchkpw
useradd -u 89 -g vchkpw vpopmail

cd /home/pkg
tar -xzf toaster-scripts-0.6.tar.gz
cd netqmail-1.05/
bunzip2 -c ../qmail-toaster-0.6-1.patch.bz2 | patch -p0
cd netqmail-1.05

# ×¢:ÔÚRedHatÉÏ£¬ÐèҪΪTLS²¹¶¡Á´½ÓÒ»¸öincludeÎļþ:
ln -s /usr/kerberos/include/com_err.h /usr/kerberos/include/krb5.h \
/usr/kerberos/include/profile.h /usr/include/

make
make setup check

# ÓÃÄã×Ô¼ºµÄÖ÷»úÃû´úÌæÏÂÃæµÄmail.domain.com
./config-fast mail.domain.com

cd /var/qmail/alias
touch .qmail-postmaster .qmail-mailer-daemon .qmail-root
chmod 644 /var/qmail/alias/.qmail*
cd -

echo 1 > /var/qmail/control/mfcheck
echo ./Maildir/ >/var/qmail/control/defaultdelivery

make cert
# °´ÌáʾÊäÈ빫˾ÐÅÏ¢

make tmprsadh
# ×¢:ÕâÀï¿ÉÄÜÒª¶àµÈÒ»»á

# ÓÃ"crontab -e"ÔÚcrontabÀïÔö¼ÓÏÂÃæÕâÌõ£¬Ã¿ÌìÍíÉϸüÐÂtemp keys
01 01 * * * /var/qmail/bin/update_tmprsadh > /dev/null 2>&1

Ϊqmail·þÎñ½¨Á¢¼à¿ØĿ¼ºÍÈÕÖ¾Îļþ:

mkdir -p /var/qmail/supervise/qmail-send/log
mkdir -p /var/qmail/supervise/qmail-smtpd/log
mkdir -p /var/qmail/supervise/qmail-pop3d/log
mkdir -p /var/qmail/supervise/qmail-pop3ds/log
chmod +t /var/qmail/supervise/qmail-send
chmod +t /var/qmail/supervise/qmail-smtpd
chmod +t /var/qmail/supervise/qmail-pop3d/log
chmod +t /var/qmail/supervise/qmail-pop3ds/log
cp /home/pkg/toaster-scripts-0.6/send.run /var/qmail/supervise/qmail-send/run
cp /home/pkg/toaster-scripts-0.6/send.log.run /var/qmail/supervise/qmail-send/log/run
cp /home/pkg/toaster-scripts-0.6/smtpd.run /var/qmail/supervise/qmail-smtpd/run
cp /home/pkg/toaster-scripts-0.6/smtpd.log.run /var/qmail/supervise/qmail-smtpd/log/run
cp /home/pkg/toaster-scripts-0.6/pop3d.run /var/qmail/supervise/qmail-pop3d/run
cp /home/pkg/toaster-scripts-0.6/pop3d.log.run /var/qmail/supervise/qmail-pop3d/log/run
cp /home/pkg/toaster-scripts-0.6/pop3ds.run /var/qmail/supervise/qmail-pop3ds/run
cp /home/pkg/toaster-scripts-0.6/pop3ds.log.run /var/qmail/supervise/qmail-pop3ds/log/run
echo 20 > /var/qmail/control/concurrencyincoming
chmod 644 /var/qmail/control/concurrencyincoming
chmod 755 /var/qmail/supervise/qmail-send/run
chmod 755 /var/qmail/supervise/qmail-send/log/run
chmod 755 /var/qmail/supervise/qmail-smtpd/run
chmod 755 /var/qmail/supervise/qmail-smtpd/log/run
chmod 755 /var/qmail/supervise/qmail-pop3d/run
chmod 755 /var/qmail/supervise/qmail-pop3d/log/run
chmod 755 /var/qmail/supervise/qmail-pop3ds/run
chmod 755 /var/qmail/supervise/qmail-pop3ds/log/run
mkdir -p /var/log/qmail/smtpd
mkdir -p /var/log/qmail/pop3d
mkdir -p /var/log/qmail/pop3ds
chown -R qmaill /var/log/qmail

Æô¶¯½Å±¾:

cp /home/pkg/toaster-scripts-0.6/rc /var/qmail/
cp /home/pkg/toaster-scripts-0.6/qmailctl /var/qmail/bin/
chmod 755 /var/qmail/rc
chmod 755 /var/qmail/bin/qmailctl

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

# ÓÃdaemontoolsÀ´Æô¶¯qmail-sendºÍqmail-smtpd
ln -s /var/qmail/supervise/qmail-send /var/qmail/supervise/qmail-smtpd /service

ÃüÁî:

# Æô¶¯£¬Í£Ö¹£¬ÖØÆô£¬²é¿´¶ÓÁеÈ
qmailctl start|stop|restart|doqueue|flush|reload|stat|pause|cont|cdb|queue|help


# ¼ì²é·þÎñ
netstat -an | grep 25
ps -ef | grep qmail
ps -efl | grep "service errors" | grep -v grep

ÈÕÖ¾£º

/var/log/maillog
/var/log/qmail/current
/var/log/qmail/pop3d/current
/var/log/qmail/pop3ds/current
/var/log/qmail/smtpd/current

ÎÒ½¨ÒéÖØлعËһϸղÅÎÒÃÇËù×öµÄ²½ÖèÒÔÊìϤ¶ÔqmailµÄ°²×°. ÏÂÃæÎÒÃǽ«¿ªÊ¼vpopmailµÄ°²×°.


--------------------------------------------------------------------------------

vpopmail



vpopmailÊÇÒ»¸öÒÔqmailΪ»ù´¡µÄÐéÄâÓò¹ÜÀí°ü

vpopmailµÄÓû§ºÍ×éÎÒÃÇÇ°±ßÒѾ­½¨Á¢ÁË

ÅäÖÃ:

mkdir -p /home/vpopmail/etc

# ÉèÖÃĬÈÏÓò£¬ºìÉ«²¿·Ý¸Ä³ÉÄãÒªÉèÖõÄÓò¡£
echo "domain.com" > /home/vpopmail/etc/defaultdomain

# ÉèÖÃsmtp¹æÔò£¬¹Ø±Õopen relays
echo '127.0.0.1:allow,RELAYCLIENT=""' > /home/vpopmail/etc/tcp.smtp
cd ~vpopmail/etc ; tcprules tcp.smtp.cdb tcp.smtp.tmp < tcp.smtp

# ÉèÖÃMySQLÐÅÏ¢£¬µÚÒ»¸övpopmailÊÇÕʺţ¬xukixuΪÃÜÂ룬µÚ¶þ¸övpopmailÊÇÊý¾Ý¿â
echo "localhost|0|vpopmail|xukixu|vpopmail" > ~vpopmail/etc/vpopmail.mysql
chmod 640 ~vpopmail/etc/vpopmail.mysql

chown -R vpopmail.vchkpw /home/vpopmail/etc

# ÔÚMySQLÀïÌí¼ÓvpopmailµÄÕʺÅ
/usr/local/mysql/bin/mysql -uroot --pxukixu


CREATE DATABASE vpopmail;
GRANT select,insert,update,delete,create,drop ON vpopmail.*
TO vpopmail@localhost IDENTIFIED BY 'xukixu';
FLUSH PRIVILEGES;
QUIT

°²×°:

cd /home/pkg/
tar zxvf vpopmail-5.4.7.tar.gz
cd vpopmail-5.4.7

.

# ´øÊý¾Ý¿âÖ§³Ö

./configure --enable-auth-module=mysql \
--enable-incdir=/usr/include/mysql \
--enable-libdir=/usr/lib/mysql \
--enable-mysql-logging \
--enable-mysql-limits \
--enable-valias \
--enable-logging=y


make
make install-strip

¹ÜÀí:

echo 'export PATH=$PATH:/home/vpopmail/bin' >> /etc/profile
source /etc/profile

# Ìí¼ÓÓò£¬ºìÉ«²¿·ÝÇ°ÃæÊÇÓòÃû£¬ºóÃæÊǹÜÀíÔ±(postmaster)ÃÜÂë
vadddomain domain.com xukixu

# Ìí¼ÓÓû§£¬ºìÉ«²¿·ÝΪע½â£¬²»ÓÃÊäÈë
vadduser -q 10485760S(ÓÊÏä´óС) xukixu@domain.com(ÓÊÏäÕʺÅ) 1234(ÃÜÂë)
vmoduser -c Ðí¾¸(ÓÊÏäÃèÊö) xukixu@domain.com

# ÉèÖÃÓÊÏäÈÝÁ¿´ïµ½90%µÄ¾¯¸æÐÅÏ¢
vi /home/vpopmail/domains/.quotawarn.msg

From: ÓÊÏä¹ÜÀíÔ±
Reply-To: postmaster@domain.com
To: ÓÊÏäÓû§
Subject: ÓÊÏä¿Õ¼ä¾¯¸æ
Mime-Version: 1.0
Content-Type: text/html; charset=gb2312
Content-Transfer-Encoding: base64

ÄúµÄÓÊÏä¿Õ¼äÒѾ­´ïµ½90%.Èç¹ûÏë¼ÌÐøʹÓã¬Çëɾ³ýһЩÐżþ.
Èç¹ûÐèÒª°ïÖú,ÇëÁªÏµÓÊÏä¹ÜÀíÔ±:
Email : postmaster@domain.com

# ÉèÖÃÓÊÏäÒÑÂúµÄ¾¯¸æÐÅÏ¢
echo "Óʼþ±»¾Ü¾ø,Óû§µÄÓÊÏä¿Õ¼äÒÑÂú." > /home/vpopmail/domains/.over-quota.msg

Æô¶¯½Å±¾:

cp /home/pkg/toaster-scripts-0.6/vpopmailctl /var/qmail/bin
ln -s /var/qmail/bin/vpopmailctl /usr/bin
chmod 755 /var/qmail/bin/vpopmailctl

# ÓÃdaemontoolsÀ´Æô¶¯qmail-pop3dºÍqmail-pop3ds
ln -s /var/qmail/supervise/qmail-pop3d /service
ln -s /var/qmail/supervise/qmail-pop3ds /service

ÃüÁî:

# Æô¶¯£¬Í£Ö¹£¬ÖØÆô£¬²é¿´¶ÓÁеÈ
vpopmailctl start|stop|restart|stat|pause|cont|help

# ¼ì²é·þÎñ
netstat -an | grep 110
ps -ef | grep qmail
ps -efl | grep "service errors" | grep -v grep

²¹¶¡:

# ´øÊý¾Ý¿âÖ§³Ö
cd /home/pkg/netqmail-1.05/netqmail-1.05
patch -p0 < /home/pkg/chkuser-0.6.mysql.patch

# Èç¹ûÊý¾Ý¿âÊÇ×Ô¶¨Òå°²×°µÄ£¬»¹Òª°Ñlibmysqlclient.a¸´ÖƵ½Ö¸¶¨Î»ÖÃ
mkdir -p /usr/local/mysql/lib/mysql/
cp /usr/local/mysql/lib/libmysqlclient.a /usr/local/mysql/lib/mysql/

make clean
make
qmailctl stop
make setup check
qmailctl start

°²×°Ñ¡Ïî²Î¿¼:


vpopmail 5.4.7
------------------------------------
vpopmail directory = /home/vpopmail
uid = 89
gid = 89
roaming users = OFF --disable-roaming-users (default)
password learning = OFF --disable-learn-passwords (default)
md5 passwords = ON --enable-md5-passwords (default)
file locking = ON --enable-file-locking (default)
vdelivermail fsync = OFF --disable-file-sync (default)
make seekable = ON --enable-make-seekable (default)
clear passwd = ON --enable-clear-passwd (default)
user dir hashing = ON --enable-users-big-dir (default)
address extensions = OFF --disable-qmail-ext (default)
ip alias = OFF --disable-ip-alias-domains (default)
domain quotas = OFF --disable-domainquotas (default)
auth module = mysql --enable-auth-module=mysql
mysql replication = OFF --disable-mysql-replication (default)
mysql logging = ON --enable-mysql-logging
mysql limits = ON --enable-mysql-limits
MySQL valias = ON --enable-valias
auth inc = -I/usr/include/mysql
auth lib = -L/usr/lib/mysql -lmysqlclient -lz -lm
system passwords = OFF --disable-passwd (default)
pop syslog = log success and errors including passwords
--enable-logging=v
auth logging = ON --enable-auth-logging (default)
one domain per SQL table = --disable-many-domains



#POP3ºÍSMTP²âÊÔ

ÓÃoutlook²âÊÔqmailµÄsmtpºÍpop3ÊÇ·ñÕý³££¬×¢ÒâÓÉÓÚvpopmailÖ§³ÖÐéÄâÓòÃû£¬ËùÒÔÔÚoutlookÖÐÉèÖÃÓʼþÕʺÅʱ£¬Óû§ÃûºóÒª¼ÓÉÏÓòÃû£¬Èçdemo@demo.com¡£smtpÊÇ´øÈÏÖ¤µÄ£¬ÔÚoutlookÖÐÒ²Òª×÷ÏàÓ¦ÉèÖ᣽¨ÒéÏȲâÊÔÕý³£ºóÔÙ½øÐÐÏÂÒ»²½°²×°¡£Èç¹ûqmail ³öÏÖÎÊÌ⣬¿É²é¿´mysqlÖеÄvpopmailÊý¾Ý¿â£¬/var/logϵÄmysqldºÍmaillogÈÕÖ¾¼Ç¼£¬ÕâÑùÈÝÒ׺ܿìÕÒ³öÎÊÌâ¡£



--------------------------------------------------------------------------------


courier-imap


Courier-IMAPÖ§³ÖIMAP/SIMAP·ÃÎÊ

°²×°:

cd /home/pkg
tar -xjf courier-imap-2.2.2.20040207.tar.bz2
cd courier-imap-2.2.2.20040207

# ×÷ΪvpopmailÓû§½øÐа²×°
chown -R vpopmail:vchkpw ../courier-imap-2.2.2.20040207
su vpopmail
./configure --with-redhat
# ×¢:RedhatÓû§ÐèҪʹÓÃ"--with-redhat"Ñ¡Ïî

make
exit
make install-strip
make install-configure

cp courier-imap.sysvinit /etc/rc.d/init.d/courier-imap
chmod 755 /etc/rc.d/init.d/courier-imap
chkconfig --add courier-imap

ÅäÖÃ:

# ÐÞ¸ÄÎļþ/usr/lib/courier-imap/etc/authdaemonrc

authmodulelist="authvchkpw"

# ÐÞ¸ÄÎļþ/usr/lib/courier-imap/etc/imapd

IMAPDSTART=YES

# ÐÞ¸ÄÎļþ/usr/lib/courier-imap/etc/imapd-ssl

IMAPDSSLSTART=YES


Æô¶¯:


/etc/rc.d/init.d/courier-imap start




--------------------------------------------------------------------------------

autorespond

AutorespondÊÇÒ»¸ö×Ô¶¯»Ø¸´¹¤¾ß£¬¿ÉÒԺܺõÄÓëqmailadminÅäºÏʹÓÃ

°²×°:

cd /home/pkg
tar -xvzf autorespond-2.0.5.tar.gz
cd autorespond-2.0.5
make
make install

ezmlm

exmlmÊÇÒ»¸ö¿ìËÙ£¬Ç¿´óµÄÓʼþÁбí³ÌÐò£¬¿ÉÒÔͨ¹ýqmailadmin¶ÔÆä½øÐÐÅäÖÃ

1.×¢Ò⣺ΪÁËÆôÓÃmaillistµÄMySQLÖ§³Ö£¬Äã±ØÐëÊ×ÏÈ£º
½¨Á¢mysql¹ÜÀíÓû§£º£¨Ex:user:ezmlm,pass:ezmlm£©
# mysql -u root -pxukixu
>use mysql;
>insert into user values('localhost','ezmlm','','y','y','y','y','y','y','y','y','y','y','y','y','y', 'y');
>update user set password=password('ezmlm') where user='ezmlm';
>FLUSH PRIVILEGES;
>exit;
½¨¿â£º(Ex:database:ezmlm)
# mysqladmin -u root -pxukixu create ezmlm



2.°²×°:

cd /home/pkg
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 < idx.patch
chmod u+x makelang
make mysql #MySQL Ö§³Ö
make clean
make man
make ch_GB #ºº×ÖGB2312Ö§³Ö
ÐÞ¸Äconf-sqlccÎļþ
ÄÚÈÝΪ£º-I/usr/include/mysql

ÐÞ¸Äconf-sqlld
ÄÚÈÝΪ£º -L/usr/lib/mysql -lmysqlclient -lnsl -lm -lz

ÐÞ¸Äconf-bin
µÚÒ»ÐУº/var/qmail/bin/ezmlm

ÐÞ¸Äconf-man
µÚÒ»ÐУº/var/qmail/man

ÐÞ¸Äconf-qmail
µÚÒ»ÐУº/var/qmail

# make setup

3.ÔÚÄ㽨Á¢Ò»¸ö»ùÓÚMySQLµÄmaillist֮ǰ£¬Äã±ØÐë±£Ö¤ezmlm¿âÖÐÒÑ´æÔÚÒ»¸ö¶ÔÓ¦µÄ±í£º
Ex:ÄãÏ뽨һ¸ö»ùÓÚMySQLµÄmaillist:testlist

# /var/qmail/bin/ezmlm/ezmlm-mktab -d testlist | mysql -uezmlm -pezmlm -f ezmlm


ÕâÑù¾ÍÔÚezmlm¿âÖÐΪtestlist½¨Á¢ÁËһϵÁÐÏà¹Ø±í¸ñ£º
+------------------------+
| Tables |
+------------------------+
| testlist |
| testlist_allow |
| testlist_allow_slog |
| testlist_cookie |
| testlist_deny |
| testlist_deny_slog |
| testlist_digest |
| testlist_digest_cookie |
| testlist_digest_mlog |
| testlist_digest_slog |
| testlist_mlog |
| testlist_mod |
| testlist_mod_slog |
| testlist_slog |
+------------------------+

Äã¿ÉÒÔÓÃÒ»ÏÂÃüÁî²ì¿´£¡
# mysqlshow -u root -pxukixu ezmlm



--------------------------------------------------------------------------------

qmailadmin

qmailadmin³ýÁ˲»ÄÜÌí¼Óɾ³ýÐéÄâÓòÍâ,¼¸ºõ¿ÉÒÔÍê³ÉËùÓеÄÐéÄâÓò¹ÜÀí

°²×°:

cd /home/pkg
tar -xvzf qmailadmin-1.2.3.tar.gz
cd qmailadmin-1.2.3

./configure --enable-htmldir=/var/www/html \
--enable-cgibindir=/var/www/cgi-bin \
--enable-vpopuser=vpopmail \
--enable-autoresponder-bin=/usr/bin \
--enable-ezmlmdir=/var/qmail/bin/ezmlm \
--enable-maxusersperpage=20 \
--enable-maxaliasesperpage=20 \
--enable-modify-quota \
--enable-domain-autofill

make
make install-strip
cd /usr/local/share/qmailadmin/lang
mv en en.bak
cp zh-cn en

°²×°Ñ¡Ïî²Î¿¼:


qmailadmin 1.2.3
---------------------------------------
cgi-bin dir = /var/www/cgi-bin
html dir = /var/www/html
image dir = /var/www/html/images/qmailadmin
image URL = /images/qmailadmin
template dir = /usr/local/share/qmailadmin
qmail dir = /var/qmail
vpopmail dir = /home/vpopmail
autorespond dir = /usr/bin
ezmlm dir = /usr/local/bin/ezmlm
ezmlm idx = yes
mysql for ezmlm = yes
help = no
modify quota = yes
domain autofill = yes
modify spam check = no



--------------------------------------------------------------------------------

°²×°²¢ÔËÐÐigenus





1.µ½http://www.igenus.orgÏÂÔØ×îÐµİ²×°...901_release.tgz



#tar zxvf igenus_2.0.2_20040901_release.tgz -C /var/www/
#cd /var/www/
#rm -rf html/
#mv igenus html



2.½¨tempÎļþ¼Ð



cd /var/www/html/


#mkdir temp



#chmod -R 0755 temp



#chown -R vpopmail:vchkpw temp

#mkdir /home/netdisk



#chmod -R 0755 /home/netdisk



#chown -R vpopmail:vchkpw /home/netdisk

#chmod -R 0755 /var/www/html/



#chown -R vpopmail:vchkpw /var/www/html/



3.ÐÞ¸Ähttpd.conf



#vi /etc/httpd/conf/httpd.conf


Group vchkpw


User vpopmail


DocumentRoot "/var/www/html/"



AddDefaultCharset GB2312 //ʹĬÈÏÒ³ÃæΪÖÐÎÄ



#/etc/rc.d/init.d/httpd restart //ÖØÆôapache£¬Ê¹ÐÞ¸ÄÉúЧ



4.ÐÞ¸Äconfig_inc.phpÎļþ



# cd /var/www/html/igenus/config



# vi config_inc.php



$CFG_BASEPATH = "/var/www/html/igenus"; \\¸Ä³ÉÄã°²×°µÄĿ¼



$CFG_MYSQL_HOST = 'localhost';



$CFG_MYSQL_USER = 'vpopmail'; \\vpopmail·ÃÎÊmysqlµÄÕʺÅ



$CFG_MYSQL_PASS = 'xukixu'; \\vpopmail·ÃÎÊmysqlµÄÃÜÂë



$CFG_MYSQL_DB = 'vpopmail'; \\Êý¾Ý¿â



$CFG_TEMP = $CFG_BASEPATh."/temp"; \\¸Ä³ÉÄã°²×°µÄĿ¼µÄµ±Ç°Ä¿Â¼ÏÂ


5.ÖØбàÖÆMysqlÊý¾Ý¿â±í¸ñ

ɾ³ý֮ǰ´´½¨µÄÓòÃû

#/home/vpopmail/bin/vdeldomain domain.com


/usr/local/mysql/bin/mysql -uroot --pxukixu

alter table vpopmail.vpopmail drop primary key;
alter table vpopmail.vpopmail add column pw_id int(5) unsigned NOT NULL PRIMARY KEY auto_increment;
alter table vpopmail.vpopmail add KEY pw_name (pw_name,pw_domain);

±à¼­/var/www/html/docs/iGENUS.sql
# phpMyAdmin SQL Dump
# version 2.5.3
# http://www.phpmyadmin.net
#
# Host: localhost
# Generation Time: Jun 04, 2004 at 11:26 AM
# Server version: 3.23.55
# PHP Version: 4.3.0
#
# Database : `vpopmail`
#

# --------------------------------------------------------

#
# Table structure for table `address`
#

use vpopmail; //¼ÓÈëÕâÒ»ÐÐ
CREATE TABLE `address` (
`id` int(11) unsigned NOT NULL auto_increment,
`pw_id` int(5) NOT NULL default '0',
`name` varchar(64) NOT NULL default '',
`email` varchar(128) NOT NULL default '',
UNIQUE KEY `id` (`id`),
KEY `pw_id` (`pw_id`)
) TYPE=MyISAM PACK_KEYS=1 ;

# --------------------------------------------------------
ɾ³ý´´½¨'lastauth'±í²¿·Ý¡£

ÔËÐÐ
#mysql -u root -pxukixu

6. ÉèÖÃigenus ¶¨ÒåÔÊÐíÉÏ´«ÏÂÔصÄÓʼþµÄ´óС

±à¼­/etc/php.ini

max_execution_time=60

memory_limit=20M

post_max_size = 10M

file_uploads=on

upload_max_filesize=10M

register_globals=On

session.bug_compat_42=0

session.bug_compat_warn=0

sendmail_path = /var/qmail/bin/qmail-inject

7£®±à¼­/etc/http/conf/httpd.conf


AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps


DirectoryIndex index.php index.html


NameVirtualHost *:80




ServerName mail.domain.net

DocumentRoot /var/www/html



ÖØÆôapache:

#service httpd restart


8.Èç¹ûÐèÒª£¬ÓÃvadddomainºÍvadduserÌí¼ÓÐÂÓòÃûºÍÐÂÓû§¡£



×îºó´ò¿ªä¯ÀÀÆ÷£¬ÊäÈëhttp://domain.com/£¬¾Í¿ÉÒÔ·ÃÎÊÍøÕ¾ÁË¡£

9.QmailÏÞÖƸ½¼þµÄ´óС



ÔÚ/var/qmail/control/databytes ÎļþÖÐÉèÖø½¼þµÄ´óС£¬¿ÉÒÔʵÏÖ¶Ôqmail¸½¼þ´óСµÄÏÞÖÆ£¬Ò»°ã°²×°Íê³Éºó£¬Õâ¸öÎļþÊÇûÓеģ¬Äã¿ÉÒÔ×Ô¼º´´½¨¡£



smtp·½Ê½ÊÇÒÔqmailµÄdatabytes×÷ÏÞÖƵÄ



´´½¨databytes²¢ÉèÖÃÓʼþ×î´óΪ4m



# echo 4000000 >/var/qmail/control/databyte



10.ÏÞÖƵ¥ÓòµÄÓÊÏäÊýÁ¿



vi /home/vpopmail/domains/domain.com/.qmailadmin-limits



maxpopaccounts 200



default_quota 52428800s



chmod 700 /home/vpopmail/domains/domain.com/.qmailadmin-limits



chwod vpopmail:vchkpw /home/vpopmail/domains/domain.com/.qmailadmin-limits


ÕâÑù¾Í°ÑÓÊÏä×ÜÊýÏÞÖÆÔÚ200¸ö£¬Ã¿¸öÓÊÏäΪ50MÁË



11.ÓÃqmail·âmailfrom



vi/var/qmail/control/badmailfrom



Õâ¸ö¿ØÖÆÎļþʵÏÖ¾ÜÊÕÓʼþ¹¦Äܵģ¬Ã¿Ò»¸öµØÖ·Òªµ¥¶ÀÒ»ÐС£¶øÇÒ£¬²»ÓÃÖØÆðqmail¾ÍÄÜÉúЧ¡£ÀýÈ磺



peng@96633.net -----ÏÞÖÆÒ»¸öÌض¨µÄÓû§



@sina.com -----ÏÞÖÆÕû¸öÓòÖеÄÓʼþ



--------------------------------------------------------------------------------

°²×°²¢ÔËÐÐiGenus_Admin

iGenus_Admin°²×°

#ÏÂÔØ
´Ówww.igenus.org ÏÂÔØigenus_adminµÄ°²×°Îļþigenus_admin_0.1.tgzµ½/home/pkg

#°²×°
tar -xzvf igenus_admin_0.1.tgz -C /var/www/html/

#ÉèÖÃ
vi /var/www/html/admin/includes/config_inc.php

/*-
* iGENUS webmail
*
* Copyright (c) 1999-2002 by iGENUS Org.
* All rights reserved.
* Author: Wu Qiong <wuqiong@sczg.com>
*
* $Id: config_inc.php,v 1.11 2004/03/23 13:59:12 wuqiong Exp $
*/

if(!defined("INCLUDE_CONFIG_OK")) {
define("INCLUDE_CONFIG_OK","TRUE");

/* gid flags defind by vpopmail.h */

// define('NO_PASSWD_CHNG',0x01);
define('NO_POP', 0x02);
define('NO_WEBMAIL', 0x04);
// define('NO_IMAP', 0x08);
// define('BOUNCE_MAIL', 0x10);
// define('NO_RELAY', 0x20);
// define('NO_DIALUP', 0x40);
// define('V_USER0', 0x080);
// define('V_USER1', 0x100);
// define('V_USER2', 0x200);
// define('V_USER3', 0x400);
define('NO_SMTP', 0x800);
// define('QA_ADMIN', 0x1000);

$CFG_VPOPMAIL_HOST = "localhost";
$CFG_VPOPMAIL_USER = "vpopmail";¡¡\\¸ÄΪÄãµÄÕʺÅ
$CFG_VPOPMAIL_PASS = "vpopmail"; \\¸ÄΪÄãµÄÃÜÂë
$CFG_VPOPMAIL_DB = "vpopmail";
$CFG_VPOPMAIL_TABLE = "vpopmail";
$CFG_ADMIN_TABLE = "admin";
$CFG_LAGESITE = true;
$CFG_NUMOFPAGE = 20;

$CFG_MAILBOX['inbox'] = ".";
$CFG_MAILBOX['outbox'] = ".Outbox";
$CFG_MAILBOX['draft'] = ".Draft";
$CFG_MAILBOX['trash'] = ".Trash";

$CFG_VPOPMAIL_PATH = "/home/vpopmail"; \\¸ÄΪÄãµÄvpopmail°²×°Ä¿Â¼¡¡
// $CFG_VPOPMAIL_PATH = "/home2/vpopmail";

$CFG_SYSADMIN_NAME = "Admin";
$CFG_SYSADMIN_PASSWD= '$1$GvmONIco$0SwBB.mEoP3KJ5Zda7ioV0';

$CFG_SYSADMIN_PASSWD_FILE = $CFG_VPOPMAIL_PATH . "/etc/syspasswd.dat";
$CFG_TIMEOUT = 600;

$CFG_IGENUS_ADM = "iGENUSÓʼþϵͳ¹ÜÀí";

$CFG_TEMPLATE_PATH = "template/";
}
?>

±£´æÍ˳ö

touch /etc/syspasswd.dat

chown -R vpopmail.vchkpw /var/www/html
chmod -R 755 /var/www/html

#µÇ¼ÉèÖÃÒ³Ãæ
http;//domain.com/admin/sys/

Óû§:AdminÃÜÂëAdminÀ´µÇ¼.×¢ÒâAÒª´óд..Õâ¸ö¹ÜÀíÕʺÅÃÜÂëµÇ¼ºó¿ÉÒԸĵÄ

µÇ¼ºó,Ê×Ïȵã"¸üÐÂÊý¾Ý¿â"Äã¾Í»á¿´¼ûÄãµÄÓòÃûÀ².È»ºóµã"±à¼­"°Ñ"µÇ¼ȨÏÞ ¸ÃÓò¹ÜÀíÔ±£¨Postmaster£©ÓÐȨµÇ¼½øÐÐÓû§¹ÜÀí"ÕâÒ»Ïî´ò¹´,È·ÈϺó,¾Í¿ÉÒÔÓÃ

http;//domain.com/admin/

À´µÇ¼¹ÜÀíÁË¡£





--------------------------------------------------------------------------------






vqadmin
vqadminÊÇÒ»¸ö»ùÓÚweb µÄ¿ØÖÆͨµÀ. ËüÔÊÐíϵͳ¹ÜÀíÔ±¿ÉÒÔÖ´ÐÐrootÓû§²ÅÄܽøÐеIJÙ×÷.

cd /home/pkg
tar -zxf vqadmin-2.3.6.tar.gz
cd vqadmin-2.3.6
vi db_owner.c

static const char *host="localhost";
static const char *user="vpopmail";
static const char *passwd="xukixu"; /* NULL for no password */
static const char *db="vpopmail";

./configure --enable-mysql=y
make
make install

±à¼­Êý¾Ý¿â£¬¼ÓÈëdomain_owner±í

mysql -uroot -pxukixu
use vpopmail;

CREATE TABLE domain_owner (
domain CHAR(64) NOT NULL,
owner CHAR(32) NOT NULL,
PRIMARY KEY(domain, owner)
);


ÏÖÔÚÎÒÃÇÐèÒª½«ÏÂÃ漸ÐÐÌí¼Óµ½httpd.confÎļþÖÐ:

vi /etc/httpd/conf/httpd.conf

deny from all
Options ExecCGI
AllowOverride AuthConfig
Order deny,allow

±£´æÎļþ²¢Í˳ö.

cd /var/www/cgi-bin/vqadmin
chown nobody .htaccess
chmod 600 .htaccess
# ´´½¨Ò»¸ö¹ÜÀíÕʺż°ÃÜÂë
htpasswd -bc /etc/httpd/conf/vqadmin.passwd admin(ÕʺÅ) adminpass(ÃÜÂë)
chown nobody.nobody /etc/httpd/conf/vqadmin.passwd

chmod 644 /etc/httpd/conf/vqadmin.passwd

chown -R vpopmail.vchkpw /var/www/cgi-bin


#±à¼­.htaccess

vi .htaccess

AuthType Basic
AuthUserFile /etc/httpd/conf/vqadmin.passwd
AuthName vQadmin
require valid-user
satisfy any



service httpd restart
ÔÚÄãµÄä¯ÀÀÆ÷ÉϲâÊÔһϰ²×°½á¹û:

http://www.domain.com/cgi-bin/vqadmin/vqadmin.cgi


--------------------------------------------------------------------------------

SpamAssassin

°²×° SpamAssassin
SpamÊÇÒ»¸öÈÃÈËÌÖÑáµÄ×ÖÑÛ. ´ó²¿·ÖµÄÈ˶¼²»Ï²»¶Ëü. Èç¹ûÄãÏë±£»¤×Ô¼ºÃâÊÜspam, Äã¾ÍÐèÒª°²×°SpamAssassin.

°²×°SpamAssassin ÒªÓõ½Time-HiRes¡¢Digest-SHA1¡¢HTML-ParserºÍHTML-Tagset. Èç¹ûÄãûÓа²×°µÄ»°,±ØÐëÊ×ÏÈ°²×°Ëü,´ËÎļþ¾ùÔÚRHAS3°²×°¹âÅ̵ڶþºÍµÚÈýÕÅÖС£¶ÔÓ¦µÄÈí¼þ°üΪ£º


perl-Time-HiRes-1.38-3.i386.rpm
perl-Digest-SHA1-2.01-15.1.i386.rpm
perl-HTML-Parser-3.26-17.i386.rpm
perl-HTML-Tagset-3.03-28.noarch.rpm


# °²×°SpamAssassin

groupadd spamd

useradd -g spamd -s /bin/false spamd


cd /home/pkg
tar -xzvf Mail-SpamAssassin-3.0.1.tar.gz
cd Mail-SpamAssassin-3.0.1

export LC_ALL=C
perl Makefile.PL
make
make install

#ÎÒÃÇÏëÒªSpamAssassin Ëæϵͳ×Ô¶¯Æô¶¯£¬°²×°Ä¿Â¼ÖÐÌṩÁËÒ»¸öÆ𶯽ű¾

cp spamd/redhat-rc-script.sh /etc/rc.d/init.d/spamd

vi /etc/rc.d/init.d/spamd

SPAMDOPTIONS="-d -c -u spamd -H /home/spamd -m5 -H"
ÐÞ¸ÄÆäÖÐÒ»ÐÐΪÉÏËùʾ¡£

chmod 755 /etc/rc.d/init.d/spamd

chkconfig --add spamd

spamassassinµÄ¹ýÂËÄ£°åÔÚ/etc/mail/spamassassin/local.cf,ÐÞ¸ÄΪ£º

required_hits 5.0
rewrite_subject 1
subject_tag ********SPAM********
report_safe 1
defang_mime 0
rewrite_subject 0
report_header 1
use_terse_report 1
use_bayes 1
auto_learn 1
skip_rbl_checks 1
use_razor2 0
use_dcc 0
use_pyzor 0

score SUBJ_FULL_OF_8BITS 0.0
score BASE64_ENC_TEXT 0.0
score BAYES_99 0.1
score BAYES_90 0.1
score SUBJ_ILLEGAL_CHARS 0.1
score FROM_ILLEGAL_CHARS 0.5
score HEAD_ILLEGAL_CHARS 0.5
score MIME_BASE64_TEXT 0.5
ok_locales en zh

chmod 755 /etc/rc.d/init.d/spamd
chkconfig --add spamd
service spamd start

# ½øÐÐÒ»¸öspamºÍnon-spamµÄ²âÊÔ
spamassassin -t < sample-spam.txt > spamtest.txt
less spamtest.txt
spamassassin -t < sample-nonspam.txt > nospamtest.txt
less nospamtest.txt
spamtest.txtÎļþÔÚÖ÷ÌâÒ»¶ÎÖн«°üº¬"*****SPAM*****" ÕâÒ»ÐÐ, ¶ønospamtest.txtÎļþÖÐÔòûÓÐ.

½¨Á¢SpamAssassinµÄѧϰϵͳ
#sa-learn --rebuild -D -p user_prefs
sa-learn --dump all¿ÉÒԲ鿴×ÔѧϰµÄÊý¾ÝÐÅÏ¢


--------------------------------------------------------------------------------

Clamav

Ìí¼ÓËùÐèµÄ×éºÍÓû§

groupadd clamav
useradd -g clamav -s /bin/false clamav

°²×°Èí¼þ
tar -xzvf clamav-0.80.tar.gz
cd clamav-0.80
./configure
make check
make install

²âÊÔClamav
clamscan --recursive --log=/tmp/clamscan.log ./ //ɨÃ赱ǰĿ¼£¬²âÊÔclamscnÊÇ·ñÔËÐÐ
cat /tmp/clamscan.log

¸ü¸Ä/usr/local/etc/freshclam.confÎļþ£¬È¥µôÏÂÃæÑ¡ÏîÇ°ÃæµÄ£££º
vi /usr/local/etc/freshclam.conf
#Example \\Ç°Ãæ¼ÓÉÏ#
UpdateLogFile /var/log/freshclam.log \\È¥µôÇ°ÃæµÄ#
LogSyslog \\È¥µôÇ°ÃæµÄ#

¸ü¸Ä/usr/local/etc/clamav.confÎļþ£¬È¥µôÏÂÃæÑ¡ÏîÇ°ÃæµÄ£££º

vi /usr/local/etc/clam.conf
#Example \\Ç°Ãæ¼ÓÉÏ#
LogFile /var/log/clamav/clamd.log \\È¥µôÇ°ÃæµÄ#
LogFileMaxSize 2M \\È¥µôÇ°ÃæµÄ££
LogTime \\È¥µôÇ°ÃæµÄ££
PidFile /var/run/clamd.pid \\È¥µôÇ°ÃæµÄ££
DataDirectory /var/lib/clamav \\È¥µôÇ°ÃæµÄ£££¬²¢ÇÒÐ޸ķ¾¶Îª/usr/local/share/clamav
LogSyslog \\È¥µôÇ°ÃæµÄ#
ScanMail \\È¥µôÇ°ÃæµÄ#

Éý¼¶clamscan²¡¶¾¿â
freshclam --verbose

°Ñfreshclam¼ÓÈëcrontab ¶¨Ê±¸üв¡¶¾¿â,×Ô¶¯É¨Ãè/homeĿ¼

crontab -e

0 1 * * * freshclam --quiet -l /var/log/freshclam.log

0 6 * * * /usr/local/bin/clamscan --recursive --infected --exclude /usr/local/share/clamav/viruses.db --exclude /usr/local/share/clamav/viruses.db2 --log=/var/log/clamscan.log /home


´´½¨freshclamÈÕÖ¾¼Ç¼Îļþ

mkdir -p /var/log/clamav
touch /var/log/clamav/clamd.log
chown clamav.clamav -R /var/log/clamav/

chmod 644 clamav.clamav -R /var/log/clamav/


touch /var/log/freshclam.log
chmod 644 /var/log/freshclam.log
chown clamav:clamav /var/log/freshclam.log

´´½¨clamavÆô¶¯½Å±¾
vi /etc/rc.d/init.d/clamav

#!/bin/sh
#
# Startup / shutdown script for Clam Antivirus


case "$1" in
start)
/usr/local/sbin/clamd && echo -n 'Clamd started'
/usr/local/bin/freshclam -d -c 2 -l /var/log/freshclam.log
echo -n ' freshclam started'
;;

stop)
/usr/bin/killall clamd > /dev/null 2>&1 && echo -n 'Clamd stoped'
/usr/bin/killall freshclam > /dev/null 2>&1 && echo -n ' freshclam Stoped'
;;

*)
echo ""
echo "Usage: `basename $0` { start | stop }"
echo ""
exit 64
;;
esac

ʹÆäÄܹ»Ö´ÐÐ
chmod 755 /etc/rc.d/init.d/clamav

Ë濪»úÆð¶¯
echo /etc/rc.d/init.d/clamav start >/etc/rc.d/rc.local


--------------------------------------------------------------------------------

qmail-scanner&qms-analog

ΪÁËÄܹ»É¨ÃèÓʼþ·þÎñÆ÷Öнø³öµÄÓʼþ, ÎÒÃÇÐèÒª°²×° qmail-scanner. Èç¹ûÄã֮ǰûÓа²×°perl-suidperl,ÎÒÃÇ»¹ÐèÒª°²×°Ëü

cd /home/pkg
rpm -Uvh perl-suidperl-5.8.0-88.3.i386.rpm

½â¿ªqmail-scanner...

tar zxvf qmail-scanner-1.22.tgz

½âѹqms-analog...

tar zxvf qms-analog-0.3.4.tar.gz

cd qms-analog-0.3.4

make all

ÏÂÒ»²½£¬ÎÒÃÇ¿½±´ËùÐèÒªµÄqms-analogÎļþµ½qmail-scanner°²×°Ä¿Â¼

cp qmail-scanner-1.22-st-qms-20040530.patch /home/pkg/qmail-scanner-1.22/

cp qms-config-script /home/pkg/qmail-scanner-1.22/

ÏÖÔÚ£¬ÈÃÎÒÃÇ´òÉÏqms-analog²¹¶¡

cd /home/pkg/qmail-scanner-1.22

chmod 755 qms-config-script

patch -p1 < qmail-scanner-1.22-st-qms-20040530.patch

¼ÌÐø°²×°qmail-scanner,Ìí¼ÓËùÐèµÄ×éºÍÓû§

groupadd qscand
useradd -g qscand -s /bin/false qscand

ÎÒÃÇͨ¹ýqms-config-script½Å±¾À´°²×°qmail-scanner£¬±à¼­qms-config-script

vi qms-config-script

ÐÞ¸ÄÏÂÃæºìÉ«²¿·ÝÒÔ´ïµ½ÎÒÃǵÄÐèÇó£º

#!/bin/sh

if [ "$1" != "install" ]; then
INSTALL=
else
INSTALL="--install"
fi

./configure --domain domain.com \
--qmail-queue-binary /var/qmail/bin/qmail-queue \
--admin postmaster \
--local-domains "domain1.com,domain2.com,......" \
--add-dscr-hdrs yes \
--dscr-hdrs-text "X-Antivirus-MYDOMAIN" \
--ignore-eol-check yes \
--sa-quarantine 0 \
--sa-delete 0 \
--sa-reject no \
--sa-subject ":SPAM:" \
--sa-alt yes \
--sa-debug no \
--notify admin \
--redundant yes \
--lang en_GB \
--debug yes \
--unzip yes \
--scanners clamscan,verbose_spamassassin \
"$INSTALL"

×¢Òâ: "--admin" ºÍ "--domain" ²ÎÊý×é³ÉÁËÕʺÅ"user"@"domain name". ¾¯¸æÏûÏ¢½«Í¨¹ýqmail-scanner ·¢ÍùÕâ¸öÓʼþÕʺÅ, ËùÒÔ±ØÐëÈ·ÈÏÕâÊÇÒ»¸ö¹ÜÀí¼¶±ðµÄÕʺÅ. ÁíÍâ,ËùÓÐÓòµÄ¾¯¸æÐÅÏ¢¶¼»á·¢¸øÕâ¸öÕʺÅ, ËùÒÔÒ»¶¨ÒªÐ¡ÐÄ.

±£´æ²¢Í˳ö¡£

ÏÖÔÚÎÒÃDzâÊÔqmail-scanner°²×°

./qms-config-script

ÔÚµÚÒ»²½Ê±, °´y ÔÊÐíqmail-scannerÌáÇ°configure. µÚ¶þ²½Ê±, °´y,½¨Á¢ qmail-queue-scanner.pl Îļþ.

²âÊÔÈç¹ûûÓдíÎó ,¾Í¿ÉÒÔ½øÐÐÏÂÒ»²½°²×°

./qms-config-script install

¿´¿´/var/qmail/bin/qmail-scanner-queue.plÊÇ·ñ´æÔÚ

chown qscand:qscand /var/qmail/bin/qmail-scanner-queue.pl
chmod 4755 /var/qmail/bin/qmail-scanner-queue.pl

È»ºóÓÃÒ»¸öÆÕͨÓû§µÇ½£¬Ö´ÐÐ/var/qmail/bin/qmail-scanner-queue.pl -z

setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -z //Èç¹ûûÓÐCan't do setuid³öÏÖ£¬°²×°OK

setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -r //²é¿´qmailscanµ±Ç°°üº¬µÄÌØÕ÷

setuidgid qscand /var/qmail/bin/qmail-scanner-queue.pl -g //±£´æqmailscan¶¨ÒåÌØÕ÷µÄÐ޸ģ¬Ê¹ËûÉúЧ¡£

chown qscand:qscand /var/qmail/bin/qmail-scanner-queue.pl
chmod 4755 /var/qmail/bin/qmail-scanner-queue.pl


chown -R qscand:qscand /var/spool/qmailscan

vi /var/qmail/supervise/qmail-smtpd/run

ÔÚÄãµÄqmailÆô¶¯½Å±¾¼ÓÈëºìÉ«²¿·Ý
#!/bin/sh
QMAILDUID=`id -u vpopmail`
NOFILESGID=`id -g vpopmail`
PATH=$PATH:/usr/local/bin:/var/qmail/bin
QMAILQUEUE="/var/qmail/bin/qmail-scanner-queue.pl" export QMAILQUEUE
MAXSMTPD=`cat /var/qmail/control/concurrencyincoming`
exec /usr/local/bin/softlimit -m 40000000 \
/usr/local/bin/tcpserver -v -H -R -l 0 \
-x /home/vpopmail/etc/tcp.smtp.cdb -c "$MAXSMTPD" \
-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \
/var/qmail/bin/qmail-smtpd \
/home/vpopmail/bin/vchkpw /bin/true 2>&1

ºóÖØÐÂÆô¶¯smtp·þÎñ

qmailctl stop

qmailctl start

qmailctl stat

ÕâÀïÓвâÊÔ³ÌÐò

cd /home/pkg/qmail-scanner-1.23/contrib/

chmod 755 test_installation.sh

./test_installation.sh -doit

Õâ¸ö½Å±¾»áÉ趨µÄ¹ÜÀíÔ±ÓʼþµØÖ··¢ËÍ3¸öÓʼþ£¬µÚÒ»¸öÓʼþÊÇÒ»°ãµÄÕý³£Óʼþ£¬µÚ¶þ¸öÓʼþÖлá°üº¬eicar.com²âÊÔ²¡¶¾£¬µÚÈý¸öÓʼþͬÑù°üº¬eicar.com²âÊÔ²¡¶¾£¬²»¹ýËù¸½´øµÄÎļþÃû²»ÊÇeicar.com¡£
Èç¹ûqmail-scanner°²×°ÕýÈ·£¬¹ÜÀíÔ±¾ÍÓ¦¸Ã¿ÉÒÔÊÕµ½¹ØÓÚºóÃæµÄÁ½¸öÓʼþµÄ¾¯¸æÓʼþ¡£
Èç¹ûϵͳ³ö´í£¬¿ÉÒԲ鿴/var/spool/qmailscan/qmail-queue.logÈÕÖ¾Îļþ¡£
qmail-scannerµÄÌØÕ÷¹ýÂËÔÚ/var/spool/qmailscan/quarantine-atachments.txt

Ö÷ÒªµÄÅÅ´í¼à²âÈÕÖ¾
/var/spool/qmailscan/quarantine.log
/var/spool/qmailscan/qmail-queue.log
/var/spool/qmailscan/qms-events.log
/var/log/clamav/clamd.log
/var/log/maillog


--------------------------------------------------------------------------------

MailDrop and TNEF reader

TNEFÊÇÒ»¸ö´Ó"application/ms-tnef". ÀàÐÍÖÐÕÒ³öMIME¸½¼þµÄ³ÌÐò.Õâ½ö½öÊÇ΢ÈíϵͳÖеÄÒ»ÖÖ¸½¼þ.

TNEF³ÌÐòÔÊÐí½«·â×°³ÉTNEFµÄ¸½¼þÌáÈ¡³öÀ´. °²×°TNEF²¢²»ÊDZØÐëµÄ, µ«ÎÒÇ¿ÁÒÍƼö°²×°Ëü!

# °²×° maildrop
cd /home/pkg
tar -jzvf maildrop-1.7.0.tar.bz2
cd maildrop-1.7.0
./configure
make
make install-strip
make install-man

# °²×° the tnef
cd /home/pkg
tar -xzvf tnef-1.2.3.1.tar.gz
cd nef-1.2.3.1
./configure
make
make install



ʹÓÃMaildropµ÷ÓÃSpamAssassin

ÔÚ/home/vpopmail/domains/localhost.com(Äã´´½¨µÄÓò)/ ½¨Á¢mailfilterÎļþ
touch mailfilter
chown vpopmail:vchkpw mailfilter
chmod 700 mailfilter


mailfilterÄÚÈÝÈçÏ£º

VPOP="| /home/vpopmail/bin/vdelivermail '' bounce-no-mailbox"
VHOME=`/home/vpopmail/bin/vuserinfo -d $EXT@$HOST`

if ( $SIZE < 262144 )
{
exception {
xfilter "/usr/bin/spamc -f -u $EXT@$HOST"
}
}

if (/^X-Spam-Flag: YES/)
{
# try filtering it using user-defined rules
exception {
include $VHOME/Maildir/.mailfilter
}
# 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 {
include $VHOME/Maildir/.mailfilter
}
exception {
to "$VPOP"
}
}

ÐÞ¸Ä.qmail-defaultÄÚÈÝÈçÏ£º
| /usr/local/bin/maildrop ./mailfilter


--------------------------------------------------------------------------------

QmailAnalog & qlogtools

QmailanalogÕë¶ÔqmailµÄÈÕÖ¾½øÐÐһЩ×î»ù±¾µÄ·ÖÎö£¬²¢½«½á¹û·¢Ë͵½ÄãÖ¸¶¨µÄλÖá£ÔÚÎҵķ½°¸ÖУ¬ÉèÖÃqmailanalogÿÌìÍíÉÏÔËÐУ¬²¢½«½á¹û·¢Ë͸ø¹ÜÀíÔ±¡£ÔÚʹÓÃqmailanalogʱ£¬ÎÒÃÇ»¹½«»áÓõ½ qlogtoolsÈí¼þ°ü¡£qlogtoolsÌṩһϵÁзÖÎöqmailÈÕÖ¾µÄ¹¤¾ß£¬ÕâЩ¹¤¾ß½«ÎļþÖлåɬÄѶ®µÄÈÕ־ת»»³É±ãì¶ÎÒÃÇÔĶÁºÍÄܹ»Àí½âµÄ±¨¸æ¡£µ±°²×°Íê³ÉQmailstatsºÍQlogtoolsºó£¬ÎÒ½«»á´´½¨Ò»¸ö½Å±¾ÈÃËüÿÌìÍíÉÏÔËÐУ¬²¢½«±¨¸æ·¢Ë͵½¹ÜÀíÔ±ÓÊÏä¡£Õâ¸ö½Å±¾Ò²¿ÉÓõ½ÎÒÃÇÏÈÇ°°²×°µÄqms-analog,qms-analog½«»áÌṩqmail-scannerÔËÐÐ״̬±¨¸æ¡£

ÏÈ°²×°qmailanalog

cd /home/pkg/

tar zxvf qmailanalog-0.70.tar.gz

cd qmailanalog-0.70

patch < /home/pkg/qmailanalog-0.70.errno.patch

make && make setup check

°²×°qlogtools

cd /home/pkg/

tar zxvf qlogtools-3.1.tar.gz

cd qlogtools-3.1

patch < /home/pkg/qlogtools_errno.patch

make

./installer

ÏÖÔÚÎÒÃÇÒª´´½¨Ò»¸ö½Å±¾£¬²¢½«ËüÌí¼Óµ½cron,ÈÃÆäÿÌìÍíÉÏÔËÐв¢²úÉú±¨¸æ¡£

ÏÂÃæÊÇÒ»¸ö¿É¿¿µÄ½Å±¾£¬Ëü½«»áÊÕ¼¯qmailanalogÊä³öµÄÐÅÏ¢²¢²úÉú±¨¸æ¡£

ºìÉ«²¿·Ý¸Ä³ÉÄãµÄÓòÃû¡£
vi /var/qmail/bin/qmailstats

#!/bin/sh
# Qmailanalog invocation script
PATH=/usr/local/qmailanalog/bin:/var/qmail/bin:/bin:/usr/bin:/usr/local/bin
QMAILSTATS="/tmp/q.$$"
EMAILMSG="/tmp/qms.$$"
umask 077
cat /var/log/qmail/* /var/log/qmail/pop3d/* /var/log/qmail/pop3ds/* /var/log/
qmail/smtpd/* | tai64n2tai | awk '{$1=substr($1,1,index($1,".")+6);print}' | matchup > $QMAILSTATS 5>/dev/null

DATE=`date +'%D'`

echo "To: postmaster@yourdomain.com" > $EMAILMSG
echo "From: postmaster@yourdomain.com" >> $EMAILMSG
echo "Subject: Nightly Qmail Stats Report for $DATE" >> $EMAILMSG
echo "" >> $EMAILMSG
echo "" >> $EMAILMSG
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> $EMAILMSG
zoverall < $QMAILSTATS >> $EMAILMSG
echo "" >> $EMAILMSG
echo "" >> $EMAILMSG
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> $EMAILMSG
zfailures < $QMAILSTATS >> $EMAILMSG
echo "" >> $EMAILMSG
echo "" >> $EMAILMSG
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> $EMAILMSG
zdeferrals < $QMAILSTATS >> $EMAILMSG
echo "" >> $EMAILMSG
echo "" >> $EMAILMSG
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> $EMAILMSG
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~ L a s t 2 4 H o u r s ~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> $EMAILMSG
cat /var/spool/qmailscan/qms-events.log | qms-analog 24 >> $EMAILMSG
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> $EMAILMSG
echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~ A l l R e c o r d s ~~~~~~~~~~~~~~~~~~~~~~~~~~~~" >> $EMAILMSG
cat /var/spool/qmailscan/qms-events.log | qms-analog 0 >> $EMAILMSG
cat $EMAILMSG | qmail-inject

rm -f $QMAILSTATS
rm -f $EMAILMSG

ÉèÖô˽ű¾¿ÉÖ´ÐÐ

chmod 750 /var/qmail/bin/qmailstats

ÏÖÔÚ£¬ÈÃÎÒÃÇÔËÐнű¾

/var/qmail/bin/qmailstats

È·ÈÏÄãµÄ¹ÜÀíÔ±ÓÊÏ䣬Ä㽫»áÊÕµ½Ò»·Ý·Ç³£Ï꾡µÄ±¨¸æ¡£

Èç¹û²âÊÔÔËÐÐÕý³££¬ÄǾͼÓÈëcronÈÃÆäÿÌìÔçÉÏ3µãÔËÐС£

crontab -e

0 3 * * * /var/qmail/bin/qmailstats 1>/dev/null 2>/dev/null


--------------------------------------------------------------------------------

isoqlog

isoqlogÊÇÒ»¸öqmailÈÕÖ¾·ÖÎö¹¤¾ß£¬ËüÊÇÓÃperlдµÄ£¬¿ÉÒÔ·ÖÎöºÍͳ¼Æ qmailµÄÔËÐÐÈÕÖ¾£¬²¢Éú³ÉƯÁÁµÄHTML¸ñʽµÄ±¨±í£¬Èç¹û·þÎñÆ÷ÉÏÒѾ­°²×°WEB·þÎñ£¬¹ÜÀíÔ±¾Í¿ÉÒÔͨ¹ýä¯ÀÀÆ÷À´²é¿´ÕâЩ±¨±í¡£Ïà¶ÔÓÚ qmailanalog,isoqlog·ÖÎöµÄÏîÄ¿ÉÔ΢ÉÙһЩ¡£

isoqlog¿ÉÒÔÉú³É¶à¸öÓʼþÓòµÄ±¨±í£»¶ÔÓÚÿ¸öÓʼþÓò£¬isoqlog¿ÉÒÔͳ¼Æ³öÿÌ졢ÿÔ¡¢Ã¿ÄêµÄÓʼþÁ÷Á¿ÒÔ¼°×Ö½ÚÊý£¬»¹Éú³ÉÏàÓ¦µÄͳ¼ÆÖù״ͼ£»¶ÔÓÚÿÌìµÄ±¨±í£¬isoqlog¿ÉÒÔ¸ù¾ÝÓʼþͶµÝµÄÊýÁ¿ÒÔ¼°×Ö½ÚÊýµÄ¶àÉÙÀ´¶ÔÓʼþÓû§½øÐÐÅÅÁС£

#°²×°isoqlog

cd /home/pkg

tar zxvf isoqlog-2.1.1.tar.gz

cd isoqlog-2.1.1

./configure

make

make install

make clean

cd isoqlog


mkdir /var/www/html/isoqlog

cp -pr ./htmltemp/images ./htmltemp/library /var/www/html/isoqlog


#ÅäÖÃisoqlog

cd /usr/local/etc

mv isoqlog.conf-dist isoqlog.conf

vi isoqlog.conf

½«ÏÂÃæºìÉ«²¿·Ý¸Ä³ÉÄãµÄ°²×°Ä¿Â¼ºÍÖ÷»úÃû³Æ¡£

#isoqlog Configuration file

logtype = "qmail-multilog" #log type qmai-multilog, qmail-syslog, sendmail, postfix
logstore = "/var/log/qmail" #
domainsfile = "/usr/local/etc/isoqlog.domains" #
outputdir = "/var/www/html/isoqlog" #html outpur directory
htmldir = "/usr/local/share/isoqlog/htmltemp"
langfile = "/usr/local/share/isoqlog/lang/english"
hostname = "mail.domain.com"

maxsender = 100
maxreceiver = 100
maxtotal = 100

maxbyte = 100

±£´æ²¢Í˳ö¡£

ÏÂÒ»²½ÊǸæËßisoqlogÄÄЩÐéÄâÓòÐèÒª²úÉúͳ¼Æ±¨±í£¬ÎÒÏ£ÍûÎÒµÄmail·þÎñÆ÷Äܹ»±¨¸æÿ¸öÓòµÄ״̬£¬ËùÒÔÖ»ÐèÒª¼òµ¥µÄ´´½¨Á˸öÁ´½Ó¼´¿É£º

ln -s /var/qmail/control/rcpthosts isoqlog.domains

ÏÖÔÚ£¬isoqlogÓ¦¸ÃÄܹ»Õý³£ÔËÐÐÁË£¬ÔËÐÐÈçÏÂÃüÁî²âÊÔÒ»ÏÂЧ¹û£º

/usr/local/bin/isoqlog

ͨ¹ýÈçÏÂÒ³Ãæ²é¿´Êä³ö½á¹û£º

http://domain.com/isoqlog

Äã¿ÉÒÔµã»÷¸÷¸öÐéÄâÓòÃû³ÆÏÔʾÆ䱨±í¡£


ÎÒÃÇÏ£ÍûisoqlogÄܹ»¼´Ê±Ìṩ±¨±í£¬½«ÈçÏÂÄÚÈݼÓÈëcrontab

crontab -e

58 * * * * /usr/local/bin/isoqlog 1>/dev/null 2>/dev/null

ÿ¸öСʱµÄµÚ58·ÖÖÓÔËÐÐÒ»´Î


--------------------------------------------------------------------------------

MRTG

°²×° MRTG
¶à·ÓÉÆ÷ͨÐżàÊÓÆ÷(MRTG)ÊÇÔÚÍøÂçÁ´Â·Éϼà¿ØͨПºÔصÄÒ»¼þ¹¤¾ß¡£ MRTG ²úÉú°üº¬Í¼±íµÄHTMLÍøÒ³,Ëü¿ÉÒÔ½«ÏµÍ³ÖеÄͨÐÅÇé¿öʵʱµÄÏÔʾÔÚÒ³ÃæÉÏ¡£ ÎÒÃÇ¿ÉÒÔÔÚÎÒÃǵÄϵͳÉÏʹÓÃËüÀ´¼à¿Øµç×ÓÓʼþºÍspamÇé¿ö¡£

# °²×° zlib (ѹËõµÄͼÐÎÎļþ°ü)
cd /home/pkg
tar -xzf zlib-1.1.4.tar.gz
mv zlib-1.1.4/ zlib
cd zlib
./configure
make
cd ..

# °²×° libpng (PNGͼƬ¸ñʽ°ü)
tar -xzf libpng-1.2.7.tar.gz
mv libpng-1.2.7/ libpng
cd libpng
make -f scripts/makefile.std CC=gcc ZLIBLIB=../zlib ZLIBINC=../zlib
rm *.so.* *.so
cd ..

# °²×° gd (ÖÆͼÈí¼þ°ü)
tar -xzf gd-1.8.3.tar.gz
mv gd-1.8.3/ gd
cd gd
make INCLUDEDIRS="-I. -I../zlib -I../libpng" LIBDIRS="-L../zlib -L. -L../libpng" LIBS="-lgd -lpng -lz -lm"
make install
cd ..

# ±àÒë MRTG
tar -xzf mrtg-2.10.15.tar.gz
cd mrtg-2.10.15/
./configure --prefix=/usr/local/mrtg-2 --with-gd=/home/pkg/gd/ --with-z=/home/pkg/zlib/ --with-png=/home/pkg/libpng/
make
make install
ËùÓÐMRTGÐèÒªµÄÈí¼þ°ü¶¼°²×°ÔÚÁË /usr/local/mrtg-2 Ŀ¼ÏÂ. ÄãÏÖÔÚ¿ÉÒÔ°²È«µÄɾ³ýÉÏÃæ±àÒëµÄÔ´Âë. µ«ÊÇÄã×îºÃÁô×Å,ÒÔ±ãÄã±àÒëÏÂÒ»¸ö°æ±¾µÄMRTGʱËùÐè.

ͨ¹ý°²×°inter7µÄqmailmrtg ,ÎÒÃǽ«ÔÚÎÒÃǵÄϵͳÉÏ°²×°MRTG

# ±àÒë qmailmrtg
cd /home/pkg
tar -xzf qmailmrtg7-4.0.tar.gz
cd qmailmrtg7-4.0
make
make install
mkdir /var/www/html/qmailmrtg
cp qmail.mrtg.cfg index.html /var/www/html/qmailmrtg
cd /usr/local/apache/htdocs/qmailmrtg/
ÐÞ¸Ä qmail.mrtg.cfg ºÍ index.htmlÎļþ, ½«ËùÓгöÏÖFQDN µÄµØ·½¶¼¸Ä³ÉÄãµÄÍêÕûÓòÃû(ÀýÈç: test.com). Èç¹ûÄãµÄHTTP MRTGĿ¼²¢²»ÊÇĬÈ쵀 (ÀýÈç: Ä㲢ûÓÐ°Ñ /var/www/html/×÷ΪÄãµÄweb¸ùĿ¼), Ôò±ØÐëÔÚ/var/www/html/qmailmrtg/qmail.mrtg.cfg ÎļþÖÐÐÞ¸ÄWorkDir±äÁ¿ÎªÕýÈ·µÄ·¾¶. Èç¹ûÄã²»ÐèÒª¼Ç¼ijÏî·þÎñ, Äã¿ÉÒÔÔÚËù²»ÐèÒª¼Ç¼µÄ·þÎñÿһÐеÄÇ°Ãæ¼ÓÒ»¸ö# À´×¢Ê͵ôËü,²¢É¾³ýindex.htmlÖжÔÓ¦µÄ·þÎñÏîÄ¿¡£

Äã¿ÉÒÔÐÞ¸Ä pop3ºÍsmtpËùÔÚµÄÐÐ, ÉèÖÃMaxBytes²ÎÊýÀ´ÖØдtcpserverÖÐ-cXËùÔÚÐÐ.

Ä㻹¿ÉÒÔÐÞ¸ÄconcurrencyÀ´ÖØдconcurrencyremote»òconcurrencylocal µÄÖµ. Èç¹ûÕâЩÎļþÔÚ/var/qmail/control Ŀ¼Ï²¢²»´æÔÚ,ÔòqmailĬÈϵÄֵΪ20.

ÏÂÃæÊÇÎÒÃǵÄ×îºóÒ»²½,½«ÏÂÃæÒ»¶ÎÌí¼Óµ½crontabÖÐ, ÒÔʹÎÒÃÇÄÜÿÎå·ÖÖÓÉý¼¶Ò»´ÎMRTGÊý¾Ý. ÔËÐÐÈçÏÂÃüÁî:

crontab -e
Ìí¼ÓÏÂÃæÒ»¶Î (ʹMRTGÿÎå·ÖÖÓÔËÐÐÒ»´Î) È»ºóÍ˳öcrontab:

*/5 * * * * /usr/local/mrtg-2/bin/mrtg /var/www/html/qmailmrtg/qmail.mrtg.cfg 2>&1 > /dev/null
ÏÖÔÚÔËÐÐMRTGÈý´ÎÀ´°²×°Ëü. Ä㽫»áÊÕµ½3´Î¾¯¸æÏûÏ¢. Ö®ºó,Ä㽫²»»áÔÙÊÕµ½¾¯¸æÁË.

env LANG=C /usr/local/mrtg-2/bin/mrtg /var/www/html/qmailmrtg/qmail.mrtg.cfg
ÏÖÔÚÓ¦¸Ã°²×°ºÃÁË. ΪÁËÄÜÏÔʾЩÐÅÏ¢,ÎÒÃǵȴý15·ÖÖÓµÄÈÕÖ¾¼Ç¼. Äã¿ÉÒÔͨ¹ýÏÂÃæµÄµØÖ·À´¼ì²éͼÐμà¿ØÇé¿ö:

http://your.host.name/qmailmrtg/
²é¿´ËüÃǵÄͼÐμà¿ØÇé¿ö!



--------------------------------------------------------------------------------

²âÊÔ
²âÊÔigenus

http://domain.com/

²âÊÔqmailadmin


http://domain.com/cgi-bin/qmailadmin

²âÊÔvQadmin


http://domain.com/cgi-bin/vqadmin/vqadmin.cgi
²âÊÔSMTPÈÏÖ¤
# telnet localhost 25

Trying 127.0.0.1...

Connected to mail.domain.com (127.0.0.1).
Escape character is '^]'.
220 mail. domain.com ESMTP
EHLO hostname
250-mail.domain.com
250-AUTH LOGIN CRAM-MD5 PLAIN
250-AUTH=LOGIN CRAM-MD5 PLAIN
250-PIPELINING
250 8BITMIME
²âÊÔPOP3
# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
+OK Hello there.
user xy.wang@domain.com
+OK Password required.
pass [password]
+OK logged in.
quit
+OK Bye-bye.
Connection closed by foreign host.

²âÊÔIMAP
# telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.localdomain(127.0.0.1).
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2004 Double Precision, Inc. See COPYING for distribution information.
a001 login user@test.com [password]
a001 OK LOGIN Ok.
a001 logout
* BYE Courier-IMAP server shutting down
a001 OK LOGOUT completed
Connection closed by foreign host.


--------------------------------------------------------------------------------

Óʼþϵͳά»¤£º
ÓʼþϵͳÏà¹ØÈÕÖ¾
/var/log/maillog
/var/log/qmail/current
/var/log/qmail/pop3d/current
/var/log/qmail/pop3ds/current
/var/log/qmail/smtpd/current
/var/spool/qmailscan/qmail-queue.log
/var/spool/qmailscan/qms-events.log
/var/spool/qmailscan/quarantine.log

ÉèÖÃQmailÓû§ÓÊÏäµÄÈÝÁ¿
# cd /home/vpopmail/bin
#./vsetuserqutoa domain.com 10500000s --domain.comÕâ¸öÓò£¬¶¼Éè³É10mµÄ
#./vsetuserqutoa xuki@domain.com 10500000s ---Ö»°Ñxuki@domain.comÕâ¸öÓû§µ¥¶ÀÉèÖÃΪ10m¡£

ÅúÁ¿Ìí¼ÓÓû§

Àý1£º

н¨Ò»Îļþ batchadduser.sh£¬½«ÒÔÏÂÄÚÈÝ¿½ÈëÎļþÖб£´æ £¬ÔËÐÐchmod u+x batchadduser.shʹÆä¿ÉÖ´ÐС£

#!/bin/bash
#batchadduser.sh: batch add mail user.
#install step.
#chmod u+x batchadduser
#./batchadduser.sh domain datafile
if [ $# -lt 2 ]
then
echo "usage: $0 domain datafile"
exit 1
fi
domain=$1
datafile=$2
addcmd=/home/vpopmail/bin/vadduser
while read username passwd
do
$addcmd $username@$domain $passwd
done < $datafile

userÎļþÄÚÈݵĸñʽ
username1 passwd
username2 passwd2
............


ÔËÐÐbatchadduser.sh user¼´¿ÉÅúÁ¿Ìí¼ÓÓû§¡£

Àý2£º

ÎÒ°ÑÓû§Ãû·Åµ½Ò»¸öÎı¾ÎļþÖУ¬Ò»¸öÃû×ÖÒ»ÐУ¬ÃÜÂëºÍËüµÄÕʺÅÒ»Ö£¬Óû§×Ô¼ºÔÙÈ¥¸ÄÃÜÂë¡£

while read line
do
echo $line
./vadduser $line $line
done < user


ÓÐÑ¡ÔñµØÇåÀí²»ÐèÒªµÄMail Queue
1¡¢´¦Àí¶ÓÁÐÖеÄÓʼþ£º

ÈçÏëÔÚ¶ÓÁÐÖеÄÓʼþÂíÉÏ´«µÝ£¬¿ÉÒÔ
# kill -HUP qmail-send
Ҫɾ³ý¶ÓÁÐÖеÄÓʼþ
1) ֹͣQMAIL
2) mv /var/qmail/queue/lock /var/qmail/;find /var/qmail/queue/ -type f -exec rm {} \; ;mv /var/qmail/lock /var/qmail/queue/
3) ÖØÆôQMAIL.
¶ÓÁÐÖеÄÓʼþ°üº¬ÔÚÒÔÏÂĿ¼ÖÐ /var/qmail/queue/{info,mess,remote,local}/hash/#number
2¡¢ÔÚÓʼþ¶ÓÁÐÖпìËÙɾ³ý´ÓÒ»¸öµØ·½·¢¹ýÀ´µ«ÓÖ²»´æÔÚµÄÓʼþ Éèbad.jite.comÊÇÕâ¸öÓò¡£¿ÉÒÔ¼üÈëÒÔÏÂÃüÁî
# echo # > ~alias/.qmail-baddomain-default
# echo bad.jite.com:alias-baddomain>> /var/qmail/control/virtualdomains
# echo bad.jite.com:127.0.0.1 >> /var/qmail/control/smtproutes
È»ºóÔËÐÐ/var/qmail/bin/qmail-tcpok£¬¸øqmail-send Ò»¸öHUPÐźÅ
3¡¢É¾³ý¶ÓÁÐÖеĴóÁ¿¹ã¸æÐÅÏ¢

ÏÈÍ£Ö¹QMAIL.
1) ֹͣqmail, qmail-smtpd
2) ÔÚÒÔÏÂĬÈÏĿ¼Ï /var/qmail/queue/mess
find /var/qmail/queue/mess -type f -exec grep "^Subject:dss" {} \; -print -exec rm {} \;
3) ÔËÐÐqueue-fixÇå³ýÏà¹ØÎļþ,
4) ÖØÆôqmail.

ʹÓÃsh±¸·Ýqmail£«mysqlÊý¾Ýµ½Ö¸¶¨µÄftpµØÖ·µÄ·½·¨
±¸·ÝvpopmailµÄdomainsĿ¼¡¢qmailµÄcontrolĿ¼ºÍmysqlµÄvarÊý¾Ý´æ·ÅĿ¼£¬Ê¹ÓÃcrontab¶¨Ê±½øÐвÙ×÷¡£ÏÂÃæÊǽű¾Îļþ£¬¾ßÌåµÄĿ¼ÊÓ×Ô¼ºµÄϵͳ¸ü¸Ä:
mkdir /var/qmailbakup
cd /var/qmailbakup
touch qmailbakup.sh
chmod 755 qmailbakup .sh
vi qmailbakup.sh
[code:1:d480555598]
#!/bin/sh
DATE=`date +%Y-%m-%d-%H`
cd /var/qmailbakup/
tar cvzf domains.$DATE.tar.gz /home/vpopmail/domains
tar cvzf control.$DATE.tar.gz /var/qmail/control
tar cvzf mysql.$DATE.tar.gz /usr/local/mysql/var
ftp -n 192.168.0.21 << ! //ÄãµÄftp·þÎñÆ÷µÄµØÖ·
user qmail qmailbakup //ftpÓû§ÃûºÍÃÜÂ룬עÒâÒªÓÐputȨÏÞ
binary
put domains.$DATE.tar.gz
put control.$DATE.tar.gz
put mysql.$DATE.tar.gz
bye
!
rm -f domains.$DATE.tar.gz control.$DATE.tar.gz mysql.$DATE.tar.gz //ɾ³ý±¾»ú²úÉúµÄÎļþ£¬Èç¹ûÄãÏëÔÚ±¾·þÎñÆ÷Ò²±£´æÒ»·Ý±¸·Ý£¬È¥µô¸ÃÏî¼´¿É¡£
[/code:1:d480555598]
ʹÓÃcrontab¶¨Ê±Ö´ÐУº
vi /etc/crontab
00 20 * * 0-6 /var/qmailbakup/qmailbakup.sh
ÕâÑùÿÌìÍíÉÏ8£º00Ö´Ðиı¸·Ý³ÌÐò¡£
¸øÐÂÀË·¢ÐŵĽâ¾ö°ì·¨
qmail
echo "ÎÒµÄÓʼþ·þÎñÆ÷µÄÕæʵÓòÃû(A¼Ç¼)" > /var/qmail/control/helohost

ÁÙʱÏÞÖÆÒ»¸öÓû§µÄpop3
vmoduser -p email_addr or domain ( for the entire domain )

ÐÞ¸ÄĬÈϵÄÓòÃû
A:
Òª¸ü¸Ähaohao.comΪĬÈÏÓò¡£
·½·¨£º
¸ü¸Ä~qmail/control/
defaultdomain
me
plusdomains
ÖðÒ»¸ü¸ÄÆô¶¯pop3ºÍ smtpµÄÆô¶¯½Å±¾£º
Ð޸ģºemail.3sk.comΪhaohaoo.com
ÔÚ×îÉϱßÌí¼Ó£ºexport VPOPMAIL_DOMAIN=haohaoo.com

½«Ò»¸öϵͳµÄQmailÓû§ÍêÕûµØתÒƵ½ÁíÒ»¸öϵͳ
A:
a.cdbÅäÖõÄ?ÄÇôÇë°Ñ/home/vpopmail/domainsÕâ¸öÎļþ¼Ð±¸·ÝºÃ¾Í¿ÉÒÔÁË¡£Óû§ºÍÃÜÂëÎļþ£¬»¹ÓÐÓû§Ðżþ¶¼ÔÚÕâ¸öĿ¼Ï¡£
»¹Ó¦¸Ã±¸·Ý/var/qmail/controlϵÄÏà¹ØÅäÖÃÎļþ¡£

b.Èç¹ûÊÇÒÔMYSQLÊý¾Ý¿â·½Ê½À´´æ´¢Óû§ÈÏÖ¤ÐÅÏ¢µÄ
Ö»ÐèÒª±¸·Ý
~vpopmail/domainϵÄËùÓÐÓʼþ
/var/qmail/controlµÄÅäÖÃÎļþ
MYSQLÊý¾Ý¿âĿ¼ÏµÄvpopmail¿âĿ¼¡£Ò»°ãÊÇ/var/lib/mysql£¨RPM£©¡¢/usr/local/mysql/data¡¢/usr/local/mysql/varÏÂÃæ¡£


°ÑÒ»ÓʼþÓòµÄÃû×Ö±ÈÈça.com¸ü¸ÄΪb.com£¬ÈçºÎʵÏÖ
ÒÔϼ¸¸ö²½Ö裺
1¡¢cd /home/vpopmail/domains
mv a.com b.com
2¡¢°ÑvpopmailÊý¾Ý¿âµÄvpopmail±íµ¼³ö°ÑËùÓÐa.com¸ÄΪb.com£¬È»ºóɾ³ývpopmail±í£¬ÔÙµ¼Èë.
3¡¢°Ñ°ÑvpopmailÊý¾Ý¿âµÄdir_control±íµÄa.com¸ÄΪb.com
4¡¢ÔÚ/home/qmail/control Ŀ¼Ï塄 virtualdomainsºÍrcpthostsϵĵÄa.com¸ÄΪb.com.
5¡¢ÔÚ/home/qmail/usersĿ¼Ï°ÑassignÎļþµÄa.com¸ÄΪb.com
6¡¢ÐèÒªÔËÐÐqmail-newuÖØÐÂÉú³Écdb¡£assignÖ»ÊÇÅäÖÃÎļþ£¬cdb²ÅÊÇʵ¼ÊµÄÊý¾ÝÎļþ¡£
¼Ó¿ì qmail ͶµÝÓʼþËÙ¶È
A: /var/qmail/controlÏÂÃæÊÇqmailµÄ¿ØÖÆÎļþ£¬ÕâÁ½¸öÎļþ£º
Concurrentcylocal default: 10 ×î´ó±¾µØͬʱ´«ËÍÊý
Concurrencyremote default: 20 ×î´óÔ¶³Ìͬʱ´«ËÍÊý
¸ü¸ÄÓòµÄĬÈϹÜÀíÕ˺Å
A: vmoduserÓиö-a²ÎÊý£¬¿ÉÒÔ¸³ÓèÓû§¹ÜÀíȨÏÞ¡£

Èç¹ûÏëÈ«Ãæ½ûÓÃpostmasterµÄÌØÊâȨÏÞ»°£¬¾ÍÖ»ÄܸÄÔ´´úÂëÁË¡£

QMAILϵÄÖ÷ÒªÅäÖÃÎļþ£¨/var/qmail/controlĿ¼Ï£©£º
ÎļþÃû ĬÈÏÖµ ʹÓÃÕß ÓÃ;
badmailfrom none qmail-smtpd ºÚÃûµ¥µØÖ·
bouncefrom MAILER-DAEMON qmail-send ÍË»ØÓʼþ
bouncehost me qmail-send ÍË»ØÓʼþ
concurrencylocal 10 qmail-send ±¾µØͬʱͶµÝÓʼþµÄÊýÄ¿
concurrencyremote 20 qmail-send ͬʱͶµÝÖÁÔ¶³ÌÖ÷»úµÄÊýÄ¿
defaultdomain me qmail-inject ĬÈÏÓòÃû
defaulthost me qmail-inject ĬÈÏÖ÷»úÃû
databytes 0 qmail-smtpd ÓʼþµÄ×î´óÈÝÁ¿ (0=ÎÞÏÞÖÆ)
doublebouncehost me qmail-send
doublebounceto postmaster qmail-send
envnoathost me qmail-send ûÓÐ"@"µÄĬÈÏÓòÃû
helohost me qmail-remote Ö÷»úÃû
idhost me qmail-inject Message-IDµÄÖ÷»úÃû
localiphost me qmail-smtpd ±¾µØIPµÄÌæ´úÃû
locals me qmail-send ´«µÝÖÁ±¾µØµÄÓòÃû
me ϵͳÕýʽÓòÃû various
morercpthosts none qmail-smtpd µÚ¶þ¸örcpthosts
percenthack none qmail-send ʹÓà "%"¸ñʽµÄÓòÃû
plusdomain me qmail-inject
qmqpservers none qmail-qmqpc QMQP·þÎñÆ÷µÄIPµØÖ·
queuelifetime 604800 qmail-send ÔÚ¶ÓÁÐÖÐÓʼþ±£´æµÄʱ¼ä£¨Ã룩
rcpthosts none qmail-smtpd ½ÓÊÕÓʼþµÄÓòÃû
smtpgreeting me qmail-smtpd
smtproutes none qmail-remote
timeoutconnect 60 qmail-remote SMTPÁ¬½Ó³¬Ê±Ê±¼ä
timeoutremote 1200 qmail-remote µÈ´ýÔ¶³ÌÖ÷»úµÄʱ¼ä
timeoutsmtpd 1200 qmail-smtpd SMTP¿Í»§Á¬½Ó³¬Ê±µÄʱ¼ä
virtualdomains none qmail-send ÐéÄâÓòÃû


QmailÏÞÖƸ½¼þ´óС
ÎÒµÄÅäÖþ­Ñé==¡·QmailÏÞÖƸ½¼þ´óС£º
1.ÔÚ/var/qmail/control/databytes ÖÐÉèÖø½¼þ´óС£¬Õâ¸öÎļþÒªÊÖ¶¯½¨Á¢£¬Ö±½ÓÊäÈëÊý×Ö¾ÍÐУ¬Ä¬Èϵ¥Î»Îªbytes,Èç10485760Ϊ10M£»
2.WebmailÖз¢Ë͸½¼þĬÈÏÖ»Ö§³Ö500K×óÓÒ,ÈçÏëÖ§³Ö5M¸½¼þ£¬ÐÞ¸ÄÈçÏÂÎļþ
# vi /etc/php.ini

post_max_filesize=5M //320ÐÐ
upload_max_filesize=5M //405ÐÐ
session.bug_compat_42=0 //¼ÓÈëµ½641ÐÐ
session.bug_compat_warn=0

# vi /etc/httpd/conf.d/php.conf
LimitRequestBody 5242880 //ÐÞ¸Ä14ÐеÄֵΪ5M

WebMailÉÏ´«¸½¼þ´óСÏÞÖÆ (½â¾öÉÏ´«Îļþ²»ÄÜ´óÓÚ512KBµÄÎÊÌâ)
¸ü¸Ä/etc/httpd/conf.d/php.conf:

LimitRequestBody 524288ÖеÄ524288ÕýºÃ¸ú512KBÏàµÈ£¬½«Æä¸ü¸ÄΪ10485760,ÉèÖÃÔÊÐí×î´óÉÏ´«µÄ¸½¼þΪ10MB¡£
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 14 ÌõÆÀÂÛ

  1. china19901107 ÓÚ 2011-05-26 23:15:11·¢±í:

    ²»´í²»´í£¬Ö§³ÖÖ§³Ö£¡£¡£¡£¡

  2. zengtiakun ÓÚ 2010-05-14 13:44:34·¢±í:

    »¹¿ÉÒÔ°¡£¡

  3. yuliuliu777 ÓÚ 2010-05-14 04:01:24·¢±í:

    Ö§³Öһϡ£

  4. liulove8193 ÓÚ 2009-11-21 16:38:16·¢±í:

    ºÃ£¡

  5. liulove8193 ÓÚ 2009-11-21 13:53:41·¢±í:

    Ö§³Öһϣ¬Â¥Ö÷ÐÁ¿àÁË¡£

  6. liulove8193 ÓÚ 2009-11-21 13:49:26·¢±í:

    ºÃ

  7. yusan ÓÚ 2009-06-14 09:28:57·¢±í:

    http://www.xuki.org/qmail_2.0.tar.g...?ݸöÈËÏ°¹ß°É¡?

    ºÃÏñÏÂÔصØÖ·ÊÇ´íÎóµÄ°¡ ¡£

  8. yusan ÓÚ 2009-06-14 08:26:53·¢±í:

    Ö§³Öһϣ¬Â¥Ö÷ÐÁ¿àÁË¡£

  9. youki2008 ÓÚ 2009-06-13 14:14:27·¢±í:

    thank you£¡

  10. youki2008 ÓÚ 2009-06-13 14:14:21·¢±í:

    thank you£¡

  11. youki2008 ÓÚ 2009-06-13 14:13:57·¢±í:

    ²»¹ýÂ¥Ö÷ÐÁ¿àÁË£¡

  12. youki2008 ÓÚ 2009-06-13 14:13:36·¢±í:

    ¾ÍÊÇÓеã¶à°¡£¡

  13. youki2008 ÓÚ 2009-06-13 14:13:16·¢±í:

    ºÃ¶«Î÷£¡

  14. xuyiqiang ÓÚ 2009-06-12 16:36:54·¢±í:

    ºÃ°¡~~£¡£¡£¡