Linux԰̳'s Archiver

chengkinhung 2007-7-23 22:42

CentOS5аbQmail̘I]ϵy

Qmail̘I]ϵybփ


؟•: փԲṩκΓҲṩκʾĬʾ֮؟Ρ


================================================================================
ݺ:
================================================================================
փǹPژIrgWоQmailϵyrİbPӛ,󲿷YρԴGoogle
Wԃļgęn,ҽ^aͷ,ҽY˱ڜyԇ͑
@õČ`.l@փԵҪĿ,ҪO]һȫ_Դܛ̘I
]ϵy, Ҳϣ׻͗lİbE,Linuxʹ߸ӿٺ͸
Qmail]ϵy.

փԼǰb^̵ԅęn,bκܛwYԴ,Ҳδ
ȫBQmail]ϵyʹü,ұփĿǰֻBRed Hatϵy(CentOS5)
аbQmailķ. Ȼփÿ¹֮еÿb,ԔָPܛw
ٷWַ򅢿YԴ,eԓܛw¿õd朽,˽hʹñփԵČ,
ͨ^ھb(Online Install)ʽ@YԴ.

փԵİbeܛwYԴ,^֮,ͨ^ʽṩYԴ,
ڱփ֮.ڰbeGNU GPLڙĹ_YԴ(Open Source),
ṩ̘I;Mܛ.ֲGNU GPLЭ,ӭκʿ޸.

փYԴWַ(hÑʹðȫB):
[url]http://sourceforge.net/project/showfiles.php?group_id=203579[/url]
[url]https://sourceforge.net/projects/qmailsetupmenu[/url]
================================================================================



================================================================================
Ŀָ:
================================================================================
һ: װǰ׼;
ڶ: װQmailĻϵͳ;
: װЭQmail׼;
Ĺ: װvpopmailϵͳ;
幝: װʼϵͳClamAV;
: װʼϵͳSpamAssassin;
߹: OQmail\_;
ڰ˹: װQmailadminDomain Quota;
ھŹ: װCourier(authlib+imap+sqwebmail+maildrop)SSL֧;
ʮ: װSquirrelMail;
11: װHorde-Webmail;
12: װɨqmail-scanner;
13: POP3SMTPSSL֧;
14: bVqadmin;
15: MAʹO;
================================================================================



================================================================================
ܺ:
================================================================================
ձbփԲõQmail]ϵy,һ߂̘ܵI]ϵy,ܝM
СĪ,ҲmڌTṩ]յISPWj˾.߂רI̘I
]ϵyИ˜ʹ,ܱC̘IÑṩȫ,͸Ч̄.

1) ֶ֧,ÿ_C֧֔ǧ̓M;

2) ֧֔탦Ϣ,ÑϢMySQL(oLinuxϵy~̖),
   ȫԺ`;

3) ֧~Ŀ~]g~:
   - ÿg]䔵Ŀ,Ñе]˻ĿgС;
   - ûй,Ӻ̈́h̖,OÄe,޸Լ{g;
   - ÑOßoƔĄe(Dl);

4) ֧POP3Эյ,֧SSLȫB,֧SMTPJC;

5) ֶ֧NWebmailշ;

6) ԄӒMWP]Ϣ(,lͺDl),OʹQHPSIMи
   ,Чֹ]͹];
================================================================================



================================================================================
ϵyʽ:
================================================================================
Qmailϵy: qmailctl start
ֹͣQmailϵy: qmailctl stop

QmailϵyAO_: /var/qmail/bin/
TCP Server ķĿ·: /service(朽/var/qmail/supervise/)

,h͹]: /home/vpopmail/bin/

һԃ]IJ:
--------------------------------------------------------------------------------
cd /home/vpopmail/bin/;
./vdominfo test.com                #Ϣ:
- - - - - - - - - - - - - - - - - - - - - - - - -
domain: test.com
uid:    809
gid:    809
dir:    /home/vpopmail/domains/test.com
users:  2
- - - - - - - - - - - - - - - - - - - - - - - - -
--------------------------------------------------------------------------------

һ]IJ:
--------------------------------------------------------------------------------
cd /home/vpopmail/bin/;
./vadddomain test.com;
Please enter password for postmaster:
enter password again:
--------------------------------------------------------------------------------

һ]̖IJ:
--------------------------------------------------------------------------------
cd /home/vpopmail/bin/;
/vadduser [email]email@test.com[/email]
Please enter password for [email]email@test.com[/email]:
enter password again:
--------------------------------------------------------------------------------

һh]̖IJ:
--------------------------------------------------------------------------------
cd /home/vpopmail/bin/;
./vdeluser [email]email@test.com[/email]
--------------------------------------------------------------------------------

һh]IJ:
--------------------------------------------------------------------------------
cd /home/vpopmail/bin/;
./vdeldomain test.com
--------------------------------------------------------------------------------

һÁ(֧~)_(/home/vpopmail/bin/adddomain.pl)ʹ÷:
--------------------------------------------------------------------------------
cd /home/vpopmail/bin/;
./adddomain-hung.pl;
Please input the new domain:test.com
Please enter password for postmaster:
enter password again:
domain testhung1.com has been create success
Please set the pop user quota for the domain:10
set quota success!
--------------------------------------------------------------------------------

]µ]~@: /home/vpopmail/domains/
]Ŀ: /home/vpopmail/domains/yourdomain/youremailaccount/.Mkdir/new/
x]Ŀ: /home/vpopmail/domains/yourdomain/youremailaccount/.Mkdir/cur/


P]̎:

(1) ȽһTռ],: [email]abuse@test.com[/email];
(2) Ȼ]Dĵ@;
(3) OԄӌW_̎];
(4) һ^V_̎ÑķiҪ;

Ԕ̎Ո15: MAʹOá.

Ոע: փδÑ],ĿǰP]ҎtOԼ
iԾֻ_ŽoCϵyĹTʹ.
================================================================================



================================================================================
Ñʹ÷:
================================================================================
Ñ: [url]http://xxx.xxx.xxx.xxx/cgi-bin/qmailadmin[/url]
[User Account]         postmaster
[Domain Name]          yourdomain
[Password]             postmasterpassword

ͨÑ: [url]http://xxx.xxx.xxx.xxx/cgi-bin/qmailadmin[/url]
[User Account]         youremailaccount
[Domain Name]          yourdomain
[Password]             yourpassword

ÑW]: [url]http://xxx.xxx.xxx.xxx/cgi-bin/sqwebmail[/url]
[User ID]              youremail@yourdomain
[Password]             yourpassword

ÑW]: [url]http://xxx.xxx.xxx.xxx/squirrelmail/[/url]
ʺ:                  youremail@yourdomain
:           yourpassword

ÑW]: [url]http://xxx.xxx.xxx.xxx/horde/[/url]
ʹQ:           youremail@yourdomain
      :           yourpassword

POP3ͻ:
:   xxx.xxx.xxx.xxx
ʻ:   youremailaccount%yourdomain
:   yourpassword
================================================================================



================================================================================
YԴļ:
================================================================================
qmail-install-online-src.rar DZװҪ޸aIJԴ͈_;
qmail-install-online-menu-text.rar DZbփԵTEXTı;
qmail-install-online-src-all.tar.gz DZһγɹbȫYԴ;

xҪYԴ,gӭ@d(hÑʹðȫB):
[url]http://sourceforge.net/project/showfiles.php?group_id=203579[/url]
[url]https://sourceforge.net/project/showfiles.php?group_id=203579[/url]

κɆ,gӭ“j:
QQ:        507649008
MSN:        [email]chengkinhung@hotmail.com[/email]
SKYPE:        chengkinhung
EMAIL:        [email]chengkinhung@gmail.com[/email]
================================================================================



================================================================================
YԴR:
================================================================================
QmailٷW: [url]http://www.chinese.qmail.org/servlet/template?series=33&article=74[/url]
IBM_l: [url]http://www.ibm.com/developerworks/cn/linux/[/url]
================================================================================

[[i] chengkinhung 2007-8-23 12:14 ༭ [/i]]

chengkinhung 2007-7-23 22:56

SORRY, ÿ¹ƪ^10000

@ol, ՈS?**?ٰl.

chengkinhung 2007-7-25 11:24

һ: װǰ׼

Linuxϵͳ,ʺQmailϵͳеĻ,û,Ȩ޺Ŀ¼;

1) ϵͳC뻷;
--------------------------------------------------------------------------------
ΪQmailԴİװõʹΪ"cc"C, , ϵͳû
ӦΪ"cc"ı, ôͱ޸İװõconf-ccconf-ld, ȷװ
ҵʺϵC.

Linuxʾ, cc Ȼس:

cc;
cc: no input files (ע: CصķӦϢ)

õ"no input files"ķ,@ϵyȱʡL·һ
(mڱb)õCg.

ûƷӦ,ԈµCg:

/usr/bin/cc;
/usr/bin/gcc;
/usr/local/bin/cc;
/usr/local/bin/gcc;
/usr/ccs/bin/cc;

Ĝyԇ]һ,녢ϵͳ**֮Pfęn,ȷϵͳ
пõCȷ·; Red Hat Linux,RPMԃ:

rpm -qa | grep gcc;
rpm -qa | grep egcs;

Ĝyԇκһ,˵ϵͳпõC,·
ƲϱװҪ,ڰbQmail֮ǰ,ҪQmailİbYԴPCg
Oõ.QmailԴ,PCghÅ conf-ccconf-ld
ɂļ. Ҫ޸õ conf-ccconf-ld, ñ༭conf-ccconf-ldļ,
Ȼûļе "cc" ΪʺϵyеCƼ(ͨڵһ).

, ϵͳпõCΪ"gcc", DZ·ʵ"/usr/bin/gcc",
ô༭ conf-ccconf-ld ļ(ļqmail-1.03Դ,潫Ҫ
ЩԴ), ļе"cc"Ϊ"gcc" "/usr/bin/gcc".

ע: RedHatϵͳȻʹgcc,ͨһ(/usr/bin/cc)ָ /usr/bin/gcc,
¾Ͳ޸õ. (ɴɼ,һ޸õ򵥵ķ,
һΪ cc ,ָϵͳпõC).
--------------------------------------------------------------------------------

2) ϵͳıҪ(apache+php+mysqlnamed);
--------------------------------------------------------------------------------
#ϵͳ:
rpm -qa | grep httpd;
rpm -qa | grep php;
rpm -qa | grep mysqld;
rpm -qa | grep bind;        (Ǽnamed, RedHatName ServerԤBind)

ע: ϵͳԱQmailʼϵͳĸЧҪ,Qmailĸ,ȶ
ͰȫԶЩLinxuϵͳϳ̶,δװϵͳ,
װLinuxϵͳ,òϵͳİװԶװ͵Щϵͳ,Դ.
--------------------------------------------------------------------------------
  
3) ֤ϵͳԶ(Ŀǰ[*]);
--------------------------------------------------------------------------------
setup; ->System Service;
[*] httpd
[*] mysqld
[*] named
#ֹط
service httpd start; service httpd restart;
service mysqld start; service mysqld restart;
service named start; service named restart;
--------------------------------------------------------------------------------
  
4) رSELINUX;
--------------------------------------------------------------------------------
vi /etc/sysconfig/selinux;
#д: SELINUX=enforcing
#ij: SELINUX=disabled
#SELINUXиĶ,뱣沢Linux: reboot
  
ע: ϵͳҪرSELinux,ΪSELinux֧Qmailϵʼϵͳ,Ϊ
SELinuxܵҵʼ൱鷳.ҪʼSELinux,
οվ:

ٷվ: [url]http://www.nsa.gov/selinux/[/url]
ά**: [url]http://zh.wikipedia.org/wiki/SELinux[/url]
άӢ: [url]http://en.wikipedia.org/wiki/SELinux[/url]
IBM DW : [url]http://www.ibm.com/developerworks/cn/linux/s-selinux/index.html[/url]
--------------------------------------------------------------------------------

