OpenBSD的spamd
许久不碰反垃圾邮件的事情了,一来前段时间垃圾邮件确实也没有那么多,加上spamassassin确实相当有效,二来也是因为犯懒。
不过,最近几天垃圾邮件明显比平时多了许多,所以决定坐下来仔细处理一下。
共 17 篇文章。
许久不碰反垃圾邮件的事情了,一来前段时间垃圾邮件确实也没有那么多,加上spamassassin确实相当有效,二来也是因为犯懒。
不过,最近几天垃圾邮件明显比平时多了许多,所以决定坐下来仔细处理一下。
我想这可能是很多人比较关心的问题,特别是希望用一台机器,多块网卡,甚至有多个网关来实现伪双线的同学。
默认情况下FreeBSD系统中配置的网关,是不会自动使用多个网卡的。网关会与某一块网卡关联,并且,默认网关只能有一个。
但是,我们经常会遇到一些比较复杂的情况。例如,你有两块网卡,并且都接入了同一个网段,使用同一个网关,此时,所有的流量都会从一块网卡出去,另一块网卡则没有出流量;另一种比较极端的情况是,你有网通、电信各一个IP,但只有1台机器,而且机房也不给做BGP(当然,这是伪双线,我个人强烈建议不要使用这种机房服务),标准的路由方式就不太好用了。这时候,我们可以借助 FreeBSD 内建的 pf (通过route-to规则)来完成一些比较复杂的功能。
传统上判断操作系统是通过扫描进行的,例如,发一个SYN+FIN的包,看对方如何回应,由于各式各样的原因,包括性能考虑,或编程上的疏忽,这些包会留有一些特征。这类典型的应用是nmap和NetCraft。
这类方法有它的作用,对于尝试攻击的人来说,这些特征能够给他们相当多的信息,这些信息甚至足以让攻击者找到一击毙命的攻击方法(例如,发现那是一台没有打过补丁、没有防火墙的Windows)。然而,它也有一些不可避免的局限:
之前一直有些头疼的ssh虫问题,很令人吃惊地找到了一个解决方法。在扫描感染IP的TCP特征之后,发现这些机器的共同特征——他们都用的是Linux。
很幸运地,我不使用Linux,FreeBSD附带的pf提供了一项非常有意思的强大能力(这项能力源于OpenBSD的pf),即按操作系统来控制访问。其它用法还包括例如,禁止没有打补丁的Windows访问,让不同用的操作系统访问得到不同的内容等等。
考虑到Linux如此容易感染ssh蠕虫,我决定采用下述pf策略:
block in quick proto tcp from any os “Linux” to any port ssh
So someone has hacked 210.51.165.42, which apparantly is an open proxy that can lead to attacks. The box has tried to trick my mail server into trusting him and thus relay spams, but my postfix configurations has rejected all its requests. Considering to have pf configuration to avoid it…
I will release third (more or less unstable) release ISO if nothing will prevent me from doing that :-) The latest delphijfork includes several new features, which is tend to exhibit new technologies and possiblities of FreeBSD:
Also, FreeBSD-CURRENT has several new features, including:
Finally, yes, itojun has imported pf(4) into NetBSD. Having pf(4) in base indicates that NetBSD’s recognition of pf(4) related work, and as security officer of NetBSD, itojun-san’s import have some special meanings.
I have added some SYNFLOOD proof packet filter rules for beastie.frontfree.net. Interestingly, the filter options seems to “forge” beastie.frontfree.net to be an OpenBSD box.
It appears that NetBSD has finally adopted packet filter, an OpenBSD feature to its base. Compared to FreeBSD’s pf port, this will be much easier one because the VM structure is almostly alike.