OpenBSD 5.0 spamd部署和反垃圾邮件完全讨论?

在OpenBSD环境下搭建各种服务器的相关讨论。

版主: lionuxchenjun天地乾坤

回复
f5b
锆 Zr
帖子: 643
注册时间: 2011-10-22 20:43

OpenBSD 5.0 spamd部署和反垃圾邮件完全讨论?

帖子 f5b » 2011-11-30 20:47

之前发过一篇帖子,但被回复过后无法修改,这里把最近的研究完全分享

对OpenBSD不感兴趣者请从第二、部分开始阅读:)

一、spamd简易部署

0. 首先请看2个地方
man spamd
https://calomel.org/spamd_config.html

仅启用白名单和灰名单?
whitelisted hosts do not talk to spamd. Their connections are instead
sent to a real mail server, such as sendmail(8).

greylisted hosts are redirected to spamd, but spamd has not yet decided
if they are likely spammers. They are given a temporary failure message
by spamd when they try to deliver mail.

1. /etc/rc.conf.local
spamd_flags="-v" ,记录详尽信息才启用-v,或许 spamd_flags="-v -G 2:4:864"更加实用。

2. /etc/syslog.conf
!!spamd
daemon.err;daemon.warn;daemon.info /var/log/spamd
!*

注意:
以上3行必须放在syslog.conf头部!
两个叹号表示spamd程序的日志只保存在/var/log/spamd,不出现在/var/log/daemon
!*结尾可保证其它log可以继续保存


详情请man syslog.conf
The syslog.conf file is the configuration file for the syslogd(8)
program. It consists of blocks of lines separated by program
specifications, with each line containing two fields: the selector field
which specifies the types of messages and priorities to which the line
applies, and an action field which specifies the action to be taken if a
message syslogd receives matches the selection criteria. The selector
field is separated from the action field by one or more tab(用tab分割,否则无效) characters.

3. /etc/pf.conf
去掉#符号
# rules for spamd(8)
#table <spamd-white> persist
#table <nospamd> persist file "/etc/mail/nospamd"
#pass in on egress proto tcp from any to any port smtp \
# rdr-to 127.0.0.1 port spamd
#pass in on egress proto tcp from <nospamd> to any port smtp
#pass in log on egress proto tcp from <spamd-white> to any port smtp
#pass out log on egress proto tcp to any port smtp

记得手工添加/etc/mail/nospamd文件


4. 不用黑名单
Checking /etc/mail/spamd.conf

The spamd.conf file is used to list out black list files. We do _not_ suggest using blacklist because of the unknowns involved in their collection. We do not know what affiliations the people collecting the ips may have or their agenda. To be safe we suggest avoiding blacklists. Use spamd to make your own lists.

The following is all you need in your /etc/mail/spamd.conf as to void out all black lists.

all:\
::


5. 重新启动计算机即可。



二、高级配置说明

1. spamd相关高级应用(依赖pf)请openports.se
搜索discription中的关键: spamd 或 grey

2. smtpd服务端可以做一些限制如黑名单功能等,在postfix中,看
http://www.spamcop.net/fom-serve/cache/349.html
Here is a sample of one user's main.cf where the SCBL is used:

smtpd_recipient_restrictions =

reject_invalid_hostname,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_sender_domain,
reject_unknown_recipient_domain,
reject_unauth_pipelining,
permit_mynetworks,
reject_unauth_destination,
reject_rbl_client bl.spamcop.net
permit

Another example using several BL's is available at http://jimsun.linxnet.com/misc/postfix-anti-UCE.txt

更多黑名单信息请参考
http://www.openbsd.org/spamd/
http://www.spamhaus.org

http://www.openbsd.org/spamd/ 提到中国和韩国是垃圾邮件发源地重灾区,无组织去管是一个很大因素。
经个人验证,国内很多gov.cn结尾的政府网站邮件系统都被利用来发送垃圾邮件,连国务院办公厅的邮件系统mail.gov.cn都不例外。
免费电子邮件系统中,好像yahoo和tom经常被利用来对外发送垃圾邮件。

3. 安装amavisd-new = spamassassin + clamav