5) RedHatϵͳװԤ׼sendmailpostfix,Ȅh;
--------------------------------------------------------------------------------
rpm -e --nodeps sendmail;
rpm -e --nodeps postfix;
rpm -e --nodeps sendmail-cf;

hsendmailʱҲῴµľϢ(RPMɾ׼ǰᱸصõ)
warning: /var/log/mail/statistics saved as /var/log/mail/statistics.rpmsave
warning: /etc/mail/submit.cf saved as /etc/mail/submit.cf.rpmsave

f: ׼䌍oh,鱣CQmailϵyķ\,횴_Jѽֹͣ,
ķն˿,Լ{ĬJ朽.
--------------------------------------------------------------------------------
  
6) Ϊ˱Ѿڵļȷ,ɾĿ¼;
--------------------------------------------------------------------------------
rm -rf /var/qmail;
rm -rf /var/log/qmail;
rm -rf /service;
ע: Ŀ¼ϵͳвδʹ,ϵͳѾӦ
Ŀ¼,ɾЩĿ¼ĺ;
--------------------------------------------------------------------------------
  
7) ҪԤȼû;
--------------------------------------------------------------------------------
QmailϵyҪLinuxϵͳ7û,QmailԴһ
INSTALL.idsļ,ļ˽BڸNϵyÑͽM.Ǵļ
_^B,Solaris,LinuxFreeBSDÑͽM:

vi INSTALL.ids;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
On some systems there are commands that make this easy. Solaris and
Linux:

   # 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

FreeBSD 2.2:

   # pw groupadd nofiles
   # pw useradd alias -g nofiles -d /var/qmail/alias -s /nonexistent
   # pw useradd qmaild -g nofiles -d /var/qmail -s /nonexistent
   # pw useradd qmaill -g nofiles -d /var/qmail -s /nonexistent
   # pw useradd qmailp -g nofiles -d /var/qmail -s /nonexistent
   # pw groupadd qmail
   # pw useradd qmailq -g qmail -d /var/qmail -s /nonexistent
   # pw useradd qmailr -g qmail -d /var/qmail -s /nonexistent
   # pw useradd qmails -g qmail -d /var/qmail -s /nonexistent
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

ڱװփõQmailϵy\ÑͽM,cʽaÑͽMвͬ,
҂ָЩûGIDUID. ù̶ÑID\QmailϵyĿ,
˷ϵymwƵȾSo,@Ҫ]C,ԼҪڸ
C֮gw]Ñϵy,ҪüȺ(pC)ϵy,Ƿdzֵò
ķʽ.

DZbփЌʹõGIDUID:

GID: 801, 802
UID: 800,801,802,803,804,805,806

PUIDGIDf:

LinuxϵͳʹGIDUIDʶû,/etc/passwdгظID,ô
ֻһIDŻЧû. ,ϵyѽЩGIDUIDԒ,ô
װ̾Ϳ޷ȷصĿ¼ļ,Qmailϵͳܻ˶ʧ.,
ִаװ֮ǰ, ȼһǰϵͳеÑͽM, ǷѾбÑͽM
ʹGIDUID. ϵͳѾGIDUID, ôҪ޸ЩID
ֵ,ظID.

Ϊ˱ϵͳһ,ԺǨ, ϵͳ,ѡһ
UIDGIDװQmail.ͳһUIDGIDװQmailϵͳ,Աϵy
ںmľSo޸ϵyGIDUID韩.
--------------------------------------------------------------------------------


--------------------------------------------------------------------------------
Y: Ҫ޸IJϵͳûGIDUID,·:
--------------------------------------------------------------------------------
vi /etc/passwd;

סҪ޸ĵIDӦû,GIDUID,ӛҪ޸ϵyдÑ
ļĿG,ɲµFINDﵽĿ:

find / -uid [UID] Cexec chown [USER] {} \;
find / -gid [GID] Cexec chown [GROUP] {} \;

[UID][GID]ΪûIDֵ,[USER][GROUP]ǴIDӦû,,
ûhttԭȵUIDGIDΪ801,ô:

find / -uid 801 -exec chown htt {} \; (UIDΪ101ļĿ¼,ΪûhttUID;)
find / -gid 801 -exec chown .htt {} \; (GIDΪ101ļĿ¼,ΪhttGID;)  
--------------------------------------------------------------------------------

8) QmailϵͳĿ¼,ϵͳûԼȨ;
--------------------------------------------------------------------------------
#ִϵ,Qmailϵͳû,Ŀ¼:

groupadd -g 801 qmail;
groupadd -g 802 nofiles;

mkdir -p /var/qmail; (qmailгĿ¼)
chown root.qmail /var/qmail;

useradd -g nofiles -d /var/qmail/alias -s /sbin/nologin -p'*' -u 800 alias;
useradd -g nofiles -d /var/qmail -M -s /sbin/nologin -p'*' -u 801 qmaild;
useradd -g nofiles -d /var/qmail -M -s /sbin/nologin -p'*' -u 802 qmaill;
useradd -g nofiles -d /var/qmail -M -s /sbin/nologin -p'*' -u 803 qmailp;

useradd -g qmail -d /var/qmail -M -s /sbin/nologin -p'*' -u 804 qmailq;
useradd -g qmail -d /var/qmail -M -s /sbin/nologin -p'*' -u 805 qmailr;
useradd -g qmail -d /var/qmail -M -s /sbin/nologin -p'*' -u 806 qmails;

mkdir /var/log/qmail;
mkdir /var/log/qmail/qmail-send;
mkdir /var/log/qmail/qmail-smtpd;
mkdir /var/log/qmail/qmail-pop3d;
chown -R qmaill:root /var/log/qmail;
chmod -R 750 /var/log/qmail;

mkdir /var/qmail/supervise;
mkdir -p /var/qmail/supervise/qmail-smtpd/log;
mkdir -p /var/qmail/supervise/qmail-send/log;
mkdir -p /var/qmail/supervise/qmail-pop3d/log;
chmod +t /var/qmail/supervise/qmail-smtpd;
chmod +t /var/qmail/supervise/qmail-send;
chmod +t /var/qmail/supervise/qmail-pop3d;

chengkinhung 2007-7-25 11:33

ڶ: װQmailĻϵͳ ()

================================================================================
1) Qmail(Ոxabʽ):
================================================================================
--------------------------------------------------------------------------------
(a) dqmail-1.03YԴ;
--------------------------------------------------------------------------------
οַ: [url]http://www.qmail.org/top.html[/url]

ע: װ(b)ʽи޲©netqmail, ΪװҪһ
еQmailչspamcontrol,Ѿ޲©˴Ľ,
netqmail,Աװԭʼ汾qmail-1.03.tar.gz.(Ҳ˵,װ
˲aʽԴ)

cd /usr/local/src/qmail/;
wget [url]http://cr.yp.to/software/qmail-1.03.tar.gz[/url];
tar zxvf qmail-1.03.tar.gz;
cd /usr/local/src/qmail/qmail-1.03/;

,沿aİbspamcontrol,ԭʼYԴ:
cp -p Makefile Makefile.org;
cp -p qmail-smtpd.c qmail-smtpd.c.org;
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(b) dٷƼnetqmail-1.05;
--------------------------------------------------------------------------------
ҪװSpamcontrol,ôغйٷƼnetqmail-1.05.tar.gz,
صڹٷվ,qmail-1.03.tar.gzԴ, qmailԼ
׼Ҫ,ЩһЩ©,ͼ(ܲʺijЩϵͳ
**);

οַ: [url]http://www.qmail.org/netqmail/[/url]

cd /usr/local/src/qmail/;
wget [url]http://qmail.org/netqmail-1.05.tar.gz[/url];
tar -zxvf netqmail-1.05.tar.gz;
cd netqmail-1.05; (Ŀ¼qmailԴͲ,οREADME˵ִ޲)
./collate.sh; (Զѹϲ,һnetqmail-1.05Ŀ¼,עǷдϢ)

ע: űcollate.sh޲qmail-1.03IJ,netqmail-1.05
׼IJ, other-patchesĿ¼, Щ׼DzԴ뷽ʽװ,
οREADME˵ִ޲.RPMʽװ׼,RPM׼Ѿ
޲©,򲻱ٽ޲.
--------------------------------------------------------------------------------
================================================================================


================================================================================
2) spamcontrol:
================================================================================
οַ: [url]http://www.fehcom.de/qmail/spamcontrol.html[/url]
mkdir -p /usr/local/src/qmail/spamcontrol;
cd /usr/local/src/qmail/spamcontrol/;
wget [url]http://www.fehcom.de/qmail/spamcontrol/spamcontrol-2418_tgz.bin[/url];

عؼԵز:
wget [url]http://www.fehcom.de/qmail/spamcontrol/clamav-0.90.1_output.patch_[/url];
wget [url]http://www.fehcom.de/qmail/spamcontrol/ucspi-ssl-0.70_ucspitls-0.4.patch_[/url];
wget [url]http://www.fehcom.de/qmail/spamcontrol/badmimetypes[/url];
wget [url]http://www.fehcom.de/qmail/spamcontrol/badloadertypes[/url];

ѹspamcontrol-2418_tgz.binὫԴļͷڵǰĿ¼,Ƚqmail
װĿ¼:
cd /usr/local/src/qmail/qmail-1.03;
tar -xzf ../spamcontrol/spamcontrol-2418_tgz.bin;
ע: һҪqmailװĿ¼ͷԴ,ܱ֤ļ.

ĸ,ȻװвδȫҪ,Ϊ˱ԴԺһ,
һ,Էδάչ:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/bin/cp -fp ../spamcontrol/badloadertypes ./;
/bin/cp -fp ../spamcontrol/badmimetypes ./;
/bin/cp -fp ../spamcontrol/clamav-0.90.1_output.patch_ ./;
/bin/cp -fp ../spamcontrol/ucspi-ssl-0.70_ucspitls-0.4.patch_ ./;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

vi conf-spamcontrol;         (޸spamcontrolĵ,˴ҪӶѡ)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Configuration for SPAMCONTROL (no tabs allowed)
#
# Additional RELAYING
#
relaymailfrom=no # might be dangerous - use SMTP Auth
#
# Additional CONTROLLING
#
quitasap=no # close SMTP session in case of a filter condition (violates SMTP RFC)
reqbrackets=yes # qmail-smtpd requires brackets "<address>" in SMTP addresses
verp=yes # allow VERP addresses for RECIPIENTS
recipients550=no # in case of none-existing RECIPIENTS get a direct 550 reply instead a deferred bounce (via 450)
#
# SMTP AUTHENTICATION
#
authcram=no # additional CRAM-MD5 support; needs a CRAM-MD5 supporting PAM (ie. cmd5checkpw)
#
# LOADSHARING enhancements
#
moreipme=no # Scott Gifford's additional control files moreipme and notipme
#
# PERFORMCANCE enhancements
#
bigtodo=no # Bruce Guenter's BigToDo patch - consider raising conf-split in the first place

locals=yes
queue_extra=yes
tarpitting=yes
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
f:
tarpitting        _TARPITa,yӋRCPTĿOֹtSMTPB

./install_spamcontrol.sh;        (\аװspamcontrolİb_)
--------------------------------------------------------------------------------
================================================================================

chengkinhung 2007-7-25 11:38

ڶ: װQmailĻϵͳ ()

===============================================================================
3) bqmail-monitorO](ع,粻Ҫշ,ɺԴ˲)
===============================================================================
Ոע: OM]ԭnjSMTPBһ,@ǷdzϵyYԴ
O._Ҫ˱Oع,ȫ˽˱Oԭ,thrҪb
Oع. QmailϵyijW,ֻҪһ˜ʵ̘I]ϵy,ô
ԺԴ˰bE.

Wַ: [url]http://sourceforge.net/projects/qmail-monitor/[/url]

cd /usr/local/src/qmail/;
wget [url]http://nchc.dl.sourceforge.net/sourceforge/qmail-monitor/qmail-monitor-0.99.tar.gz[/url];
tar zxvf qmail-monitor-0.99.tar.gz;

Ոע: qmail-monitor-0.99ͬqmailpatchݶob,ֹ.

