歡迎您光臨本站 註冊首頁

安裝milter-limit配置postfix限制郵件賬號發送量

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

  安裝milter-limit配置postfix限制郵件賬號發送量[希望加精]
 
 1.下載
 milter-limit-0.14.tar.gz
 http://www.snertsoft.com/clients/downloads.php 
 
 libsnert-1.71.6.tar.gz
 http://www.snertsoft.com/clients/downloads.php 
 
 sendmail.8.14.2.tar.gz
 ftp://ftp.sendmail.org/pub/sendmail/sendmail.8.14.2.tar.gz 
 
 db-4.5.20.tar.gz
 http://download.oracle.com/berkeley-db/db-4.5.20.tar.gz 
 
 
 2.安裝
 安裝sendmail.8.14.2tar -zxf sendmail.8.14.2.tar.gz 
 cd sendmail-8.14.2
 cd libmilter/
 ./Build -c
 ./Build install安裝db4.5tar -zxf db-4.5.20.tar.gz
 cd db-4.5.20
 cd build_unix
 ../dist/configure
 make && make install安裝libsnerttar -zxf milter-limit-0.14.tar.gz
 tar -zxf libsnert-1.71.6.tar.gz
 cd com/snert/src/lib
 ./configure && make && make install注以下是./configure運行完成後的結果,如果有不同,請解決依賴的問題特別是DBLibSnert/1.71.6
 Copyright 1996, 2009 by Anthony Howe. All rights reserved.
 
   Platform............: FreeBSD gcc
   Berkeley DB.........: 4.5 -ldb-4.5
   POSIX Threads.......: yes yes
   SQLite3.............: yes
   Sendmail libmilter..: yes
   Semaphore API.......: SYSTEMV_API
   Shared Memory API...: SYSTEMV_API
   CFLAGS..............: -I/usr/local/include/db45 -I/usr/home/feishu/limit/org/sqlite/include -D_THREAD_SAFE -pthread -D_REENTRANT -O2 -Wall -I${top_srcdir}/../../include
   LDFLAGS.............: -L/usr/local/lib/db45 -L/usr/home/feishu/limit/org/sqlite/lib -pthread -L${top_srcdir}/../../lib
   LIBS................:make build
 make install安裝milter-limitcd ../milter-limit
 ./configure --enable-run-user=postfix --enable-run-group=mail --enable-debug
 make build
 make install配置postfixecho "smtpd_milters = unix:/var/run/milter/milter-limit.socket" >> /usr/local/etc/postfix/main.cf啟動相關服務/usr/local/etc/rc.d/postfix restart
 /usr/local/etc/rc.d/milter-limit.sh restart相關代碼
 
 生成access.db的PHP腳本代碼#!/usr/local/bin/php -q
 <?php
 $access = "/etc/mail/access";
 $fp = fopen($access,'w+');
 
 $host ="localhost";
 $user = "tmail";
 $passwd = "tmail";
 $dbname = "tmail";
 
 $link = mysql_connect($host,$user,$passwd);
 mysql_select_db($dbname,$link);
 
 $query = "select * from tmail_users order by id desc";
 $rules = mysql_query($query,$link);
 
 while($rs = mysql_fetch_object($rules)){
 //限制賬號一天發送量/d,可以限制一小時發送量/h
         $limit = "milter-limit-From:".$rs->email."        ".$rs->sendnum."/1d"."\n";
         if(fwrite($fp,$limit)===FALSE){
                 echo "不能寫入文件。請檢查文件許可權。";
         }
 }
 system("/usr/sbin/makemap hash /etc/mail/access < /etc/mail/access");
 system("/usr/local/etc/rc.d/milter-limit.sh restart");
 ?>常見問題/libexec/ld-elf.so.1: Shared object "libdb-4.5.so" not found, required by "milter-limit"
 /libexec/ld-elf.so.1: Shared object "libdb-4.5.so" not found, required by "milter-limit解決方案ln -s /usr/local/BerkeleyDB.4.5/lib/libdb-4.5.so /usr/local/lib/libdb-4.5.sohttp://www.milter.info/sendmail/milter-limit/#Installation

[ 本帖最後由 scyzxp 於 2009-8-31 13:34 編輯 ]

《解決方案》

 

  postfix還不能完整的原生支持sendmail的milter
 這個方案還沒有測試過
 
 postfix還有下面一些內建的參數
 
 smtpd_client_connection_rate_limit=5
 ip地址連接的頻率控制.
 smtpd_client_message_rate_limit=5
 客戶端發送郵件的頻率控制.(某種情況下smtpd_client_message_rate_limit和smtpd_client_connection_rate_limit的效果是一樣.smtpd_client_connection_rate_limit是指連接到伺服器25埠就開始計算,smtpd_client_message_rate_limit是發送郵件時計算.)
 
 smtpd_client_recipient_rate_limit=10
 rcpt to的頻率控制,也就是說TO了多少個人.
 smtpd_client_event_limit_exceptions(default: $mynetworks)
 指不做頻率控制檢測的網路,默認是mynetworks.


[火星人 ] 安裝milter-limit配置postfix限制郵件賬號發送量已經有564次圍觀

http://coctec.com/docs/service/show-post-20927.html