三、讨论:与垃圾邮件斗争,没有尽头...

0. 先看看 http://picsays.com/2011/11/17/spam-pollution/ 垃圾邮件的污染

1. https://blog.delphij.net/2011/06/post-602.html
delphij's Chaos 说到

如果只是自己架邮件的话,我认为不合算(成本可能是托管到 Google 那里的几十倍;如果算上免费的版本——可以有10个用户——那就更不合算了),除非你和我有类似的考虑,例如:

a) 发生宕机时立即知道,以及可以立即获得的异地备份(我自己运行的系统有至少1份异地备份,差距不超过24小时)。Google 承诺的 uptime 是 99.9%,这个 uptime 完全可以满足绝大多数用户的需要,但是出现问题的时候有可能在第一时间拿不到自己的数据。
b) 立即知道邮件的处理情况。邮件是否已经到了对方服务器上?什么时间到的?对方发出的邮件是否已经收到?这些问题 Google 目前并不提供查询的方法,实现起来不难,但成本不一定会便宜。
c) 隐私。坦率地说这个不完全是问题(真正需要保密的邮件我会做端到端的加密,而不是依赖服务器不泄密,而且我并不认为 Google 做这件事一定会不如我自己来做,因为他们有足够的保安资源)
d) 求职需要。邮件系统涉及了典型的 Internet 系统所需要面临的很多方面的问题,包括如何配置 DNS、反解析、应对 abuse 投诉、服务器架设等等,这些经验如果自己开公司,或者出去找工作都会用得上。当然,这个不一定真的是一个问题。
e) 发信需要。我的某些应用软件需要发送邮件给其他人,我需要自己的邮件服务器。

所以,至少我想到的这些方面,都 *不是* 必须自己去架设邮件系统的理由。作为兴趣是可以的,如果真要去做个生产环境的话,最好还是评估一下成本和收益再决定。


2. http://ask.slashdot.org/story/11/08/07/ ... ternatives
Self-Hosted Gmail Alternatives? 讨论自己做mail服务器的优缺点

自己做的挑战

a) 硬件,自己的硬件,还得有相应的数据备份措施。
b) 软件,系统和软件都必须持续更新,特别是反垃圾和反病毒功能。
c) 维护,必须有专员负责无法外发邮件、无法接受邮件和病毒、垃圾邮件处理等问题,时间成本?

用isp服务的好处
a) 一般企业是有限个别管理员维护邮件系统,而isp有专门的团队在维护。
b) 由于95%以上的邮件是垃圾或病毒邮件,一般企业需要专员调节更新垃圾、病毒邮件过滤器,维护不良则容易丢失邮件或垃圾过多;而isp已经有一套很完善的处理机制。
c) 一般企业处理不能外发邮件问题:如ip被列入黑名单,快速解决方案是dns更改mx记录和ip地址等,需要准备多几个固定ip,申诉途径慢;isp处理更快。
d) 一般企业预防外发垃圾邮件的治标方案是关闭通过客户端外发邮件功能,mail客户端只能接收邮件,web方式才能外发邮件,效率不高;isp则开启所有功能,收和发两种服务器分离。


3. 国内我们可以用什么电子邮件服务商?

a) 网易、腾讯等很多企业都提供免费电子邮箱,gmail更好,可惜国内访问限制多。
b) 国内看起来很专业的收费的企业邮件系统是http://www.coremail.cn/
c) 国内免费的企业域名邮箱托管服务我测试过的有腾讯企业邮箱,内部使用界面与qq邮箱一致。


四、我们该怎么办?

1. 请看
http://www.cnii.com.cn/gj/content/2011- ... 936744.htm
英国BBC网站11月14日消息称,韩国政府正在游说其互联网服务供应商(ISP)签署一项国家计划,以解决垃圾邮件问题。该计划要求ISP通过封堵一种常见的信息传送路径,以将电子邮件限制于官方的计算机网关,该计划被命名为“封堵25(端口)。

2. 在自家web网站提供“联系我们”的表单而不是email地址,让客户在线提交问题是个不错的方法,加上captcha验证会更妥当?

回复

在线用户

正浏览此版面之用户: 没有注册用户 和 18 访客