cd /usr/local/src/qmail/qmail-1.03/;
mv Makefile Makefile.spam;
mv qmail-smtpd.c qmail-smtpd.c.spam;
cp -p Makefile.org Makefile;
cp -p qmail-smtpd.c.org qmail-smtpd.c;

cd /usr/local/src/qmail/qmail-monitor-0.99;
make install QMAIL_SRC=../qmail-1.03;

z鰲bǷ:

ll ../qmail-1.03/monitor.*;        (簲b_,ƒ)
-------------------------------------------------------------------------------
-rw-r--r-- 1 root root 100818 Jun 20 06:22 ../qmail-1.03/monitor.a
-rw-r--r-- 1 root root    472 Jun 20 06:22 ../qmail-1.03/monitor.h
-------------------------------------------------------------------------------

tҪֹƴ˃ɂļ:
cp monitor.a monitor.h ../qmail-1.03/;

Ոע,grF¾,_lʾ,Ժҕ˾Ϣ:
control.l:100: warning: passing argument 3 of &acirc;?˜aalloc&acirc;?™ from incompatible pointer type

cd /usr/local/src/qmail/qmail-1.03/;
mv Makefile Makefile.monitor;
mv qmail-smtpd.c qmail-smtpd.c.monitor;
mv Makefile.spam Makefile;
mv qmail-smtpd.c.spam qmail-smtpd.c;

ֹmonitora:

vi Makefile;                #(̎Oع):
-------------------------------------------------------------------
ҵ:
fs.a auto_qmail.o base64.o socket.lib
Ğ:
fs.a monitor.a auto_qmail.o base64.o socket.lib

ҵ:
alloc.a substdio.a error.a str.a fs.a auto_qmail.o base64.o  `cat \
Ğ:
alloc.a substdio.a error.a str.a fs.a monitor.a auto_qmail.o base64.o  `cat \

ҵ:
exit.h rcpthosts.h timeoutread.h timeoutwrite.h commands.h wait.h \
Ğ:
exit.h rcpthosts.h timeoutread.h timeoutwrite.h commands.h monitor.h wait.h \
-------------------------------------------------------------------

vi qmail-smtpd.c;        #(̎Oع):
-------------------------------------------------------------------
(1)ڵ30:
#include "monitor.h"

(2)ҵ̎:
void straynewline() { out("451 See [url]http://pobox.com/~djb/docs/smtplf.html.[/url]\r\n"); flush(); _exit(1); }
void err_unimpl() { out("502 unimplemented (#5.5.1)\r\n"); }

뺯die_monitor():

void straynewline() { out("451 See [url]http://pobox.com/~djb/docs/smtplf.html.[/url]\r\n"); flush(); _exit(1); }

void die_monitor()
{
  char err_msg[255];
  out("421 unexpected problem parsing monitor control: ");
  out(monitor_error(err_msg, sizeof(err_msg)));
  out("\r\n");
  flush();
  _exit(1);
}

void err_unimpl() { out("502 unimplemented (#5.5.1)\r\n"); }


(3)ҵ̎:
struct constmap mapbmf;

ڴӃ:
struct constmap mapbmf;
int monitorok = 0;
monitor_rs *rs;

(4)ҵ̎:
  unsigned long u;

ڴһ:
  unsigned long u;
  int i;

(5)ҵƒ̎:
  if (!(databytes + 1)) --databytes;
  remoteip = env_get("TCPREMOTEIP");

ڃ:
  if (!(databytes + 1)) --databytes;

  rs = monitor_create();
  if(rs == NULL) die_nomem();
  if(monitor_readfile(rs, "control/monitor") > 0) die_monitor();
  if(monitor_size(rs) > 0) monitorok = 1;

  remoteip = env_get("TCPREMOTEIP");

(6)ҵ̎:
  out("250-PIPELINING\r\n250-8BITMIME\r\n");
f汾̎:
  out("\r\n250-PIPELINING\r\n250-8BITMIME\r\n");

иĞ:
  out("250-PIPELINING\r\n250-8BITMIME\r\n250-MONITOR\r\n");
f汾Ǹij:
  out("\r\n250-PIPELINING\r\n250-8BITMIME\r\n250-MONITOR\r\n");

(7)ҵƒ̎:
  qmail_from(&qqt,mailfrom.s);
  qmail_put(&qqt,rcptto.s,rcptto.len);

ڃвһ:
  qmail_from(&qqt,mailfrom.s);
  if(monitorok && monitor_rcpt(rs, &mailfrom, &rcptto) != 0) die_nomem();
  qmail_put(&qqt,rcptto.s,rcptto.len);
-------------------------------------------------------------------------------

Ոע: bqmail-monitor,QmailϵyAOδñOع, Qmailϵy
ęnĿ(/var/qmail/control)½һ'monitor'_,ñO
.ԅlYԴеķęnmonitor.sampleıO_; :

vi /var/qmail/control/monitor;        (˹ܱϵybȫЧ)
-------------------------------------------------------------------------------
dup mail from any to any rcpt [email]postmaster@test.com[/email]                  #]
dup mail from [email]user1@test.com[/email] to any rcpt [email]chengkinhung@gmail.com[/email]  #Oҕ΂̖
dup mail from ~@home.25u.com to any rcpt [email]postmaster@home.25u.com[/email] #Oҕ
-------------------------------------------------------------------------------
: O,һе˼njͨ^CSMTPl͵]һ
̖[email]postmaster@test.com[/email]ȥ; ڶе˼nj[email]user1@test.com[/email]@̖l
]һݵⲿ][email]chengkinhung@gmail.com[/email]ȥ;е˼tnj
home.25u.coml͵]һݵ[email]postmaster@home.25u.com[/email]ȥ.

: O_monitorÑÿSMTPBб{,һ޸˱O_,
Ч(o؆qmail),Ոձ؇z鲢_JZo`,tQmailϵy
SMTPBʧ,@ܕÑȫol].

f: ˷㌢İb,Ҍֹ޸ĵăɂęn, diff(-ruN)
ᘌspamcontrol-2418patch(qmail-1.03-spamcontrol-2418-monitor.patch),
ɌpatchļֱQqmail-monitor-0.99bYԴеqmail.patch,b.
===============================================================================

chengkinhung 2007-7-25 11:44

ڶ: װQmailĻϵͳ ()

================================================================================
4) ޸qmail-smtpdԸЧʽʼԤΪ:
================================================================================
vi /usr/local/src/qmail/qmail-1.03/qmail-smtpd.c;

#void straynewline(), :
void straynewline() { out("451 See [url]http://pobox.com/~djb/docs/smtplf.html.[/url]\r\n"); flush(); _exit(1); }

е"451"Ϊ"553":
void straynewline() { out("553 See [url]http://pobox.com/~djb/docs/smtplf.html.[/url]\r\n"); flush(); _exit(1); }

f:

ŷյЧʽʼʱ, AOlϢ(451a)o:

"I am not going to accept that message at the moment,you can try again later"

ŷյϢ֮, ٰͨ֕lͬӵ]o, @͕ɶ
؏ͶMYԴ.Ȼ,ݔݸĞ553,ôŷֱӰl
Ϣ(553a)oķ:

"I am not going to accept that message,don't try sending it again."

@͌VŷҪٰl@oЧż.
================================================================================


================================================================================
5) qmailͬһʱɴqueueֵ:
================================================================================
(a) ʹÕr{ qmail ϵyĮǰ̎;

Qmailϵyb֮,/var/qmail/control/Ŀ¼°lFĵ,
qmailͬʱqueue,˃ɂęnʾ:

/var/qmail/control/concurrencyincoming;        #ָʾtcpserverͬʱ
/var/qmail/control/concurrencyremote;        #ָʾqmail-remoteͬʱ߳

ֵͨ,Ȼ†qmail(qmail-send), ָʾqmailͬһrg
̎ٵ],Էֹϵy^d

ע: LinuxϵͳԴʹOƴʩ,ôͱ횴_JPǷ
֧OÔֵ.,_Jѽ``descriptors''``openfiles''YԴO
ɁKД(concurrency)ăɱ5``maxproc''YԴ(ϵy@O
Ԓ)OɁKД(concurrency)ăɱ4tÿ]ͻȻrqmailҪ
tf

(b) ھgǰ{ qmail ϵyAO̎;

ɂOļÁ{ qmail ϵyǰ̎ăɂ,@ɂ
OÔֵ, ܳ^ qmail ϵyIJ̎ĘOޔֵ.@
Ɣֵ qmail ϵyھgǰͱOõ,AOֵ120qmailԴĿ¼
Ϊconf-spawnļ,ھgr޸conf-spawnļеĔֵ

vi /usr/local/src/qmail/qmail-1.03/conf-spawn;        #žconf-spawnAO:
--------------------------------------------------------------------------------
120

This is a silent concurrency limit. You can't set it above 255. On some
systems you can't set it above 125. qmail will refuse to compile if the
limit is too high.
-------------------------------------------------------------------------------

,޸ĴֵһҪϵͳ,·鿴ǰLinuxϵͳԴĿ:

ulimit -a -H;
-------------------------------------------------------------------------------
core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
file size               (blocks, -f) unlimited
pending signals                 (-i) 1024
max locked memory       (kbytes, -l) 32
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 7679
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited
-------------------------------------------------------------------------------

ʾ,open filesΪ1024,˵Linuxϵͳ,conf-spawnԵΪQmail
ֵ֧255;

ȻҲ޸ϵyO,"open files". ڴ,"open files"Linux
ϵͳһ̴򿪵ļ(Ҳ򿪵SOCKET,ӰMySQL
lBӔĿ).ֵulimit޸,:

ulimit -HSn 4096;        #"open files"ֵ4096;

ulimit޸ĵĔֵֻǰÑĿǰʹíhЧ,ϵy؆Ñ˳
͕ʧЧ.Ҫ޸ĔֵЧ,t޸ęn:

vi /etc/security/limits.conf;        #޸Ñļ16384
-------------------------------------------------------------------------------
root hard nofile 16384
root soft nofile 16384
amanda hard nofile 16384
amanda soft nofile 16384
apache hard nofile 16384
apache soft nofile 16384
qmail hard nofile 16384
qmail soft nofile 16384
vpopmail hard nofile 16384
vpopmail soft nofile 16384
mysql hard nofile 16384
mysql soft nofile 16384
-------------------------------------------------------------------------------

ע: "255"ֵ,Qmailϵͳͬʱqueue,ՈҪ
`Qmailλrg̎].O]ϵyconcurrencyremote
OõIJ̎255,ÿqueue̵ƽ̎rg3.6,ôՓ
]ϵyÿСr̎^25f(3600x255/3.6=255,000)ϵ]. ,
]ϵyÿ̎]Ŀ^100fԒ,ôͻϟo횸IJ̎.
Xô_Ҫ޸Ĵֵ, ׌Qmailϵyͬr̎^255queue
,ôͱ޸qmail-1.03Դ.޸Ĵֵ,οٷվ
ܵIJ([url]http://qmail.org/big-concurrency.patch[/url]).
===============================================================================


================================================================================
6) ʼװqmail;
================================================================================
#ǰѡaʽ,벢qmail-1.03Ŀ¼(փԲô˷ʽ):
cd /usr/local/src/qmail/qmail-1.03/;

#ǰѡbʽ,벢netqmail-1.05Ŀ¼:
cd /usr/local/src/qmail/netqmail-1.05/netqmail-1.05;

make man;
make setup check;

