qmail最大限度阻止垃圾邮件的方法!以及补丁!邮件服务器教程
|
| 论文作者:佚名 论文来源:不详 论文发布时间:2006-6-18 23:55:39 论文发布人:chjchjchj |
减小字体
增大字体
摘要:qmail最大限度阻止垃圾邮件的方法!以及补丁! 垃圾邮件的特色: 1。信件的内容重复 2。量大很多人都能收到 3。回信地址乱填 4。利用别的主机发信
防止方法: 1。可设定某主机relay的范围 比如几千封垃圾邮件过来我们可以设定只收那台主机(mailhost)所发出的信件(mailfrom),如果是他帮别的主机代发(mailfrom和mailhost不一样)的,我们就拒绝。这样可以减少收到垃圾邮件的机会。
2。根据smtp request host来 deny 我们可以将一些不友好的主机,加入一个特别的名单,不接受从这些主机发来的信,并且可以附上退信的原因。
3。badmailfrom 支持 domain 我们可以设定一些不受欢迎的发信人。可以设定整个域的人
4。mailfrom 必须能被resolvel,有适当mxip 检查“发信人位置”是否合理。至少所填写的机器应该查得到地址,才能回信,那些乱添地址的信件会被过滤掉。
5。smtp request host(mailhost)必须能被resolvel 发垃圾邮件的主机没有完整的主机名称。所以象这样的邮件都被过滤掉。
6。使用matchkey防范法 当新的邮件到了首先:检查A:checksun:信件文本字节值(ASCII)综合 B:bodysize:信件文本bytes数 C:信件文本行数 先算出三个特定的值,然后扫描queue统计A,B,C完全相符的次数,当达到设定值时就自动deny掉,被deny掉的特定值不会加入queue里,也就是当发现文章内容相同的信件超过一定数量时,就deny掉。全自动运作不用手动设定名单,可有效的deny掉大部分垃圾邮件。
7。可设定某主机最大送信量 8。加强try 和 deny long 有详尽的收信记录,可以看看发信量特别大的地址,同时看看拒绝了多少,可以查询一下垃圾邮件发来的时间,等等。
9。可以设定重要的发信地址 这个功能是上面功能的补充,因为有时会有”误伤“的状况发生,这时候可以设定这名单,让收信更顺利,这样例如:sina.com sohu.com 163.com china.com 等等会受到特别的优惠。
以下是qmail-smtp.c 的源代码以上功能都具备 [code:1:859a2aa963]
#include <stdio.h> #include <string.h> #include "qmail-qkey.h" #include "dns.h" #include "sig.h" #include "readwrite.h" #include "stralloc.h" #include "substdio.h" #include "alloc.h" #include "auto_qmail.h" #include "control.h" #include "received.h" #include "constmap.h" #include "error.h" #include "ipme.h" #include "ip.h" #include "qmail.h" #include "str.h" #include "fmt.h" #include "scan.h" #include "byte.h" #include "case.h" #include "env.h" #include "now.h" #include "exit.h" #include "rcpthosts.h" #include "timeoutread.h" #include "timeoutwrite.h" #include "commands.h"
#define MAXHOPS 100 unsigned int databytes = 100000; int timeout = 1200; unsigned rcptcount;
int safewrite(fd,buf,len) int fd; char *buf; int len; { int r; r = timeoutwrite(timeout,fd,buf,len); if (r <= 0) _exit(1); return r; }
char ssoutbuf[512]; substdio ssout = SUBSTDIO_FDBUF(safewrite,1,ssoutbuf,sizeof ssoutbuf);
void flush() { substdio_flush(&ssout); } void out(s) char *s; { substdio_puts(&ssout,s); }
void die_read() { _exit(1); } void die_alarm() { out("451 timeout (#4.4.2)\r\n"); flush(); _exit(1); } void die_nomem() { out("421 out of memory (#4.3.0)\r\n"); flush(); _exit(1); } void die_control() { out("421 unable to read controls (#4.3.0)\r\n"); flush(); _exit(1); } void die_ipme() { out("421 unable to figure out my IP addresses (#4.3.0)\r\n"); flush(); _exit(1); } void straynewline() { out("451 See http://pobox.com/~djb/docs/smtplf.html.\r\n"); flush(); _exit(1); }
void err_bmf() { out("553 sorry, your envelope sender is in my badmailfrom list (#5.7.1)\r\n"); } void err_nogateway() { out("553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)\r\n"); } void err_unimpl() { out("502 unimplemented (#5.5.1)\r\n"); } void err_syntax() { out("555 syntax error (#5.5.4)\r\n"); } void err_wantmail() { out("503 MAIL first (#5.5.1)\r\n"); } void err_wantrcpt() { out("503 RCPT first (#5.5.1)\r\n"); } void err_noop() { out("250 ok\r\n"); } void err_vrfy() { out("252 send some mail, i'll try my best\r\n"); } void err_qqt() { out("451 qqt failure (#4.3.0)\r\n"); }
stralloc greeting = {0};
void smtp_greet(code) char *code; { substdio_puts(&ssout,code); substdio_put(&ssout,greeting.s,greeting.len); } void smtp_help() { out("214 qmail home page: http://pobox.com/~djb/qmail.html\r\n"); } void smtp_quit() { smtp_greet("221 "); out("\r\n"); flush(); _exit(0); }
char *remoteip; char *remotehost; char *remoteinfo; char *local; char *relayclient;
stralloc helohost = {0}; char *fakehelo;
void dohelo(ar
|
|
|
|
|
|
|
| ∷相关技术评论 |
(评论内容只代表网友观点,与本站立场无关!) [查看发表评论...] | |
|
|
| |
站内广告 |
| |
|
站内搜索 |
| |
栏目导航 |
| |
|
|
本月热门 |
| |
|
|
本日热门 |
| |
|
|
|