<?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>Michele Manzotti &#187; OpenBSD</title>
	<atom:link href="http://www.manzotti.eu/tag/openbsd/feed" rel="self" type="application/rss+xml" />
	<link>http://www.manzotti.eu</link>
	<description></description>
	<lastBuildDate>Thu, 19 Jan 2012 09:56:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>OpenBSD: Masterizzare da Shell</title>
		<link>http://www.manzotti.eu/openbsd-masterizzare-da-shell</link>
		<comments>http://www.manzotti.eu/openbsd-masterizzare-da-shell#comments</comments>
		<pubDate>Fri, 30 Jan 2009 13:52:59 +0000</pubDate>
		<dc:creator>manzotti.eu</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[cd]]></category>
		<category><![CDATA[dvd]]></category>
		<category><![CDATA[masterizzare]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[wav]]></category>

		<guid isPermaLink="false">http://manzotti.eu/?p=238</guid>
		<description><![CDATA[Per masterizzare con openBSD è necessario avere installati i seguenti pacchetti: cdrecord mpg321 mkisofs growisofs Questi pacchetti di solito sono già presenti con l&#8217;installazione di default. Tuttavia è possibile recuperarli presso il repository ufficiale oppure nei rispettivi siti che supportano il progetto. Per prima cosa è necessario individuare il device che utilizzeremo per masterizzare. #cdrecord [...]]]></description>
			<content:encoded><![CDATA[<p>Per masterizzare con openBSD è necessario avere installati i seguenti pacchetti:</p>
<ul>
<li>cdrecord</li>
<li>mpg321</li>
<li>mkisofs</li>
<li>growisofs</li>
</ul>
<p>Questi pacchetti di solito sono già presenti con l&#8217;installazione di default. Tuttavia è possibile recuperarli presso il <a href="http://www.openbsd.org/4.3_packages/i386.html">repository ufficiale</a> oppure nei rispettivi siti che supportano il progetto.</p>
<p>Per prima cosa è necessario individuare il device che utilizzeremo per masterizzare.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#cdrecord -scanbus</span></pre></div></div>

<p>Di norma su openBSD il device è /dev/rcd0c. Per controllare che sia quello giusto digitiamo:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#eject /dev/rcd0c</span>
<span style="color: #666666; font-style: italic;">#eject -t /dev/rcd0c</span>
<span style="color: #666666; font-style: italic;">#cdrecord dev=/dev/rcd0c driveropts=help -checkdrive</span></pre></div></div>

<p>I primi due comandi servono per aprire e chiudere il lettore cd/dvd mentre il terzo fornisce info sul device. Eccone un esempio:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">Cdrecord<span style="color: #339933;">-</span>Clone <span style="color: #cc66cc;">2.01</span> <span style="color: #009900;">&#40;</span>i386<span style="color: #339933;">-</span>unknown<span style="color: #339933;">-</span>openbsd4<span style="color: #339933;">.</span>3<span style="color: #009900;">&#41;</span> Copyright <span style="color: #009900;">&#40;</span>C<span style="color: #009900;">&#41;</span> <span style="color: #cc66cc;">1995</span><span style="color: #339933;">-</span><span style="color: #cc66cc;">2004</span> Jörg Schilling
scsidev<span style="color: #339933;">:</span> <span style="color: #ff0000;">'/dev/rcd0c'</span>
devname<span style="color: #339933;">:</span> <span style="color: #ff0000;">'/dev/rcd0c'</span>
scsibus<span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">2</span> target<span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">2</span> lun<span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">2</span>
Using libscg version <span style="color: #ff0000;">'schily-0.8'</span><span style="color: #339933;">.</span>
Device type    <span style="color: #339933;">:</span> Removable CD<span style="color: #339933;">-</span>ROM
Version        <span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span>
Response Format<span style="color: #339933;">:</span> <span style="color: #cc66cc;">2</span>
Capabilities   <span style="color: #339933;">:</span>
Vendor_info    <span style="color: #339933;">:</span> <span style="color: #ff0000;">'HL-DT-ST'</span>
Identifikation <span style="color: #339933;">:</span> <span style="color: #ff0000;">'DVDRAM GSA-H42L '</span>
Revision       <span style="color: #339933;">:</span> <span style="color: #ff0000;">'SL00'</span>
Device seems to be<span style="color: #339933;">:</span> Generic mmc2 DVD<span style="color: #339933;">-</span>R<span style="color: #339933;">/</span>DVD<span style="color: #339933;">-</span>RW<span style="color: #339933;">.</span></pre></div></div>

<p>Ora che abbiamo individuato il device passiamo alle masterizzazioni.</p>
<p><strong>A) Masterizzare una distribuzione DVD .iso</strong></p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">growisofs <span style="color: #339933;">-</span>speed<span style="color: #339933;">=</span><span style="color: #cc66cc;">4</span> <span style="color: #339933;">-</span>dvd<span style="color: #339933;">-</span>compat <span style="color: #339933;">-</span>Z <span style="color: #339933;">/</span>dev<span style="color: #339933;">/</span>rcd0c<span style="color: #339933;">=</span>PATH_dvd<span style="color: #339933;">.</span>iso</pre></div></div>

<p><strong>B) Masterizzare una distribuzione CD .iso</strong></p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">cdrecord <span style="color: #339933;">-</span>v <span style="color: #339933;">-</span>eject speed<span style="color: #339933;">=</span><span style="color: #cc66cc;">8</span> dev<span style="color: #339933;">=/</span>dev<span style="color: #339933;">/</span>rcd0c PATH_cd<span style="color: #339933;">.</span>iso</pre></div></div>

<p><strong>C) Masterizzare un CD AUDIO</strong></p>
<p>Se abbiamo dei file .mp3 e il nostro lettore legge solamente l&#8217;estensione .wav dobbiamo convertirli:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #b1b100;">for</span> i in <span style="color: #339933;">*.</span>mp3<span style="color: #339933;">;</span> <span style="color: #b1b100;">do</span> mpg321 <span style="color: #339933;">--</span>stereo <span style="color: #ff0000;">&quot;$i&quot;</span> <span style="color: #339933;">-</span>w $<span style="color: #009900;">&#40;</span>echo <span style="color: #0000ff;">$i</span> <span style="color: #339933;">|</span> <span style="color: #000066;">tr</span> <span style="color: #ff0000;">&quot;mp3&quot;</span> <span style="color: #ff0000;">&quot;wav&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> done<span style="color: #339933;">;</span></pre></div></div>

<p>Ora non rimane che masterizzare i .wav:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">cdrecord dev<span style="color: #339933;">=/</span>dev<span style="color: #339933;">/</span>rcd0c <span style="color: #339933;">-</span>eject speed<span style="color: #339933;">=</span><span style="color: #cc66cc;">2</span> <span style="color: #339933;">-</span>pad <span style="color: #339933;">-</span>audio <span style="color: #339933;">*.</span>wav</pre></div></div>

<p><strong>D) Masterizza un CD MP3</strong></p>
<p>Se invece vogliamo creare un cd mp3 dovremmo prima di tutto creare una iso:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">mkisofs <span style="color: #339933;">-</span>J <span style="color: #339933;">-</span>o mp3<span style="color: #339933;">.</span>iso <span style="color: #339933;">/</span>home<span style="color: #339933;">/</span>cartella_dove_sono_gli_mp3</pre></div></div>