^쾎g^еķ,κe`,ԭ,Ȼmake clean,¾g;

./config-fast ***please input your domain***; (ՈעҪԼC)

ע: ű"***please input your domain***"˴FQDN(ȫϸ
),abc.net, ôӦ ./config-fast abc.net;(Linux
,֪ǰ,hostname鿴). ٴ: abc.netֻһ,
Ӧʵİװʹ.(仰˵,Ҫװyou.net,ôӦִ
./config-fast you.net)
================================================================================

chengkinhung 2007-7-25 11:49

: װЭQmailĹ׼ ()

QmailϵͳҪֳЭ,Դﵽ; Ӳװĸ׼:

daemontools-0.76-2.i386.rpm (ӹ)
supervise-scripts-3.5-1.noarch.rpm
ucspi-tcp-0.88-2macchi1.i686.rpm (tcpsever)
ucspi-unix-0.36-2macchi1.i686.rpm

1)Qmailucspi-tcp׼(ѡa,bcκһַʽ):
ucspi-tcpDan Bernsteinд,Pοַ:
[url]http://cr.yp.to/ucspi-tcp.html[/url]        (@Dan BernsteinSoľW)
[url]http://cr.yp.to/ucspi-tcp/install.html[/url]
[url]http://smarden.org/pape/djb/[/url]        (Gerrit PapeΪucspi-tcpmanĵ)

--------------------------------------------------------------------------------
(a) رTarballԭ;
--------------------------------------------------------------------------------
dYԴ: [url]ftp://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz[/url]

mkdir /usr/local/src/qmail/ucspi-tcp;
cd /usr/local/src/qmail/ucspi-tcp/;
wget [url]http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz[/url];
tar -zxvf ucspi-tcp-0.88.tar.gz;

bucspi-tcp֮ǰ,Ҫȴ²,װʧ:

(a.1) ucspi-tcp-0.88.isp.patch;

οWַ: [url]http://jeremy.kister.net/[/url]
cd /usr/local/src/qmail/ucspi-tcp/;
wget [url]http://jeremy.kister.net/code/ucspi-tcp-0.88.isp.patch[/url];
cd /usr/local/src/qmail/ucspi-tcp/ucspi-tcp-0.88/;
patch < ../ucspi-tcp-0.88.isp.patch;

ע: һҪ,ѡװ˲,Ӱ(a.2)IJװʽ.

ʹf: ˲ǽMa,¶a:
- - - - - - - - - - - - - - - - - - - - - - - -
rblsmtpd-nodefaultrbl.patch
rblsmtpd-nonrecursive-v4.patch
ucspi-tcp-0.88-periplimit.7.patch
- - - - - - - - - - - - - - - - - - - - - - - -
periplimita,ϴ˲,Ϳtcp.smtpļ
ÿ(IPCַʶ)IJ,O÷:

vi /etc/tcp.smtp;        (˲EϵybЧ)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:allow,MAXCONNIP="2",MAXCONNC="5"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -

O˼: ͑ͨ^SMTPBl]r,ͬIPͬrMе
SMTP,ͬһCַͬrMеSMTP,ͨ^SMTPB
Ŀ,Ϳ_ֹE]lͷյĿ.(޸tcp.smtpqmailctl cdb
ؽݿЧ)

ԭ: SMTPB^MAXCONNIPMAXCONNCr, RBLSMTPDODROPMSG׃,,
@Ҳ͵ҪSMTPD_(/service/qmail-smtpd/run),O rblsmtpd,
O÷:

vi /service/qmail-smtpd/run;        (Dzփ)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
exec softlimit -m 30000000 \
tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \
-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp rblsmtpd \
/var/qmail/bin/qmail-smtpd \
/home/vpopmail/bin/vchkpw /bin/true 2>&1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(a.2) ٷվnetqmail-1.05йucspi-tcp;

ļɴnetqmail-1.05ѹиƹ:


cd /usr/local/src/qmail/ucspi-tcp/;
cp /usr/local/src/qmail/netqmail-1.05/other-patches/ucspi-tcp-0.88.* ./;
cd /usr/local/src/qmail/ucspi-tcp/ucspi-tcp-0.88/;

(i) ucspi-tcp-0.88.nodefaultrbl.patch        (̎؈)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
patch < ../ucspi-tcp-0.88.nodefaultrbl.patch;

ע: ˲Ҳ޸rblsmtpd.cļ,ѾǰIJ(1)ucspi-tcp-0.88.isp.patch
,ôڴ˾Ͳٴucspi-tcp-0.88.nodefaultrbl.patch,Ϊucspi-tcp-0.88.isp.patch
޸˲ȫͬ.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(ii) ucspi-tcp-0.88.a_record.patch
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
patch < ../ucspi-tcp-0.88.a_record.patch;

ע: ˲޸rblsmtpd.cļ,Ȼucspi-tcp-0.88.isp.patchҲ޸
rblsmtpd.cļ,ߵ޸IJͬ,ȴucspi-tcp-0.88.isp.patch,
ٴucspi-tcp-0.88.a_record.patch,Ⱥܵߵ,;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

(iii) ucspi-tcp-0.88.errno.patch        (̎؈)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
patch < ../ucspi-tcp-0.88.errno.patch;

ע: ˲޸error.hļ,ѾǰIJ(1)ucspi-tcp-0.88.isp.patch
,ôڴ˾Ͳٴucspi-tcp-0.88.errno.patch,Ϊucspi-tcp-0.88.errno.patch
Ѿȫucspi-tcp-0.88.isp.patch.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

ú,ͿԿʼ:
make;
make setup check;
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(b) RPMװ׼;
--------------------------------------------------------------------------------
i386i686,õǺܾɵĵ,ҲӦi386,ڵĵԻ϶
°i686,ûӦİ汾׼.

i686汾:
οַ: [url]http://dir.filewatcher.com/d/Other/i686/Utilities/System.0.0.htm[/url]
wget [url]ftp://141.30.228.4/pub/mirrors/redhat/contrib/libc6/i686/ucspi-tcp-0.88-2macchi1.i686.rpm[/url];

i386汾:
οٷַ: [url]http://www.qmail.org/rpms/[/url]
wget [url]http://www.qmail.org/rpms/RPMS/ucspi-tcp-0.88-112memphis.i386.rpm[/url];

İװi686汾,ѡi386汾,ôװ޲ͬ,ֻ轫װ
ļƸ׼Ƽ.

rpm -ivh ucspi-tcp-0.88-112memphis.i386.rpm;
--------------------------------------------------------------------------------
  
--------------------------------------------------------------------------------
(c) RPMԴ׼;
--------------------------------------------------------------------------------
οַ: [url]http://www.qmail.org/rpms/ucspi-tcp.html[/url]
wget [url]http://www.qmail.org/rpms/SRPMS/ucspi-tcp-0.88-112memphis.src.rpm[/url];
wget [url]http://www.qmail.org/rpms/SPECS/ucspi-tcp.patched.spec[/url];

οַ: [url]http://www.cis.fiu.edu/support/mirror/1121499012.73-redhat-contrib.html[/url]
[url]ftp://mirrors.cs.fiu.edu/pub/mirrors/redhat-contrib/libc6/SRPMS/ucspi-tcp-0.88-2macchi1.src.rpm[/url]

ؽRPM׼:
rpmbuild --rebuild ucspi-tcp-0.88-112memphis.src.rpm;
--------------------------------------------------------------------------------


2) Qmailucspi-unix׼(ѡa,b,cdκһַʽ):
--------------------------------------------------------------------------------
(a) رtarballԴ;
--------------------------------------------------------------------------------
οַ: [url]http://untroubled.org/ucspi-unix/[/url]

mkdir /usr/local/src/qmail/ucspi-unix/;
cd /usr/local/src/qmail/ucspi-unix/;
wget [url]http://untroubled.org/ucspi-unix/ucspi-unix-0.36.tar.gz[/url];
tar zxvf ucspi-unix-0.36.tar.gz;
cd ucspi-unix-0.36;
make;
./installer;

׼tarballCentOS޷ɹ,녢·̎:

Note: If ucspi-unix fails during compilation with an error in env.c (sysdeps.h
not found) you need to get bglibs and install it. After untarring the source, cd
into the directory and run "make" followed by "make install". Try recompiling
ucspi-unix again. If compilation of ucspi-unix finishes without an error, type
"./installer" to install binaries and manuals into /usr/local/bin and
/usr/local/man, respectively. In some cases the installer gives an error
"installer error: Could not change directory to '/usr/local/man'". If you got
this error just type "mkdir /usr/local/man" and then "./installer" again.

,Ȱbbiglibs:

Wַ: [url]http://untroubled.org/bglibs[/url]
cd /usr/local/src/qmail/ucspi-unix/;
wget [url]http://untroubled.org/bglibs/bglibs-1.102.tar.gz[/url];
tar zxvf bglibs-1.102.tar.gz;
cd bglibs-1.102;
make;                (Ոע: ̎grg^L)
make install;

Ȼٴΰbucspi-unix-0.36:
cd /usr/local/src/qmail/ucspi-unix/ucspi-unix-0.36/;
make;
./installer;
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(b) ذװRPMװ׼;
--------------------------------------------------------------------------------
οַ: [url]http://dir.filewatcher.com/d/Other/i686/Utilities/System.0.0.htm[/url]
wget [url]ftp://141.30.228.4/pub/mirrors/redhat/contrib/libc6/i686/ucspi-unix-0.36-2macchi1.i686.rpm[/url];
rpm -ivh ucspi-unix-0.36-2macchi1.i686.rpm;


dbQmailٷWվ朽Ӱ汾:
wget [url]http://www.qmail.org/rpms/RPMS/ucspi-tcp-0.88-112memphis.i386.rpm[/url]
rpm -ivh ucspi-unix-0.36-2macchi1.i686.rpm;
--------------------------------------------------------------------------------
  
--------------------------------------------------------------------------------
(c) رRPMԴ׼;
--------------------------------------------------------------------------------
οַ: [url]http://untroubled.org/ucspi-unix/[/url]
wget [url]http://untroubled.org/ucspi-unix/ucspi-unix-0.36-1.src.rpm[/url];

οַ: [url]http://www.cis.fiu.edu/support/mirror/1121499012.73-redhat-contrib.html[/url]
wget [url]ftp://mirrors.cs.fiu.edu/pub/mirrors/redhat-contrib/libc6/SRPMS/ucspi-unix-0.36-2macchi1.src.rpm[/url]

ؽRPM׼:
rpmbuild --rebuild ucspi-unix-0.36-1.src.rpm;
--------------------------------------------------------------------------------

(d) YUMװucspi-unix;
--------------------------------------------------------------------------------
yum list | grep ucspi-unix;
yum install ucspi-unix;
:
yum update ucspi-unix;
--------------------------------------------------------------------------------

chengkinhung 2007-7-25 11:52

: װЭQmailĹ׼ ()

3) Qmaildaemontools׼(ѡa,bcκһַʽ):
--------------------------------------------------------------------------------
(a) رtarballԴ;
--------------------------------------------------------------------------------
οַ: [url]http://cr.yp.to/daemontools.html[/url]

mkdir /usr/local/src/qmail/daemontools;
cd /usr/local/src/qmail/daemontools/;
wget [url]http://cr.yp.to/daemontools/daemontools-0.76.tar.gz[/url];
tar zxvf daemontools-0.76.tar.gz; (˴ѹ󽫻һΪadminĿ¼)

Ҫȴ򲹶,װʧ,ļɴnetqmail-1.05иƹ:
cp ../netqmail-1.05/other-patches/daemontools-0.76.errno.patch ./;

cd admin/daemontools-0.76/src/;
patch < ../../../daemontools-0.76.errno.patch;
cd ../;
./package/install;

Ոע: bdaemontoolszĿ/service,ԓĿѽ,daemontoolsO
svscanѽb,Ԅ/etc/inittabӃ,Ķsvscano.
ڰb֮ǰȄh/serviceĿ,tҪڰb֮,ֹ޸/etc/inittab,
һЃ:

vi /etc/inittab;
- - - - - - - - - - - - - - - - - - - -
SV:123456:respawn:/command/svscanboot
- - - - - - - - - - - - - - - - - - - -

ҲԸɴh/serviceĿ,Ȼٰbdaemontoolsһ.bɹ,
svscan:

telinit q;
ps -ef | grep svscan;        (z醢ӽY)

: ΪһRPM׼supervise-scripts޷tarballԴʽװ,
daemontoolsRPM׼,ڱϵͳֻܲRPMYUMʽװdaemontools,
˽(b)ʽװdaemontoolsrpm׼)
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(b) daemontoolsrpm׼;
--------------------------------------------------------------------------------
οַ:
[url]http://www.qmail.org/rpms/daemontools.html[/url]
[url]http://summersoft.fay.ar.us/pub/qmail/daemontools/[/url]

mkdir /usr/local/src/qmail/daemontools;
cd /usr/local/src/qmail/daemontools/;

wget [url]http://summersoft.fay.ar.us/pub/qmail/daemontools/rhel-4/daemontools-0.76-2.i386.rpm[/url];
rpm -ivh daemontools-0.76-2.i386.rpm;

dbQmailٷWվ朽Ӱ汾:
wget [url]http://www.qmail.org/rpms/RPMS/daemontools-0.76-112memphis.i386.rpm[/url];
rpm -ivh daemontools-0.76-112memphis.i386.rpm;

ע: ֪RPMķֱ,²ٷվİ汾Ӧµİ.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(c) YUMװdaemontools;
--------------------------------------------------------------------------------
yum list | grep daemontools;
yum install daemontools;
:
yum update daemontools;
--------------------------------------------------------------------------------

ע: ΪһRPM׼supervise-scripts޷tarballԴʽװ,
daemontoolsRPM׼,ԱϵͳĿǰֻܲRPMYUMʽװdaemontools.


4) Qmailsupervise-scripts׼(ѡa,bcκһַʽ):
--------------------------------------------------------------------------------
(a) رtarballԴ;
--------------------------------------------------------------------------------
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(i) Ȱװbglibs;        (ǰ氲bucspi-unixrѽb^bglibs,Ͳٰb)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
οַ: [url]http://untroubled.org/bglibs/[/url]
cd /usr/local/src/qmail/;
wget [url]http://untroubled.org/bglibs/bglibs-1.102.tar.gz[/url];
tar zxvf bglibs-1.102.tar.gz;
cd bglibs-1.102;
make;
make install;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(ii) ٰbsupervise-scripts-3.5.tar.gz;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
οַ: [url]http://untroubled.org/supervise-scripts/[/url]

mkdir /usr/local/src/qmail/supervise-scripts/;
cd /usr/local/src/qmail/supervise-scripts/;
wget [url]http://untroubled.org/supervise-scripts/supervise-scripts-3.5.tar.gz[/url];
tar zxvf supervise-scripts-3.5.tar.gz;
cd supervise-scripts-3.5;
make install-config;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

ע: tarballԴ޷CentOSаװ,ԭ,ʹ(bc)ʽװ.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(b) supervise-scripts-3.5-1.noarch.rpm׼;
--------------------------------------------------------------------------------
οַ: [url]http://untroubled.org/supervise-scripts/[/url]
wget [url]http://untroubled.org/supervise-scripts/supervise-scripts-3.5-1.noarch.rpm[/url];
rpm -ivh supervise-scripts-3.5-1.noarch.rpm;

Ոע: supervise-scripts-3.5CentOS5аbFe`,e`Ϣ@ʾ:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Preparing...                ########################################### [100%]
   1:supervise-scripts      ########################################### [100%]
tail: cannot open `+23' for reading: No such file or directory
error: %post(supervise-scripts-3.5-1.noarch) scriptlet failed, exit status 1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Ո(d)EM)
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(c) YUMװsupervise-scripts;
--------------------------------------------------------------------------------
yum list | grep supervise-scripts;
yum install supervise-scripts;
:
yum update supervise-scripts;

