<?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>Amicalement Web - Astuces et Bons plans dans le développement web &#187; sécurité</title>
	<atom:link href="http://www.amicalement-web.net/tag/securite/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.amicalement-web.net</link>
	<description>Astuces et bons plans d&#039;un web developpeur</description>
	<lastBuildDate>Thu, 03 Jun 2010 10:06:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Développement Web: les bons plans de la semaine #16</title>
		<link>http://www.amicalement-web.net/developpement-web-les-bons-plans-de-la-semaine-16/2009/09/29/</link>
		<comments>http://www.amicalement-web.net/developpement-web-les-bons-plans-de-la-semaine-16/2009/09/29/#comments</comments>
		<pubDate>Tue, 29 Sep 2009 18:48:35 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Bons plans]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[sécurité]]></category>
		<category><![CDATA[stats]]></category>
		<category><![CDATA[Symfony]]></category>
		<category><![CDATA[traduction]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.amicalement-web.net/?p=789</guid>
		<description><![CDATA[ Petit décalage à nouveau, mais lundi a été un jour de reprise donc forcément un jour très (trop?) long. Mais pas d&#8217;inquiétude, voici la petite sélection qui remet les pendules à l&#8217;heure que vous retrouverez à nouveau tous les lundis!
Malgré une rentrée très intense, je trouve que la qualité des billets trouvés sur mon [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.amicalement-web.net/wp-content/uploads/newspaper.png" alt="newspaper" title="newspaper" width="614" height="100" class="alignnone size-full wp-image-791" /> Petit décalage à nouveau, mais lundi a été un jour de reprise donc forcément un jour très (trop?) long. Mais pas d&#8217;inquiétude, voici la petite sélection qui remet les pendules à l&#8217;heure que vous retrouverez à nouveau tous les lundis!</p>
<p>Malgré une rentrée très intense, je trouve que la qualité des billets trouvés sur mon parcours n&#8217;est pas supérieur à ce que je pouvais trouver pendant la trêve estivale. Comme quoi, quantité ne rime vraiment pas avec qualité. Mais il y a quand même des choses très intéressantes.<br />
<span id="more-789"></span></p>
<ul>
<li><a  href="http://sundaymorning.jaysalvat.com/">Traduction d&#8217;un site via jquery</a><br />
C&#8217;est la bonne idée de la semaine. Qui en plus bénéficie d&#8217;une très bonne réalisation. Ce plugin, permet grâce à l&#8217;api de traduction Google, d&#8217;offrir à vos visiteurs, un premier niveau de traduction! A essayer et à adopter.</li>
<li><a  href="http://ha.ckers.org/xss.html">Listing des attaques XSS communes</a><br />
Histoire de vérifier que votre site est en béton armé, voici un récapitulatif de toutes les failles XSS les plus courantes.</li>
<li><a  href="http://www.statosphere.fr/website/">Un site de stats sur le monde du web</a><br />
Et moi qui adore les stats, je pouvais pas passer à côté. Et en plus c&#8217;est en français ;)
</li>
<li><a  href="http://symfonyguide.wordpress.com/2009/09/28/symfony-forms-saving-process/">Le processus de save des formulaires Symfony</a><br />
C&#8217;est le bon lien de la semaine Symfony. Vous retrouverez dans ce billet, un schéma reprenant tout le fonctionnement lors d&#8217;un save d&#8217;un formulaire.</li>
<li><a  href="http://css-tricks.com/unobtrusive-page-changer/">Une sélection par selectbox, non intrusive s&#8217;il vous plaît</a><br />
C&#8217;est certainement le gadget javascript, le plus utilisé. Permettre de valider une option d&#8217;une liste déroulante simplement en la sélectionnant (sans submit donc). Mais voilà, sans js, et bien c&#8217;est pas pratique. Voici une version, qui permet de faire la même chose, mais qui offre une alternative sans js. Et ça c&#8217;est bien.</li>
<li><a  href="http://www.distancetohere.com/2009/09/tracking-copied-text-using-javascript-and-php/">Capter les sélections de vos utilisateurs</a><br />
C&#8217;est plus par le côté technique que l&#8217;aspect pratique que j&#8217;ai été séduit. Mais on peut imaginer trouver un intérêt à la cette technique.</li>
<li><a  href="http://www.webdesignbooth.com/wordpress-web-optimization-15-tips-and-plugins-to-monitor-speed-up-and-optimize-your-wordpress-blog/">15 astuces pour optimiser votre blog wordpress</a><br />
Astuces et plugins, pour vous aidez à dompter et à optimiser votre blog.</li>
<li><a  href="http://net.tutsplus.com/videos/screencasts/quick-and-easy-filtering-with-jquery/">Filtrer vos données avec jquery</a><br />
Parce que ça reste une des meilleurs utilisations de jquery à mon sens, voici encore un tutorial sur du filtering de donnée avec jquery</li>
<li><a  href="http://jquerystyle.com/2009/09/23/bezier-curves-and-arcs-in-jquery">Mathématiques + jquery = animation</a><br />
Et oui, les maths en fait, ça sert! En l&#8217;occurence, les courbes de béziers ici permettent d&#8217;obtenir un résultat d&#8217;animation jquery bluffant</li>
<li><a  href="http://blog.jaysalvat.com/articles/realisez-un-bandeau-de-news-en-jquery-comme-sur-itele.php">Un petit bandeau de news en jquery</a><br />
C&#8217;est en français, ca valait bien le déplacement!
</li>
<li><a  href="http://papermashup.com/demos/jquery-highlighting-form-inputs/">Mettre en avant la ligne de votre champ de formulaire</a><br />
Et oui, le css permet de mettre en avant, le champ lui même, mais forcément, c&#8217;est plus visible de mettre toute la ligne! La démo parle d&#8217;elle même.
</li>
</ul>
<p><small>Crédit photo: http://www.flickr.com/photos/drb62/2054107736/</small></p>
]]></content:encoded>
			<wfw:commentRss>http://www.amicalement-web.net/developpement-web-les-bons-plans-de-la-semaine-16/2009/09/29/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Veille sécuritaire avec flux RSS (part 1)</title>
		<link>http://www.amicalement-web.net/veille-securitaire-avec-flux-rss-part-1/2009/08/28/</link>
		<comments>http://www.amicalement-web.net/veille-securitaire-avec-flux-rss-part-1/2009/08/28/#comments</comments>
		<pubDate>Fri, 28 Aug 2009 07:57:00 +0000</pubDate>
		<dc:creator>Benoit</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[sécurité]]></category>
		<category><![CDATA[veille]]></category>

		<guid isPermaLink="false">http://www.amicalement-web.net/?p=598</guid>
		<description><![CDATA[
Il existe sur Internet, de nombreux sites de veille sécuritaire permettant de vous maintenir au courant des dernières vulnérabilités découvertes. Si vous utilisez une application open-source (forum, blog, cms &#8230;), des visites régulières sur ces sites ou abonnement aux flux RSS, vous permettent de maintenir à jour votre application et minimiser les risques de piratages.
Mais, [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.amicalement-web.net/wp-content/uploads/veille.secu2.png" alt="Veille sécuritaire" width="614" height="100" class="alignnone size-full wp-image-640" /></p>
<p>Il existe sur Internet, de nombreux sites de veille sécuritaire permettant de vous maintenir au courant des dernières vulnérabilités découvertes. Si vous utilisez une application open-source (forum, blog, cms &#8230;), des visites régulières sur ces sites ou abonnement aux flux RSS, vous permettent de maintenir à jour votre application et minimiser les risques de piratages.</p>
<p>Mais, que vous utilisiez une application web open-source (ou non) à jour, cela n&#8217;empêche pas les tentatives d&#8217;attaques, c&#8217;est pourquoi je vous propose ici un petit script python pour effectuer vous même votre veille sécuritaire.</p>
<p>Cet article est la 1ère partie d&#8217;une série de 3 :</p>
<ul>
<li><b>Part 1</b>: Configuration des logs apache, création de la BDD puis présentation et configuration du script de traitement.</li>
<li><b>Part 2</b>: Script de génération du flux RSS avec présentation détaillées des informations dans le flux.</li>
<li><b>Part 3</b>: Amélioration du script avec des expressions régulières plus poussés, rajout d&#8217;options &#8230;</li>
</ul>
<p><span id="more-598"></span>Il est intéressant de noter que la Partie 1 est la plus importante, les 2 autres parties pouvant être réalisées sans attendre la suite de l&#8217;article si vous savez programmer.</p>
<h3>Logs apache, BDD &amp; script de traitement</h3>
<p>
<h4>Configuration des logs apache</h4>
<p>Ce script de veille se base sur les fichiers de logs apache, il faut donc vous assurer dans un premier temps que les directives de logs sont bien renseignées au niveau de votre configuration.<br />
L&#8217;article ne portant pas sur la configuration d&#8217;apache, je ne vais pas m&#8217;étendre dessus, voici donc les lignes nécessaires à la génération des logs.</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="apache" style="font-family:monospace;"><span style="color: #00007f;">LogFormat</span> %V %{canonical}p %h %{X-Forwarded-For}i %{PHPSESSID}C %t \<span style="color: #7f007f;">&quot;%r<span style="color: #000099; font-weight: bold;">\&quot;</span> %gt;s %b <span style="color: #000099; font-weight: bold;">\&quot;</span>%{Referer}i<span style="color: #000099; font-weight: bold;">\&quot;</span> <span style="color: #000099; font-weight: bold;">\&quot;</span>%{User-Agent}i<span style="color: #000099; font-weight: bold;">\&quot;</span>
ErrorLog /var/log/apache/my_error_log</span></pre></div></div>

<p>Ceci est un exemple de format de log, vous pouvez le modifier sans problème :</p>
<ul>
<li><b>%V</b>: Nom du serveur</li>
<li><b>%{canonical}p</b>: port</li>
<li><b>%h</b>: IP du visiteur</li>
<li><b>%{X-Forwareded-for}i</b>: IP du proxy</li>
<li><b>%{PHPSESSID}C</b>: ID de session (pratique pour retracer le chemin d&#8217;un pirate potentiel)</li>
<li><b>%t</b>: Date</li>
<li><b>%r</b>: Requête</li>
<li><b>%&gt;s</b>: Status de la requête</li>
<li><b>%b</b>: Taille de la requête</li>
<li><b>%{Referer}i</b>: Referer (lien précédent)</li>
<li><b>%{User-Agent}i</b>: Informations sur le navigateur du visiteur</li>
</ul>
<p>Pour plus d&#8217;infos, je vous invite à consulter <a  href="http://httpd.apache.org/docs/2.0/logs.html">la documentation officielle concernant les directives logs d&#8217;apache</a>.<br />
Une fois votre fichier modifié, n&#8217;oubliez pas de le recharger. Un simple reload doit normalement suffire.</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 reload</pre></div></div>

<h4>Création de la BDD MySQL</h4>
<p>Les informations traitées par le script seront enregistrées en BDD pour pouvoir garder une trace, voici le code SQL pour la création des tables concernées.</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">--</span>
<span style="color: #808080; font-style: italic;">-- Création de la table des attaques potentielles recensées</span>
<span style="color: #808080; font-style: italic;">--</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`veille_vuln`</span> <span style="color: #66cc66;">&#40;</span>
	<span style="color: #ff0000;">`id_vuln`</span> bigint<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">20</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">AUTO_INCREMENT</span><span style="color: #66cc66;">,</span>
	<span style="color: #ff0000;">`ip`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">15</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	<span style="color: #ff0000;">`url`</span> text<span style="color: #66cc66;">,</span>
	<span style="color: #ff0000;">`log`</span> text<span style="color: #66cc66;">,</span>
	<span style="color: #ff0000;">`temps`</span> datetime<span style="color: #66cc66;">,</span>
	<span style="color: #ff0000;">`id_type`</span> tinyint<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span><span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id_vuln`</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">UNIQUE</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`ip`</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">`url`</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">150</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">`log`</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">150</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">`temps`</span><span style="color: #66cc66;">,</span><span style="color: #ff0000;">`id_type`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET utf8;
&nbsp;
<span style="color: #808080; font-style: italic;">--</span>
<span style="color: #808080; font-style: italic;">-- Création de la table des types d'attaques surveillées</span>
<span style="color: #808080; font-style: italic;">--</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">CREATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`veille_vuln_type`</span> <span style="color: #66cc66;">&#40;</span>
	<span style="color: #ff0000;">`id_type`</span> tinyint<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">UNSIGNED</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span> <span style="color: #993333; font-weight: bold;">DEFAULT</span> <span style="color: #ff0000;">'0'</span><span style="color: #66cc66;">,</span>
	<span style="color: #ff0000;">`nom`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">45</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	<span style="color: #ff0000;">`link`</span> varchar<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">250</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
	<span style="color: #993333; font-weight: bold;">PRIMARY</span> <span style="color: #993333; font-weight: bold;">KEY</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id_type`</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#41;</span> ENGINE<span style="color: #66cc66;">=</span>MyISAM <span style="color: #993333; font-weight: bold;">DEFAULT</span> CHARSET utf8;
&nbsp;
<span style="color: #808080; font-style: italic;">--</span>
<span style="color: #808080; font-style: italic;">-- Insertion des types de vulnérabilités surveillées</span>
<span style="color: #808080; font-style: italic;">--</span>
&nbsp;
<span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`veille_vuln_type`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id_type`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`nom`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`link`</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span> 
<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'XSS'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'http://fr.wikipedia.org/wiki/Cross_site_scripting'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'2'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Unicode'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'3'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Include'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'4'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'SQL Injection'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'http://fr.wikipedia.org/wiki/Injection_SQL'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'5'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Mot sensible'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<h4>Script veille-secu</h4>
<p>Une fois les logs apache configurés et la <acronym title="Base De Données">BDD</acronym> créée, nous allons  nous attaquer au script de traitement.<br />
En début de script, appel des différentes librairies nécessaires.</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Importation des librairies necessaires</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">re</span>, <span style="color: #dc143c;">cgi</span>, <span style="color: #dc143c;">time</span>, MySQLdb, <span style="color: #dc143c;">sys</span>
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">getopt</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">getopt</span>,GetoptError</pre></div></div>

<p>Ensuite, la partie à configurer pour :</p>
<ul>
<li>Effectuer la connexion à la <acronym title="Base De Données">BDD</acronym></li>
<li>Indiquer le fichier <strong>pointer</strong></li>
<li>Gérer vos expressions régulières.</li>
</ul>
<p>Le fichier <strong>pointer</strong> va vous permettre de conserver la dernière ligne de logs traitée par le script afin de ne pas repasser sur tout le fichier et utiliser des ressources mémoires inutilement.<br />
Juste après ces infos, deux bloc d&#8217;expressions régulières qui permettront de traiter la ligne de log pour la découper puis de détecter une éventuelle tentative d&#8217;attaque.</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#---------------------------------#</span>
<span style="color: #808080; font-style: italic;">#	PARTIE A CONFIGURER</span>
<span style="color: #808080; font-style: italic;">#---------------------------------#</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Declaration des variables generales (chemin absolu)</span>
file_pointer = <span style="color: #483d8b;">'/path/to/your/pointer'</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Declaration des variables de connexion a la BDD MySQL</span>
bdd_host	= <span style="color: #483d8b;">'127.0.0.1'</span>
bdd_user	= <span style="color: #483d8b;">'mon_user'</span>
bdd_pass	= <span style="color: #483d8b;">'mon_pass'</span>
bdd_db		= <span style="color: #483d8b;">'ma_bdd'</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Declaration des regexp de traitement des logs</span>
pattern_ip 	= <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'[0-9]{1,3}<span style="color: #000099; font-weight: bold;">\.</span>[0-9]{1,3}<span style="color: #000099; font-weight: bold;">\.</span>[0-9]{1,3}<span style="color: #000099; font-weight: bold;">\.</span>[0-9]{1,3}'</span><span style="color: black;">&#41;</span>
pattern_date 	= <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'[0-9]{2}<span style="color: #000099; font-weight: bold;">\/</span>...<span style="color: #000099; font-weight: bold;">\/</span>[0-9]{4}:[0-9]{2}:[0-9]{2}:[0-9]{2}'</span><span style="color: black;">&#41;</span>
pattern_url 	= <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'(GET|POST|PUT|DELETE|HEAD|PROPFIND|LOCK|OPTIONS)<span style="color: #000099; font-weight: bold;">\ </span>[^ ]*<span style="color: #000099; font-weight: bold;">\ </span>'</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Declaration des regexp de detection d'attaques potentielles</span>
p_faille_xss 	=  <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'((<span style="color: #000099; font-weight: bold;">\%</span>3C)|&lt;)[^<span style="color: #000099; font-weight: bold;">\n</span>]+((<span style="color: #000099; font-weight: bold;">\%</span>3E)|&gt;)'</span>, <span style="color: #dc143c;">re</span>.<span style="color: black;">IGNORECASE</span><span style="color: black;">&#41;</span>
p_faille_unicode = <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\.</span>exe|<span style="color: #000099; font-weight: bold;">\/</span>syntaxe<span style="color: #000099; font-weight: bold;">\/</span>winnt<span style="color: #000099; font-weight: bold;">\/</span>system32<span style="color: #000099; font-weight: bold;">\/</span>'</span>, <span style="color: #dc143c;">re</span>.<span style="color: black;">IGNORECASE</span><span style="color: black;">&#41;</span>
p_faille_inc 	= <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'(http|ftp):<span style="color: #000099; font-weight: bold;">\/</span><span style="color: #000099; font-weight: bold;">\/</span>|<span style="color: #000099; font-weight: bold;">\/</span>etc<span style="color: #000099; font-weight: bold;">\/</span>(passwd|shadow)|<span style="color: #000099; font-weight: bold;">\/</span>(sbin|bin)<span style="color: #000099; font-weight: bold;">\/</span>|<span style="color: #000099; font-weight: bold;">\.</span><span style="color: #000099; font-weight: bold;">\.</span><span style="color: #000099; font-weight: bold;">\/</span>'</span>, <span style="color: #dc143c;">re</span>.<span style="color: black;">IGNORECASE</span><span style="color: black;">&#41;</span>
p_faille_sql 	= <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'(<span style="color: #000099; font-weight: bold;">\ </span>|%20)(union|or)(<span style="color: #000099; font-weight: bold;">\ </span>|%20)'</span>, <span style="color: #dc143c;">re</span>.<span style="color: black;">IGNORECASE</span><span style="color: black;">&#41;</span>
p_faille_word 	= <span style="color: #dc143c;">re</span>.<span style="color: #008000;">compile</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'(root|htaccess|passwd|<span style="color: #000099; font-weight: bold;">\.</span>log|<span style="color: #000099; font-weight: bold;">\.</span>conf)'</span>, <span style="color: #dc143c;">re</span>.<span style="color: black;">IGNORECASE</span><span style="color: black;">&#41;</span></pre></div></div>

<p>La suite du fichier concerne le traitement des options et des arguments qu&#8217;il est possible de passer au script, ici une seule option <em>&laquo;&nbsp;&#8211;help&nbsp;&raquo;</em> et un seul argument <em>&laquo;&nbsp;le fichier&nbsp;&raquo;</em>. Nous verrons dans la partie 3 des cas beaucoup plus poussés pour faire de ce script un mini <acronym title="Intrusion Detection System">IDS</acronym> et limiter au maximum les faux-positifs.</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#-----------------------------------------------------#</span>
<span style="color: #808080; font-style: italic;">#	NE PAS MODIFIER CETTE PARTIE</span>
<span style="color: #808080; font-style: italic;">#-----------------------------------------------------#</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Declaration des options et arguments</span>
optionmap = <span style="color: black;">&#91;</span>
	<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;-h&quot;</span>, <span style="color: #483d8b;">&quot;--help&quot;</span>, <span style="color: #483d8b;">&quot;Affiche l'aide&quot;</span><span style="color: black;">&#93;</span>,
	<span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;-f&quot;</span>, <span style="color: #483d8b;">&quot;--logfile&quot;</span>, <span style="color: #483d8b;">&quot;Specifie le fichier de log a traiter (chemin absolu)&quot;</span><span style="color: black;">&#93;</span>,
<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Traitement des options et arguments</span>
args = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
params = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
<span style="color: #ff7700;font-weight:bold;">try</span>:
	args, params = <span style="color: #dc143c;">getopt</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>:<span style="color: black;">&#93;</span>, <span style="color: #483d8b;">&quot;&quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span><span style="color: black;">&#91;</span>o<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> <span style="color: #ff7700;font-weight:bold;">for</span> o <span style="color: #ff7700;font-weight:bold;">in</span> optionmap<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>, \
		<span style="color: black;">&#91;</span>x<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span>:<span style="color: black;">&#93;</span> <span style="color: #ff7700;font-weight:bold;">for</span> x <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">reduce</span><span style="color: black;">&#40;</span><span style="color: #ff7700;font-weight:bold;">lambda</span> x,y: x+y, <span style="color: black;">&#91;</span>z<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span>:-<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> <span style="color: #ff7700;font-weight:bold;">for</span> z <span style="color: #ff7700;font-weight:bold;">in</span> optionmap<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
	args = <span style="color: black;">&#91;</span>a <span style="color: #ff7700;font-weight:bold;">for</span> a,b <span style="color: #ff7700;font-weight:bold;">in</span> args<span style="color: black;">&#93;</span>
&nbsp;
	log = <span style="color: #ff4500;">0</span>
	mode = <span style="color: #008000;">None</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">for</span> option <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;--help&quot;</span>, <span style="color: #483d8b;">&quot;-h&quot;</span><span style="color: black;">&#93;</span>:
		<span style="color: #ff7700;font-weight:bold;">if</span> option <span style="color: #ff7700;font-weight:bold;">in</span> args:
			args.<span style="color: black;">remove</span><span style="color: black;">&#40;</span>option<span style="color: black;">&#41;</span>
			mode = <span style="color: #483d8b;">&quot;help&quot;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">for</span> option <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: black;">&#91;</span><span style="color: #483d8b;">&quot;--logfile&quot;</span>, <span style="color: #483d8b;">&quot;-f&quot;</span><span style="color: black;">&#93;</span>:
		<span style="color: #ff7700;font-weight:bold;">if</span> option <span style="color: #ff7700;font-weight:bold;">in</span> args:
			args.<span style="color: black;">remove</span><span style="color: black;">&#40;</span>option<span style="color: black;">&#41;</span>
			log = params.<span style="color: black;">pop</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Traitement des errreurs</span>
<span style="color: #ff7700;font-weight:bold;">except</span> GetoptError, e:
	<span style="color: #dc143c;">sys</span>.<span style="color: black;">stderr</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;option invalide: &quot;</span><span style="color: black;">&#41;</span>
	<span style="color: #dc143c;">sys</span>.<span style="color: black;">stderr</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #008000;">str</span><span style="color: black;">&#40;</span>e<span style="color: black;">&#41;</span>+<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
	mode = <span style="color: #483d8b;">&quot;help&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Affichage de l'aide si le mode &quot;help&quot; est defini ou si le fichier de log est equivalent a 0</span>
<span style="color: #ff7700;font-weight:bold;">if</span> mode == <span style="color: #483d8b;">&quot;help&quot;</span> <span style="color: #ff7700;font-weight:bold;">or</span> log == <span style="color: #ff4500;">0</span>:
	<span style="color: #dc143c;">sys</span>.<span style="color: black;">stderr</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Syntax: veille-secu <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> m <span style="color: #ff7700;font-weight:bold;">in</span> optionmap:
		<span style="color: #dc143c;">sys</span>.<span style="color: black;">stderr</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span>m<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> + <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> + m<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> + <span style="color: #483d8b;">&quot;   <span style="color: #000099; font-weight: bold;">\t</span>: &quot;</span> + m<span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span> + <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">for</span> o <span style="color: #ff7700;font-weight:bold;">in</span> m<span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span>:-<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>:
			<span style="color: #dc143c;">sys</span>.<span style="color: black;">stderr</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span> + o + <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: black;">&#41;</span>
	<span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Connexion à la <acronym title="Base De Données">BDD</acronym> avec les informations renseignées en début de fichier.</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># Connexion a la BDD</span>
cnx = MySQLdb.<span style="color: black;">connect</span><span style="color: black;">&#40;</span>
	host	= bdd_host,
	<span style="color: #dc143c;">user</span>	= bdd_user,
	passwd	= bdd_pass,
	db		= bdd_db
<span style="color: black;">&#41;</span>
c = cnx.<span style="color: black;">cursor</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Comme expliqué précédemment, nous allons ici vérifier l&#8217;existence et la valeur du <strong>pointer</strong> pour ne pas reprendre le fichier complet puis ouvrir le fichier de log au niveau du <strong>pointer</strong>.<br />
Nous verrons en fin d&#8217;article la possibilité de remettre ce pointer à 0 si vous avez un logrotate activé sur votre serveur.</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># Vérification du pointer pour ne pas reprendre le fichier a 0</span>
pointer = <span style="color: #ff4500;">0</span>
verif = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>file_pointer,<span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">for</span> num <span style="color: #ff7700;font-weight:bold;">in</span> verif.<span style="color: black;">xreadlines</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	pointer = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>num<span style="color: black;">&#41;</span>
verif.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Ouverture du fichier de log et vérification du pointer</span>
logapache = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>log,<span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">if</span> pointer <span style="color: #66cc66;">&amp;</span>gt<span style="color: #66cc66;">;</span> <span style="color: #ff4500;">0</span>:
	logapache.<span style="color: black;">seek</span><span style="color: black;">&#40;</span>pointer, <span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Traitement du fichier ligne par ligne. A chaque ligne de log, le script va analyser l&#8217;url et déterminer, en fonction des regexp définies plus haut, si la requête est une tentative d&#8217;attaque ou non.<br />
Dans cet exemple du script, les regexp de détection sont assez basiques, dans la partie 3 nous élaborerons des techniques plus poussées.</p>
<p>Si une attaque potentielle est détectée, alors elle sera enregistrée en <acronym title="Base De Données">BDD</acronym> pour générer par la suite le flux RSS ou tout simplement consulter les différents enregistrements à partir d&#8217;une interface web comme nous le verrons dans la partie 2 de l&#8217;article.</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># Traitement du fichier ligne par ligne</span>
k=<span style="color: #ff4500;">1</span>
<span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> logapache.<span style="color: black;">xreadlines</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	<span style="color: #808080; font-style: italic;"># Initialisation des Variables</span>
	data_ip 		= <span style="color: #483d8b;">'NULL'</span>
	data_date		= <span style="color: #483d8b;">'NULL'</span>
	data_url		= <span style="color: #483d8b;">'NULL'</span>
	<span style="color: #808080; font-style: italic;"># IP</span>
	field_ip = pattern_ip.<span style="color: black;">search</span><span style="color: black;">&#40;</span>line<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> field_ip:
		data_ip = field_ip.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	<span style="color: #808080; font-style: italic;"># DATE</span>
	field_date = pattern_date.<span style="color: black;">search</span><span style="color: black;">&#40;</span>line<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> field_date:
		tmp_date = <span style="color: #dc143c;">time</span>.<span style="color: black;">strptime</span><span style="color: black;">&#40;</span>field_date.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>, <span style="color: #483d8b;">&quot;%d/%b/%Y:%H:%M:%S&quot;</span><span style="color: black;">&#41;</span>
		data_date = <span style="color: #dc143c;">time</span>.<span style="color: black;">strftime</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;%Y-%m-%d %H:%M:%S&quot;</span>, tmp_date<span style="color: black;">&#41;</span>
	<span style="color: #808080; font-style: italic;"># URL</span>
	field_url = pattern_url.<span style="color: black;">search</span><span style="color: black;">&#40;</span>line<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">if</span> field_url:
		data_method,data_url = <span style="color: black;">&#40;</span>field_url.<span style="color: black;">group</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> + <span style="color: black;">&#91;</span><span style="color: #483d8b;">'0'</span>,<span style="color: #483d8b;">'0'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span>:<span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span>
		<span style="color: #808080; font-style: italic;"># ATTAQUES POTENTIELLES</span>
		field_faille_xss 		= p_faille_xss.<span style="color: black;">search</span><span style="color: black;">&#40;</span>data_url<span style="color: black;">&#41;</span>
		field_faille_unicode 	= p_faille_unicode.<span style="color: black;">search</span><span style="color: black;">&#40;</span>data_url<span style="color: black;">&#41;</span>
		field_faille_inc 		= p_faille_inc.<span style="color: black;">search</span><span style="color: black;">&#40;</span>data_url<span style="color: black;">&#41;</span>
		field_faille_sql 		= p_faille_sql.<span style="color: black;">search</span><span style="color: black;">&#40;</span>data_url<span style="color: black;">&#41;</span>
		field_faille_word 		= p_faille_word.<span style="color: black;">search</span><span style="color: black;">&#40;</span>data_url<span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> field_faille_xss <span style="color: #ff7700;font-weight:bold;">or</span> field_faille_unicode <span style="color: #ff7700;font-weight:bold;">or</span> field_faille_inc <span style="color: #ff7700;font-weight:bold;">or</span> field_faille_sql <span style="color: #ff7700;font-weight:bold;">or</span> field_faille_word:
			<span style="color: #ff7700;font-weight:bold;">if</span> field_faille_xss:
				faille_type = <span style="color: #483d8b;">'1'</span>
			<span style="color: #ff7700;font-weight:bold;">elif</span> field_faille_unicode:
				faille_type = <span style="color: #483d8b;">'2'</span>
			<span style="color: #ff7700;font-weight:bold;">elif</span> field_faille_inc:
				faille_type = <span style="color: #483d8b;">'3'</span>
			<span style="color: #ff7700;font-weight:bold;">elif</span> field_faille_sql:
				faille_type = <span style="color: #483d8b;">'4'</span>
			<span style="color: #ff7700;font-weight:bold;">elif</span> field_faille_word:
				faille_type = <span style="color: #483d8b;">'5'</span>
			c.<span style="color: black;">execute</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;INSERT IGNORE veille_vuln (ip, url, log, temps, id_type) VALUES (%s, %s, %s, %s, %s)&quot;</span>, <span style="color: black;">&#40;</span>data_ip, data_url, line, data_date, faille_type<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
			k = k + <span style="color: #ff4500;">1</span></pre></div></div>

<p>Une fois le fichier traité, nous allons successivement :</p>
<ul>
<li>Fermer la connexion MySQL</li>
<li>Récupérer la position du pointer</li>
<li>Fermer le fichier de log</li>
</ul>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;"># Fermeture de la connexion MySQL</span>
cnx.<span style="color: black;">commit</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
c.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Recuperation position actuelle du pointer puis fermeture du fichier</span>
eof = logapache.<span style="color: black;">tell</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
logapache.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Sauvegarde du pointer en cours</span>
new_verif = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>file_pointer,<span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span>
new_verif.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #008000;">str</span><span style="color: black;">&#40;</span>eof<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
new_verif.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Si vous n&#8217;avez qu&#8217;un seul fichier de log que vous videz de temps en temps, il suffit de mettre en tâche cron le script <strong>veille-secu</strong>, mais si vous utilisez un logrotate, il faudra rajouter une étape.</p>
<p>Ci-dessous, on fait tourner le script toutes les 5min.</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">5</span>	<span style="color: #000000; font-weight: bold;">*</span>	<span style="color: #000000; font-weight: bold;">*</span>	<span style="color: #000000; font-weight: bold;">*</span>	<span style="color: #000000; font-weight: bold;">*</span>	<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>veille-secu <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>your<span style="color: #000000; font-weight: bold;">/</span>apache_log</pre></div></div>

<p>Dans le cas d&#8217;une utilisation de logrotate, dans votre fichier de conf, on va ajouter au niveau de <strong>postrotate</strong> une commande permettant de remettre le <strong>pointer</strong> à 0 à chaque rotation de log.</p>
<p></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">postrotate
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>apache2.pid <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
		<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>your<span style="color: #000000; font-weight: bold;">/</span>pointer
	<span style="color: #000000; font-weight: bold;">fi</span>
endscript</pre></div></div>

<p>Voilà, j&#8217;espère que ce premier article vous plaira sinon Tim risque de pas être content et il ne voudra plus venir me voir ^^</p>
]]></content:encoded>
			<wfw:commentRss>http://www.amicalement-web.net/veille-securitaire-avec-flux-rss-part-1/2009/08/28/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Une nouvelle recrue, parce qu&#8217;il le vaut bien</title>
		<link>http://www.amicalement-web.net/une-nouvelle-recrue-parce-quil-le-vaut-bien/2009/08/27/</link>
		<comments>http://www.amicalement-web.net/une-nouvelle-recrue-parce-quil-le-vaut-bien/2009/08/27/#comments</comments>
		<pubDate>Thu, 27 Aug 2009 16:25:37 +0000</pubDate>
		<dc:creator>Tim</dc:creator>
				<category><![CDATA[Actualité]]></category>
		<category><![CDATA[sécurité]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.amicalement-web.net/?p=677</guid>
		<description><![CDATA[ Oyez oyez, un petit billet pour vous informer qu&#8217;à compter d&#8217;aujourd&#8217;hui et pour une durée indéterminée, nous allons accueillir un petit nouveau sur ce blog! Bon ok, il est pas si nouveau que ça, vu qu&#8217;il traine dans les couloirs du site depuis quelques temps déjà et dans mes pattes encore plus :D

C&#8217;est donc [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.amicalement-web.net/wp-content/uploads/image-mystere.png" alt="image-mystere" title="image-mystere" width="614" height="100" class="alignnone size-full wp-image-678" /> Oyez oyez, un petit billet pour vous informer qu&#8217;à compter d&#8217;aujourd&#8217;hui et pour une durée indéterminée, nous allons accueillir un petit nouveau sur ce blog! Bon ok, il est pas si nouveau que ça, vu qu&#8217;il traine dans les couloirs du site depuis quelques temps déjà et dans mes pattes encore plus :D<br />
<span id="more-677"></span></p>
<p>C&#8217;est donc mogito qui me rejoint pour écrire quelques beaux tutorials! Encore un Symfoniste? Et non, même pas, mogito est ce qu&#8217;on appelle un développeur&#8230; undergroud. Un homme de l&#8217;ombre qui est passionné de sécurité informatique et qui met ses compétences de développement pour cette passion principalement. En même temps, ça tombe bien, c&#8217;est aussi un peu son boulot, pour un gros site marchand qu&#8217;on ne citera pas (enfin je laisse mog le faire :p).</p>
<p>Vous aurez donc, dès demain, le droit à son premier tutorial. Je veux pas spoiler, mais ca parle de &#8230; sécurité informatique je crois!</p>
<p>J&#8217;espère que vous lui réservez un accueil chaleureux, et que vous apprécierez cet élargissement de la ligne éditoriale.</p>
<p>J&#8217;en profite pour relancer mon appel, je ne suis fermé à aucune proposition de collaboration! Plus on est de fous, plus on ris.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.amicalement-web.net/une-nouvelle-recrue-parce-quil-le-vaut-bien/2009/08/27/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