<p>Dopo di che masterizzarla:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">cdrecord dev<span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">0</span> speed<span style="color: #339933;">=</span><span style="color: #cc66cc;">16</span> <span style="color: #339933;">-</span>eject mp3<span style="color: #339933;">.</span>iso</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.manzotti.eu/openbsd-masterizzare-da-shell/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenBSD WARNING: / was not properly unmounted</title>
		<link>http://www.manzotti.eu/openbsd-warning-was-not-properly-unmounted</link>
		<comments>http://www.manzotti.eu/openbsd-warning-was-not-properly-unmounted#comments</comments>
		<pubDate>Sun, 18 Jan 2009 13:06:58 +0000</pubDate>
		<dc:creator>manzotti.eu</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[fsck]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[unmounted]]></category>
		<category><![CDATA[warning]]></category>

		<guid isPermaLink="false">http://manzotti.eu/?p=232</guid>
		<description><![CDATA[Di solito quando mi capitava un warning del genere, era consuetudine riavviare la macchina. Al boot successivo OpenBSD eseguiva un check in automatico dell&#8217;hard disk e tutto andava a buon fine. Di solito questo warning mi capitava quando per svariati motivi staccavo l&#8217;hard disk dalla scheda madre. Ma questa volta mi sono trovato ad una [...]]]></description>
			<content:encoded><![CDATA[<p>Di solito quando mi capitava un <em>warning</em> del genere, era consuetudine riavviare la macchina.<br />
Al boot successivo OpenBSD eseguiva un check in automatico dell&#8217;hard disk e tutto andava a buon fine. Di solito questo warning mi capitava quando per svariati motivi staccavo l&#8217;hard disk dalla scheda madre.<br />
Ma questa volta mi sono trovato ad una cosa del genere:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">automatic boot in  progtress<span style="color: #339933;">:</span> starting file <span style="color: #000066;">system</span> cheks<span style="color: #339933;">.</span>
 <span style="color: #339933;">/</span>dev<span style="color: #339933;">/</span>rwd0c<span style="color: #339933;">:</span> file <span style="color: #000066;">system</span> is clean<span style="color: #339933;">;</span> <span style="color: #b1b100;">not</span> cheking
 <span style="color: #cc66cc;">1366448</span> DUP I<span style="color: #339933;">=</span><span style="color: #cc66cc;">329986</span>
 <span style="color: #339933;">/</span>dev<span style="color: #339933;">/</span>rwd0c<span style="color: #339933;">:</span> UNEXPECTED INCONSISTENCY<span style="color: #339933;">;</span> RUN fsck_fss MANUALLY<span style="color: #339933;">.</span>
 THE FOLLOWING FILE SYSTEM HAD AN UNEXPECTED INCONSISTENCY<span style="color: #339933;">:</span>
 fss<span style="color: #339933;">:</span> <span style="color: #339933;">/</span>dev<span style="color: #339933;">/</span>rwd0c <span style="color: #339933;">/</span>
 Automatic file <span style="color: #000066;">system</span> chek failed<span style="color: #339933;">;</span> help<span style="color: #339933;">!</span>
 Enter pahtname of shell <span style="color: #b1b100;">or</span> RETURN <span style="color: #b1b100;">for</span> sh<span style="color: #339933;">:</span></pre></div></div>

<p>L&#8217;output riportato sopra non è quello esatto ma una copia ritrovata in rete, tuttavia è utile per capire che genere di errore mi sono trovato davanti.<br />
Per risolvere questo inghippo è bastato semplicemente premere enter e indicare il tipo di shell, nel mio caso ho adottato la classica <em>&#8220;vt200&#8243;</em>. Dopo di che è bastato eseguire il seguente comando e riavviare la macchina.</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># fsck -fy</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.manzotti.eu/openbsd-warning-was-not-properly-unmounted/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ssh brute force bloccato con pf e regole di filtering su OpenBSD</title>
		<link>http://www.manzotti.eu/ssh-brute-force-bloccato-con-pf-e-regole-di-filtering</link>
		<comments>http://www.manzotti.eu/ssh-brute-force-bloccato-con-pf-e-regole-di-filtering#comments</comments>
		<pubDate>Sat, 10 Jan 2009 14:21:38 +0000</pubDate>
		<dc:creator>manzotti.eu</dc:creator>
				<category><![CDATA[Security]]></category>
		<category><![CDATA[brute]]></category>
		<category><![CDATA[force]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[pf]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://manzotti.eu/?p=98</guid>
		<description><![CDATA[Poco tempo fa stavo stavo dando un occhiata ai miei log e mi sono subito accorto di un attacco brute force sulla porta ssh. #tail /var/log/authlog Dec 26 19:22:31 maxbsd sshd&#91;12620&#93;: Failed password for root from 218.23.105.25 port 45219 ssh2 Dec 26 19:22:31 maxbsd sshd&#91;13293&#93;: Received disconnect from 218.23.105.25: 11: Bye Bye Dec 26 19:22:35 [...]]]></description>
			<content:encoded><![CDATA[<p>Poco tempo fa stavo stavo dando un occhiata ai miei log e mi sono subito accorto di un attacco brute force sulla porta ssh.</p>
<p>#tail /var/log/authlog</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">Dec <span style="color: #cc66cc;">26</span> <span style="color: #cc66cc;">19</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">22</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">31</span> maxbsd sshd<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">12620</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span> Failed password <span style="color: #b1b100;">for</span> root from 218<span style="color: #339933;">.</span>23<span style="color: #339933;">.</span>105<span style="color: #339933;">.</span>25 port <span style="color: #cc66cc;">45219</span> ssh2
Dec <span style="color: #cc66cc;">26</span> <span style="color: #cc66cc;">19</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">22</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">31</span> maxbsd sshd<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">13293</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span> Received disconnect from 218<span style="color: #339933;">.</span>23<span style="color: #339933;">.</span>105<span style="color: #339933;">.</span>25<span style="color: #339933;">:</span> <span style="color: #cc66cc;">11</span><span style="color: #339933;">:</span> Bye Bye
Dec <span style="color: #cc66cc;">26</span> <span style="color: #cc66cc;">19</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">22</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">35</span> maxbsd sshd<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">6301</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span> <span style="color: #000066;">reverse</span> mapping checking getaddrinfo <span style="color: #b1b100;">for</span> 25<span style="color: #339933;">.</span>105<span style="color: #339933;">.</span>23<span style="color: #339933;">.</span>218<span style="color: #339933;">.</span>broad<span style="color: #339933;">.</span>static<span style="color: #339933;">.</span>hf<span style="color: #339933;">.</span>ah<span style="color: #339933;">.</span>cndata<span style="color: #339933;">.</span>com <span style="color: #009900;">&#91;</span>218<span style="color: #339933;">.</span>23<span style="color: #339933;">.</span>105<span style="color: #339933;">.</span>25<span style="color: #009900;">&#93;</span> failed <span style="color: #339933;">-</span> POSSIBLE BREAK<span style="color: #339933;">-</span>IN ATTEMPT<span style="color: #339933;">!</span>
Dec <span style="color: #cc66cc;">26</span> <span style="color: #cc66cc;">19</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">22</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">35</span> maxbsd sshd<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">6301</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span> Failed password <span style="color: #b1b100;">for</span> root from 218<span style="color: #339933;">.</span>23<span style="color: #339933;">.</span>105<span style="color: #339933;">.</span>25 port <span style="color: #cc66cc;">45474</span> ssh2
Dec <span style="color: #cc66cc;">26</span> <span style="color: #cc66cc;">19</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">22</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">35</span> maxbsd sshd<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2351</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span> Received disconnect from 218<span style="color: #339933;">.</span>23<span style="color: #339933;">.</span>105<span style="color: #339933;">.</span>25<span style="color: #339933;">:</span> <span style="color: #cc66cc;">11</span><span style="color: #339933;">:</span> Bye Bye
Dec <span style="color: #cc66cc;">26</span> <span style="color: #cc66cc;">19</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">22</span><span style="color: #339933;">:</span><span style="color: #cc66cc;">39</span> maxbsd sshd<span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3801</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">:</span> <span style="color: #000066;">reverse</span> mapping checking getaddrinfo <span style="color: #b1b100;">for</span> 25<span style="color: #339933;">.</span>105<span style="color: #339933;">.</span>23<span style="color: #339933;">.</span>218<span style="color: #339933;">.</span>bro</pre></div></div>

<p>Per eliminare questo genere di attacchi possiamo:</p>
<ul>
<li>Abilitare ssh in modo che dopo 3 tentativi sbagliati cada la connessione</li>
<li>Inserire una regola in pf in modo che non accetti più di 3 connessioni contemporaneamente dallo stesso Ip, per poi bannarlo in una blacklist</li>
<li>Creare uno script in modo che legga l&#8217;ip dell&#8217;attaccante dai log e lo inserisca nella blacklist.</li>
</ul>
<p>Per risolvere il primo punto è sufficiente modificare il file di configurazione di ssh, sshd_config, decommentando l&#8217;opzione:</p>
<p># nano /etc/ssh/sshd_config</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">MaxAuthTries <span style="color: #cc66cc;">3</span></pre></div></div>

<p>Per il secondo punto è necessario definire una tabella che contenga gli ip bloccati (la nostra blacklist). Dunque editiamo il file di configurazione di pf che si trova in /etc/pf.conf:</p>
<p>#nano /etc/pf.conf</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">table  persist file <span style="color: #ff0000;">&quot;/etc/spammers&quot;</span></pre></div></div>

<p>Ora invece scriviamo la regola in modo che non accetti più di 3 connessioni contemporaneamente dallo stesso Ip e lo inserisca nella blacklist:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #000066;">int</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;fxp0&quot;</span>
ssh_limit<span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;(max-src-conn-rate 3/30, overload  flush global)&quot;</span>
pass in <span style="color: #000066;">log</span> quick on <span style="color: #0000ff;">$int</span> inet proto tcp from any to <span style="color: #0000ff;">$int</span> port ssh flags S<span style="color: #339933;">/</span>SA keep state <span style="color: #0000ff;">$ssh_limit</span></pre></div></div>

<p>Infine per il terzo punto è sufficiente creare uno script, ssh_block_attack, come il seguente, in modo che legga il file di log e metta in blacklist l&#8217;indirizzo ip che ha sbagliato la password o l&#8217;username:</p>
<p># nano /root/ssh_block_attack</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
&nbsp;
<span style="color: #b1b100;">while</span> <span style="color: #000066;">read</span> mm dd hms localhostname sshd word1 word2 word3 word4 host1 host2 rest<span style="color: #339933;">;</span>
<span style="color: #b1b100;">do</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#91;</span> <span style="color: #ff0000;">&quot;$word1 $word2 $word4&quot;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Invalid user from&quot;</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">then</span>
data<span style="color: #339933;">=</span><span style="color: #ff0000;">`date`</span>
pfctl <span style="color: #339933;">-</span>t spammers <span style="color: #339933;">-</span>T add <span style="color: #0000ff;">$host1</span>
echo <span style="color: #ff0000;">&quot;Aggiunto $host1 a spammers il $data&quot;</span> <span style="color: #339933;">&gt;&gt;</span> <span style="color: #339933;">/</span>root<span style="color: #339933;">/</span>ssh_log
&nbsp;
elif <span style="color: #009900;">&#91;</span> <span style="color: #ff0000;">&quot;$word1 $word2 $word3 $host1&quot;</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;Failed password for from&quot;</span> <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">then</span>
pfctl <span style="color: #339933;">-</span>t spammers <span style="color: #339933;">-</span>T add <span style="color: #0000ff;">$host2</span>
echo <span style="color: #ff0000;">&quot;Aggiunto $host2 a spammers il $data&quot;</span> <span style="color: #339933;">&gt;&gt;</span> <span style="color: #339933;">/</span>root<span style="color: #339933;">/</span>ssh_log
fi
done</pre></div></div>

<p>Per lanciarlo avvio dandogli in pasto il log da monitorare aggiungiamo questa riga in /etc/rc.local .</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">tail <span style="color: #339933;">-</span>f <span style="color: #339933;">/</span>var<span style="color: #339933;">/</span><span style="color: #000066;">log</span><span style="color: #339933;">/</span>authlog <span style="color: #339933;">|</span> sh ssh_block_attack <span style="color: #339933;">&amp;</span></pre></div></div>

<p>Infine se vogliamo vedere la tabella degli ip bloccati è necessario utilizzare questo comando</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">pfctl <span style="color: #339933;">-</span>t spammers <span style="color: #339933;">-</span>T show</pre></div></div>

<p>Ovviamente per non saturare la nostra macchina ogni tanto andrebbe svuotata:</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;">pfctl <span style="color: #339933;">-</span>t spammers <span style="color: #339933;">-</span>T <span style="color: #000066;">delete</span> indirizzo_ip</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.manzotti.eu/ssh-brute-force-bloccato-con-pf-e-regole-di-filtering/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