Ոע: supervise-scripts-3.5CentOS5аbFe`,Ո(d)E;
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(d) z鰲bY,e`:        vi /etc/inittab;       
--------------------------------------------------------------------------------
(d.1) ڵ22֮:
SV:2345:respawn:/usr/bin/svscan-start /service
SX:S016:wait:/usr/bin/svscan-stopall /service

(d.2) һ:
SV:123456:respawn:env - PATH=/usr/local/bin:/usr/sbin:/usr/bin:/bin svscan /service < /dev/null > /dev/console 2> /dev/console

ע: supervise-scripts-3.5ijЩϵyŸo_b,ֹփ;
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
(e) initsvscan:
--------------------------------------------------------------------------------
telinit q;
:
kill -1 1;

ps -ef | grep svscan;        (z醢ӽY)
--------------------------------------------------------------------------------

chengkinhung 2007-7-25 11:59

Ĺ: װvpopmailϵͳ()

Ĺ: װvpopmailϵͳ

===============================================================================
1) MySQLнvpopmailݿ;
===============================================================================
CREATE DATABASE vpopmail;
GRANT SELECT ON vpopmail.* TO vpopmailread@localhost IDENTIFIED BY 'uBeSfIFmaRkwL';
GRANT ALL ON vpopmail.* TO vpopmail@localhost IDENTIFIED BY 'xLwMvPjDkZFLaEnQy';
quit;

ע: ˴Ȩûvpopmailݿ,ֱvpopmailreadvpopmail,ס
Ӧ,ΪVPOPMAILϵͳʴݿʱ,ҪʹЩ. 벻Ҫ
ʹùڼ򵥵Ԥ,ϵͳİȫ.
===============================================================================


===============================================================================
2) vpopmailݵû;
===============================================================================
/usr/sbin/groupadd -g 809 vchkpw;
/usr/sbin/useradd -g vchkpw -u 809 vpopmail;
===============================================================================


===============================================================================
3) غͰװVPOPMAIL;
===============================================================================
οվ:
[url]http://www.inter7.com/index.php?page=vpopmail[/url]

Դ:
mkdir /usr/local/src/qmail/vpopmail;
cd /usr/local/src/qmail/vpopmail/;
wget [url]http://jaist.dl.sourceforge.net/sourceforge/vpopmail/vpopmail-5.4.17.tar.gz[/url];
wget [url]http://jaist.dl.sourceforge.net/sourceforge/vpopmail/vpopmail-5.4.18.tar.gz[/url];
wget [url]http://jaist.dl.sourceforge.net/sourceforge/vpopmail/vpopmail-5.4.19a.tar.gz[/url];

-------------------------------------------------------------------------------
ע: vpopmail-5.4.18,һ¹,ִӻ޸ĵ
(/var/qmail/binĿ¼µĹ߳)֮,Լɾ֮ǰִһָ·Ϊ
onchangeĽűļ.˹ڰװʱʹѡenable-onchange-scriptָǷ,
ʵ,ʹδָѡ,ָenable-onchange-script=n,Զװ˹,
ǵִQmailbinĿ¼µ֮,ͻ´:

ONCHANGE script /home/vpopmail/etc/onchange not found.
:
ONCHANGE script /home/vpopmail/etc/onchange unable to fork.

README.onchangeе˵:

If --enable-onchange-script is added to the ./configure command
many vpopmail commands, and calls into the library will call the
script ~vpopmail/etc/onchange.  Commands that add or update call
the script after making their changes.  Commands that delete
something call the script before doing the delete.

Ҳ޲onchange©ı,δ޲˰װ©,ô˹,޲Ͳ;

wget [url]http://qmail.jms1.net/patches/vpopmail-5.4.18-onchange.fix.patch[/url];
wget [url]http://qmail.jms1.net/patches/vpopmail-5.4.18-onchange.fix.patch[/url];
tar zxvf vpopmail-5.4.19a.tar.gz;
cd vpopmail-5.4.19;
patch < ../vpopmail-5.4.18-onchange.fix.patch;

ӛf: ʹָѡenable-onchange-script=n,Ҳֹͣʹonchange;
-------------------------------------------------------------------------------

ľgҪָtcp.smtpļ,ϵyoļ,ͱ½һ:
echo '127.0.0.1:allow,RELAYCLIENT=""' > /etc/tcp.smtp;

#MySQL/var/lib/mysql/Ŀ¼δ±yumװ;
./configure \
--enable-auth-logging=y \
--enable-logging=v \
--enable-log-name=vpopmail \
--enable-auth-module=mysql \
--enable-roaming-users=y \
--enable-onchange-script=n \
--enable-sqwebmail-pass=n \
--enable-many-domains=n \
--enable-passwd=y \
--disable-clear-passwd \
--enable-tcpserver-file=/etc/tcp.smtp \
--enable-incdir=/usr/include/mysql \
--enable-libdir=/usr/lib/mysql \
--enable-libs=mysqlclient \
--enable-ip-alias-domains=y \
--enable-qmail-ext=y \
--enable-mysql-replication=n \
--enable-valias=n
-----------------------------------------------
#MySQL/var/lib/mysql/Ŀ?**±?;
./configure \
--enable-auth-logging=y \
--enable-logging=v \
--enable-log-name=vpopmail \
--enable-auth-module=mysql \
--enable-roaming-users=n \
--enable-onchange-script=n \
--enable-sqwebmail-pass=n \
--enable-many-domains=n \
--enable-passwd=y \
--disable-clear-passwd \
--enable-tcpserver-file=/etc/tcp.smtp \
--enable-incdir=/var/lib/mysql/include/mysql \
--enable-libdir=/var/lib/mysql/lib/mysql \
--enable-libs=mysqlclient \
--enable-ip-alias-domains=y \
--enable-qmail-ext=y \
--enable-mysql-replication=n \
--enable-valias=n
-----------------------------------------------
#MySQL/usr/local/mysql/Ŀ¼;
./configure \
--enable-auth-logging=y \
--enable-logging=v \
--enable-log-name=vpopmail \
--enable-auth-module=mysql \
--enable-roaming-users=n \
--enable-onchange-script=n \
--enable-sqwebmail-pass=n \
--enable-many-domains=n \
--enable-passwd=y \
--disable-clear-passwd \
--enable-tcpserver-file=/etc/tcp.smtp \
--enable-incdir=/usr/local/mysql/include/mysql \
--enable-libdir=/usr/local/mysql/lib/mysql \
--enable-libs=mysqlclient \
--enable-ip-alias-domains=y \
--enable-qmail-ext=y \
--enable-mysql-replication=n \
--enable-valias=n
-----------------------------------------------

make;
make install-strip;

ע:
-------------------------------------------------------------------------------
(a)CentOSϵͳ,tcp.smtp·/etc/tcp.smtp,趨:
--enable-tcpserver-file=/etc/tcp.smtp
Ҳ'whereis tcp.smtp'ȷһtcp.smtp·.

(b)MySQL·ҲҪϵͳʵ,ֹ,:
--enable-incdir=/usr/local/mysql/include/mysql \
--enable-libdir=/usr/local/mysql/lib/mysql \

(c)ȫֹSMTPDl:
--enable-roaming-users=n        #ֹ
--enable-roaming-users=y        #S
[Ñԭǣij[Ñͨ^pop3ȡԣtijΕrgSԓַͨ^
]Dlżvpopmailbɺͨ^cronr\г£
40 * * * * /home/vpopmail/bin/clearopensmtp 2>&1 > /dev/null
Ҳÿ40SrelayIPַбtijÑͨ^pop3ȡż(
ͨ^pop3ȡżҪJ^ģtԱ^@ǺϷÑ)YԣtÑځ40
ԃȿͨ^ԓ]ϵyDl]֮ͲSͨ^ԓϵyDl]

(d)ǷÿdomainsһtableŻѡ:
Ԥı,vpopmailÿdomainsһtable(--disable-many-domains),
domains˻.ʵvpopmailҲԽdomains˻϶
һtable. д,ÿֻʺ(5-10),
ôÿøԵݱķʽ,ή.
ͬһݱķ(--enable-many-domains),ܻ.
-------------------------------------------------------------------------------
===============================================================================


===============================================================================
4) vpopmailMySQLݿĵ;
===============================================================================
vpopmailϵͳǰݿʱȨûvpopmailreadvpopmailMySQL,
ڴ˴û.

vi /home/vpopmail/etc/vpopmail.mysql;
-------------------------------------------------------------------------------
# MYSQL CONNECTION SETTINGS FOR VPOPMAIL
#
# Line 1 defines the connection to use for database reads,
# Line 2 defines the connection to use for database updates/writes.
#
# If you omit line 2, then the same settings will be
# used for both read and write.
#
# settings for each line:
# host|port|user|password|database
#
localhost|0|vpopmailread|uBeSfIFmaRkwL|vpopmail
localhost|0|vpopmail|xLwMvPjDkZFLaEnQy|vpopmail
#
# Note:
#   The value of host may be either a hostname or an IP address.
#   If host is 'localhost', then sockets (Unix) or named pipes (Windows)
#   will be used instead of TCP/IP to connect to the server.
-------------------------------------------------------------------------------
===============================================================================


