<?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>Renoir Boulanger &#187; UNIX</title>
	<atom:link href="http://renoirboulanger.com/blog/tag/unix/feed/" rel="self" type="application/rss+xml" />
	<link>http://renoirboulanger.com</link>
	<description>Un geek social et Linuxien de nature</description>
	<lastBuildDate>Thu, 08 Sep 2011 18:02:22 +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>Procédure pour créer un serveur FTP sécurisé SSL forcé avec usager virtuels sous Ubuntu Linux avec vsFTPd</title>
		<link>http://renoirboulanger.com/blog/2010/04/procedure-pour-creer-un-serveur-ftp-securise-ssl-force-avec-usager-virtuels-sous-ubuntu-linux-avec-vsftpd/</link>
		<comments>http://renoirboulanger.com/blog/2010/04/procedure-pour-creer-un-serveur-ftp-securise-ssl-force-avec-usager-virtuels-sous-ubuntu-linux-avec-vsftpd/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 19:12:12 +0000</pubDate>
		<dc:creator>Renoir Boulanger</dc:creator>
				<category><![CDATA[Techniques]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[p52]]></category>
		<category><![CDATA[Sécurite]]></category>
		<category><![CDATA[Tutoriels]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://renoirboulanger.com/?p=2162</guid>
		<description><![CDATA[Procédure pour créer un serveur FTP sécurisé SSL forcé avec usager virtuels sous Ubuntu Linux avec vsFTPdJe ne sais pas si vous êtes comme moi mais je n&#8217;aime pas laisser non crypté l&#8217;accès a un service qui me demande un mot de passe. Je devait monter un serveur cette semaine qui doit avoir les accès [...]]]></description>
			<content:encoded><![CDATA[<a href='http://renoirboulanger.com/blog/2010/04/procedure-pour-creer-un-serveur-ftp-securise-ssl-force-avec-usager-virtuels-sous-ubuntu-linux-avec-vsftpd/' class='retweet '  style='display:block;margin:10px 0px;' >Procédure pour créer un serveur FTP sécurisé SSL forcé avec usager virtuels sous Ubuntu Linux avec vsFTPd</a><p>Je ne sais pas si vous êtes comme moi mais je n&#8217;aime pas laisser non crypté l&#8217;accès a un service qui me demande un mot de passe. Je devait monter un serveur cette semaine qui doit avoir les accès FTP.</p>
<p>J&#8217;ai pris l&#8217;initiative de sécuriser la machine avec du SSL car je crois qu&#8217;aujourd&#8217;hui c&#8217;est notre devoir de faire ce genre de chose. Ce n&#8217;est pas la première fois que je configure un serveur FTP over SSL mais je n&#8217;avait jamais pris de notes vraiment à ce jour. Je l&#8217;ai fait cette fois-ci!</p>
<h3><a name="ComptesFTPvirtuel%28sansutilisateurlocal%29sousUbuntuavecvsFTPdetcryptoSSL-Cequecetteproc%C3%A9durefait..."></a>Ce que cette procédure fait&#8230;</h3>
<ol>
<li>Pouvoir créer des comptes FTP sans avoir a créer un utilisateur local (donc pas accès shell (SSH)).</li>
<li>Permet les connections FTP over SSL de façon EXPLICITE sur un port non standard  (cet exemple utilisera le port <tt>6123</tt>)</li>
<li>Ne permet pas d&#8217;utilisateur ni de connexions anonymes</li>
<li>Bannit les hôtes qui tentent de se connecter (LOGIN FAILED)	via <strong>fail2ban</strong></li>
<li>Utilise le system PAM interne pour l&#8217;authentification</li>
<li>Ne requiert pas d&#8217;usager local (pas de risque de tentative de connection SSH, usager séparés)</li>
<li>Le serveur FTP roule sur son propre usager</li>
</ol>
<p><span id="more-2162"></span></p>
<h3><a name="ComptesFTPvirtuel%28sansutilisateurlocal%29sousUbuntuavecvsFTPdetcryptoSSL-Proc%C3%A9dure"></a>Procédure</h3>
<ol>
<li>Vérifier quelle version de serveur FTP est installé

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># dpkg --list | grep ftp</span>
~
ii  <span style="color: #c20cb9; font-weight: bold;">ftp</span>                               <span style="color: #000000;">0.17</span>-<span style="color: #000000;">19</span>                      The FTP client
ii  lftp                              3.7.15-1ubuntu2              Sophisticated command-line FTP<span style="color: #000000; font-weight: bold;">/</span>HTTP client p
ii  vsftpd                            2.2.0-1ubuntu1               lightweight, efficient FTP server written fo</pre></td></tr></table></div>

<p><strong>Note</strong> vsftpd est ce qu&#8217;on veut. Dans ce cas-ci il est déjà installé (ii).</li>
<li>Assurer que les prérequis sont installés

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># aptitude install vsftpd libpam-pwdfile openssl</span></pre></td></tr></table></div>

</li>
<li>Modifier le fichier de config <strong>vsftpd.conf</strong>.<br />
<strong>Note</strong> Modifiez pour ces valeurs (ci-bas) et conservez les autres valeurs par défaut.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># vi /etc/vsftpd.conf</span>
~
<span style="color: #007800;">anonymous_enable</span>=NO
<span style="color: #007800;">local_enable</span>=YES
<span style="color: #007800;">write_enable</span>=YES
<span style="color: #007800;">local_umask</span>=022
<span style="color: #007800;">chroot_local_user</span>=YES
<span style="color: #007800;">ftpd_banner</span>=Un nom Quelconque FTP
<span style="color: #007800;">nopriv_user</span>=vsftpd
&nbsp;
<span style="color: #666666; font-style: italic;"># renoirboulanger.com 2010-04-29 we will force usage on an other port</span>
<span style="color: #666666; font-style: italic;">#connect_from_port_20=YES</span></pre></td></tr></table></div>

</li>
<li>Ajouter ou corriger (étaient pas présents lorsque j&#8217;ai crée la procédure)

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># 2010-04-28 accès usager</span>
<span style="color: #007800;">virtual_use_local_privs</span>=YES
<span style="color: #007800;">guest_enable</span>=YES
<span style="color: #007800;">user_sub_token</span>=<span style="color: #007800;">$USER</span>
<span style="color: #007800;">local_root</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>ibottin<span style="color: #000000; font-weight: bold;">/</span>FTP<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$USER</span>
<span style="color: #007800;">hide_ids</span>=YES</pre></td></tr></table></div>

<p><strong>Note</strong> Ajuster le <tt>local_root</tt> a l&#8217;endroit	ou envoyer les fichiers.</li>
<li>Activer le SSL
<ol>
<li>Créer le certificat

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /etc/ssl</span>
<span style="color: #666666; font-style: italic;"># /usr/bin/openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout vsftpd.pem -out vsftpd.pem</span></pre></td></tr></table></div>

</li>
<li>Ajouter au <tt>/etc/vsftpd.conf</tt>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># vi /etc/vsftpd.conf</span>
~
<span style="color: #666666; font-style: italic;"># renoirboulanger.com 2010-04-30 SSL configuration</span>
<span style="color: #007800;">listen_port</span>=<span style="color: #000000;">6123</span>
<span style="color: #007800;">ftp_data_port</span>=<span style="color: #000000;">6122</span>
<span style="color: #007800;">pasv_min_port</span>=<span style="color: #000000;">6000</span>
<span style="color: #007800;">pasv_max_port</span>=<span style="color: #000000;">6100</span>
&nbsp;
<span style="color: #007800;">ssl_enable</span>=YES
<span style="color: #666666; font-style: italic;"># Allow anonymous users to use secured SSL connections</span>
<span style="color: #007800;">allow_anon_ssl</span>=YES
<span style="color: #666666; font-style: italic;"># All non-anonymous logins are forced to use a secure SSL connection in order to</span>
<span style="color: #666666; font-style: italic;"># send and receive data on data connections.</span>
<span style="color: #007800;">force_local_data_ssl</span>=NO
<span style="color: #666666; font-style: italic;"># All non-anonymous logins are forced to use a secure SSL connection in order to send the password.</span>
<span style="color: #007800;">force_local_logins_ssl</span>=YES
<span style="color: #007800;">ssl_tlsv1</span>=YES
<span style="color: #007800;">ssl_sslv2</span>=YES
<span style="color: #007800;">ssl_sslv3</span>=YES
<span style="color: #007800;">rsa_cert_file</span>=<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>vsftpd.pem</pre></td></tr></table></div>

</li>
</ol>
</li>
<li><strong>Remplacer</strong> le contenu du fichier <tt>pam.d/vsftpd</tt>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># vi /etc/pam.d/vsftpd</span>
~
auth required pam_pwdfile.so pwdfile <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vsftpd.passwd
account required pam_permit.so</pre></td></tr></table></div>

<p><strong>Note</strong> Il est important de remplacer le reste du fichier par ce contenu ci-haut.</li>
<li>Modifier permissions sur le fichier .pem

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># chown vsftpd /etc/ssl/vsftpd.pem</span></pre></td></tr></table></div>

</li>
<li>Redémarrer vsftpd

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># /etc/init.d/vsftpd restart</span></pre></td></tr></table></div>

</li>
<li>Créer le unix user qui va rouler le démon

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># adduser --system --no-create-home --disabled-login -s /usr/sbin/nologin --home /var/ftp vsftpd</span></pre></td></tr></table></div>

</li>
<li>Modifier les permissions pour l&#8217;utilisateur qui roule vsftpd (ajuster)

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># chown -R ftp:ftp /var/ftp/</span>
<span style="color: #666666; font-style: italic;"># chmod -R 740 /var/ftp</span></pre></td></tr></table></div>

</li>
<li><strong><a href="http://renoirboulanger.com/blog/2010/04/procedure-pour-creer-un-serveur-ftp-securise-ssl-force-avec-usager-virtuels-sous-ubuntu-linux-avec-vsftpd#ComptesFTPvirtuel%28sansutilisateurlocal%29sousUbuntuavecvsFTPdetcryptoSSL-AjouterunutilisateurFTP">Ajouter un utilisateur FTP</a></strong></li>
<li>Ajuster <tt>fail2ban</tt>
<div class="code panel" style="border-width: 1px;">
<div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><strong>Ajuster le bloc [vsftpd]</strong></div>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># vi /etc/fail2ban/jail.conf</span>
~
<span style="color: #7a0874; font-weight: bold;">&#91;</span>vsftpd<span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
enabled  = <span style="color: #c20cb9; font-weight: bold;">true</span></pre></td></tr></table></div>

<p><strong>Note</strong> par defaut <tt>enabled</tt> est a false&#8230;	il faut l&#8217;activer.</p>
</div>
</li>
<li>Redémarrer vsftpd

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># /etc/init.d/vsftpd restart</span>
 <span style="color: #000000; font-weight: bold;">*</span> Stopping FTP server: vsftpd
   ...done.
 <span style="color: #000000; font-weight: bold;">*</span> Starting FTP server: vsftpd
   ...done.
<span style="color: #666666; font-style: italic;"># ps aux|grep vsftpd</span>
vsftpd   <span style="color: #000000;">18771</span>  <span style="color: #000000;">0.0</span>  <span style="color: #000000;">0.0</span>  <span style="color: #000000;">28904</span>  <span style="color: #000000;">1300</span> ?        Ss   <span style="color: #000000;">17</span>:09   <span style="color: #000000;">0</span>:00 <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>vsftpd
vsftpd   <span style="color: #000000;">18772</span>  <span style="color: #000000;">0.0</span>  <span style="color: #000000;">0.0</span>  <span style="color: #000000;">29100</span>  <span style="color: #000000;">1608</span> ?        S    <span style="color: #000000;">17</span>:09   <span style="color: #000000;">0</span>:00 <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>vsftpd
<span style="color: #c20cb9; font-weight: bold;">ftp</span>      <span style="color: #000000;">18773</span>  <span style="color: #000000;">0.0</span>  <span style="color: #000000;">0.0</span>  <span style="color: #000000;">28928</span>   <span style="color: #000000;">924</span> ?        S    <span style="color: #000000;">17</span>:09   <span style="color: #000000;">0</span>:00 <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>vsftpd
root     <span style="color: #000000;">18795</span>  <span style="color: #000000;">0.0</span>  <span style="color: #000000;">0.0</span>  <span style="color: #000000;">22628</span>  <span style="color: #000000;">1712</span> ?        S    <span style="color: #000000;">17</span>:<span style="color: #000000;">14</span>   <span style="color: #000000;">0</span>:00 <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>vsftpd
...</pre></td></tr></table></div>

<p><strong>Note</strong> les deux premiers <tt>vsftpd</tt> est le résultat attendu</li>
<li>Nous allons forcer le FTP over SSL sur le port <strong>6122</strong>, pour ça il faut autoriser le Firewall

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># iptables -A INPUT -m state --state ESTABLISHED,RELATED</span>
<span style="color: #666666; font-style: italic;"># iptables -A INPUT -m tcp -p tcp --dport 6122 -j ACCEPT</span>
<span style="color: #666666; font-style: italic;"># iptables -A INPUT -m state --state NEW,ESTABLISHED</span>
<span style="color: #666666; font-style: italic;"># iptables -A INPUT -m tcp -p tcp --dport 6123 -j ACCEPT</span>
<span style="color: #666666; font-style: italic;"># iptables -A INPUT -p tcp --dport 6000:6100 -j ACCEPT</span></pre></td></tr></table></div>

<p><strong>Source</strong>: <a href="http://my.afterdawn.com/ketola/blog_entry.cfm/1262/vsftpd_ssl_and_iptables">vsftpd SSL and iptables</a></li>
<li>Sauvegarder le Firewall

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># iptables-save &amp;gt; /etc/iptables.rules</span></pre></td></tr></table></div>

</li>
<li>Tester de l&#8217;extérieur avec un client FTP (Filezilla, etc)
<p>Voir les options suivantes a la connection</p>
<ol>
<li>port: 6123</li>
<li>Forcer le SSL</li>
</ol>
</li>
</ol>
<h3><a name="ComptesFTPvirtuel%28sansutilisateurlocal%29sousUbuntuavecvsFTPdetcryptoSSL-AjouterunutilisateurFTP"></a>Ajouter un utilisateur FTP</h3>
<p>On utilise le truc simple de htpasswd pour l&#8217;authentification. Pas de gossage <img src='http://renoirboulanger.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<h3><a name="ComptesFTPvirtuel%28sansutilisateurlocal%29sousUbuntuavecvsFTPdetcryptoSSL-Cr%C3%A9erunnouveaucompte"></a>Créer un nouveau compte</h3>
<ol>
<li>Créer le <em>premier compte</em>, sinon, <strong>passer	a la directive suivante</strong>! ou Utiliser mon script <a href="http://renoirboulanger.com/blog/2010/04/procedure-pour-creer-un-serveur-ftp-securise-ssl-force-avec-usager-virtuels-sous-ubuntu-linux-avec-vsftpd#ComptesFTPvirtuel%28sansutilisateurlocal%29sousUbuntuavecvsFTPdetcryptoSSL-Scriptpourcr%C3%A9eruncompteutilisateur">Script pour créer un compte utilisateur</a>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># htpasswd -c /etc/vsftpd.passwd ftpuser</span>
New password:
Re-type new password:
Adding password <span style="color: #000000; font-weight: bold;">for</span> user ftpuser</pre></td></tr></table></div>

<p><strong>Note</strong> l&#8217;option <strong><tt>-c</tt></strong> est	pour créer le fichier la première fois.</li>
<li>Voir les directives de *<a href="http://renoirboulanger.com/blog/2010/04/procedure-pour-creer-un-serveur-ftp-securise-ssl-force-avec-usager-virtuels-sous-ubuntu-linux-avec-vsftpd#ComptesFTPvirtuel%28sansutilisateurlocal%29sousUbuntuavecvsFTPdetcryptoSSL-Scriptpourcr%C3%A9eruncompteutilisateur">Script pour créer un compte utilisateur</a></li>
</ol>
<h3><a name="ComptesFTPvirtuel%28sansutilisateurlocal%29sousUbuntuavecvsFTPdetcryptoSSL-Ajouteroumodifierunutilisateur"></a><strong>Ajouter ou modifier un utilisateur</strong></h3>
<ol>
<li>Utiliser le script <strong><tt>evo-vsftpd-user</tt></strong>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> evo-vsftpd-user foo
Création d<span style="color: #ff0000;">'un nouvel usager dans /etc/vsftpd.passwd ...
New password:
Re-type new password:
Adding password for user foo
 ... OK
 * Création du dossier /home/ibottin/FTP/foo ...  OK
 * Changement des permissions du dossier ...  OK
Terminé!</span></pre></td></tr></table></div>

<p>Voir les directives de <strong><a href="http://renoirboulanger.com/blog/2010/04/procedure-pour-creer-un-serveur-ftp-securise-ssl-force-avec-usager-virtuels-sous-ubuntu-linux-avec-vsftpd#ComptesFTPvirtuel%28sansutilisateurlocal%29sousUbuntuavecvsFTPdetcryptoSSL-Scriptpourcr%C3%A9eruncompteutilisateur">Script pour créer un compte utilisateur</a></strong></li>
</ol>
<h3><a name="ComptesFTPvirtuel%28sansutilisateurlocal%29sousUbuntuavecvsFTPdetcryptoSSL-Scriptpourcr%C3%A9eruncompteutilisateur"></a>Script pour créer un compte utilisateur</h3>
<ol>
<li>Créer le fichier

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># vi /usr/sbin/evo-vsftpd-user</span></pre></td></tr></table></div>

</li>
<li>Coller le contenu

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> $<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Aucun argument usager fourni&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;usage: sudo evo-vsftpd-user foo&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>;
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(whoami)</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">'root'</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Vous n'avez pas les permisions utilisateur requises.&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>;
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Création d'un nouvel usager dans /etc/vsftpd.passwd ... &quot;</span>
htpasswd <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>vsftpd.passwd $<span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; ... OK &quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot; * Création du dossier /home/ibottin/FTP/$1 ... &quot;</span>
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>ibottin<span style="color: #000000; font-weight: bold;">/</span>FTP<span style="color: #000000; font-weight: bold;">/</span>$<span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; OK&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot; * Changement des permissions du dossier ... &quot;</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #c20cb9; font-weight: bold;">ftp</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>ibottin<span style="color: #000000; font-weight: bold;">/</span>FTP<span style="color: #000000; font-weight: bold;">/</span>$<span style="color: #000000;">1</span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> <span style="color: #000000;">740</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>ibottin<span style="color: #000000; font-weight: bold;">/</span>FTP<span style="color: #000000; font-weight: bold;">/</span>$<span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot; OK&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Terminé!&quot;</span></pre></td></tr></table></div>

</li>
<li>Rendre exécutable

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># chmod +x /usr/sbin/evo-vsftpd-user</span></pre></td></tr></table></div>

</li>
</ol>
<h3><a name="ComptesFTPvirtuel%28sansutilisateurlocal%29sousUbuntuavecvsFTPdetcryptoSSL-Tester"></a>Tester</h3>
<ol>
<li>Installer le paquet pour tester
<div class="code panel" style="border-width: 1px;">
<div class="codeContent panelContent">

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># aptitude install ftp-ssl</span></pre></td></tr></table></div>

</div>
</div>
</li>
<li>Tester

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># ftp-ssl someserver.net 6123</span>
Connected to someserver.net.
<span style="color: #000000;">220</span> Un nom Quelconque FTP
Name <span style="color: #7a0874; font-weight: bold;">&#40;</span>someserver.net:renoirboulanger<span style="color: #7a0874; font-weight: bold;">&#41;</span>: ftpuser
<span style="color: #000000;">234</span> Proceed with negotiation.
<span style="color: #7a0874; font-weight: bold;">&#91;</span>SSL Cipher DES-XXXX-SHA<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #000000;">331</span> Please specify the password.
Password:
<span style="color: #000000;">230</span> Login successful.
Remote system <span style="color: #7a0874; font-weight: bold;">type</span> is UNIX.
Using binary mode to transfer files.
<span style="color: #c20cb9; font-weight: bold;">ftp</span><span style="color: #000000; font-weight: bold;">&amp;</span>gt;</pre></td></tr></table></div>

<p><strong>Note</strong> [SSL Cipher DES-XXXX-SHA] est ce qu&#8217;on attend <img src='http://renoirboulanger.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
</ol>
<h3><a name="ComptesFTPvirtuel%28sansutilisateurlocal%29sousUbuntuavecvsFTPdetcryptoSSL-Pourd%C3%A9boguer"></a>Pour déboguer</h3>
<p>Le feedback est assez difficile a avoir de la part de vsftpd, mais pour en voir plus:</p>
<ol>
<li>Pour le debug

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># vi /etc/vsftpd.conf</span>
~
<span style="color: #666666; font-style: italic;"># for debuging</span>
<span style="color: #007800;">log_ftp_protocol</span>=YES</pre></td></tr></table></div>

</li>
</ol>
<h3><a name="ComptesFTPvirtuel%28sansutilisateurlocal%29sousUbuntuavecvsFTPdetcryptoSSL-Ressources"></a>Ressources</h3>
<ul>
<li><a href="http://wjholden.com/vsftpd-help.html">vsftpd help</a></li>
<li><a href="http://vsftpd.beasts.org/vsftpd_conf.html">vsftpd.conf manpages</a></li>
<li><a href="http://my.afterdawn.com/ketola/blog_entry.cfm/1262/vsftpd_ssl_and_iptables">vsftpd SSL and iptables</a></li>
<li><a href="http://www.ubuntututorials.net/installing-vsftpd-using-text-file-for-virtual-users/">Installing vsftpd using text file for virtual users</a></li>
<li><a href="http://www.cyberciti.biz/tips/configure-vsfptd-secure-connections-via-ssl-tls.html">Vsftpd SSL / TLS FTP Server Configuration</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://renoirboulanger.com/blog/2010/04/procedure-pour-creer-un-serveur-ftp-securise-ssl-force-avec-usager-virtuels-sous-ubuntu-linux-avec-vsftpd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comment dire à Apache le mime-type d&#8217;un document Office 2007</title>
		<link>http://renoirboulanger.com/blog/2010/04/comment-dire-a-apache-le-mime-type-dun-document-office-2007/</link>
		<comments>http://renoirboulanger.com/blog/2010/04/comment-dire-a-apache-le-mime-type-dun-document-office-2007/#comments</comments>
		<pubDate>Wed, 21 Apr 2010 13:22:49 +0000</pubDate>
		<dc:creator>Renoir Boulanger</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sécurite]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://renoirboulanger.com/?p=2078</guid>
		<description><![CDATA[Comment dire à Apache le mime-type d&#8217;un document Office 2007J&#8217;ai entendu parler de certains Problèmes avec les documents .docx qui son considérés comme étant des fichiers zip. J&#8217;ai pensé partager avec vous comment j&#8217;ai réparé la situation.
Il est possible que le serveur apache ne considère pas les fichiers doc sur le serveur comme étant des [...]]]></description>
			<content:encoded><![CDATA[<a href='http://renoirboulanger.com/blog/2010/04/comment-dire-a-apache-le-mime-type-dun-document-office-2007/' class='retweet '  style='display:block;margin:10px 0px;' >Comment dire à Apache le mime-type d&#8217;un document Office 2007</a><p>J&#8217;ai entendu parler de certains Problèmes avec les documents <strong>.docx</strong> qui son considérés comme étant des fichiers zip. J&#8217;ai pensé partager avec vous comment j&#8217;ai réparé la situation.</p>
<p>Il est possible que le serveur apache ne considère pas les fichiers doc sur le serveur comme étant des fichiers office. Normalement un navigateur téléchargera le fichier et ouvrira avec le programme qu&#8217;il considère comme étant le bon.</p>
<p>A moins que l&#8217;ordinateur du visiteur ait pas de bonne association de fichier, dans ce cas, on peut rien y faire.</p>
<p>Pour aider, on peut annoncer au serveur web les associations MIME.</p>
<p>Le problème avec cette méthode qui ne sert presque a rien, c&#8217;est que ça ne changera rien si</p>
<ol>
<li>Le visiteur n&#8217;a pas de bonne association sur son système d&#8217;exploitation</li>
<li>Le visiteur n&#8217;a pas Microsoft Office 2007 ou Open Office</li>
</ol>
<p><span id="more-2078"></span></p>
<h3>Procédure</h3>
<p>Copier-coller ce bloc dans un ou encore dans l&#8217;un ou l&#8217;autre:</p>
<ul>
<li>le <tt>.htaccess</tt> du site qui contient les fichiers a télécharger, exemple: <tt>public_html/</tt></li>
<li>le <tt>&lt;VirtualHost/&gt;</tt> dans le <tt>&lt;Directory&gt;</tt> associé.</li>
</ul>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="htaccess" style="font-family:monospace;">AddType application/vnd.ms-word.document.macroEnabled.12 .docm
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
AddType application/vnd.ms-powerpoint.template.macroEnabled.12 potm
AddType application/vnd.openxmlformats-officedocument.presentationml.template potx
AddType application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
AddType application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
AddType application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
AddType application/vnd.ms-excel.addin.macroEnabled.12 xlam
AddType application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
AddType application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
AddType application/vnd.ms-excel.template.macroEnabled.12 xltm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx</pre></td></tr></table></div>

<p><strong>source:</strong><a href="http://www.webdeveloper.com/forum/showthread.php?t=162526">Webdeveloper.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://renoirboulanger.com/blog/2010/04/comment-dire-a-apache-le-mime-type-dun-document-office-2007/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Les différentes versions du service de tâches planifié CRON</title>
		<link>http://renoirboulanger.com/blog/2010/04/les-differentes-versions-du-service-de-taches-planifie-cron/</link>
		<comments>http://renoirboulanger.com/blog/2010/04/les-differentes-versions-du-service-de-taches-planifie-cron/#comments</comments>
		<pubDate>Mon, 19 Apr 2010 13:04:07 +0000</pubDate>
		<dc:creator>Renoir Boulanger</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Outils]]></category>
		<category><![CDATA[Techniques]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Vocabulaire]]></category>

		<guid isPermaLink="false">http://renoirboulanger.com/?p=2086</guid>
		<description><![CDATA[Les différentes versions du service de tâches planifié CRONSuite a mon article «Comment automatiser une tâche avec CRON en utilisant Vim» je me suis venu aux questions sur les différences essentielles entre les versions de CRON.
Le concept de CRON est, un «lanceur de commandes» planifié pour les systèmes UNIX. Le nom est inspiré du dieu [...]]]></description>
			<content:encoded><![CDATA[<a href='http://renoirboulanger.com/blog/2010/04/les-differentes-versions-du-service-de-taches-planifie-cron/' class='retweet '  style='display:block;margin:10px 0px;' >Les différentes versions du service de tâches planifié CRON</a><p><img class="size-full wp-image-2104" style="float: right; border: 0px;" title="Une horloge" src="http://renoirboulanger.com/wp-content/uploads/2010/04/Clock-icon.png" alt="" width="205" height="205" />Suite a mon article «<a href="http://renoirboulanger.com/blog/2010/04/comment-automatiser-une-tache-avec-cron-en-utilisant-vim/">Comment automatiser une tâche avec <em>CRON</em> en utilisant Vim</a>» je me suis venu aux questions sur les différences essentielles entre les versions de <em>CRON</em>.</p>
<p>Le concept de <em>CRON</em> est, un «lanceur de commandes» planifié pour les systèmes UNIX. Le nom est inspiré du dieu grec Chronos.</p>
<p>Ayant déjà utilise Gentoo Linux j&#8217;avait vu qu&#8217;il était possible d&#8217;utiliser plus d&#8217;une version de CRON mais je ne m&#8217;était jamais penché sur les différences. Je l&#8217;ai fait aujourd&#8217;hui.</p>
<p><span id="more-2086"></span></p>
<h3>Une question de choix et de distribution</h3>
<p>Généralement chaque distribution de système d&#8217;exploitation UNIX (Linux, Unix, Qnx, etc) a son lot d&#8217;outils standards dont CRON fait partie. Chaque éditeur de distribution choisit sa version préférée mais permet d&#8217;interchanger (avec <a href="http://wiki.debian.org/DebianAlternatives">Alternatives sous Debian</a>, par exemple).</p>
<h3>Versions de <em>CRON</em></h3>
<h4>Anacron</h4>
<p>La différence d&#8217;<em>Anacron</em> avec <em>cron</em> (traditionnel) est le fait qu&#8217;Anacron ne roule pas en permanence comme un démon en arrière plan. Il est idéal sur des système qui ne roule pas nécessairement 24 heures par jour ou avec peu de ressources processeur.</p>
<p><a href="http://anacron.sourceforge.net/">site officiel</a></p>
<h4>vixie-cron</h4>
<p>La version de cron la plus utilisée (selon mon expérience, notamment sous les installation par défaut de Ubuntu, Debian et Red Hat et CentOS)</p>
<p><a href="http://troy.jdmz.net/cron/">site officiel</a></p>
<h4>bcron</h4>
<p>L&#8217;auteur a crée cette version car il avait besoin de précision concernant les délais entre les commandes et les changements de saisons (Heure d&#8217;été).</p>
<p>J&#8217;ai remarqué plusieurs autres outils intéressant que l&#8217;auteur a publié. Je l&#8217;ai ajouté a mes marque-pages.</p>
<h4>fcron</h4>
<p>L&#8217;auteur a crée cette version de cron dans l&#8217;optique que la machine peut ne pas être allumée 24/24 et 7 jours/7. fcron se base plutôt sur le temps que le système fonctionne (le «uptime») plutot qu&#8217;un moment précis. L&#8217;auteur dit que fcron veut remplacer Vixie-cron et anacron mais en <em>mieux</em>.</p>
<p>Le genre de tâche qu&#8217;on peut faire est:</p>
<ul>
<li>Lance une commande aux chaque 3heures que le système est allumé</li>
<li>Lance une commande au moins une fois entre 3h00 am et 6h00 am tout les jours.</li>
</ul>
<p><a href="http://fcron.free.fr/">site officiel</a></p>
<h4>incron</h4>
<p>incron est une fonctionnalité cron a l&#8217;application inotify qui est un système basé sur le système de fichiers plutôt que sur des plages de temps. Un cas d&#8217;utilisation serait, par exemple, de pouvoir lancer une commande lorsqu&#8217;un logrotate a été lancé ou si un fichier a été ajouté dans un dossier.</p>
<p><a href="http://linux.die.net/man/5/incron.conf">pages manuel</a> &#8211; <a href="http://inotify.aiken.cz/">site officiel</a></p>
<p><strong>Autres versions</strong></p>
<p>Avez-vous utilisé l&#8217;un d&#8217;eux dans vos projets?</p>
]]></content:encoded>
			<wfw:commentRss>http://renoirboulanger.com/blog/2010/04/les-differentes-versions-du-service-de-taches-planifie-cron/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comment automatiser une tâche avec CRON en utilisant Vim</title>
		<link>http://renoirboulanger.com/blog/2010/04/comment-automatiser-une-tache-avec-cron-en-utilisant-vim/</link>
		<comments>http://renoirboulanger.com/blog/2010/04/comment-automatiser-une-tache-avec-cron-en-utilisant-vim/#comments</comments>
		<pubDate>Thu, 15 Apr 2010 00:45:52 +0000</pubDate>
		<dc:creator>Renoir Boulanger</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open-Source]]></category>
		<category><![CDATA[Tutoriels]]></category>
		<category><![CDATA[UNIX]]></category>
		<category><![CDATA[Vocabulaire]]></category>
		<category><![CDATA[Vulgarisation]]></category>

		<guid isPermaLink="false">http://renoirboulanger.com/?p=2076</guid>
		<description><![CDATA[Comment automatiser une tâche avec CRON en utilisant VimDeux tâches vraiment essentielles qu&#8217;on fait en administrant une machine sous Linux sont très souvent de modifier/créer un fichier et de planifier des tâches de maintenance.
Pour utiliser «cron» il faut savoir utiliser «vi», les commandes sont très souvent les mêmes. Je dois spécifier que j&#8217;ai basé mon [...]]]></description>
			<content:encoded><![CDATA[<a href='http://renoirboulanger.com/blog/2010/04/comment-automatiser-une-tache-avec-cron-en-utilisant-vim/' class='retweet '  style='display:block;margin:10px 0px;' >Comment automatiser une tâche avec CRON en utilisant Vim</a><div id="attachment_2079" class="wp-caption alignright" style="width: 280px"><img class="size-full wp-image-2079 " title="Logo Vim" src="http://renoirboulanger.com/wp-content/uploads/2010/04/Vim_logo.png" alt="Vi - Vi.... Improved (amélioré)" width="270" height="270" /><p class="wp-caption-text">Logo Vim, qui signifie vi-improved (amélioré)</p></div>
<p>Deux tâches vraiment essentielles qu&#8217;on fait en administrant une machine sous Linux sont très souvent de modifier/créer un fichier et de planifier des tâches de maintenance.</p>
<p>Pour utiliser «<em>cron»</em> il faut savoir utiliser «<em>vi»</em>, les commandes sont très souvent les mêmes. Je dois spécifier que j&#8217;ai basé mon tutoriel sur CRON fourni par Ubuntu Linux qui est (de mémoire) le même paquet que celui fourni dans <a href="http://www.redhat.com/">Red Hat Linux</a>, <a href="http://www.debian.org/">Debian Linux</a> ou <a href="http://www.ubuntu.com/">Ubuntu Linux</a>.</p>
<p>Le but de ce billet est en fait de vous montrer sommairement comment automatiser une tâche (une commande) avec cron.</p>
<p>Je publierai plus tard un billet sur les différences entre les distributions de cron.</p>
<p><span id="more-2076"></span></p>
<h3>Utiliser vi (prérequis)</h3>
<p>Vi est un éditeur de texte en ligne de commande qui permet de faire bien des macros, il peut sembler compliquer mais l&#8217;essentiel se résume ainsi.</p>
<ul>
<li><strong>ESCAPE</strong> permet d&#8217;entrer une commande</li>
<blockquote>
<li><strong>i</strong> mode Insertion</li>
<li><strong>r</strong> mode remplacer le caractère courrant</li>
</blockquote>
<li><strong>SHIFT+a</strong> insérer a partir de la fin de la ligne courrante</li>
<li><strong>:</strong> entrer une commande spéciale</li>
<blockquote>
<li><strong>:wq</strong> sauvegarder le fichier et quitter l&#8217;éditeur</li>
<li><strong>:w</strong> sauvegarder le fichier courrant</li>
<li><strong>:10</strong> sauter a la 10e ligne du document</li>
</blockquote>
<li><strong>/text</strong> Chercher &#8216;text&#8217; dans le document courrant</li>
<blockquote>
<li><strong>n</strong> Chercher le prochain mon cherché (par rapport a ce qui a été dit ci-haut)</li>
</blockquote>
<li><strong>dd</strong> supprimer la ligne courrante</li>
<li><strong>5dd</strong> supprimer les 5 prochaines lignes</li>
</ul>
<p>source: <a href="http://matrix.samizdat.net/pratique/documentation/guide-survie-VI.html">Guide de survie VI</a></p>
<h3>Créer une tâche CRON</h3>
<p>Pour créer une tâche sur un système Linux il y a plusieurs méthodes possibles.</p>
<ol>
<li><a href="http://renoirboulanger.com/blog/2010/04/comment-automatiser-une-tache-avec-cron-en-utilisant-vim#crontab">Ajouter une ligne dans le «crontab», la table d&#8217;actions CRON</a></li>
<li><a href="http://renoirboulanger.com/blog/2010/04/comment-automatiser-une-tache-avec-cron-en-utilisant-vim#crond">Ajouter fichier avec directives dans /etc/cron.d/</a></li>
<li><a href="http://renoirboulanger.com/blog/2010/04/comment-automatiser-une-tache-avec-cron-en-utilisant-vim#etccron">Ajouter une ligne dans un des dossiers /etc/cron.daily/, /etc/cron.hourly/, /etc/cron.monthly</a></li>
</ol>
<h4><a name="crontab"></a>1. Ajouter une ligne dans le «crontab», la table d&#8217;actions CRON</h4>
<p>C&#8217;est fait soit en utilisant la commande crontab, ou en éditant le fichier /etc/crontab</p>
<p>crontab roule tout le temps en tant que root, et l&#8217;idéal serait d&#8217;utiliser un fichier dans /etc/cron.d/<br />
Savoir sur quel usager doit rouler la tâche (un user local qui peut rouler la commande, idéalement pas root!)</p>
<ul>
<li>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">someuser<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~$ crontab <span style="color: #660033;">-e</span></pre></td></tr></table></div>

</li>
<li>l&#8217;éditeur vi va s&#8217;ouvrir</li>
<li>aller a l&#8217;endroit ou vous voulez éditer</li>
<li>créez une nouvelle ligne en Insert mode, en utilisant le i, ou a la fin de la ligne courrante en faisant CTRL+a</li>
<li>Entrer une ligne dans le format

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><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> commande a être exé<span style="color: #c20cb9; font-weight: bold;">cut</span>ée
- - - - -
<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>
<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> +----- jour de la semaine <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0</span> - <span style="color: #000000;">6</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">Dimanche</span>=<span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</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> +------- mois <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span> - <span style="color: #000000;">12</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span> +--------- jour dans le mois <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">1</span> - <span style="color: #000000;">31</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">|</span> +----------- heure <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0</span> - <span style="color: #000000;">23</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
+------------- min <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">0</span> - <span style="color: #000000;">59</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<p>exemple:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">30</span> <span style="color: #000000;">18</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: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>someuser<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/*</span>  <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>someuser<span style="color: #000000; font-weight: bold;">/</span>cronlogs<span style="color: #000000; font-weight: bold;">/</span>clean_tmp_dir.log</pre></td></tr></table></div>

</li>
<li>&#8230; qui effacera le contenu de <tt>/home/someuser/tmp/</tt> a tout les 18h30 de tout les jours et qui log dans <tt>/home/someuser/cronlogs/clean_tmp_dir.log</tt></li>
<li>Pour quitter faites ESCAPE  :wq     pour write quit.</li>
</ul>
<p>source: <a href="http://adminschoice.com/crontab-quick-reference">Crontab Quick reference</a></p>
<h4><a name="crond"></a>2. Ajouter fichier avec directives dans /etc/cron.d/</h4>
<p>C&#8217;est le même principe sauf qu&#8217;il s&#8217;agit d&#8217;un fichier nommé, généralement sous le même nom que le package Linux qu&#8217;il dessert. Exemple php5 aurait son package.</p>
<p>Sauf qu&#8217;on peut spécifier qui lancera la commande.</p>
<p>Comment faire&#8230;</p>
<ul>
<li>Créer un fichier, ex:<br />
# vi /etc/cron.d/php5</li>
<li>Coller la commande qui a été testée au par avant

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">someuser<span style="color: #000000; font-weight: bold;">@</span>ubuntu:~$ <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>someuser<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>someuser<span style="color: #000000; font-weight: bold;">/</span>cronlogs<span style="color: #000000; font-weight: bold;">/</span>clean_tmp_dir.log</pre></td></tr></table></div>

</li>
<li>Ajouter une ligne, ESCAPE+i</li>
<li>Commencer par le moment de l&#8217;exécution comme avec «Ajouter une ligne dans le crontab»</li>
<li>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">30</span> <span style="color: #000000;">19</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></pre></td></tr></table></div>

</li>
<li>Ajouter le nom du username qui va rouler la commande</li>
<li>ex: someuser</li>
<li>Ajouter la commande testée tout a l&#8217;heure<br />
ex: rm /home/someuser/tmp/* > /home/someuser/cronlogs/clean_tmp_dir.log</li>
<li>Ce qui donnera:

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000;">30</span> <span style="color: #000000;">19</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> someuser <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>someuser<span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>someuser<span style="color: #000000; font-weight: bold;">/</span>cronlogs<span style="color: #000000; font-weight: bold;">/</span>clean_tmp_dir.log</pre></td></tr></table></div>

</li>
<li>Voilà!</li>
</ul>
<h4><a name="etccron"></a>3. Ajouter une ligne dans un des dossiers /etc/cron.daily/, /etc/cron.hourly/, /etc/cron.monthly</h4>
<p>Même concept que le crontab sauf que l&#8217;on a pas a mentionner quand exécuter, c&#8217;est /etc/crontab  qui dit qand les fichiers sont exécuté</p>
<h3>Sources</h3>
<ul>
<li><a href="http://adminschoice.com/crontab-quick-reference">Crontab Quick reference</a></li>
<li><a href="http://matrix.samizdat.net/pratique/documentation/guide-survie-VI.html">Guide de survie VI</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://renoirboulanger.com/blog/2010/04/comment-automatiser-une-tache-avec-cron-en-utilisant-vim/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Un firewall simple sous Linux avec «Ferm»</title>
		<link>http://renoirboulanger.com/blog/2009/08/un-firewall-simple-sous-linux-avec-%c2%abferm%c2%bb/</link>
		<comments>http://renoirboulanger.com/blog/2009/08/un-firewall-simple-sous-linux-avec-%c2%abferm%c2%bb/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 04:12:06 +0000</pubDate>
		<dc:creator>Renoir Boulanger</dc:creator>
				<category><![CDATA[GeekNight]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sécurite]]></category>
		<category><![CDATA[Tutoriels]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://renoirboulanger.com/?p=751</guid>
		<description><![CDATA[Un firewall simple sous Linux avec «Ferm»Attention: Article Technique!
Dans le but de faire profiter la postérité et ma mémoire personnelle voici mon premier post d&#8217;une série d&#8217;articles spécialisée sur Linux.
Ces articles proviennent de ma voûte documentaire professionnelle et personnelle.
Évidemment pour les publier ici je dois censurer les détails sensibles, vous me comprendrez (!)
Le fait de [...]]]></description>
			<content:encoded><![CDATA[<a href='http://renoirboulanger.com/blog/2009/08/un-firewall-simple-sous-linux-avec-%c2%abferm%c2%bb/' class='retweet '  style='display:block;margin:10px 0px;' >Un firewall simple sous Linux avec «Ferm»</a><p>Attention: Article Technique!</p>
<p>Dans le but de faire profiter la postérité et ma mémoire personnelle voici mon premier post d&#8217;une série d&#8217;articles spécialisée sur Linux.</p>
<p>Ces articles proviennent de ma voûte documentaire professionnelle et personnelle.</p>
<p>Évidemment pour les publier ici je dois censurer les détails sensibles, vous me comprendrez (!)</p>
<p>Le fait de les avoir dans le format Wiki Markup de Confluence&#8230; et les traduire ici demande du temps pour les reformatter pour mon blogue.</p>
<h2>D&#8217;autres articles spécialisés Debian Linux</h2>
<p>D&#8217;autres articles technique (pour Debian Linux) seront aussi disponibles dans les prochaines semaines.</p>
<p>Voici une liste de quelques uns que je compte publier:</p>
<ol>
<li>Monter une machine en SNMP v2c en lecture seule</li>
<li>Permettre des updates aux serveurs NTP a l&#8217;heure</li>
<li>Installer VMware server 2 sur Debian</li>
<li>Augumenter le niveau de sécurité pour Infra Publique sous Debian</li>
<li>Procédure configuration SYSLOG-NG vers un serveur de log</li>
</ol>
<p>J</p>
<p><span id="more-751"></span></p>
<h2>Installer et configurer</h2>
<p>En fait, sous Debian c&#8217;est pas très compliqué, on ajoute le paquet, puis on le configure comme mentionné plus bas.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># apt-get update</span>
<span style="color: #666666; font-style: italic;"># apt-get install ferm libnet-dns-perl perl iptables</span></pre></td></tr></table></div>

<p>J&#8217;ai fait une petite version qui permet d&#8217;utiliser des variables et mettre le code un peu plus clean (d&#8217;un point de vue programmeur).</p>
<p>Vous pouvez remplacer par ce code ci:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># -*- shell-script -*-</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;">#  Configuration file for ferm(1).</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># vmware-mgmt = 8333</span>
<span style="color: #666666; font-style: italic;"># vmware-console = 902</span>
<span style="color: #666666; font-style: italic;"># ntop = 3000</span>
<span style="color: #666666; font-style: italic;"># ... ports ajoutes dans /etc/services</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Source http://www.krzywanski.net/archives/90</span>
<span style="color: #666666; font-style: italic;"># Interfaces</span>
<span style="color: #000000; font-weight: bold;">@</span>def <span style="color: #007800;">$DEV_LOCAL</span> = lo;
<span style="color: #000000; font-weight: bold;">@</span>def <span style="color: #007800;">$DEV_LAN</span> = <span style="color: #7a0874; font-weight: bold;">&#40;</span>eth1 vmnet1 vmnet8<span style="color: #7a0874; font-weight: bold;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">@</span>def <span style="color: #007800;">$DEV_INTERNET</span> = eth0;
&nbsp;
<span style="color: #666666; font-style: italic;"># Ports</span>
<span style="color: #000000; font-weight: bold;">@</span>def <span style="color: #007800;">$PORTS</span> = <span style="color: #7a0874; font-weight: bold;">&#40;</span>ntp name http https smtp<span style="color: #7a0874; font-weight: bold;">&#41;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;"># Known IPs</span>
<span style="color: #000000; font-weight: bold;">@</span>def <span style="color: #007800;">$SSH_ALLOWED</span> = <span style="color: #7a0874; font-weight: bold;">&#40;</span>69.159.234.55 192.168.2.1<span style="color: #7a0874; font-weight: bold;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">@</span>def <span style="color: #007800;">$SSH_DYNDNS</span> = <span style="color: #000000; font-weight: bold;">@</span>resolve<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>somehost.renoirboulanger.com someotherhost.somenetwork.net<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;"># SSH Clients</span>
<span style="color: #000000; font-weight: bold;">@</span>def <span style="color: #007800;">$SSH_CLIENTS</span> = <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$SSH_ALLOWED</span> <span style="color: #007800;">$SSH_DYNDNS</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>;
&nbsp;
table filter <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    chain INPUT <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        policy DROP;
&nbsp;
        <span style="color: #666666; font-style: italic;"># connection tracking</span>
        mod state state INVALID DROP;
        mod state state <span style="color: #7a0874; font-weight: bold;">&#40;</span>ESTABLISHED RELATED<span style="color: #7a0874; font-weight: bold;">&#41;</span> ACCEPT;
&nbsp;
        <span style="color: #666666; font-style: italic;"># allow local packages</span>
        interface <span style="color: #007800;">$DEV_LOCAL</span> ACCEPT;
        interface <span style="color: #007800;">$DEV_LAN</span> ACCEPT;
&nbsp;
        <span style="color: #666666; font-style: italic;"># allow ping from the administrator's network</span>
        interface <span style="color: #007800;">$DEV_INTERNET</span> saddr <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$SSH_DYNDNS</span> <span style="color: #007800;">$SSH_ALLOWED</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> proto icmp icmp-type echo-request ACCEPT;
&nbsp;
        <span style="color: #666666; font-style: italic;"># respond to ping</span>
        proto icmp icmp-type echo-request ACCEPT;
&nbsp;
        <span style="color: #666666; font-style: italic;"># allow SSH connections</span>
        proto tcp dport <span style="color: #000000;">2522</span> ACCEPT;
&nbsp;
        proto tcp dport <span style="color: #007800;">$PORTS</span> ACCEPT;
    <span style="color: #7a0874; font-weight: bold;">&#125;</span>
    chain OUTPUT <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        policy ACCEPT;
&nbsp;
        <span style="color: #666666; font-style: italic;"># connection tracking</span>
        mod state state INVALID DROP;
        mod state state <span style="color: #7a0874; font-weight: bold;">&#40;</span>ESTABLISHED RELATED<span style="color: #7a0874; font-weight: bold;">&#41;</span> ACCEPT;
    <span style="color: #7a0874; font-weight: bold;">&#125;</span>
    chain FORWARD <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        policy DROP;
&nbsp;
        <span style="color: #666666; font-style: italic;"># connection tracking</span>
        mod state state INVALID DROP;
        mod state state <span style="color: #7a0874; font-weight: bold;">&#40;</span>ESTABLISHED RELATED<span style="color: #7a0874; font-weight: bold;">&#41;</span> ACCEPT;
    <span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></td></tr></table></div>

<p>Pour plus de détails a propos de la syntaxe, <a href="http://ferm.foo-projects.org/download/2.0/ferm.html">voir la documentation</a>.</p>
<h2>Autres ressources</h2>
<p>J&#8217;ai utilisé, entre autres ces ressources pour m&#8217;inspirer de ce mini-tutoriel</p>
<ol>
<li><a href="http://www.debian.org/doc/manuals/securing-debian-howto">Securing Debian HOWTO</a></li>
<li><a href="http://www.tldp.org/HOWTO/Security-HOWTO/">Linux Security HOWTO</a></li>
<li><a href="http://www.cromwell-intl.com/security/security-firewall.html">Firewall Tools</a></li>
<li><a href="http://www.debian.org/security/">Debian Security</a></li>
<li><a href="http://www.debian.org/doc/debian-policy/">Debian Policies</a></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://renoirboulanger.com/blog/2009/08/un-firewall-simple-sous-linux-avec-%c2%abferm%c2%bb/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Effacer un disque dur</title>
		<link>http://renoirboulanger.com/blog/2008/04/effacer-un-disque-dur/</link>
		<comments>http://renoirboulanger.com/blog/2008/04/effacer-un-disque-dur/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 04:45:08 +0000</pubDate>
		<dc:creator>Renoir Boulanger</dc:creator>
				<category><![CDATA[GeekNight]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sécurite]]></category>
		<category><![CDATA[Tutoriels]]></category>
		<category><![CDATA[UNIX]]></category>

		<guid isPermaLink="false">http://www.renoirboulanger.com/blog/2008/04/16/effacer-un-disque-dur/</guid>
		<description><![CDATA[Effacer un disque durLorsqu&#8217;on se préocupe de ses informations personnelles et qu&#8217;on veut se débarrasser d&#8217;un ordinateur ou d&#8217;un vieux disque dur il faut, idéalement, le vider. J&#8217;ai une petite méthode pour le faire pas trop compliqué et totalement sécuritaire pour les données.
Ma méthode implique

Un disque dur qu&#8217;on veut wiper (effacer)
Un LiveCD de Linux
Du temps
Une [...]]]></description>
			<content:encoded><![CDATA[<a href='http://renoirboulanger.com/blog/2008/04/effacer-un-disque-dur/' class='retweet '  style='display:block;margin:10px 0px;' >Effacer un disque dur</a><p>Lorsqu&#8217;on se préocupe de ses informations personnelles et qu&#8217;on veut se débarrasser d&#8217;un ordinateur ou d&#8217;un vieux disque dur il faut, idéalement, le vider. J&#8217;ai une petite méthode pour le faire pas trop compliqué et totalement sécuritaire pour les données.</p>
<p>Ma méthode implique</p>
<ul>
<li>Un disque dur qu&#8217;on veut wiper (effacer)</li>
<li>Un LiveCD de Linux</li>
<li>Du temps</li>
<li>Une tour d&#8217;ordinateur pour le processus, idéalement inutilisée&#8230; sinon où chercher ou quoi utiliser pour se «dé-s&#8217;emmerder»
<ul>
<li>Un lecteur CD-Rom</li>
</ul>
</li>
</ul>
<p>Attention, un peu technique&#8230; mais tellement conseillé <img src='http://renoirboulanger.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>ÉTAPE UN&#8230; backups?!</h3>
<p>C&#8217;est un peu stupide de le préciser&#8230; mais assurez-vous qu&#8217;il est vraiment vide de vos données avant de faire quoi que ce soit!</p>
<p><strong>Je vous recommande DE NE PAS AVOIR D&#8217;AUTRES DISQUES D&#8217;INSTALLÉ lors de l&#8217;exécution de ce script</strong> Tant que vous exécutez pas le script a l&#8217;<a href="http://renoirboulanger.com/blog/2008/04/effacer-un-disque-dur/#six">étape six</a> vous ne risquez rien (!). </p>
<p><span id="more-531"></span></p>
<h3>ÉTAPE DEUX&#8230; Graver le LiveCD</h3>
<p>Pour faire la chose facile, vous pouvez prendre le LiveCD de Debian, ma distribution préférée:</p>
<p><code lang="bash">http://live.debian.net/cdimage/release/current/i386/iso-cd/</code></p>
<p>Une version &#8216;<tt>debian-live-(.*)-i386-rescue.iso</tt>&#8216; fera l&#8217;affaire.</p>
<div style="background:#ececec;margin:5px 0px;padding:18px 8px 8px 50px;border:1px solid #333">
<h4 style="color:#777;margin-bottom:10px;">OÙ TROUVER LINUX</h4>
<p>Vous pouvez regarder <a href="http://wiki.debian.org/LiveCD">ici</a> pour d&#8217;autres versions de Debian.</p>
<p>Pour remplacer Windows, ce que je recommande c&#8217;est d&#8217;utiliser <a href="http://www.ubuntu.com/">Ubuntu Linux</a> (ce que j&#8217;utilise pour mon environnement de Bureau).</p>
<p>Mais ce n&#8217;est pas le but de cet article <img src='http://renoirboulanger.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Juste une dernière note comme ça: Debian, pour moi, sert pour les serveurs&#8230; et Ubuntu est basé sur Debian.</p>
<p>Pour ce qui concerne Linux et notre utilisation actuelle, n&#8217;importe quelle version fera l&#8217;affaire.</p></div>
<p>Les commandes nécessaires seront celles de base pour n&#8217;importe quel Linux depuis ses débuts :</p>
<ul>
<li>/dev/urandom, ou</li>
<li> /dev/zero</li>
<li>dd</li>
</ul>
<p>Je ne me rappelle pas quand Linux en général a inclus ces trucs mais c&#8217;est ce qu&#8217;il faut.</p>
<p>En gros les deux premiers sont des device files qui fournissent du junk aléatoire&#8230; et l&#8217;autre. Que des zéros!</p>
<p>Tandis que &#8220;dd&#8221; est un utilitaire pour écrire en device to device&#8230;. (aka. dd) <img src='http://renoirboulanger.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>ÉTAPE TROIS, on vide</h3>
<p>En fait, on enlève tout les autres disques durs question de ne pas se tromper!</p>
<p>Ensuite, il est bien de remarquer que le processus peut prendre du temps. Ce serait idéal d&#8217;avoir une tour qui sert a rien&#8230; sinon on tombe a devoir attendre après.</p>
<h3>ÉTAPE QUATRE, On démarre le LiveCD</h3>
<p>&#8230; On attend le command prompt. C&#8217;est comme du DOS à l&#8217;époque, sauf que c&#8217;est vraiment plus puissant!</p>
<p>Pour reconnaitre un prompt linux, on voit quelque chose du genre:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">user<span style="color: #000000; font-weight: bold;">@</span>debian:~ $</pre></td></tr></table></div>

<p>ou encore&#8230; si on voit le dièze (#)&#8230; c&#8217;est qu&#8217;on est un super utilisateur (root). Un LiveCD nous envoit généralement en root alors on devrait voir quelque chose de similaire à:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>debian: ~ <span style="color: #666666; font-style: italic;">#</span></pre></td></tr></table></div>

<h3>ÉTAPE CINQ, on script un peu</h3>
<p>On peut le faire de plusieurs façon la même chose.  En gros, on se doit, pour s&#8217;assurer d&#8217;effacer complè<span style="background-color: #ffffff; ">tement le disque de le remplir au moins huit fois au minimum de données random. Alors je propose le petit script qui se copie bien à la main.</span></p>
<p>Si vous avez vidé vos disques durs le disque dur a vider devraît être /dev/hda</p>
<p>Pour vous en assurer, faites</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>debian: ~<span style="color: #666666; font-style: italic;"># file /dev/hda</span></pre></td></tr></table></div>

<p>Un output similaire ceci devrait sortir&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>hda: block special <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">3</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></td></tr></table></div>

<div style="background:#ececec;margin:5px 0px;padding:18px 8px 8px 50px;border:1px solid #333">
<h4 style="color:#777;margin-bottom:10px;">«CRASH COURSE» SUR LES PARTITIONS ET LINUX</h4>
<p>Pour vous assurer de ne pas effacer un bon disque dur, je vous <strong>re-recommande DE NE PAS AVOIR D&#8217;AUTRES DISQUES D&#8217;INSTALLÉ lors de l&#8217;exécution de ce script</strong> (<a href="http://renoirboulanger.com/blog/2008/04/effacer-un-disque-dur/#six">étape six</a>)!!!</p>
<p>Parceque si c&#8217;est pas le disque <tt>/dev/hda</tt>, c&#8217;est peut être <tt>/dev/sda</tt> ou même un autre nom.</p>
<p>Petit cours rapide de partitionnement sous Linux.</p>
<p>Les disques durs n&#8217;ont pas de lettres&#8230; tout dépend où dans le système on &#8220;monte&#8221; la partition.</p>
<p>En fait les noms vont ainsi</p>
<ul>
<li><tt>hda</tt>, <tt>hdb</tt>, <tt>hdc</tt>&#8230; pour les disques durs IDE</li>
<li><tt>sda</tt>, <tt>sdb</tt>, <tt>sdc</tt>&#8230;. pour les disques SATA et SCSI et USB</li>
</ul>
<p>Vous imaginez que le &#8216;a&#8217; (b,c,d&#8230;) représente l&#8217;ordre selon la nappe de connecteurs.</p>
<p>La première partition du premier disque sera donc: <tt>/dev/sda1</tt>
</div>
<p>Si tout est beau&#8230; on continue.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>debian: ~<span style="color: #666666; font-style: italic;"># vi wipedisk.sh</span></pre></td></tr></table></div>

<p>En VI, il faut faire &#8216;i&#8217; avant de commencer d&#8217;écrire&#8230;</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">i</span>=<span style="color: #000000;">1</span>;i<span style="color: #000000; font-weight: bold;">&amp;</span>lt;=<span style="color: #000000;">10</span>;i+=<span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>; <span style="color: #000000; font-weight: bold;">do</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Passe <span style="color: #007800;">$i</span>&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;"><span style="color: #000000; font-weight: bold;">if</span></span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>urandom <span style="color: #007800;">of</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>hda
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></td></tr></table></div>

<p>Ensuite on quitte <strong>en faisant</strong> <strong>[escape]</strong> on <strong>écrit</strong> &#8220;<strong>:wq</strong>&#8221; (deux points&#8230; &#8220;w&#8221; et &#8220;q&#8221;&#8230; qui signifie commande write quit)</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>debian: ~<span style="color: #666666; font-style: italic;"># chmod 755 wipedisk.sh</span></pre></td></tr></table></div>

<p>Qui va rendre le fichier exécutable.</p>
<h3><a name="six"></a>ÉTAPE SIX&#8230; on exécute.</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">root<span style="color: #000000; font-weight: bold;">@</span>debian: ~<span style="color: #666666; font-style: italic;"># ./wipedisk.sh</span></pre></td></tr></table></div>

<p>En général, ça peut prendre du temps. Mais à la fin d&#8217;une soirée de film&#8230; le disque devrait être totalement rempli d&#8217;ordures aléatoire.</p>
<p>Au plaisir!</p>
]]></content:encoded>
			<wfw:commentRss>http://renoirboulanger.com/blog/2008/04/effacer-un-disque-dur/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

