<?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/"
	>

<channel>
	<title>Views From The Hill &#187; Gentoo</title>
	<atom:link href="http://dustint.com/archives/tag/gentoo/feed" rel="self" type="application/rss+xml" />
	<link>http://dustint.com</link>
	<description>Tales Of A (Former) SFU Computing Scientist</description>
	<lastBuildDate>Thu, 17 Jun 2010 20:14:27 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Gentoo blacklist.py init Script</title>
		<link>http://dustint.com/archives/22</link>
		<comments>http://dustint.com/archives/22#comments</comments>
		<pubDate>Wed, 04 Jun 2008 06:41:28 +0000</pubDate>
		<dc:creator>Dustin</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[blacklist.py]]></category>
		<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[ssh security]]></category>

		<guid isPermaLink="false">http://dustint.com/?p=22</guid>
		<description><![CDATA[I have several servers which run an assortment of http, svn, ssh, and ftp services. One of the largest annoyances are automated breaking scripts pounding my services. Recently, I have been looking into blacklist.py: a handy python script written by Reto Glauser, which monitors syslog-ng logs looking for possible break-in attempts. The script uses iptables [...]]]></description>
			<content:encoded><![CDATA[<p>I have several servers which run an assortment of http, svn, ssh, and ftp services. One of the largest annoyances are automated breaking scripts pounding my services. Recently, I have been looking into <a href="http://blinkeye.ch/mediawiki/index.php/SSH_Blocking">blacklist.py</a>: a handy python script written by Reto Glauser, which monitors syslog-ng logs looking for possible break-in attempts. The script uses iptables to block future traffic from suspicious IP&#8217;s for a specified amount of time.</p>
<p>After I got the script setup and running I wanted a Gentoo init script that would automatically start the script on boot. After reading through some examples in my /etc/init.d/ directory I seem to have managed to cook up something that works:<span id="more-22"></span></p>
<pre>[code]
#!/sbin/runscript
# blacklist is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# blacklist is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# Copyright: Dustin Thomson
# Homepage: http://dustint.com
# Date: 2008-06-03
# Version 0.0.1

EXEC=/usr/sbin/blacklist
PID=/var/run/blacklist.pid

depend(){
        need net
}

checkconfig(){
        if [ ! -e /usr/sbin/blacklist ] ; then
                eerror "blacklist not found in /usr/sbin/blacklist"
                return 1
        fi
}

start() {
        checkconfig || return 1
        ebegin "Starting Blacklist"
        $EXEC &amp;
        eend $?
}

stop()  {
        ebegin "Stopping Blacklist"
        start-stop-daemon --stop --retry 20 --quiet --pidfile $PID
        eend $?
}
[/code]</pre>
<p>Alternatively, for those with wget, cd into /etc/init.d/ and:</p>
<pre>wget <a href="http://dustint.com/wp-content/uploads/2008/06/blacklist">http://dustint.com/wp-content/uploads/2008/06/blacklist</a>
chmod +x blacklist</pre>
<p>I have placed blacklist.py in /usr/sbin/ and renamed it to simply blacklist</p>
<p>Reto also hosts a handy &#8220;stage-4&#8243; <a href="http://blinkeye.ch/mediawiki/index.php/GNU/Linux_System_Backup_Script_(stage4)">backup script</a> which can create a full backup of your filesystem.</p>
]]></content:encoded>
			<wfw:commentRss>http://dustint.com/archives/22/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