===============================================================================
5) Ԥļ(ɰmԼ{);
===============================================================================
vi /home/vpopmail/etc/vlimits.default;
-------------------------------------------------------------------------------
maxpopaccounts          10
maxforwards             -1
maxautoresponders       -1
maxmailinglists         -1

# quota for entire domain, in megabytes
# example shows a domain with a 100MB quota and a limit of 10,000 messages
#quota                   100
quota                   1000
#maxmsgcount            10000

# default quota for newly created users (in bytes)
# example shows a user with a 20MB quota and a limit of 1000 messages
default_quota           104857600
#default_maxmsgcount    1000
-------------------------------------------------------------------------------
===============================================================================

[[i] chengkinhung 2007-12-16 23:56 ༭ [/i]]

chengkinhung 2007-7-25 12:02

Ĺ: װvpopmailϵͳ()

===============================================================================
6) Զ;
===============================================================================
vi /etc/crontab;        #OÿСrĵ40һб
-------------------------------------------------------------------------------
40 * * * * root /home/vpopmail/bin/clearopensmtp 2>&1 > /dev/null
-------------------------------------------------------------------------------
===============================================================================


===============================================================================
7) һΪtest.comIJ̓M:
===============================================================================
/home/vpopmail/bin/vadddomain test.com;
/home/vpopmail/bin/vadduser [email]user1@test.com[/email]; (ʾO[email]user1@test.com[/email]Ŀ)
/home/vpopmail/bin/vdeluser [email]user1@test.com[/email];
/home/vpopmail/bin/vdeldomain test.com;
ʾ: ִvdeldomainἴʱqmailϵͳļ,/var/qmail/users/cdbݿ;
===============================================================================


===============================================================================
8) һʼperlű;
===============================================================================
Wַ: [url]http://www.inter7.com/qmailadmin/install.txt[/url]

vi /home/vpopmail/bin/adddomain.pl;        #_^޸֧Ķλ;
-------------------------------------------------------------------------------
#!/usr/bin/perl
$str="";
$domainstr="";

print "Please input domain(eg: test.com):";
while($str ne "\n") {
  $domainstr=$domainstr.$str;
  $str=getc();
}

`/home/vpopmail/bin/vadddomain $domainstr`;
print "Domain $domainstr has been created successfully.\n";

$num="";
$accnum="";
$maxnum="";
while(1) {
  print "Please input maximum accounts(eg: 10):";
  while($num ne "\n") {
    $accnum=$accnum.$num;
    $num=getc();
  }
  if(!($accnum=~m/[^0-9]/)) {
    $maxnum=$accnum;
    last;
  }
  $accnum="";
  $num="";
}

$path="";
$path=`/home/vpopmail/bin/vdominfo -d $domainstr`;
$path=~s/[\s\r]//g;
$file="$path/.qmailadmin-limits";

open(FD,">$file");

print FD "maxpopaccounts $maxnum";
print FD "\n";
print FD "maxaliases -1\n";
print FD "maxforwards -1\n";
print FD "maxmailinglists -1\n";
print FD "maxautoresponders -1\n";
print FD "default_quota 104857600\n";
$domainquota=$maxnum*100;
print FD "quota $domainquota";
print FD "\n";

print FD "\n";
print FD "#disable_pop\n";
print FD "#disable_imap\n";
print FD "#disable_external_relay\n";
print FD "#disable_webmail\n";
print FD "#disable_dialup\n";
print FD "#disable_password_changing\n";

close(FD);

`chmod g-w $file`;
print "Set domain quota successfully!\n";
-------------------------------------------------------------------------------
chmod 755 /home/vpopmail/bin/adddomain.pl;

ע: ΪqmaildomainsĿ¼Ԥֻ100,100ʱqmailԶ
Ŀ¼,Ŀ¼ư(0-9)ʹдĸ(A-Z). ű޸֮,֧
Ŀ¼Զλ(Domain,ȡDomain·).

f: _,vpopmailqmailϵy֮,߀һ
".qmailadmin-limits"~Oęn;Ʌ·_O̓M:

/home/vpopmail/bin/adddomain.pl;
-------------------------------------------------------------------------------
Please input domain(eg: test.com):home.25u.com
Please enter password for postmaster:
enter password again:
ONCHANGE script /home/vpopmail/etc/onchange not found.
Domain home.25u.com has been created successfully.
Please input maximum accounts(eg: 10):10
Set domain quota successfully!
-------------------------------------------------------------------------------

vi /home/vpopmail/domains/home.25u.com/.qmailadmin-limits;        (z~)
-------------------------------------------------------------------------------
maxpopaccounts 10                #10POP3̖;
maxaliases -1                        #oބeĿ;
maxforwards -1                        #oDlĿ;
maxmailinglists -1                #o]б;
maxautoresponders -1                #oԄӻظ;
default_quota 104857600                #ÿPOP3̖ĬJĿgС(λByte);
quota 1000                        #ȫwg~1G(λM);
-------------------------------------------------------------------------------
===============================================================================

[[i] chengkinhung 2007-12-16 23:59 ༭ [/i]]

chengkinhung 2007-7-25 12:04

幝: װʼϵͳClamAV ()

Clam AntiVirusnjUNIXOGPLܛҪ]ŷ裩
ܛоwvʽָʽԄӾWϸ¹(郞ķܛ
ҪĮȻǽ²Yώ)͸^@ЩClam AntiVirusbܛְlĹÙn
ʽ׌ɽYܛ.

Ҫܣ
-------------------------------------------------------------------------------
ָʽ
ټоwijvʽ
ɽYsendmailʹõmilter
֧ԮaIJYώ¹
Cn
on-access蹦ܣLinux&reg;FreeBSD&reg;
ÿθ²Yώ죨ReaĿɅ醾W퓣
֧ԮRAR (2.0)ZipGzipBzip2TarMS OLE2MS CabinetnMS CHM (sHTML)MS SZDD
֧ԮmboxMaildirԭʼ]n
֧ԮUPXFSGPetitesPortable Executablen
-------------------------------------------------------------------------------

ClamAVĻװƹ(/usr/binĿ¼):
-------------------------------------------------------------------------------
freshclam - As you know an anti-virus solution is only as good as the latest
virus updates it has. This tool is used to update the virus databases on your
system. It downloads the latest virus updates from the internet and keeps your
anti-virus solution upto date.

clamscan - This is the tool that actually checks your files to see if they are infected.

sigtool - When you download the latest virus updates from the net, there should
be a way of verifying the validity of the update. This is achieved by the sigtool.
It is used to verify the digital signatures of databases and list virus signature
names among other things.
-------------------------------------------------------------------------------
===============================================================================


===============================================================================
1) ϵͳ׼ûʺ(ClamAVҪzlib,bzipgmp׼֧):
===============================================================================
-------------------------------------------------------------------------------
RPMǷѾװ׼:
-------------------------------------------------------------------------------
rpm -qa | grep zlib;
rpm -qa | grep zlib-devel;
rpm -qa | grep bzip2;
rpm -qa | grep bzip2-devel;
rpm -qa | grep gmp;
rpm -qa | grep gmp-devel;
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
ûаװ׼,װ:
-------------------------------------------------------------------------------
yum install zlib;
yum install zlib-devel;
yum install bzip2;
yum install bzip2-devel;
yum install gmp;
yum install gmp-devel;
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
openssl׼:
-------------------------------------------------------------------------------
rpm -qa | grep openssl;
yum list | grep openssl;        #ǷҪװ

yum install openssl;
yum update openssl;
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
ûʻ:
-------------------------------------------------------------------------------
ǵһΰװ,ϵͳӦûûʺ,Ҫ½:

groupadd clamav;
useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav;

ע: 潫ܵRPMYUMװԶװûʺ,ַװ,
ԺԽûIJ; Ϊ߰ȫԺͳһ, һʹֹ
ûʻ.

Ոע: ΪϵͳclamavҪqmail-scannerɨ,ͨ qmail-scanner
_ClamAVĒ蹦, ClamAV־ļȨޱóqmail-scanner
ִ߾жд,tŸo];
-------------------------------------------------------------------------------
===============================================================================


===============================================================================
2) װClamAVϵͳ(A,BCַѡһ);
===============================================================================
-------------------------------------------------------------------------------
A) YUM߰װ(򵥷,Ƽô˷):
-------------------------------------------------------------------------------
yum list clamav;
yum install clamav;                (BԄӰbclamav-db)
yum install clamav-devel;
yum install clamav-milter;        (HsendmailҪ,BԄӰbclamd)
yum install clamd;                (bclamav-milter,ͱаbclamd)

Ոע: clamav-milternjTsendmailOӋĿٺг,ʹsendmail,
ͨ^mail-scanner֮_ClamAV,tذb͆clamav-milter.

vi /etc/passwd;                #Ϊ߰ȫ,뽫bashĿΪ/bin/false,ʾ:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
clamav:x:104:104:Clam Anti Virus Checker:/var/clamav:/bin/false
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ոע: /etc/shells б /bin/false
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
B) RPMװ;
-------------------------------------------------------------------------------
οվ:
[url]http://www.clamav.net/[/url]
[url]http://www.clamav.net/download/sources/[/url]
[url]http://crash.fce.vutbr.cz/crash-hat/5/clamav/[/url]

RPM׼:
wget [url]http://crash.fce.vutbr.cz/crash-hat/5/clamav/clamav-0.90.1-0.i386.rpm[/url];
wget [url]http://crash.fce.vutbr.cz/crash-hat/5/clamav/clamav-db-0.90.1-0.i386.rpm[/url];
wget [url]http://crash.fce.vutbr.cz/crash-hat/5/clamav/clamav-devel-0.90.1-0.i386.rpm[/url];
wget [url]http://crash.fce.vutbr.cz/crash-hat/5/clamav/clamav-milter-0.90.1-0.i386.rpm[/url];
wget [url]http://crash.fce.vutbr.cz/crash-hat/5/clamav/clamav-server-0.90.1-0.i386.rpm[/url];
wget [url]http://crash.fce.vutbr.cz/crash-hat/5/clamav/clamav.spec[/url];

RPMԴ:        #Ҫ,ôsrcԴrebuildϵǰϵͳҪrpm׼
wget [url]http://crash.fce.vutbr.cz/crash-hat/5/clamav/clamav-0.90.1-0.src.rpm[/url];

rpm -ivh clamav-0.90.1-0.i386.rpm;
rpm -ivh clamav-db-0.90.1-0.i386.rpm;
rpm -ivh --nodeps clamav-milter-0.90.1-0.i386.rpm;
rpm -ivh clamav-server-0.90.1-0.i386.rpm;

Ոע: bclamav-milterrsendmailsendmail-cfهPϵ,
ϵyҪ sendmail, Ϳ --nodeps هPϵ.
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
C) Դװ(ϵͳʹô˰װ);
-------------------------------------------------------------------------------
wget [url]http://freshmeat.net/redir/clamav/29355/url_tgz/clamav-0.90.1.tar.gz[/url];
wget [url]http://freshmeat.net/redir/clamav/29355/url_tgz/clamav-0.90.3.tar.gz[/url];
tar zxvf clamav-0.90.1.tar.gz;
cd clamav-0.90.1;

Ոע: ̎gPIطָ ClamAV \, ˱ȽPÑͽM.
, (b)ʽ, ѡָû qscand Ϊ ClamAV
ʹ,ôִûLinux:

groupadd qscand;
useradd -g qscand -s /bin/false -c "Qmail-Scanner Account" qscand;

