<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>BSD Security</title>
	<atom:link href="http://bsdsecurity.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://bsdsecurity.wordpress.com</link>
	<description>Weblog about FreeBSD, OpenBSD and Information Security</description>
	<lastBuildDate>Tue, 04 Apr 2006 22:26:28 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='bsdsecurity.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/c074a9cc4ecb3e7650a6450778298be2?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>BSD Security</title>
		<link>http://bsdsecurity.wordpress.com</link>
	</image>
			<item>
		<title>Filtering attacks from China and Korea using FreeBSD and pf</title>
		<link>http://bsdsecurity.wordpress.com/2006/03/25/filtering-attacks-from-china-and-korea-using-freebsd-and-pf/</link>
		<comments>http://bsdsecurity.wordpress.com/2006/03/25/filtering-attacks-from-china-and-korea-using-freebsd-and-pf/#comments</comments>
		<pubDate>Sat, 25 Mar 2006 20:08:08 +0000</pubDate>
		<dc:creator>bsdsecurity</dc:creator>
				<category><![CDATA[FreeBSD]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[pf]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">https://bsdsecurity.wordpress.com/2006/03/25/filtering-attacks-from-china-and-korea-using-freebsd-and-pf/</guid>
		<description><![CDATA[Since many attacks (mostly SSH bruteforce), mail and blog spam is comming from servers located in China and Korea, filtering the traffic from these countries is not such a bad idea. Some time ago, while reading about OpenBSD&#8217;s spamd, I&#8217;ve learned about this site where you can find the list of the network prefixes which [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bsdsecurity.wordpress.com&blog=165106&post=3&subd=bsdsecurity&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Since many attacks (mostly SSH bruteforce), mail and blog spam is comming from servers located in China and Korea, filtering the traffic from these countries is not such a bad idea. Some time ago, while reading about OpenBSD&#8217;s spamd, I&#8217;ve learned about <a target="_blank" title="this site" href="http://okean.com/asianspamblocks.html">this site</a> where you can find the list of the network prefixes which are used in China and Korea. With a simple shell script (name it 500.get-china-korea-cidr) you can get the list of IP&#8217;s and format it for including in <a href="http://www.openbsd.org/faq/pf/index.html">OpenBSD&#8217;s pf</a>:</p>
<p><code>#!/bin/sh</code></p>
<p><code><br />
if [ ! -d /etc/pf_rules ]<br />
        mkdir /etc/pf_rules<br />
else<br />
    /usr/bin/fetch http://www.okean.com/sinokoreacidr.txt<br />
    cat sinokoreacidr.txt | cut -d ' ' -f 1 &gt; /etc/pf_rules/china_and_korea.cidr</code></p>
<p>Put this script in <code>/etc/periodic/weekly</code> and make it executable (<code>chmod +x /etc/periodic/weekly/500.get-china-korea-cidr</code>). </p>
<p>Then you should enter the following rules in your <code>/etc/pf.conf</code> file:</p>
<p><code>table &lt;blog_spammers&gt; persist file "/etc/pf_rules/china_and_korea.cidr"</code></p>
<p><code>block in on $ext_if from &lt;blog_spammers&gt; to any</code></p>
<p>So now the script will update list of CIDR network prefixes weekly and pf will filter all the traffic comming from the network prefixes located in <code>/etc/pf_rules/china_and_korea.cidr</code>. If you don&#8217;t want to filter all the traffic from those netblocks, just write a selective filter rule instead of the one I&#8217;ve wrote here. Also, if you want to filter just the network prefixes which are known to be used by spammers for a long time, you can use the CIDR network prefix list from <a href="http://www.spews.org/spews_list_level1.txt">SPEWS</a>.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/bsdsecurity.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/bsdsecurity.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/bsdsecurity.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/bsdsecurity.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/bsdsecurity.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/bsdsecurity.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/bsdsecurity.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/bsdsecurity.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/bsdsecurity.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/bsdsecurity.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/bsdsecurity.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/bsdsecurity.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=bsdsecurity.wordpress.com&blog=165106&post=3&subd=bsdsecurity&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://bsdsecurity.wordpress.com/2006/03/25/filtering-attacks-from-china-and-korea-using-freebsd-and-pf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ae62de41e7d292fe932fba70b5f1c1ed?s=96&#38;d=identicon" medium="image">
			<media:title type="html">bsdsecurity</media:title>
		</media:content>
	</item>
	</channel>
</rss>