vi /var/qmail/supervise/qmail-send/run #!/bin/sh exec env - PATH="/var/qmail/bin:$PATH" qmail-start ./Maildir/
vi /var/qmail/supervise/qmail-send/log/run #!/bin/sh # Keep 30 logs of max 10Mb each # # They will get rotated when they reach 10Mb in size, # or at midnight when our crontab script fires (whichever event comes 1st) exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s10000000 n30 /var/log/qmail/send
vi /var/qmail/supervise/qmail-smtpd/run #!/bin/sh QMAILDUID=`id -u qmaild` NOFILESGID=`id -g qmaild`
exec /usr/local/bin/softlimit -m 2000000 \ /usr/local/bin/tcpserver \ -v -x /home/vpopmail/etc/tcp.smtp.cdb \ -c 20 -R -u "$QMAILDUID" -g "$NOFILESGID" 0 smtp \ /usr/local/bin/rblsmtpd -b -C \ -r 'relays.ordb.org:Your message was rejected because the mail server you use is configured to allow OPEN RELAY - More detailed information regarding this problem is available from http://www.ordb.org/lookup/?%IP% - Please forward this error through to your email server support staff for easy resolution.' \ -r 'inputs.relays.osirusoft.com:Your message was rejected because the mail server you use is either configured to allow OPEN RELAY - More information regarding this problems is available at http://relays.osirusoft.com/cgi-bin/rbcheck.cgi?addr=%IP% - Please forward this error to your email server support staff for resolution.' \ -r 'proxies.relays.monkeys.com:Your message was rejected because the message was sent from an OPEN PROXY - More information regarding this problems is available at http://www.monkeys.com/upl/listed-ip-0.cgi?ip=%IP% - Please forward this error to your email server support staff for resolution.' \ /var/qmail/bin/qmail-smtpd 2>&1
vi /var/qmail/supervise/qmail-smtpd/log/run #!/bin/sh # Keep 30 logs of max 10Mb each # # They will get rotated when they reach 10Mb in size, # or at midnight when our crontab script fires (whichever event comes 1st) exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s10000000 n30 /var/log/qmail/smtpd
vi /var/qmail/supervise/qmail-pop3d/log/run #!/bin/sh # Keep 30 logs of max 10Mb each # They will get rotated when they reach 10Mb in size, # or at midnight when our crontab script fires (whichever event comes 1st) exec /usr/local/bin/setuidgid qmaill /usr/local/bin/multilog t s10000000 n30 /var/log/qmail/pop3d
修改 crontab ,使之每天转储 qmail 的日志文件。
crontab -e 0 0 * * * /usr/local/bin/svc -a /service/qmail-smtpd/log 0 0 * * * /usr/local/bin/svc -a /service/qmail-send/log 0 0 * * * /usr/local/bin/svc -a /service/qmail-pop3d/log
vi /home/vpopmail/etc/tcp.smtp #------------------------------------------------------ # DESCRIPTION OF THE RULES TO REMIND ME OF HOW THIS FILE WORKS # # If you set 'allow', this means that our mail server will allow # the specified ip range to make a TCP connection to our server # # If you set 'deny', this means that our mail server will not allow # the specified ip range to make a TCP connection to our server # # If you set RELAYCLIENT="", this means that the listed IP range is # allowed to relay mail through our server # # If you dont set RELAYCLIENT="", this means that the listed IP range # will not be able to relay mail through our server # # If you set RBLSMTPD="", this means that the listed IP ranges will # not be checked against any of the RBL databases # # If you set RBLSMTPD="some text here", this means that an RBL lookup # wont be performed, but the mail will be rejected with the specified # text as a 4xx temp error message # # If you set RBLSMTPD="-some text here", this means that an RBL lookup # wont be performed, but the mail will be rejected with the specified # text as a 5xx perm error message # # If you do not set RBLSMTPD="" or ="some text", then an RBL lookup # will be performed. If the lookup is successful, then RBLSMTPD will # return your custom error message (as specified in the -r parameter # in smtpd supervise script) #----------------------------------------------------- # HERE ARE THE RULES : #---------------------------------------------------------------- # local class-c's allowed to relay WITHOUT RBL checking 123.123.123.:allow,RELAYCLIENT="",RBLSMTPD="" 123.111.111.:allow,RELAYCLIENT="",RBLSMTPD="" #---------------------------------------------------------------- # these ips are ones that we have setup so that they arent RBL checked # usually because we have spoken with the owners of the mail server # in question and for one reason or another they cannot update their # config, and we still want to be able to receive mail from them. # # reminder text goes here for this entry so we know the story... 111.111.111.:allow,RBLSMTPD="" # reminder text goes here for this entry so we know the story... 222.222.222.222:allow,RBLSMTPD="" #----------------------------------------------------------------- # mailXX.offermail.net connecting regularly and sending invalid # format messages causing exit with status 256 (bare linefeed normally) # entry added 15/12/2001 # after looking at the mail coming from these servers it was found to be spam 216.242.75.100-116:allow,RBLSMTPD="-Connections from this IP have been banned." # #----------------------------------------------------------------- # heaps of spam from replyto of *@freeamateurhotties.com dec2001 64.228.127.:allow,RBLSMTPD="-Connections refused due to spam from freeamateurhotties.com" 154.20.94.:allow,RBLSMTPD="-Connections refused due to spam from freeamateurhotties.com" 154.20.96.:allow,RBLSMTPD="-Connections refused due to spam from freeamateurhotties.com" 154.20.97.:allow,RBLSMTPD="-Connections refused due to spam from freeamateurhotties.com" 154.20.98.:allow,RBLSMTPD="-Connections refused due to spam from freeamateurhotties.com" 209.151.132.:allow,RBLSMTPD="-Connections refused due to spam from freeamateurhotties.com" 209.151.131.:allow,RBLSMTPD="-Connections refused due to spam from freeamateurhotties.com" 216.18.85.:allow,RBLSMTPD="-Connections refused due to spam from freeamateurhotties.com" #----------------------------------------------------------------- # himailer spam 15/7/02 61.230.72-75.:allow,RBLSMTPD="-Connections refused due to spam from HiMailer.com" # #----------------------------------------------------------------- # Allow connections from localhost, # allow relay (cause the WebMail server runs on localhost), # and dont do RBL lookup 127.0.0.1:allow,RELAYCLIENT="",RBLSMTPD="" #----------------------------------------------------------------- # Everyone else can make connections to our server, but not allowed to relay # RBL lookups are performed :allow
接下来配置 /home/vpopmail/etc/tcp.pop3 文件,这个文件控制允许存取 pop3 服务的机器,在有人攻击 pop3 服务器的时候,可以用这个文件阻止攻击者的 IP 地址。
vi /home/vpopmail/etc/tcp.pop3 # Allow any client to connect to us via POP3 # If people are abusing POP3 such as denial-of-service on POP3, # you can add their ips here to block them out :allow