a:(°汾ô)
wget [url]http://www.fehcom.de/qmail/spamcontrol/clamav-0.88.2_output.patch_[/url];
Ոע: °a䌍ǰspamcontrolYԴ:
cp /usr/local/src/qmail/qmail-1.03/*_output.patch_ ./
tar zxvf clamav-0.90.3.tar.gz;
cd clamav-0.90.3;
patch ../*_output.patch_;

(a)ָûclamavclamavclamd:
./configure \
--sysconfdir=/etc \
--with-user=clamav \
--with-group=clamav \
--enable-milter;

(b)ָrootclamd,ԽQHPSIĒ跽(AOb޸ijroot):
./configure \
--sysconfdir=/etc \
--with-user=root \
--with-group=root \
--disable-zlib-vcheck \
--enable-milter;

(c)ָûqscandqscandClamAV,ԽϺqmail-qscandİװ:
./configure \
--sysconfdir=/etc \
--with-user=qscand \
--with-group=qscand \
--disable-zlib-vcheck \
--enable-milter;

ע: 鱾ϵͳҪqmail-qscandִвɨsyslog¼־,
˾gEָûqscand\ClamAV, ͿԽyһɂϵyʹ,Ҫ
ںPE޸ClamAV־ĵ,qmail-qscandĽűȨдClamAV
־ĵ.xʹQHPSI{ClamAV,thOóroot݁, Ո
mE(Qmail\_)PQHPSIOÃ.

make;
make install;

Ոע: tarYԴbAO·/usr/local/bin/,OQHPSIՈƥO.
-------------------------------------------------------------------------------
===============================================================================

chengkinhung 2007-7-25 12:06

幝: װʼϵͳClamAV ()

===============================================================================
3) ú͵ClamAV;
===============================================================================
-------------------------------------------------------------------------------
(a) ϵͳԶclamav-milterclamd;
-------------------------------------------------------------------------------
chkconfig clamav-milter on
chkconfig clamd on
service clamav-milter start
service clamd start
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
(b) ޸Oęn;
-------------------------------------------------------------------------------
vi /etc/sysconfig/clamav-milter;        #ԤҪ,һ㲻޸

vi /etc/freshclam.conf;        #밴˵ע͵freshclam.confͷһ:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Comment or remove the line below.
#Example                #עʹ,ôûκ,ֻȷִ޸Ķ
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

vi /etc/clamd.conf;        #밴˵ע͵clamd.confͷһ:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Comment or remove the line below.
#Example                #עʹ,ôûκ,ֻȷִ޸Ķ

ScanMail yes                #횴_ScanMail@x(䌍ĬJѽ_)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

ע: Ϊ֤ȫ,ǧҪClam AntiVirusĶִļSGIDSUID;
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
(c) {sendmailĒ腢(H,ҪsendmailԒ);
-------------------------------------------------------------------------------
ClamAV-milternjTosendmailõ,˱޸sendmailO.Ҫֱ
sendmailClamAV-milter,MailScannerClamAV, ôͲҪ
ClamAV-milter(䌍ðbClamAV-milter),ǿҪⰲb ClamAV
perl module.

bclamav-milterrδȡsm-client֧,ôclamav-milterӕr,͕
Ԅәz /etc/mail/sendmail.cf ǷѽĒx. z鲻
O, clamav-milter ͟o, /etc/mail/sendmail.mc O
clmilterx, Ȼپg/etc/mail/sendmail.cfęn.

ȻͲҪʹsendmailԒ, ҲԸɴhsendmail,Ƴęn
sendmail.cf,ֻҪclamav-milteroҵ /etc/mail/sendmail.cf, .

Osendmail{clamav-milter蹦ܵķ:

vi /etc/mail/sendmail.mc;        (OSTYPE(`linux')dnl֮)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSTYPE(`linux')dnl
INPUT_MAIL_FILTER(`clmilter',`S=local:/var/clamav/clmilter.socket,T=S:4m;R:4m')dnl
define(`confINPUT_MAIL_FILTERS',`clmilter')
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Ոע⣺Ҳͬrʹ milter-greylistԓȷ milter-greylist OȻ
ŷ clamav-milter@Ӯһ]_r,Sendmail Ⱥ milter-greylist
Ȼź clamav-milterO£
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSTYPE(`linux')dnl
INPUT_MAIL_FILTER(`greylist',`S=local:/var/milter-greylist/milter-greylist.sock')
define(`confMILTER_MACROS_CONNECT', `j, {if_addr}')
define(`confMILTER_MACROS_HELO', `{verify}, {cert_subject}')
define(`confMILTER_MACROS_ENVFROM', `i, {auth_authen}')
INPUT_MAIL_FILTER(`clamav-milter',`S=local:/var/run/clamav/clamav-milter.sock,F=, T=S:4m;R:4m')dnl
define(`ConfINPUT_MAIL_FILTERS', `clamav-milter')dnl
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

make -C /etc/mail;                (¾gsendmail.cfęn)
service sendmail restart;

Ոע: 鱾ϵyoʹsendmail,Oֻclamav-milterbrҪ
sm-client֧,혱Bһsendmailϵyʹclamavķ. X
ñ^韩,ôhڰbclamav-milterr--nodepsȡ sm-client
֧,@ӾͿԺԱE.
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
(d) clamav P:
-------------------------------------------------------------------------------
service clamd start;
service clamav-milter start;        (clamav-milterr^L)
-------------------------------------------------------------------------------
===============================================================================


===============================================================================
4) Բöʱ,۲췵Ϣ:
===============================================================================
-------------------------------------------------------------------------------
ԸǷ˳ִ:
-------------------------------------------------------------------------------
/usr/bin/freshclam;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ClamAV update process started at Fri Mar 30 10:00:53 2007
main.cvd is up to date (version: 42, sigs: 83951, f-level: 10, builder: tkojm)
daily.inc is up to date (version: 2965, sigs: 20319, f-level: 14, builder: ccordes)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ll /var/log/clamav/freshclam.log;        #һ¸¼¼

شϢ,ûɸ־ĵ,밴²账ڲ:
touch /var/log/clamav/freshclam.log;
chmod 600 /var/log/clamav/freshclam.log;

Ӧǰİװõû,ȷĿ¼ӦȨ:
chown -R clamav.clamav /var/log/clamav/;

ע: ˴clamav־ĵȨ, Ҫںİbʹclamav
qmail-scannerɨ(ͨqmail-scannerClamAV,ʹQHPSI), ô
İװȫɺ,ClamAV־ļȨޱóqmail-scannerִȨд;

˵: ²,ָ־ĵ;
/usr/bin/freshclam --quiet -l /var/log/clam-update.log
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
öʱ²:
-------------------------------------------------------------------------------
vi /etc/crontab;        #¶ʱʹ--quiet,طǴϢ
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
26 03 * * * root /usr/bin/freshclam --quiet
38 15 * * * root /usr/bin/freshclam --quiet
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

ע: չٷվĽ,Ϊ󲿷ûԤÿСʱĿͷ0-3Ӹ,
dzӵ,뾡ڱķӶִи;
-------------------------------------------------------------------------------
===============================================================================

[[i] chengkinhung 2007-7-25 12:08 ༭ [/i]]

chengkinhung 2007-7-26 08:30

: װʼϵͳSpamAssassin

===============================================================================
1) װMail-SpamAssassin(ɰABѡһ);
===============================================================================
-------------------------------------------------------------------------------
A) YUMװ:
-------------------------------------------------------------------------------
rpm -qa | grep spamassassin;        #ǷѾװ
yum list | grep spamassassin;        #Դ
yum install spamassassin;        #°װ
:
yum update spamassassin;        #
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
B) TARԴװ:
-------------------------------------------------------------------------------
οվ: [url]http://spamassassin.apache.org/[/url]
Դ: [url]http://spamassassin.apache.org/downloads.cgi?update=200702131100[/url]

mkdir /usr/local/src/qmail/spamassassin;
cd /usr/local/src/qmail/spamassassin/;
wget [url]http://apache.hkmirror.org/spamassassin/source/Mail-SpamAssassin-3.1.8.tar.gz[/url];
:
wget [url]http://apache.hkmirror.org/spamassassin/source/Mail-SpamAssassin-3.2.1.tar.gz[/url];
tar zxvf Mail-SpamAssassin-3.2.1.tar.gz;
cd Mail-SpamAssassin-3.2.1;

Ոע,bTAR֮ǰ,șzϵyǷbAORPM:
rpm -qa | grep spam;
аbRPM,Ȅh:
rpm -e spamassassin;

export LANG=en_US;
perl Makefile.PL;
make;
make install;

Ҫ,ɽtarԴrpmԴ:
rpmbuild -tb Mail-SpamAssassin-3.1.8.tar.gz;
ls /usr/src/redhat/BUILD/Mail-SpamAssassin-3.1.8;
-------------------------------------------------------------------------------
===============================================================================


===============================================================================
2) Mail-SpamAssassin;
===============================================================================
һMail-SpamAssassinû:
groupadd spamd;
useradd -g spamd -s /bin/false spamd;

vi /etc/sysconfig/spamassassin;        #ָMail-SpamAssassinû,ij:
-------------------------------------------------------------------------------
# Options to spamd
#SPAMDOPTIONS="-d -c -m5 -H"                        #ԭ
SPAMDOPTIONS="-x -u spamd -H /home/spamd -d"        #ij
-------------------------------------------------------------------------------
Ոע: TARb,ܲļ,ôt½;

vi /etc/mail/spamassassin/local.cf;                #ɨ
-------------------------------------------------------------------------------
# SpamAssassin config file for version 2.5x
# generated by [url]http://www.yrex.com/spam/spamconfig.php[/url] (version 1.01)

# How many hits before a message is considered spam.
required_hits           5.0

# Whether to change the subject of suspected spam
rewrite_subject         1

# Text to prepend to subject if rewrite_subject is used
subject_tag             *****SPAM*****

# Encapsulate spam in an attachment
report_safe             1

# Use terse version of the spam report
use_terse_report        0

# Enable the Bayes system
use_bayes               1

# Enable Bayes auto-learning
auto_learn              1

# Enable or disable network checks
skip_rbl_checks         0
use_razor2              1
use_dcc                 1
use_pyzor               1

# Mail using languages used in these country codes will not be marked
# as being possibly spam in a foreign language.
# - chinese english
ok_languages            zh en

# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_locales              en zh
-------------------------------------------------------------------------------

Ոע: O3.2.1֮e,PQѸ,ՈO:
-------------------------------------------------------------------------------
# This is the right place to customize your installation of SpamAssassin.
#
# See 'perldoc Mail::SpamAssassin::Conf' for details of what can be
# tweaked.
#
# Only a small subset of options are listed below
#
###########################################################################

#   Add *****SPAM***** to the Subject header of spam e-mails
#
rewrite_header Subject *****SPAM*****


#   Save spam messages as a message/rfc822 MIME attachment instead of
#   modifying the original message (0: off, 2: use text/plain instead)
#
report_safe 1


#   Set which networks or hosts are considered 'trusted' by your mail
#   server (i.e. not spammers)
#
# trusted_networks 212.17.35.


#   Set file-locking method (flock is not safe over NFS, but is faster)
#
# lock_method flock


#   Set the threshold at which a message is considered spam (default: 5.0)
#
required_score 5.0


#   Use Bayesian classifier (default: 1)
#
use_bayes 1


#   Bayesian classifier auto-learning (default: 1)
#
bayes_auto_learn 1


#   Set headers which may provide inappropriate cues to the Bayesian
#   classifier
#
bayes_ignore_header X-Bogosity
bayes_ignore_header X-Spam-Flag
bayes_ignore_header X-Spam-Status

# Use terse version of the spam report
#use_terse_report        0

# Enable Bayes auto-learning
#auto_learn              1

# Enable or disable network checks
skip_rbl_checks         0
use_razor2              1
#use_dcc                 1
use_pyzor               1

# Mail using languages used in these country codes will not be marked
# as being possibly spam in a foreign language.
# - chinese english
#ok_languages            zh en

# Mail using locales used in these country codes will not be marked
# as being possibly spam in a foreign language.
ok_locales              en zh
-------------------------------------------------------------------------------

˵:
required_hits           5.0 (5Ϊʼ)
===============================================================================

===============================================================================
3) ÿԶ:
===============================================================================
ļǷ:
ll /etc/rc.d/init.d/spamassassin;

ϵͳǷѾspamassassin:
setup->System Service
ѰǷΪspamassassinķ,,[*],ΪԶ;

һ,YUMװ,Զspamassassin,TARԴװ,ֹ
(ΪϵͳԭԤspamassassin,ʹһ,spamd:

cp spamd/redhat-rc-script.sh /etc/rc.d/init.d/spamd;
chkconfig --add spamd;                #init.dĿ¼ΪspamdijΪservice
chkconfig spamd on;                #spamdΪԶ

/etc/rc.d/init.d/spamd start;        #ֹspamd
:
/etc/rc.d/init.d/spamassassin start;

ɨ蹦:
spamassassin -t < sample-spam.txt;
spamassassin -t < sample-nonspam.txt;

ɨ:
ll /root/.spamassassin/;
(ע: Եǰû(root)ɨ,ڼĿ¼².spamassassinĿ¼ļ)
===============================================================================

chengkinhung 2007-7-26 08:32

߹: Qmail\_ ()

===============================================================================
1) Qmailserviceнű(qmail-pop3d,qmail-smtpdqmail-send)
===============================================================================
PĿδ,ՈȽ:

mkdir /service;        (Ŀ䛑ԓڰbdaemontoolsrԄӮa)

mkdir -p /var/qmail/supervise/qmail-pop3d/log;
mkdir -p /var/qmail/supervise/qmail-smtpd/log;
mkdir -p /var/qmail/supervise/qmail-send/log;

vi /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 -c 100 0 110 qmail-popup home.25u.com \
/home/vpopmail/bin/vchkpw qmail-pop3d Maildir 2>&1
-------------------------------------------------------------------------------

vi /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 s1000000 n20 /var/log/qmail/qmail-pop3d 2>&1
-------------------------------------------------------------------------------

vi /var/qmail/supervise/qmail-smtpd/run;
-------------------------------------------------------------------------------
#!/bin/sh
export BASE64=""
export QHPSI="clamdscan"
export QHPSIARG1="--no-summary"
export REPLY554="{virus found} [see: [url]http://www.fehcom.de/emailolicy.html[/url]]"
export BADMIMETYPE=""
export BADLOADERTYPE="M"
export SMTPAUTH=""
export BOUNCEMAXBYTES=""
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 softlimit -m 30000000 \
tcpserver -v -R -l "$LOCAL" -x /etc/tcp.smtp.cdb -c "$MAXSMTPD" \
-u "$QMAILDUID" -g "$NOFILESGID" 0 smtp rblsmtpd \
/var/qmail/bin/qmail-smtpd \
/home/vpopmail/bin/vchkpw /bin/true 2>&1
-------------------------------------------------------------------------------

vi /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 s1000000 n20 /var/log/qmail/qmail-smtpd 2>&1
-------------------------------------------------------------------------------

vi /var/qmail/supervise/qmail-send/run;
-------------------------------------------------------------------------------
#!/bin/sh
exec /var/qmail/rc
-------------------------------------------------------------------------------

vi /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 s1000000 n20 /var/log/qmail/qmail-send 2>&1
-------------------------------------------------------------------------------

O_ĈЙ:
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;
===============================================================================


===============================================================================
2) Qmailпƽűrcͷտ_qmailctl;
===============================================================================
vi /var/qmail/rc;
-------------------------------------------------------------------------------
#!/bin/sh
exec env - PATH="/var/qmail/bin:$PATH" \
qmail-start "`cat /var/qmail/control/defaultdelivery`"
-------------------------------------------------------------------------------
chmod 755 /var/qmail/rc;

vi /var/qmail/bin/qmailctl;
-------------------------------------------------------------------------------
#!/bin/sh

# For Red Hat chkconfig
# chkconfig: - 80 30
# description: the qmail MTA

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

QMAILDUID=`id -u qmaild`
NOFILESGID=`id -g qmaild`

case "$1" in
start)
echo "Starting qmail..."
echo ""
if svok /service/qmail-send ; then
svc -u /service/qmail-send /service/qmail-send/log
echo "Starting qmail-send"
else
echo "qmail-send supervise not running"
fi
if svok /service/qmail-smtpd ; then
svc -u /service/qmail-smtpd /service/qmail-smtpd/log
echo "Starting qmail-smtpd"
else
echo "qmail-smtpd supervise not running"
fi
if svok /service/qmail-pop3d ; then
svc -u /service/qmail-pop3d /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 /service/qmail-smtpd /service/qmail-smtpd/log
echo " qmail-send"
svc -d /service/qmail-send /service/qmail-send/log
echo " qmail-pop3d"
svc -d /service/qmail-pop3d /service/qmail-pop3d/log
if [ -f /var/lock/subsys/qmail ]; then
rm /var/lock/subsys/qmail
fi
;;
stat)
svstat /service/qmail-send
svstat /service/qmail-send/log
svstat /service/qmail-smtpd
svstat /service/qmail-smtpd/log
svstat /service/qmail-pop3d
svstat /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 /service/qmail-send
;;
queue)
qmail-qstat
qmail-qread
;;
reload|hup)
echo "Sending HUP signal to qmail-send."
svc -h /service/qmail-send
;;
pause)
echo "Pausing qmail-send"
svc -p /service/qmail-send
echo "Pausing qmail-smtpd"
svc -p /service/qmail-smtpd
echo "Pausing qmail-pop3d"
svc -p /service/qmail-pop3d
;;
cont)
echo "Continuing qmail-send"
svc -c /service/qmail-send
echo "Continuing qmail-smtpd"
svc -c /service/qmail-smtpd
echo "Continuing qmail-pop3d"
svc -c /service/qmail-pop3d
;;
restart)
echo "Restarting qmail:"
echo "* Stopping qmail-smtpd."
svc -d /service/qmail-smtpd /service/qmail-smtpd/log
echo "* Sending qmail-send SIGTERM and restarting."
svc -t /service/qmail-send /service/qmail-send/log
echo "* Sending qmail-pop3d SIGTERM and restarting."
svc -t /service/qmail-pop3d /service/qmail-pop3d/log
echo "* Restarting qmail-smtpd."
svc -u /service/qmail-smtpd /service/qmail-smtpd/log
;;
cdb)
tcprules /etc/tcp.smtp.cdb /etc/tcp.smtp.tmp < /etc/tcp.smtp
chmod 644 /etc/tcp.smtp.cdb
echo "Reloaded /etc/tcp.smtp."
;;
help)
cat <<HELP
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 & 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
-------------------------------------------------------------------------------

chmod 755 /var/qmail/bin/qmailctl;
ln -s /var/qmail/bin/qmailctl /usr/bin;
===============================================================================

chengkinhung 2007-7-26 08:35

߹: Qmail\_ ()

3) OSMTPJC;
===============================================================================
(a) ֻ(127.0.0.1)ż:
-------------------------------------------------------------------------------
echo '127.0.0.1:allow,RELAYCLIENT=""' > /etc/tcp.smtp;
qmailctl cdb;        (ɔ)

ע: ΪװֻҪPOP3,Բⲿrelay;Ҫ
ͨSMTPŵķ,tҪ߱SMTP֤.
-------------------------------------------------------------------------------

(b) ͨ^/etc/tcp.smtpSMTPJC;
-------------------------------------------------------------------------------
QmailϵyІSMTPJCܷdz,ֻ/etc/tcp.smtpO׃SMTPAUTH=""
.˿ɌZĞ:

echo '127.0.0.1:allow,SMTPAUTH="",RELAYCLIENT=""' >> /etc/tcp.smtp;
qmailctl cdb;        (ɔ)
-------------------------------------------------------------------------------

(c) ͨ^qmail-smtpd_SMTPJC;
-------------------------------------------------------------------------------
Ҳsuperviseqmail-smtpdյrun_мSMTPAUTH=""׃,톢SMTPJC
,:
vi /var/qmail/supervise/qmail-smtpd/run;
----------------------------------------
#!/bin/sh
export BADMIMETYPE=""
export BADLOADERTYPE="M"
export SMTPAUTH=""
QMAILDUID=`id -u vpopmail`
NOFILESGID=`id -g vpopmail`
   ...
   ...
----------------------------------------
-------------------------------------------------------------------------------

Ոע: (a)c(b)е׃SMTPAUTH=""ָʾqmail-smtpdȡplainJCʽ,@ֻ
°汾spamcontrol(2.4.18)Ҫ,f汾tҪ׃.
===============================================================================

4) QmailĽյɽű;
===============================================================================
vi /var/qmail/users/vpopmail-users-alias2recipients;
-------------------------------------------------------------------------------
#!/bin/sh
#LANG=C
QMAIL=/var/qmail

if [ -e $QMAIL/users/recipients ]; then
  if [ -e $QMAIL/users/recipients.bak ]; then
    rm -f $QMAIL/users/recipients.bak
  fi
  mv $QMAIL/users/recipients $QMAIL/users/recipients.bak
fi

for vdomainpath in `cat /var/qmail/users/assign | cut -d: -f 5 | grep -v -w -e '^\.$' | sort | uniq`; do
  if [ -d ${vdomainpath} ]; then
    cd ${vdomainpath}
    ls -l | grep ^d | awk '{print $9"@localhost"}' | sed -e 's/localhost/'${vdomainpath##*/}'/' | sort -u >> $QMAIL/users/recipients
    ls -l .qmail-*| grep -v .qmail-default  | tr -s " " | awk '{print $9}' | awk -F- '{print $2"@localhost"}' | sed -e 's/localhost/'${vdomainpath##*/}'/' | sed -e 's/:/./' | sed -e 's/:/./' | sort -u >> $QMAIL/users/recipients
  fi
done

if [ -s $QMAIL/users/recipients ]; then
  /var/qmail/bin/qmail-recipients
  qmailctl reload
else
  rm -f $QMAIL/users/recipients
  mv $QMAIL/users/recipients.bak $QMAIL/users/recipients
fi
-------------------------------------------------------------------------------
chmod 755 /var/qmail/users/vpopmail-users-alias2recipients;
===============================================================================

5) QmailķǷʽַɽű;
===============================================================================
vi /var/qmail/control/vpopmail-users-alias2badrcptto;
-------------------------------------------------------------------------------
#!/bin/sh
LANG=C
QMAIL=/var/qmail
VPOPMAIL=/home/vpopmail/domains

rm -rf $QMAIL/control/badrcptto
echo "*" > $QMAIL/control/badrcptto

for i in `ls -l $VPOPMAIL | grep ^d | awk '{print $9}'`
do
  cd  $VPOPMAIL/$i
  ls -l | grep ^d | awk '{print "!"$9"@localhost"}' | sed -e 's/localhost/'$i'/' | sort -u >> $QMAIL/control/badrcptto
done

for i in `ls -l $VPOPMAIL | grep ^d | awk '{print $9}'`
do
  cd  $VPOPMAIL/$i
  ls -l .qmail-*| grep -v .qmail-default  | tr -s " " | awk '{print $9}' | awk -F- '{print "!"$2"@localhost"}' | sed -e 's/localhost/'$i'/' | sort -u >> $QMAIL/control/badrcptto
done
-------------------------------------------------------------------------------
chmod 755 /var/qmail/control/vpopmail-users-alias2badrcptto;
===============================================================================

6) QmailĿű;
===============================================================================
#]Ͷfָ(.qmailęn,t˅.qmailݸw);
echo "./Maildir" > /var/qmail/control/defaultdelivery;
chmod 644 /var/qmail/control/defaultdelivery;

#xqmailͬr̎h]͔;
echo "100" > /var/qmail/control/concurrencyremote;
chmod 644 /var/qmail/control/concurrencyremote;

#
echo "255" > /var/qmail/control/concurrencyincoming;
chmod 644 /var/qmail/control/concurrencyincoming;

#
echo "users/recipients.cdb" > /var/qmail/control/recipients;
chmod 644 /var/qmail/control/recipients;

#ָqmail-smtpdܽյλԪM(?**?]ܴ1M);
echo "1024000" > /var/qmail/