<?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>Void And Any &#187; linux</title>
	<atom:link href="http://voidandany.free.fr/index.php/category/informatique/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://voidandany.free.fr</link>
	<description>mon bazar...</description>
	<lastBuildDate>Sat, 09 Dec 2017 09:24:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Accèder à un gestionnaire de fichier léger sur un serveur headless depuis Mac OS</title>
		<link>http://voidandany.free.fr/index.php/acceder-a-un-gestionnaire-de-fichier-leger-sur-un-serveur-headless-depuis-mac-os/</link>
		<comments>http://voidandany.free.fr/index.php/acceder-a-un-gestionnaire-de-fichier-leger-sur-un-serveur-headless-depuis-mac-os/#comments</comments>
		<pubDate>Sat, 09 Dec 2017 09:24:06 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4798</guid>
		<description><![CDATA[Article rapide car à chaque fois j’oublie comment faire&#8230;. Le problème : Accéder à un gestionnaire de fichier &#171;&#160;graphique&#160;&#187; sur un serveur headless Le tout depuis un Mac (déport d&#8217;affichage, X-forwarding) Le serveur étant headless, il faut installer un gestionnaire &#8230; <a href="http://voidandany.free.fr/index.php/acceder-a-un-gestionnaire-de-fichier-leger-sur-un-serveur-headless-depuis-mac-os/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Article rapide car à chaque fois j’oublie comment faire&#8230;.</p>
<p>Le problème :</p>
<ul>
<li>Accéder à un gestionnaire de fichier &laquo;&nbsp;graphique&nbsp;&raquo; sur un serveur headless</li>
<li>Le tout depuis un Mac (déport d&#8217;affichage, X-forwarding)</li>
</ul>
<p>Le serveur étant headless, il faut installer un gestionnaire de fichier ayant  le moins de dépendance possible (il ne doit pas installer tout Xorg/Gnome/KDE).<br />
En voici quelques un :</p>
<ul>
<li><a rel="nofollow" href="http://pcmanfm.sourceforge.net/">PCManFM</a> : 51 dépendances, 39 Mo</li>
<li><a href="http://roland65.free.fr/xfe/">XFE</a> : 75 dépendance, 67 Mo</li>
<li><a href="http://www.qtfm.org/">QtFM</a> : 1 seul paquet (pas de dépendance), &lt; 1 Mo, pas dans les dépôts</li>
<li><a rel="nofollow" href="http://emelfm2.net/">emelFM2</a> : 1 seul paquet (pas de dépendance), &lt; 2 Mo</li>
</ul>
<p>(Cet article étant commencé depuis au moins 3 ans, le nombre de paquet et la taille de ces programmes à peut être changé)</p>
<p>Personnellement j&#8217;ai installé emelfm2.</p>
<p>Sur le serveur Linux toujours, s&#8217;assurer d&#8217;avoir xauth install et l&#8217;option X11Forwarding à yes dans /etc/ssh/sshd_config.</p>
<p>Sur le Mac, il faut installer XQuartz : https://www.xquartz.org/</p>
<p>Lancer XQuartz et dans le terminal qui s&#8217;ouvre lancer la commande :</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #660033;">-X</span> <span style="color: #660033;">-Y</span> <span style="color: #660033;">-C</span> -f  <span style="color: #7a0874; font-weight: bold;">&#91;</span>utilisateur linux<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>serveur linux<span style="color: #7a0874; font-weight: bold;">&#93;</span> emelfm2</pre></div></div>

</p>
<p>Et voila&#8230;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/acceder-a-un-gestionnaire-de-fichier-leger-sur-un-serveur-headless-depuis-mac-os/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monter (automatiquement) un périphérique USB (type /dev/ttyUSB0) dans LXC</title>
		<link>http://voidandany.free.fr/index.php/monter-automatiquement-un-peripherique-usb-type-devttyusb0-dans-lxc/</link>
		<comments>http://voidandany.free.fr/index.php/monter-automatiquement-un-peripherique-usb-type-devttyusb0-dans-lxc/#comments</comments>
		<pubDate>Mon, 14 Sep 2015 11:55:29 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[LXC]]></category>
		<category><![CDATA[conteneur]]></category>
		<category><![CDATA[lxc]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4786</guid>
		<description><![CDATA[Je me suis pas mal battu pour y arriver, alors si ça peut servir à quelqu&#8217;un d&#8217;autre&#8230; Le contexte : Le serveur hôte est sous Ubuntu 14.04 Le conteneur est aussi sous Ubuntu (template download, paramètres &#171;&#160;-d ubuntu  -r trusty &#8230; <a href="http://voidandany.free.fr/index.php/monter-automatiquement-un-peripherique-usb-type-devttyusb0-dans-lxc/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Je me suis pas mal battu pour y arriver, alors si ça peut servir à quelqu&#8217;un d&#8217;autre&#8230;</p>
<p>Le contexte :</p>
<ul>
<li>Le serveur hôte est sous Ubuntu 14.04</li>
<li>Le conteneur est aussi sous Ubuntu (template download, paramètres &laquo;&nbsp;-d ubuntu  -r trusty -a amd64&#8243;)</li>
<li>Un périphérique USB est connecté sur l&#8217;hôte (un <a href="http://www.digitalsmarties.net/products/jeelink">jeelink</a> pour être précis) il apparait en tant que /dev/ttyUSB0</li>
<li>Je veux monter ce périphérique dans le conteneur</li>
</ul>
<p>En premier lieu on doit trouver le numéro majeur et mineur du périphérique USB, pour cela un simple ls suffit sur l&#8217;hôte :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-la</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>ttyUSB0
crw-rw---- <span style="color: #000000;">1</span> root dialout <span style="color: #000000;">188</span>, <span style="color: #000000;">0</span> sept.  <span style="color: #000000;">1</span> <span style="color: #000000;">16</span>:08 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>ttyUSB0</pre></div></div>

<p>Le périphérique a ici le numéro 188,0</p>
<p>&nbsp;</p>
<p>Il faut ensuite autoriser ce périphérique dans le conteneur (cgroups), cela se fait dans le fichier de config de ce dernier (/var/lib/lxc/[conteneur]/config).</p>
<p>On ajoute simplement la ligne suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">lxc.cgroup.devices.allow = c <span style="color: #000000;">188</span>:<span style="color: #000000;">0</span> rwm</pre></div></div>

<p>On peut dès lors démarrer le conteneur et monter le périphérique dans le conteneur avec la commande suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> lxc-device <span style="color: #660033;">-n</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>conteneur<span style="color: #7a0874; font-weight: bold;">&#93;</span> add <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>ttyUSB0</pre></div></div>

<p>C&#8217;est déjà pas mal mais on peut faire mieux et monter automatiquement le périphérique au démarrage du conteneur, pour cela au fichier de config du dit conteneur on ajoutera :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">lxc.autodev = <span style="color: #000000;">1</span>
lxc.hook.autodev=<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>lxc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>conteneur<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">/</span>autodev</pre></div></div>

<p>On appelle un script (nommé autodev) en se branchant sur un hook de LXC, ce script contient les commandes nécessaire pour monter le périphérique :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #800000;">${LXC_ROOTFS_MOUNT}</span><span style="color: #000000; font-weight: bold;">/</span>dev
<span style="color: #c20cb9; font-weight: bold;">mknod</span> ttyUSB0 c <span style="color: #000000;">188</span> <span style="color: #000000;">0</span>
<span style="color: #c20cb9; font-weight: bold;">chmod</span> 0666 ttyUSB0</pre></div></div>

<p>Il faut rendre ce script exécutable :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>lxc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>conteneur<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">/</span>autodev</pre></div></div>

<p>&nbsp;</p>
<p>Et à chaque démarrage le script est joué (au bon moment) et le périphérique monté dans le conteneur.</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/monter-automatiquement-un-peripherique-usb-type-devttyusb0-dans-lxc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Créer un miroir ZFS avec un seul disque</title>
		<link>http://voidandany.free.fr/index.php/creer-un-miroir-zfs-avec-un-seul-disque/</link>
		<comments>http://voidandany.free.fr/index.php/creer-un-miroir-zfs-avec-un-seul-disque/#comments</comments>
		<pubDate>Tue, 01 Sep 2015 11:33:34 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[ZFS]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4782</guid>
		<description><![CDATA[Pour une raison de disponibilité de disque on peut vouloir créer un miroir ZFS avec un seul disque, voici comment procéder : Créer un fichier de type bloc simulant le disque manquant : sudo dd if=/dev/zero of=/zfs1 bs=1 count=1 seek=1024G &#8230; <a href="http://voidandany.free.fr/index.php/creer-un-miroir-zfs-avec-un-seul-disque/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Pour une raison de disponibilité de disque on peut vouloir créer un miroir ZFS avec un seul disque, voici comment procéder :</p>
<p>Créer un fichier de type bloc simulant le disque manquant :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>zero <span style="color: #007800;">of</span>=<span style="color: #000000; font-weight: bold;">/</span>zfs1 <span style="color: #007800;">bs</span>=<span style="color: #000000;">1</span> <span style="color: #007800;">count</span>=<span style="color: #000000;">1</span> <span style="color: #007800;">seek</span>=1024G</pre></div></div>

<p>(j&#8217;aurai tendance à dire que la taille du fichier, seek doit être égal à la taille du disque manquant, dans le pool ZFS, mais je n&#8217;ai pas testé plus que cela)</p>
<p>Création du pool ZFS miroir avec le disque que l&#8217;on a et le fichier bloc.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> zpool create <span style="color: #660033;">-f</span> tank mirror <span style="color: #000000; font-weight: bold;">/</span>zfs1 <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdd</pre></div></div>

<p>(si le pool existe déjà on utilisera la commande zpool add -f pour ajouter un nouveau miroir)</p>
<p>On enlève le périphérique bloc et on le supprime.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> zpool offline tank <span style="color: #000000; font-weight: bold;">/</span>zfs1
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>zfs1</pre></div></div>

<p>Vérification :</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> zpool status
&nbsp;
  pool: tank
 state: DEGRADED
status: One or <span style="color: #c20cb9; font-weight: bold;">more</span> devices has been taken offline by the administrator.
        Sufficient replicas exist <span style="color: #000000; font-weight: bold;">for</span> the pool to <span style="color: #7a0874; font-weight: bold;">continue</span> functioning <span style="color: #000000; font-weight: bold;">in</span> a
        degraded state.
action: Online the device using <span style="color: #ff0000;">'zpool online'</span> or replace the device with
        <span style="color: #ff0000;">'zpool replace'</span>.
  scan:
config:
&nbsp;
 NAME                                 STATE     READ WRITE CKSUM
 tank                                 DEGRADED     <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>
   mirror-<span style="color: #000000;">0</span>                           DEGRADED     <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>
     <span style="color: #000000; font-weight: bold;">/</span>zfs1                            OFFLINE      <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>
     sdd                              ONLINE       <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span>     <span style="color: #000000;">0</span></pre></div></div>

<p>Le miroir est bien présent, le pool est dégradé car il manque un disque.</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/creer-un-miroir-zfs-avec-un-seul-disque/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installer Ubuntu 12.04 (ou autre) minimal (pas d&#8217;interface graphique)</title>
		<link>http://voidandany.free.fr/index.php/installer-ubuntu-12-04-ou-autre-minimal-pas-dinterface-graphique/</link>
		<comments>http://voidandany.free.fr/index.php/installer-ubuntu-12-04-ou-autre-minimal-pas-dinterface-graphique/#comments</comments>
		<pubDate>Tue, 20 Nov 2012 22:39:20 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[LVM]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4752</guid>
		<description><![CDATA[Le but étant d&#8217;installer un système ne content que le nécessaire on commence par installer une version ligne de commande d&#8217;Ubuntu, c&#8217;est à dire sans bureau (Gnome / KDE / Unity) et donc sans tous les logiciels qui l&#8217;accompagne (LibreOffice, &#8230; <a href="http://voidandany.free.fr/index.php/installer-ubuntu-12-04-ou-autre-minimal-pas-dinterface-graphique/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Le but étant d&#8217;installer un système ne content que le nécessaire on  commence par installer une version ligne de commande d&#8217;Ubuntu, c&#8217;est à  dire sans bureau (Gnome / KDE / Unity) et donc sans tous les logiciels  qui l&#8217;accompagne (LibreOffice, Firefox, etc), bref comme un serveur mais avec un kernel desktop (une veille habitude chez moi suite à des problèmes remontant à la 07.10 avec le kernel serveur..)</p>
<p>Rque : rien de bien révolutionnaire dans ce post, c&#8217;est plus un pense-bête pour moi (surtout la partie partitionnement)</p>
<p>&nbsp;</p>
<p>Depuis cette <a href="http://gb.releases.ubuntu.com/precise/">page</a> télécharger l&#8217;ISO du CD alternate (en 32 ou 64 bits au choix)</p>
<p>Créer une clé USB bootable d&#8217;installation depuis un autre poste  Ubuntu (logiciel &laquo;&nbsp;Créateur de disques de démarrage&nbsp;&raquo;) ou graver l&#8217;ISO sur  un CD</p>
<p>Booter le nouveau PC sur le CD ou la clé USB</p>
<p>Choisir la langue  : Français</p>
<p>Se placer sur la ligne &laquo;&nbsp;Installer Ubuntu&nbsp;&raquo;, appuyer sur F4 et sélectionner &laquo;&nbsp;Installer un système en ligne de commande&nbsp;&raquo;</p>
<p>Répondre aux questions :</p>
<ul>
<li>Pays : France</li>
<li>Détecter l&#8217;agencement du clavier : Non</li>
<li>Pays d&#8217;origine du clavier : Français</li>
<li>Disposition du clavier : Français &#8211; Français (variante)</li>
</ul>
<p>L&#8217;installeur démarre et configure le réseau&#8230;</p>
<ul>
<li>Nom de la machine : narya</li>
<li>Nom complet de l&#8217;utilisateur : &#8230;</li>
<li>Identifiant de l&#8217;utilisateur : &#8230;</li>
<li>Mot de passe : &#8230; (2 fois), si votre mot de passe est trop  court/simple, l&#8217;installeur vous avertira et vous demandera si vous  voulez l&#8217;utiliser tout de même.</li>
<li>Chiffrer votre dossier personnel : Non</li>
<li>Timezone : Europe / Paris &#8211; Is this timezone correct ? : Oui (cette écran à échappé à la traduction&#8230;)</li>
</ul>
<p>Vient la partie la plus compliquée, le partitionnement.</p>
<ul>
<li>Choisir &laquo;&nbsp;Assisté &#8211; utiliser tout un disque avec LVM&nbsp;&raquo;</li>
<li>&laquo;&nbsp;Disque à partitionner&nbsp;&raquo;, sélectionner le disque (par précaution j&#8217;en ai mis qu&#8217;un&#8230;)</li>
<li>&laquo;&nbsp;Les  tables de partitions de périphérique suivants seront modifiées (&#8230;)  Écrire les modifications sur les disques et configurer LVM&nbsp;&raquo; : Oui</li>
<li>&laquo;&nbsp;Quantité d&#8217;espace sur le groupe de volume pour le partionnement assisté : [taille totale du disque]&nbsp;&raquo; : Continuer</li>
</ul>
<p>Le programme de partition créé un volume avec l&#8217;espace total du  disque et propose de créer 2 volumes logiques swap_1 et root, de les  formater respectivement en swap et ext4.</p>
<p>On refuse cette répartition (sélectionner Non)</p>
<ul>
<li>Dans la fenêtre suivante, dans le menu sélectionner &laquo;&nbsp;Configurer le gestionnaire de volume logique (LVM)&nbsp;&raquo;</li>
<li>Les  tables de partitions de périphérique suivants seront modifiées (&#8230;)   Écrire les modifications sur les disques et configurer LVM : Oui (de  nouveau)</li>
<li>Supprimer un volume logique, sélectionner le root qui prend toute la place</li>
</ul>
<p>On peut alors créer chaque volume logique :</p>
<ul>
<li>Créer un volume logique</li>
<li>Groupe de volume, sélectionner le seul existant</li>
<li>Nom du volume logique : root</li>
<li>Taille du volume logique : 10 GB</li>
</ul>
<ul>
<li>Créer un volume logique</li>
<li>Groupe de volume, sélectionner le seul existant</li>
<li>Nom du volume logique : home</li>
<li>Taille du volume logique : 50 GB</li>
</ul>
<ul>
<li>Créer un volume logique</li>
<li>Groupe de volume, sélectionner le seul existant</li>
<li>Nom du volume logique : data</li>
<li>Taille du volume logique : tout le reste</li>
</ul>
<p>On sort alors du partitionnement LVM : Terminer</p>
<p>La liste des partitions LVM est alors affichée, on les sélectionne  les une après les autres pour sélectionner le système de fichier  (Utiliser comme) et le point de montage.</p>
<ul>
<li>10GB           Système de fichier journalisé ext4          / Système de fichier racine</li>
<li>50 GB         Système de fichier journalisé ext4           /home Répertoires personnels des utilisateurs</li>
<li>1.9 TB          Système de fichier journalisé ext4          Autre : /data</li>
</ul>
<p>Terminer le partitionnement et appliquer les changements</p>
<p>L&#8217;écran suivant récapitule les partitions, &laquo;&nbsp;Faut il appliquer les changements sur le disque&nbsp;&raquo; : Oui</p>
<p>Le formattage des partitions commence puis l&#8217;installation proprement dite.</p>
<p>Au bout d&#8217;un certain temps, lorsque l&#8217;installation est terminée, on une nouvelle série de questions :</p>
<ul>
<li>Installer le programme de démarrage GRUB sur le secteur d&#8217;amorçage : Oui</li>
<li>L&#8217;horloge système est elle à l&#8217;heure universelle UTC : Oui</li>
</ul>
<p>Retire le CD lorsque c&#8217;est indiqué et &laquo;&nbsp;Continuer&nbsp;&raquo;, le système reboot</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/installer-ubuntu-12-04-ou-autre-minimal-pas-dinterface-graphique/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installer virtualbox sur un serveur headless (sans interface graphique)</title>
		<link>http://voidandany.free.fr/index.php/installer-virtualbox-sur-un-serveur-headless-sans-interface-graphique/</link>
		<comments>http://voidandany.free.fr/index.php/installer-virtualbox-sur-un-serveur-headless-sans-interface-graphique/#comments</comments>
		<pubDate>Tue, 20 Nov 2012 22:06:47 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[virtual machine]]></category>
		<category><![CDATA[VirtualBox]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4747</guid>
		<description><![CDATA[Et hop un petit article rapide et oui je penses encore à ce blog&#8230; Ajout du ppa virtualbox : sudo vim /etc/apt/source.list.d/virtualbox.list Y copier la ligne correspondant à votre version d&#8217;Ubuntu, dans mon cas la 12.04 : deb http://download.virtualbox.org/virtualbox/debian precise &#8230; <a href="http://voidandany.free.fr/index.php/installer-virtualbox-sur-un-serveur-headless-sans-interface-graphique/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Et hop un petit article rapide et oui je penses encore à ce blog&#8230;</p>
<p>Ajout du ppa virtualbox :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>source.list.d<span style="color: #000000; font-weight: bold;">/</span>virtualbox.list</pre></div></div>

<p>Y copier la ligne correspondant à votre version d&#8217;Ubuntu, dans mon cas la 12.04 :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">deb http://download.virtualbox.org/virtualbox/debian precise contrib</pre></div></div>

<p>Liste complète <a href="https://www.virtualbox.org/wiki/Linux_Downloads">ici</a></p>
<p>Ajout de la clé virtualbox et installation :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #660033;">-q</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.virtualbox.org<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span>oracle_vbox.asc <span style="color: #660033;">-O-</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-key</span> add -
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> update
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> linux-headers-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">uname</span> -r<span style="color: #7a0874; font-weight: bold;">&#41;</span> build-essential virtualbox-<span style="color: #000000;">4.2</span> dkms <span style="color: #660033;">--without-recommends</span></pre></div></div>

<p>Installation des additions clientes :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>download.virtualbox.org<span style="color: #000000; font-weight: bold;">/</span>virtualbox<span style="color: #000000; font-weight: bold;">/</span>4.2.4<span style="color: #000000; font-weight: bold;">/</span>Oracle_VM_VirtualBox_Extension_Pack-4.2.4-<span style="color: #000000;">81684</span>.vbox-extpack
<span style="color: #c20cb9; font-weight: bold;">sudo</span> VBoxManage extpack <span style="color: #c20cb9; font-weight: bold;">install</span> Oracle_VM_VirtualBox_Extension_Pack-4.2.4-<span style="color: #000000;">81684</span>.vbox-extpack</pre></div></div>

<p>Et voila virtualbox est installé, on pourrait s’arrêter ici et le commander en ligne de commande, mais pour plus de facilité on va installer phpvirtualbox qui comme son nom l&#8217;indique permet de piloter virtualbox via une interface web.</p>
<p>On partira du principe que vous avez déjà un serveur web (Nginx en l’occurrence, voir <a title="Installer un serveur web (nginx) sur le Seagate Dockstar" href="http://voidandany.free.fr/index.php/installer-un-serveur-web-nginx-sur-le-seagate-dockstar/">Installer Nginx</a>, <a title="Paramétrages NGINX" href="http://voidandany.free.fr/index.php/parametrages-nginx/">Paramétrer Nginx</a>).</p>
<p>On pourra s&#8217;assurer que les paquet suivant sont installés :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">php5-suhosin php-pear unzip</pre></div></div>

<p>On va tout d&#8217;abord créer un utilisateur spécifique qui exécutera le service Vboxweb-service :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">useradd <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vbox <span style="color: #660033;">-m</span> <span style="color: #660033;">-g</span> vboxusers <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">bash</span> vbox
<span style="color: #c20cb9; font-weight: bold;">passwd</span> vbox</pre></div></div>

<p>On configure virtualbox pour lui indiquer que l&#8217;on doit utiliser l&#8217;utilisateur que l&#8217;on vient de créer :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span>virtuabox</pre></div></div>

<p>On ajoute :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">VBOXWEB_USER</span>=vbox</pre></div></div>

<p>On installe le service vboxweb-service et on le démarre :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">update-rc.d vboxweb-service defaults 
<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>vboxweb-service start</pre></div></div>

<p>On récupère le code de phpvirtualbox et on l&#8217;installe :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>localhost
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>phpvirtualbox.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>files<span style="color: #000000; font-weight: bold;">/</span>phpvirtualbox-<span style="color: #000000;">4.2</span>-<span style="color: #000000;">4</span>.zip
<span style="color: #c20cb9; font-weight: bold;">unzip</span> phpvirtualbox-<span style="color: #000000;">4.2</span>-<span style="color: #000000;">4</span>.zip
<span style="color: #c20cb9; font-weight: bold;">mv</span> phpvirtualbox-<span style="color: #000000;">4.2</span>-<span style="color: #000000;">4</span> phpvirtualbox</pre></div></div>

<p>Configuration de phpvirtualbox :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>localhost<span style="color: #000000; font-weight: bold;">/</span>phpvirtualbox<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> config.php-example config.php
<span style="color: #c20cb9; font-weight: bold;">vim</span> config.php</pre></div></div>

<p>Et on modifiera les 2 lignes suivantes :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">var <span style="color: #007800;">$username</span> = <span style="color: #ff0000;">'vbox'</span>;
var <span style="color: #007800;">$password</span> = <span style="color: #ff0000;">'[Mot de passe de l'</span>utilisateur vbox<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #ff0000;">';</span></pre></div></div>

<p>Enfin en bonus voici ma config nginx :</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">server <span style="color: #7a0874; font-weight: bold;">&#123;</span>
 listen       <span style="color: #000000;">80</span>;
 server_name  localhost, <span style="color: #7a0874; font-weight: bold;">&#91;</span>IP locale<span style="color: #7a0874; font-weight: bold;">&#93;</span>;
 root         <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>localhost<span style="color: #000000; font-weight: bold;">/</span>phpvirtualbox;
&nbsp;
 include         <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>common.conf ;
 index           index.html index.php;
 access_log      <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>localhost.access.log;
&nbsp;
 location ~ \.php$ <span style="color: #7a0874; font-weight: bold;">&#123;</span>
 include         <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>fastcgi_params;
 fastcgi_param   SCRIPT_FILENAME  <span style="color: #007800;">$document_root</span><span style="color: #007800;">$fastcgi_script_name</span>;
 fastcgi_pass    127.0.0.1:<span style="color: #000000;">9000</span>;
 <span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>&nbsp;</p>
<p>On peut dès lors se connecter sur son serveur (login et mot de passe par défaut de phpvirtualbox : admin/admin)</p>
<p>A l&#8217;usage phpvirtualbox est comme virtualbox, c&#8217;en est bluffant.</p>
<p>Seul chose à savoir, lorsque l&#8217;on démarre une machine virtuel, on peut y accéder via l&#8217;onglet &laquo;&nbsp;Console&nbsp;&raquo; mais il faut changer l&#8217;adresse de connexion de null:9001 (ou tout autre port) en [IP locale du serveur virtualbox]:9001.</p>
<p>Enfin plus pratique que l&#8217;onglet console, on pourra utiliser rdestop sous Ubuntu (là aussi l&#8217;accès se fait via : [IP locale du serveur virtualbox]:9001.)</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><strong>Sources :</strong></span></p>
<p>http://www.howtoforge.com/vboxheadless-running-virtual-machines-with-virtualbox-4.1-on-a-headless-ubuntu-12.04-server</p>
<p>http://www.vionblog.com/virtualbox-4-2-and-phpvirtualbox-on-debian/</p>
<p>http://www.howtoforge.com/managing-a-headless-virtualbox-installation-with-phpvirtualbox-on-nginx-ubuntu-12.04</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/installer-virtualbox-sur-un-serveur-headless-sans-interface-graphique/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Corriger le problème des vidéos Flash bleu</title>
		<link>http://voidandany.free.fr/index.php/corriger-le-probleme-des-videos-flash-bleu/</link>
		<comments>http://voidandany.free.fr/index.php/corriger-le-probleme-des-videos-flash-bleu/#comments</comments>
		<pubDate>Mon, 06 Aug 2012 19:32:00 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4721</guid>
		<description><![CDATA[Edit 04/09/2012 : J&#8217;ai supprimé le correctif décrit cet article car il faisait planter Compiz &#160; Depuis  la 12.04 lorsque je regardais une vidéo Youtube par exemple j&#8217;avais ça : Nixie Pixel à plutôt un vilain teint, le problème vient &#8230; <a href="http://voidandany.free.fr/index.php/corriger-le-probleme-des-videos-flash-bleu/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration: underline;"><strong>Edit 04/09/2012 :</strong></span> J&#8217;ai supprimé le correctif décrit cet article car il faisait planter Compiz</p>
<p>&nbsp;</p>
<p>Depuis  la 12.04 lorsque je regardais une vidéo Youtube par exemple j&#8217;avais ça :</p>
<p><a rel="attachment wp-att-4722" href="http://voidandany.free.fr/index.php/corriger-le-probleme-des-videos-flash-bleu/selection_075/"><img class="alignleft size-large wp-image-4722" title="Sélection_075" src="http://voidandany.free.fr/wp-content/uploads/Sélection_075-650x462.png" alt="" width="640" height="454" /></a></p>
<p>Nixie Pixel à plutôt un vilain teint, le problème vient d&#8217;un bug dans le plugin Flash sous Linux avec les carte graphique nVidia et l&#8217;accélération matériel d&#8217;activé.</p>
<p>Il existe divers contournements plus ou moins heureux et plus ou moins efficace.</p>
<p>Après avoir étudié le sujet j&#8217;ai choisi d&#8217;installer la librairie libvdpau1 patché :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>code<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #c20cb9; font-weight: bold;">sudo</span> add-apt-repository ppa:tikhonov<span style="color: #000000; font-weight: bold;">/</span>misc
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libvdpau1<span style="color: #000000; font-weight: bold;">&lt;/</span>code<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>Et voila Nixie à meilleur teint :</p>
<p><a rel="attachment wp-att-4723" href="http://voidandany.free.fr/index.php/corriger-le-probleme-des-videos-flash-bleu/selection_076/"><img class="alignleft size-full wp-image-4723" title="Sélection_076" src="http://voidandany.free.fr/wp-content/uploads/Sélection_076.png" alt="" width="650" height="465" /></a></p>
<p><span style="text-decoration: underline;"><em><strong>Source :</strong></em></span><strong><em> </em></strong><a href="http://askubuntu.com/questions/117127/flash-video-appears-blue">Flash video appears blue</a></p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/corriger-le-probleme-des-videos-flash-bleu/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Télécharger la série Bref (Canal+) automatiquement (sous Linux)</title>
		<link>http://voidandany.free.fr/index.php/telecharger-la-serie-bref-canal-automatiquement-sous-linux/</link>
		<comments>http://voidandany.free.fr/index.php/telecharger-la-serie-bref-canal-automatiquement-sous-linux/#comments</comments>
		<pubDate>Wed, 02 Nov 2011 20:02:22 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4352</guid>
		<description><![CDATA[Edit 23/04/2012 : Modification du script pour télécharger via http au lieu de rtmp &#160; Mieux vaut tard que jamais, j&#8217;ai découvert la série Bref ce week-end. Cette série diffusé durant le grand-journal fait le buzz et est surtout très &#8230; <a href="http://voidandany.free.fr/index.php/telecharger-la-serie-bref-canal-automatiquement-sous-linux/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration: underline;"><em><strong>Edit 23/04/2012</strong></em></span> : Modification du script pour télécharger via http au lieu de rtmp</p>
<p>&nbsp;</p>
<p>Mieux vaut tard que jamais, j&#8217;ai découvert la <strong>série <a href="http://www.canalplus.fr/c-divertissement/pid3848-c-bref.html?tab=1">Bref</a> </strong>ce week-end.</p>
<p>Cette série diffusé durant le grand-journal fait le buzz et est surtout très drôle, rythmé, bref superbe.</p>
<p>Par contre la regarder en direct pendant le grand journal, ce n&#8217;est pas possible pour moi, la regarder en différé sur le site de Canal+ non plus, il me fallait donc trouver un moyen pour la <strong>télécharger automatiquement </strong>et pouvoir la regarder tranquillement sur mon HTPC.</p>
<p>Il existe divers scripts et programmes pour télécharger les émissions de Canal+, je devais en trouver un qui fonctionne, qui puisse être planifié (exécuté tous les jours et qui garde en mémoire les épisode déjà téléchargés) et surtout headless (en ligne de commande).</p>
<p>Mon point de départ, ce <a href="http://forum.ubuntu-fr.org/viewtopic.php?id=346586&amp;p=1">thread d&#8217;Ubuntu-fr.org</a> et j&#8217;ai trouvé mon bonheur en <a href="http://forum.ubuntu-fr.org/viewtopic.php?id=346586&amp;p=16">page 16</a> avec le <strong>script de <a href="http://forum.ubuntu-fr.org/profile.php?id=73682">vincentp010</a> </strong>(recopié en fin d&#8217;article)</p>
<p>Ce script en Python se base sur un tableau des ids des émissions à télécharger :</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">emissions=<span style="color: black;">&#91;</span>
<span style="color: #ff4500;">48</span>,    <span style="color: #808080; font-style: italic;"># GUIGNOLS</span>
<span style="color: #ff4500;">252</span>,   <span style="color: #808080; font-style: italic;"># SAV</span>
<span style="color: #ff4500;">254</span>,   <span style="color: #808080; font-style: italic;"># GROLAND</span>
<span style="color: #ff4500;">201</span>,   <span style="color: #808080; font-style: italic;"># ZAPPING</span>
<span style="color: #ff4500;">104</span>,  <span style="color: #808080; font-style: italic;"># GRAND JOURNAL</span>
<span style="color: #ff4500;">249</span>,  <span style="color: #808080; font-style: italic;"># PETIT JOURNAL</span>
<span style="color: #ff4500;">37</span>,   <span style="color: #808080; font-style: italic;"># ACTION DISCRETE</span>
<span style="color: #ff4500;">39</span>,   <span style="color: #808080; font-style: italic;"># LA MATINALE</span>
<span style="color: #ff4500;">47</span>,   <span style="color: #808080; font-style: italic;"># PEPITES DU NET</span>
<span style="color: #ff4500;">62</span>,   <span style="color: #808080; font-style: italic;"># LE BOUCAN DU JOUR</span>
<span style="color: #ff4500;">215</span>,  <span style="color: #808080; font-style: italic;"># LE MEILLEUR DU HIER</span>
<span style="color: black;">&#93;</span></pre></div></div>

<p>Restait à trouver l&#8217;<strong>id de l&#8217;émission Bref</strong>.</p>
<p>Après quelques recherches infructueuses je suis tombé sur <a href="http://www.canalplus.fr/rest/bootstrap.php?/bigplayer/initPlayer">cette URL </a>qui liste toutes les émissions de Canal+.</p>
<p>Bref à l&#8217;id <strong>627</strong>, j&#8217;ai donc modifié le tableau émission ainsi :</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">emissions=<span style="color: black;">&#91;</span>
<span style="color: #ff4500;">627</span>,    <span style="color: #808080; font-style: italic;"># BREF</span>
<span style="color: black;">&#93;</span></pre></div></div>

<p>Paramétré les chemins (penser à créer les répertoires) et nom de fichier :</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">homedir = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">expanduser</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'~/bin'</span><span style="color: black;">&#41;</span>
HISTORIQUE = homedir + <span style="color: #483d8b;">&quot;/.cplus_hist&quot;</span>
output_dir = <span style="color: #483d8b;">&quot;/data/downloads/videos/canalplus&quot;</span></pre></div></div>

<p>Installé flvstreamer :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> flvstreamer</pre></div></div>

<p>Pour finir le script est planifié en crontab et le boulot est fait&#8230;.</p>
<p>&nbsp;</p>
<p>Script de téléchargement des séries Canal+ de <a href="http://forum.ubuntu-fr.org/profile.php?id=73682">vincentp010</a> :</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>
<span style="color: #808080; font-style: italic;"># -*- coding:Utf-8 -*-</span>
&nbsp;
<span style="color: #808080; font-style: italic;">###########################################################################</span>
<span style="color: #808080; font-style: italic;"># Copyright (C) 2010  La_Poigne                                           #</span>
<span style="color: #808080; font-style: italic;"># This program is free software: you can redistribute it and/or modify    #</span>
<span style="color: #808080; font-style: italic;">#  it under the terms of the GNU General Public License as published by   #</span>
<span style="color: #808080; font-style: italic;">#  the Free Software Foundation, either version 2 of the License, or      #</span>
<span style="color: #808080; font-style: italic;">#  any later version.                                                     #</span>
<span style="color: #808080; font-style: italic;"># This program is distributed in the hope that it will be useful,         #</span>
<span style="color: #808080; font-style: italic;">#  but WITHOUT ANY WARRANTY without even the implied warranty of          #</span>
<span style="color: #808080; font-style: italic;">#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          #</span>
<span style="color: #808080; font-style: italic;">#  GNU General Public License for more details.                           #</span>
<span style="color: #808080; font-style: italic;"># You should have received a copy of the GNU General Public License       #</span>
<span style="color: #808080; font-style: italic;">#  along with this program.  If not, see &lt;http://www.gnu.org/licenses/&gt;.  #</span>
<span style="color: #808080; font-style: italic;">###########################################################################</span>
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;">#Script pour telecharger les emission du site canalplus.fr</span>
<span style="color: #808080; font-style: italic;">#Fonctionne en theorie sur tous les OS</span>
<span style="color: #808080; font-style: italic;">#</span>
<span style="color: #808080; font-style: italic;">#Changelog:</span>
<span style="color: #808080; font-style: italic;">#V 0.1</span>
<span style="color: #808080; font-style: italic;">#21-12-2010 : Creation</span>
<span style="color: #808080; font-style: italic;">#V 0.2</span>
<span style="color: #808080; font-style: italic;">#22-12-2010 : Reglage probleme encodage dans fichier log</span>
<span style="color: #808080; font-style: italic;">#V 0.3</span>
<span style="color: #808080; font-style: italic;">#23-12-2010 : Ajout d'une option &quot;--log&quot; et prise en compte de l'absence du tag sous-titre</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>, <span style="color: #dc143c;">urllib</span>, <span style="color: #dc143c;">subprocess</span>, <span style="color: #dc143c;">time</span>, <span style="color: #dc143c;">sys</span> 
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">xml</span>.<span style="color: black;">dom</span> <span style="color: #ff7700;font-weight:bold;">import</span> minidom
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;"># Numeros des emissions a telecharger, commentez celles que vous ne voulez pas</span>
emissions=<span style="color: black;">&#91;</span>
<span style="color: #ff4500;">627</span>,	<span style="color: #808080; font-style: italic;"># BREF</span>
<span style="color: #808080; font-style: italic;">#48,    # GUIGNOLS</span>
<span style="color: #808080; font-style: italic;">#252,   # SAV</span>
<span style="color: #808080; font-style: italic;">#254,   # GROLAND</span>
<span style="color: #808080; font-style: italic;">#201,   # ZAPPING</span>
<span style="color: #808080; font-style: italic;">#104,  # GRAND JOURNAL</span>
<span style="color: #808080; font-style: italic;">#249,  # PETIT JOURNAL</span>
<span style="color: #808080; font-style: italic;">#37,   # ACTION DISCRETE</span>
<span style="color: #808080; font-style: italic;">#39,   # LA MATINALE</span>
<span style="color: #808080; font-style: italic;">#47,   # PEPITES DU NET</span>
<span style="color: #808080; font-style: italic;">#62,   # LE BOUCAN DU JOUR</span>
<span style="color: #808080; font-style: italic;">#215,  # LE MEILLEUR DU HIER</span>
<span style="color: black;">&#93;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Qualite de la video</span>
<span style="color: #808080; font-style: italic;">#qualite = &quot;BAS_DEBIT&quot;</span>
<span style="color: #808080; font-style: italic;">#qualite = &quot;HAUT_DEBIT&quot;</span>
qualite = <span style="color: #483d8b;">&quot;HD&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Repertoires (pensez a les creer avant)</span>
homedir = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">expanduser</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'~/bin'</span><span style="color: black;">&#41;</span>
HISTORIQUE = homedir + <span style="color: #483d8b;">&quot;/.cplus_hist&quot;</span>
output_dir = <span style="color: #483d8b;">&quot;/data/downloads/videos/canalplus&quot;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;"># Ne rien modifier sous cette ligne</span>
<span style="color: #808080; font-style: italic;"># Sauf pour ameliorer le fonctionnement ;)</span>
&nbsp;
logfile = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>homedir, <span style="color: #483d8b;">&quot;canal.log&quot;</span><span style="color: black;">&#41;</span>
urlXMLEmissions = <span style="color: #483d8b;">&quot;http://www.canalplus.fr/rest/bootstrap.php?/bigplayer/getMEAs/&quot;</span>
urlXMLVid = <span style="color: #483d8b;">&quot;http://www.canalplus.fr/rest/bootstrap.php?/bigplayer/getVideos/&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Parse Mea file to get videos id</span>
<span style="color: #ff7700;font-weight:bold;">def</span> ParseMeas<span style="color: black;">&#40;</span>xmldoc<span style="color: black;">&#41;</span>:
   ids = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
   meas = xmldoc.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'MEA'</span><span style="color: black;">&#41;</span>
   <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> meas:
      <span style="color: #ff7700;font-weight:bold;">if</span> i.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'ID'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">childNodes</span> <span style="color: #66cc66;">!</span>= <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>:
         <span style="color: #008000;">id</span> = i.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'ID'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">childNodes</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">nodeValue</span>
         ids.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #008000;">id</span><span style="color: black;">&#41;</span>
   <span style="color: #ff7700;font-weight:bold;">return</span> ids
&nbsp;
<span style="color: #808080; font-style: italic;"># Parse video file to get name and url</span>
<span style="color: #ff7700;font-weight:bold;">def</span> ParseVid<span style="color: black;">&#40;</span>xmldoc<span style="color: black;">&#41;</span>:
   names = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
   urlVids = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
   videos = xmldoc.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'VIDEO'</span><span style="color: black;">&#41;</span>
   <span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> videos:
      titrage = i.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'INFOS'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'TITRAGE'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
      <span style="color: #ff7700;font-weight:bold;">if</span> titrage.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'TITRE'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">childNodes</span> <span style="color: #66cc66;">!</span>= <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>:
         titre = titrage.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'TITRE'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">childNodes</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">nodeValue</span>
         <span style="color: #ff7700;font-weight:bold;">if</span> titrage.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'SOUS_TITRE'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">childNodes</span> <span style="color: #66cc66;">!</span>= <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>:
            stitre = titrage.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'SOUS_TITRE'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">childNodes</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">nodeValue</span>
            date = <span style="color: #483d8b;">&quot;_&quot;</span> + stitre
         <span style="color: #ff7700;font-weight:bold;">else</span>:
            date = <span style="color: #483d8b;">&quot;&quot;</span>
         name = titre + date
         name = name.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">' '</span>, <span style="color: #483d8b;">'.'</span><span style="color: black;">&#41;</span>.<span style="color: black;">replace</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'/'</span>, <span style="color: #483d8b;">'-'</span><span style="color: black;">&#41;</span>
         videos = i.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'MEDIA'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'VIDEOS'</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
         rtmp= videos.<span style="color: black;">getElementsByTagName</span><span style="color: black;">&#40;</span>qualite<span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">childNodes</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">nodeValue</span>
         names.<span style="color: black;">append</span><span style="color: black;">&#40;</span>name<span style="color: black;">&#41;</span>
         urlVids.<span style="color: black;">append</span><span style="color: black;">&#40;</span>rtmp<span style="color: black;">&#41;</span>
   <span style="color: #ff7700;font-weight:bold;">return</span> names, urlVids
&nbsp;
<span style="color: #808080; font-style: italic;"># Execute command and write stdout in file var</span>
<span style="color: #ff7700;font-weight:bold;">def</span> execute<span style="color: black;">&#40;</span>params, <span style="color: #008000;">file</span><span style="color: black;">&#41;</span>:
   p = <span style="color: #dc143c;">subprocess</span>.<span style="color: black;">Popen</span><span style="color: black;">&#40;</span>params,stdout=<span style="color: #008000;">file</span><span style="color: black;">&#41;</span>
   p.<span style="color: black;">wait</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
   <span style="color: #ff7700;font-weight:bold;">return</span> p.<span style="color: black;">returncode</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> addHistory<span style="color: black;">&#40;</span>name<span style="color: black;">&#41;</span>:
   <span style="color: #008000;">file</span> = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>HISTORIQUE, <span style="color: #483d8b;">'a'</span><span style="color: black;">&#41;</span>
   <span style="color: #008000;">file</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span>name.<span style="color: black;">encode</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'utf-8'</span><span style="color: black;">&#41;</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
   <span style="color: #008000;">file</span>.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> checkHistory<span style="color: black;">&#40;</span>name<span style="color: black;">&#41;</span>:
   findvalue = <span style="color: #ff4500;">0</span>
   <span style="color: #008000;">file</span> = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>HISTORIQUE, <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>
   <span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">file</span>:
      <span style="color: #ff7700;font-weight:bold;">if</span> line.<span style="color: black;">decode</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'utf-8'</span><span style="color: black;">&#41;</span> == name + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span>:
         findvalue = <span style="color: #ff4500;">1</span>
   <span style="color: #008000;">file</span>.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
   <span style="color: #ff7700;font-weight:bold;">return</span> findvalue
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> downXml<span style="color: black;">&#40;</span>url<span style="color: black;">&#41;</span>:
   <span style="color: #ff7700;font-weight:bold;">try</span>:
      xmlFileSock=<span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlopen</span><span style="color: black;">&#40;</span>url<span style="color: black;">&#41;</span>
      xmlFile = xmlFileSock.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
   <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">Exception</span>, e:
      <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #ff4500;">1</span>
   <span style="color: #ff7700;font-weight:bold;">try</span>:
      xmldoc = minidom.<span style="color: black;">parseString</span><span style="color: black;">&#40;</span>xmlFile<span style="color: black;">&#41;</span>
   <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">Exception</span>, e:
      xmldoc = <span style="color: #ff4500;">1</span>
   <span style="color: #ff7700;font-weight:bold;">return</span> xmldoc
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
&nbsp;
   debug = <span style="color: #008000;">False</span>
   <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">sys</span>.<span style="color: black;">argv</span><span style="color: black;">&#41;</span> == <span style="color: #ff4500;">2</span>:     
     <span style="color: #ff7700;font-weight:bold;">if</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;--log&quot;</span>:
        debug = <span style="color: #008000;">True</span>
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Debug ON&quot;</span>
        logf = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>logfile, <span style="color: #483d8b;">&quot;w&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
   <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>HISTORIQUE<span style="color: black;">&#41;</span> == <span style="color: #008000;">False</span>:
     <span style="color: #008000;">file</span> = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>HISTORIQUE, <span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span>
     <span style="color: #008000;">file</span>.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
   <span style="color: #ff7700;font-weight:bold;">for</span> num <span style="color: #ff7700;font-weight:bold;">in</span> emissions:
      url = urlXMLEmissions + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>num<span style="color: black;">&#41;</span>
      <span style="color: #ff7700;font-weight:bold;">if</span> debug:
         logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span><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><span style="color: black;">&#41;</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
         logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Downloading &quot;</span> + url + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
      xmldoc = downXml<span style="color: black;">&#40;</span>url<span style="color: black;">&#41;</span>
      <span style="color: #ff7700;font-weight:bold;">if</span> xmldoc == <span style="color: #ff4500;">1</span>:
         <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Erreur durant la recuperation de la liste &quot;</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>num<span style="color: black;">&#41;</span>
         <span style="color: #ff7700;font-weight:bold;">if</span> debug:
            logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span>url + <span style="color: #483d8b;">&quot; download error&quot;</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
      <span style="color: #ff7700;font-weight:bold;">else</span>:
         <span style="color: #008000;">id</span> = ParseMeas<span style="color: black;">&#40;</span>xmldoc<span style="color: black;">&#41;</span>
         <span style="color: #ff7700;font-weight:bold;">if</span> debug:
            logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;-&gt; Ids &quot;</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span><span style="color: #008000;">id</span><span style="color: black;">&#41;</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
&nbsp;
         <span style="color: #ff7700;font-weight:bold;">for</span> vid <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">id</span>:
            url2 = urlXMLVid + vid
            <span style="color: #ff7700;font-weight:bold;">if</span> debug:
              logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Downloading &quot;</span> + url2 + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
            xmldoc2 = downXml<span style="color: black;">&#40;</span>url2<span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">if</span> xmldoc2 == <span style="color: #ff4500;">1</span>:
               <span style="color: #ff7700;font-weight:bold;">if</span> debug:
                  logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span>url2 + <span style="color: #483d8b;">&quot; download error&quot;</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
            <span style="color: #ff7700;font-weight:bold;">else</span>:
               names, urlVids = ParseVid<span style="color: black;">&#40;</span>xmldoc2<span style="color: black;">&#41;</span>
               <span style="color: #ff7700;font-weight:bold;">if</span> debug:
                  logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;--&gt; names &quot;</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>names<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
                  logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;---&gt; urlvid &quot;</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>urlVids<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
&nbsp;
               i = <span style="color: #ff4500;">0</span>
               loop = <span style="color: #ff4500;">0</span>
               <span style="color: #ff7700;font-weight:bold;">while</span> i <span style="color: #66cc66;">&lt;</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>names<span style="color: black;">&#41;</span>:
&nbsp;
                  check = checkHistory<span style="color: black;">&#40;</span>names<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
                  <span style="color: #ff7700;font-weight:bold;">if</span> check == <span style="color: #ff4500;">0</span>:
                     <span style="color: #ff7700;font-weight:bold;">if</span> debug:
                       logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Try to download file &quot;</span><span style="color: black;">&#41;</span>
&nbsp;
                     basename, extension = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">splitext</span><span style="color: black;">&#40;</span>urlVids<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
                     flvFile = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>output_dir , names<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span> + extension<span style="color: black;">&#41;</span>
                     <span style="color: #ff7700;font-weight:bold;">if</span> urlVids<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>.<span style="color: black;">find</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;rtmp&quot;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">!</span>=-<span style="color: #ff4500;">1</span>:
                        <span style="color: #ff7700;font-weight:bold;">if</span> debug:
                           logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;with flvstreamer&quot;</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
                        params=<span style="color: black;">&#91;</span><span style="color: #483d8b;">'flvstreamer'</span>, <span style="color: #483d8b;">'-r'</span>, urlVids<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#93;</span>
                        <span style="color: #008000;">file</span> = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span>flvFile, <span style="color: #483d8b;">'w'</span><span style="color: black;">&#41;</span>
                        r = execute<span style="color: black;">&#40;</span>params, <span style="color: #008000;">file</span><span style="color: black;">&#41;</span>
                        <span style="color: #008000;">file</span>.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
                     <span style="color: #ff7700;font-weight:bold;">else</span>:
                        <span style="color: #ff7700;font-weight:bold;">if</span> debug:
                           logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;direct download&quot;</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
                        <span style="color: #ff7700;font-weight:bold;">try</span>:
                           <span style="color: #dc143c;">urllib</span>.<span style="color: black;">urlretrieve</span><span style="color: black;">&#40;</span>urlVids<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span>, flvFile<span style="color: black;">&#41;</span>
                           r=<span style="color: #ff4500;">0</span>
                        <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">Exception</span>:
                           r=<span style="color: #ff4500;">1</span>
                     <span style="color: #808080; font-style: italic;"># If returncode OK, next file</span>
                     <span style="color: #ff7700;font-weight:bold;">if</span> r == <span style="color: #ff4500;">0</span>:
                        <span style="color: #ff7700;font-weight:bold;">if</span> debug:
                          logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Download finished, add file to history &quot;</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
                        addHistory<span style="color: black;">&#40;</span>names<span style="color: black;">&#91;</span>i<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
                        loop = <span style="color: #ff4500;">0</span>
                        i += <span style="color: #ff4500;">1</span>
                     <span style="color: #ff7700;font-weight:bold;">else</span>:
                        <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">exists</span><span style="color: black;">&#40;</span>flvFile<span style="color: black;">&#41;</span>:
                           <span style="color: #dc143c;">os</span>.<span style="color: black;">remove</span><span style="color: black;">&#40;</span>flvFile<span style="color: black;">&#41;</span>
                        loop += <span style="color: #ff4500;">1</span>
                        <span style="color: #808080; font-style: italic;"># After 5 retry abord file</span>
                        <span style="color: #ff7700;font-weight:bold;">if</span> loop == <span style="color: #ff4500;">5</span>:
                           <span style="color: #ff7700;font-weight:bold;">if</span> debug:
                              logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Download aborded&quot;</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
                           i += <span style="color: #ff4500;">1</span>
                           loop = <span style="color: #ff4500;">0</span>
                        <span style="color: #ff7700;font-weight:bold;">else</span>:
                           <span style="color: #ff7700;font-weight:bold;">if</span> debug:
                              logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Download error&quot;</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
                           <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Download error, retry in 30 seconds&quot;</span>
                           <span style="color: #dc143c;">time</span>.<span style="color: black;">sleep</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">30</span><span style="color: black;">&#41;</span>
                  <span style="color: #ff7700;font-weight:bold;">else</span>:
                     <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;File already downloaded&quot;</span>
                     <span style="color: #ff7700;font-weight:bold;">if</span> debug:
                       logf.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;File already downloaded&quot;</span> + <span style="color: #483d8b;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span><span style="color: black;">&#41;</span>
&nbsp;
                     i += <span style="color: #ff4500;">1</span>
&nbsp;
   <span style="color: #ff7700;font-weight:bold;">if</span> debug:
      logf.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p><span style="text-decoration: underline;"><em><strong>PS : </strong></em></span>si vous cherchez un programme avec une interface graphique qui fait la même chose et bien plus encore, il existe <a href="http://code.google.com/p/tvdownloader/">tvdownloader</a> qui est parfait</p>
<div id="_mcePaste" class="mcePaste" style="position: absolute; left: -10000px; top: 4902px; width: 1px; height: 1px; overflow: hidden;">flvFile = os.path.join(output_dir , names[i] + extension)<br />
 if urlVids[i].find(&laquo;&nbsp;rtmp&nbsp;&raquo;)!=-1:<br />
 if debug:<br />
 logf.write(&laquo;&nbsp;with flvstreamer&nbsp;&raquo; + &#8216;\n&#8217;)<br />
 params=['flvstreamer', '-r', urlVids[i]]<br />
 file = open(flvFile, &#8216;w&#8217;)<br />
 r = execute(params, file)<br />
 file.close()<br />
 else:<br />
 if debug:<br />
 logf.write(&laquo;&nbsp;direct download&nbsp;&raquo; + &#8216;\n&#8217;)<br />
 try:<br />
 urllib.urlretrieve(urlVids[i], flvFile)<br />
 r=0<br />
 except Exception:<br />
 r=1</div>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/telecharger-la-serie-bref-canal-automatiquement-sous-linux/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Erreur lors de l&#8217;installation de MySQL sur Debian</title>
		<link>http://voidandany.free.fr/index.php/erreur-lors-de-linstallation-de-mysql-sur-debian/</link>
		<comments>http://voidandany.free.fr/index.php/erreur-lors-de-linstallation-de-mysql-sur-debian/#comments</comments>
		<pubDate>Wed, 07 Sep 2011 16:55:58 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Non classé]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[dockstar]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4243</guid>
		<description><![CDATA[En fin de compte j&#8217;ai changé d&#8217;avis pour mon Dockstar et j&#8217;y ai installé MySQL, en effet la plupart des sites/scripts on en pré-requis MySQL. Or quand j&#8217;ai réinstallé MySQL : sudo aptitude install mysql-server mysql-client J&#8217;ai eu les erreurs suivantes &#8230; <a href="http://voidandany.free.fr/index.php/erreur-lors-de-linstallation-de-mysql-sur-debian/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>En fin de compte j&#8217;ai changé d&#8217;avis pour mon <a title="Marques-pages : Un mini serveur le Seagate Dockstar" href="http://voidandany.free.fr/index.php/marques-pages-un-mini-serveur-le-seagate-dockstar/">Dockstar</a> et j&#8217;y ai <a title="Installer et configurer Mysql sur le Dockstar" href="http://voidandany.free.fr/index.php/installer-et-configurer-mysql-sur-le-dockstar/">installé MySQL</a>, en effet la plupart des sites/scripts on en pré-requis MySQL.</p>
<p>Or quand j&#8217;ai réinstallé MySQL :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> mysql-server mysql-client</pre></div></div>

<p>J&#8217;ai eu les erreurs suivantes :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Les paquets partiellement installés suivants seront configurés : 
 mysql-server mysql-server-5.1 
 Aucun paquet ne va être installé, mis à jour ou enlevé.
 0 paquets mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.
 Il est nécessaire de télécharger 0 o d'archives. Après dépaquetage, 0 o seront utilisés.
 Paramétrage de mysql-server-5.1 (5.1.49-3) ...
 Stopping MySQL database server: mysqld.
 /etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz ... (warning).
 Starting MySQL database server: mysqld.
 /etc/init.d/mysql: line 120: /etc/mysql/debian-start: Aucun fichier ou dossier de ce type
 invoke-rc.d: initscript mysql, action &quot;start&quot; failed.
 dpkg : erreur de traitement de mysql-server-5.1 (--configure) :
 le sous-processus script post-installation installé a retourné une erreur de sortie d'état 127
 configured to not write apport reports
 dpkg : des problèmes de dépendances empêchent la configuration de mysql-server :
 mysql-server dépend de mysql-server-5.1 ; cependant :
 Le paquet mysql-server-5.1 n'est pas encore configuré.
 dpkg : erreur de traitement de mysql-server (--configure) :
 problèmes de dépendances - laissé non configuré
 configured to not write apport reports
 Des erreurs ont été rencontrées pendant l'exécution :
 mysql-server-5.1
 mysql-server
 E: Sub-process /usr/bin/dpkg returned an error code (1)
 Échec de l'installation d'un paquet. Tentative de réparation : 
 Paramétrage de mysql-server-5.1 (5.1.49-3) ...
 Stopping MySQL database server: mysqld.
 /etc/init.d/mysql: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz ... (warning).
 Starting MySQL database server: mysqld.
 /etc/init.d/mysql: line 120: /etc/mysql/debian-start: Aucun fichier ou dossier de ce type
 invoke-rc.d: initscript mysql, action &quot;start&quot; failed.
 dpkg : erreur de traitement de mysql-server-5.1 (--configure) :
 le sous-processus script post-installation installé a retourné une erreur de sortie d'état 127
 dpkg : des problèmes de dépendances empêchent la configuration de mysql-server :
 mysql-server dépend de mysql-server-5.1 ; cependant :
 Le paquet mysql-server-5.1 n'est pas encore configuré.
 dpkg : erreur de traitement de mysql-server (--configure) :
 problèmes de dépendances - laissé non configuré
 Des erreurs ont été rencontrées pendant l'exécution :
 mysql-server-5.1
 mysql-server</pre></div></div>

<p>Voici la solution que j&#8217;ai trouvé sur <a href="http://ubuntuforums.org/showthread.php?t=814782">[ubuntu] mysql problem &#8211; Ubuntu Forums</a> :</p>
<p>Créer un fichier /etc/mysql/debian-start (avec sudo) et y copier ceci :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
 <span style="color: #666666; font-style: italic;">#</span>
 <span style="color: #666666; font-style: italic;"># This script is executed by &quot;/etc/init.d/mysql&quot; on every (re)start.</span>
 <span style="color: #666666; font-style: italic;">#</span>
 <span style="color: #666666; font-style: italic;"># Changes to this file will be preserved when updating the Debian package.</span>
 <span style="color: #666666; font-style: italic;">#</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">source</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>debian-start.inc.sh
&nbsp;
<span style="color: #007800;">MYSQL</span>=<span style="color: #ff0000;">&quot;/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf&quot;</span>
 <span style="color: #007800;">MYADMIN</span>=<span style="color: #ff0000;">&quot;/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf&quot;</span>
 <span style="color: #007800;">MYUPGRADE</span>=<span style="color: #ff0000;">&quot;/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf&quot;</span>
 <span style="color: #007800;">MYCHECK</span>=<span style="color: #ff0000;">&quot;/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf&quot;</span>
 <span style="color: #007800;">MYCHECK_SUBJECT</span>=<span style="color: #ff0000;">&quot;WARNING: mysqlcheck has found corrupt tables&quot;</span>
 <span style="color: #007800;">MYCHECK_PARAMS</span>=<span style="color: #ff0000;">&quot;--all-databases --fast --silent&quot;</span>
 <span style="color: #007800;">MYCHECK_RCPT</span>=<span style="color: #ff0000;">&quot;root&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># The following commands should be run when the server is up but in background</span>
 <span style="color: #666666; font-style: italic;"># where they do not block the server start and in one shell instance so that</span>
 <span style="color: #666666; font-style: italic;"># they run sequentially. They are supposed not to echo anything to stdout.</span>
 <span style="color: #666666; font-style: italic;"># If you want to disable the check for crashed tables comment</span>
 <span style="color: #666666; font-style: italic;"># &quot;check_for_crashed_tables&quot; out.</span>
 <span style="color: #666666; font-style: italic;"># (There may be no output to stdout inside the background process!)</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Checking for corrupt, not cleanly closed and upgrade needing tables.&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">&#40;</span>
 upgrade_system_tables_if_necessary;
 check_root_accounts;
 check_for_crashed_tables;
 <span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">&amp;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p>Rendre le fichier exécutable :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>mysql<span style="color: #000000; font-weight: bold;">/</span>debian-start</pre></div></div>

<p>Et reprendre l’installation (un dpkg reconfigure aurait sûrement aussi fait l&#8217;affaire):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> mysql-server mysql-client</pre></div></div>

<p>Normalement il n&#8217;y a plus d&#8217;erreurs:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Les paquets partiellement installés suivants seront configurés :
 mysql-server mysql-server-5.1
 Aucun paquet ne va être installé, mis à jour ou enlevé.
 0 paquets mis à jour, 0 nouvellement installés, 0 à enlever et 0 non mis à jour.
 Il est nécessaire de télécharger 0 o d'archives. Après dépaquetage, 0 o seront utilisés.
 Paramétrage de mysql-server-5.1 (5.1.49-3) ...
 Stopping MySQL database server: mysqld.
 Starting MySQL database server: mysqld.
 Checking for corrupt, not cleanly closed and upgrade needing tables..
 Paramétrage de mysql-server (5.1.49-3) ...</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/erreur-lors-de-linstallation-de-mysql-sur-debian/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Téléchargement automatique de séries avec le dockstar</title>
		<link>http://voidandany.free.fr/index.php/telechargement-automatique-de-series-avec-le-dockstar/</link>
		<comments>http://voidandany.free.fr/index.php/telechargement-automatique-de-series-avec-le-dockstar/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 21:11:27 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[flexget]]></category>
		<category><![CDATA[periscope]]></category>
		<category><![CDATA[serie]]></category>
		<category><![CDATA[sous-titres]]></category>
		<category><![CDATA[Transmission]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=3953</guid>
		<description><![CDATA[Voici un article décrivant tout un workflow de téléchargement automatisé de séries au fur et à mesure de leur diffusion sur Internet. Cette article est la compilation de nombreux de mes articles qui traitaient d&#8217;un bout du sujet Les manipulation &#8230; <a href="http://voidandany.free.fr/index.php/telechargement-automatique-de-series-avec-le-dockstar/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Voici un article décrivant tout un workflow de téléchargement automatisé de séries au fur et à mesure de leur diffusion sur Internet.</p>
<p>Cette article est la compilation de nombreux de mes articles qui traitaient d&#8217;un bout du sujet</p>
<p>Les manipulation décrites ont été testé sur mon Dockstar mais peuvent être adaptées sans grand efforts sur tout autre machine Linux.</p>
<p>&nbsp;</p>
<p>Cette article met en œuvre différentes briques logiciels et différents scripts :</p>
<ul>
<li>Flexget : Surveille un flux RSS listant la disponibilité des épisodes de série, si la série est configurée, télécharge le fichier .torrent correspondant et le place dans un répertoire surveillé par Transmission</li>
<li>Transmission : télécharge la série via le protocole P2P bittorent</li>
<li>Scripts Transmission : un ensemble de scripts qui limitent la bande passante dès lors qu&#8217;un PC du LAN est allumé (pour ne pas perturber la navigation sur Internet), déplacent le fichier vidéo de la série dans une répertoire particulier dès lors que le téléchargement par Transmission est terminé (et que le ratio de partage est atteint)</li>
<li>Periscope : Scrute à intervalle régulier le répertoire où sont placé les téléchargements terminés et cherche sur divers sites la disponibilité de sous-titres, auquel cas le fichier de sous titre est téléchargé et renommé automatiquement avec le même nom que le fichier vidéo</li>
<li>Script de rangement : ce script scrute à son tour le répertoire où sont placé les téléchargements terminés et si sont présents à la fois le fichier vidéo et le fichier de sous-titre il les déplace dans un répertoire où la série peut être visionné (répertoire accessible par un HTPC ou par une Freebox)</li>
</ul>
<p>&nbsp;</p>
<p>Enfin avertissement d&#8217;usage : Télécharger c&#8217;est mal, cet article est une démonstration des possibilités de Linux et non pas une incitation à commettre un crime&#8230;</p>
<p>&nbsp;</p>
<h2>Flexget : téléchargement des fichiers torrent à partir d&#8217;un flux RSS</h2>
<h3>Installation</h3>
<p>Dépendances : Flexget est un programme python distribué sous la forme d&#8217;un paquet egg installable via la commande easy_install du paquet python-setuptools :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> python2.6 python-setuptools</pre></div></div>

<p>(Cette installation est assez gourmande en espace disque presque 17Mo sur mon Dockstar)</p>
<p>Comme indiqué l&#8217;installation de Flexget est ensuite simple car packagé sous la forme d&#8217;un egg :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> easy_install flexget</pre></div></div>

<p>Les paquets egg s&#8217;assurent de l’installation des dépendance (en terme de librairies Python). Lors de l&#8217;installation de PyYAML j&#8217;ai eu cette erreur qui ne semble pas avoir de conséquences :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">libyaml is not found or a compiler error: forcing --without-libyaml
(if libyaml is installed correctly, you may need to
specify the option --include-dirs or uncomment and
modify the parameter include_dirs in setup.cfg)
zip_safe flag not set; analyzing archive contents...
Adding PyYAML 3.09 to easy-install.pth file</pre></div></div>

<p>&nbsp;</p>
<h3>Configuration</h3>
<p>Par défaut Flexget va chercher sa configuration dans un fichier config.yml dans un répertoire .flexget du répertoire  home de l&#8217;utilisateur le lançant, on créé donc ce fichier :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> ~<span style="color: #000000; font-weight: bold;">/</span>.flexget
<span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>.flexget
<span style="color: #c20cb9; font-weight: bold;">touch</span> config.yml</pre></div></div>

<p>Vient ensuite la configuration proprement dite de Flexget et partie la plus compliquée (enfin le temps de comprendre la syntaxe de la configuration Flexget).</p>
<p>Pour vous aider vous pouvez :</p>
<ul>
<li>lire le paragraphe Configuration de mon article <a title="Lien permanent vers Téléchargement automatisé de séries avec Flexget" rel="bookmark" href="../index.php/telechargement-automatise-de-series-avec-flexget-torrents/">Téléchargement automatisé de séries avec Flexget</a></li>
<li>lire, parcourir, étudier le <a href="http://flexget.com/">site de Flexget</a> et plus particulièrement les pages <a href="http://flexget.com/wiki/Plugins/series">series</a>, <a href="http://flexget.com/wiki/Plugins/series/per_series_settings">How to configure settings per series, </a><a href="http://flexget.com/wiki/Plugins/series/per_group_settings">How to configure settings with groups</a> et <a href="http://flexget.com/wiki/Cookbook/Series">series cookbook</a></li>
<li>vous inspirer du squelette de mon fichier qui fonctionne parfaitement (l&#8217;envoi de mail se fait en utilisant le serveur SMTP de Free qui ne nécessite pas d&#8217;authentification si c&#8217;est votre FAI)</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">presets:
  global:
    email:
      from: adresse@free.fr
      to:
        - adresse@free.fr
      smtp_host: smtp.free.fr
feeds:
  Series_torrent:
    rss: http://showrss.karmorra.info/xxx
    series:
       settings:
         hdtv:
           timeframe: 3 hours
           quality: hdtv
         720p:
           timeframe: 3 hours
           quality: 720p
       hdtv:
         - Nom série 1
         - Nom série 2
       720p:
         - Nom série téléchargée en HD
    download: /data/downloads/torrents/watch/</pre></div></div>

<p>&nbsp;</p>
<h2>Transmission : téléchargement de la série</h2>
<p>Flexget télécharge le fichier .torrent correspondant à un épisode de série, Transmission se charge de télécharger l&#8217;épisode.</p>
<h3>Installation</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> transmission-daemon transmission-cli</pre></div></div>

<p>(place occupé sur mon système : 1 692 ko)</p>
<p>Le paquet transmission-cli n&#8217;est utile que pour les scripts périphériques à Transmission (déplacement des torrents terminés, économie de bande passante)</p>
<p>Pour ma configuration j&#8217;utilise l&#8217;arborescence de répertoire suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">download/
    torrents/
        complete/
        downloading/
        seeding/
        watch/</pre></div></div>

<ul>
<li>watch : répertoire configuré dans Flexget dans lequel les fichiers .torrent vont être déposés, Transmission est configuré pour surveiller ce répertoire et démarrer automatiquement le téléchargement correspondant</li>
<li>downloading : répertoire ou sont situés les fichiers en cours de téléchargement (fichier avec une extension part pour partial)</li>
<li>seeding : fichier complet mais pour lesquels le ratio de partage n&#8217;a pas encore été atteint</li>
<li>complete : répertoire où sont déposés in-fine les fichiers complétement téléchargés (et ayant atteint le bon ratio de partage). Ce répertoire est ensuite scruté pour la recherche des sous-titres</li>
</ul>
<p>&nbsp;</p>
<h3>Changement de l&#8217;utilisateur démarrant Transmission (optionnel)</h3>
<p>Stopper Transmission :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</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>transmission-daemon stop</pre></div></div>

<p>Éditer le fichier default du script d&#8217;init :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vim</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span>transmission-daemon</pre></div></div>

<p>Mettre la ligne OPTIONS en commentaire :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#OPTIONS=&quot;--config-dir $CONFIG_DIR&quot;</span></pre></div></div>

<p>Éditer le script d&#8217;init</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">vim</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>transmission-daemon</pre></div></div>

<p>Changer l&#8217;utilisateur démarrant le service en modifiant la ligne USER :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">USER</span>=mon_utilisateur <span style="color: #666666; font-style: italic;">#debian-transmission</span></pre></div></div>

<p>Copier le fichier de configuration vers le HOME de notre utilisateur (et mettre à jour les droits) :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>.config<span style="color: #000000; font-weight: bold;">/</span>transmission-daemon
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>transmission-daemon<span style="color: #000000; font-weight: bold;">/</span>settings.json <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>.config<span style="color: #000000; font-weight: bold;">/</span>transmission-daemon<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> mon_utilisateur:mon_utilisateur <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>.config<span style="color: #000000; font-weight: bold;">/</span>transmission-daemon<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-R</span></pre></div></div>

<p>&nbsp;</p>
<h3>Configuration de Transmission</h3>
<p>La configuration de Transmission doit se faire lorsque ce dernier ne fonctionne pas, il faut donc arrêter le démon si cela n&#8217;est pas déjà fait :</p>

<div class="wp_syntax"><div class="code"><pre class="avisynth" style="font-family:monospace;">sudo <span style="color:#006600; font-weight:bold;">/</span>etc<span style="color:#006600; font-weight:bold;">/</span>init<span style="color:#006600; font-weight:bold;">.</span><span style="color:#9900CC;">d</span><span style="color:#006600; font-weight:bold;">/</span>transmission<span style="color:#006600; font-weight:bold;">-</span>daemon stop</pre></div></div>

<p>On édite ensuite le fichier settings.json qui contient tous les paramètres de Transmission, selon si vous avez réalisé la configuration du paragraphe ci-dessus ce fichier se situe dans votre $HOME dans .config/transmission-deamon sinon il est dans /etc/transmission-deamon</p>
<p>Je ne reprendrais pas ici l&#8217;explication des différents paramètres voir pour cela mon article <a title="Lien permanent vers Installer et configurer Transmission en tant que démon" rel="bookmark" href="https://wakala.davidy.fr/ph/index.php?q=406a0f0004b616c61154637a12e91a0a1eb4d83aCkJHEwlOTkAJUVYDDFdTDUwYXhcHUxdfFxkIXgEBSR9IDBUdXlYSFgNaXwZBTARCS1tdDARaVRZHU0pIFkRYVxZbCEMWDV5fFQELH0NZDxZPR0YGHgUEWwlWHQ%3D%3D">Installer et configurer Transmission en tant que démon</a></p>
<p>&nbsp;</p>
<h3>Paramétrage d&#8217;une Blocklist personnalisée</h3>
<p>Une blocklist est une liste d&#8217;adresse IP avec qui on ne souhaite pas partager les fichiers en cours de téléchargement. Pour mettre à jour cette liste ou en utiliser une personnalisée se référer à mon article <a title="Lien permanent vers Utiliser des listes de blocage personnalisées (blocklist) avec le démon Transmission" rel="bookmark" href="../index.php/utiliser-des-listes-de-blocage-personnalisees-blocklist-avec-le-demon-transmission/">utiliser des listes de blocage personnalisées (blocklist) avec le démon Transmission</a></p>
<h3>Déplacement des téléchargements terminés</h3>
<p>Par défaut une fois les téléchargements terminés Transmission partage indéfiniment le fichier, ce comportement peut être modifié par script voir mon article <a title="Lien permanent vers Déplacer/enlever les téléchargements terminés de Transmission (démon)" rel="bookmark" href="../index.php/deplacerenlever-les-telechargements-termines-de-transmission-demon/">Déplacer/enlever les téléchargements terminés de Transmission (démon)</a></p>
<h3>Limitation automatique de la bande passante</h3>
<p>Lorsque Transmission télécharge il prendra par défaut toute la bande passante, pénalisant les autres usage d&#8217;Internet sur le réseau.</p>
<p>Il est possible de définir des vitesses maximales de téléchargement afin de limiter ce comportement, voir il est possible de définir 2 vitesses maximales et de les planifier en fonction des jours / heures.</p>
<p>Mais encore mieux grâce a un petit script qui s’exécute à intervalle régulier le basculement de la vitesse maximal à la vitesse modéré se fait automatiquement dès lors qu&#8217;un PC du réseau est allumé, pour en savoir plus voir mon article <a title="Lien permanent vers Limiter l’usage de la bande passante par Transmission automatiquement" rel="bookmark" href="../index.php/limiter-lusage-de-la-bande-passante-par-transmission-automatiquement/">Limiter l’usage de la bande passante par Transmission automatiquement</a></p>
<p>&nbsp;</p>
<h2>Periscope : recherche des sous-titres</h2>
<p>Périscope permet de télécharger les sous-titres associés à un fichier vidéo. Il se base sur divers sites fournissant des sous titres (dont <a rel="nofollow" href="http://www.opensubtitles.org/en">OpenSubtitles.org</a>)</p>
<p>Personnellement je l&#8217;installe depuis les sources ainsi :</p>
<p>Installation de subversion pour récupérer le dernier code source et des dépendances de Périscope :</p>
<pre>sudo aptitude install subversion python-setuptools python-beautifulsoup python-xdg</pre>
<p>Téléchargement du code source :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> checkout http:<span style="color: #000000; font-weight: bold;">//</span>periscope.googlecode.com<span style="color: #000000; font-weight: bold;">/</span>svn<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span> periscope-svn</pre></div></div>

<p>Installation :</p>
<div>
<div>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> periscope-svn
<span style="color: #c20cb9; font-weight: bold;">sudo</span> python setup.py <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

</div>
</div>
<p>Bonus : <a href="http://voidandany.free.fr/wp-content/uploads/SousTitresEu.py">mon plugin sous-titres.eu</a> (pour l&#8217;installer copier le fichier dans le répertoire plugins des     sources et ajouter la ligne &laquo;&nbsp;from SousTitresEu import SousTitresEu&nbsp;&raquo;     dans le fichier __init__.py du répertoire plugins puis compiler)</p>
<p>&nbsp;</p>
<p>Configuration de la langue via le fichier ~/.config/periscope</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[DEFAULT]
 lang = fr
 plugins =</pre></div></div>

<p>Plus de détails :<a title="Lien permanent vers Téléchargement automatique des sous-titres de série avec Periscope" rel="bookmark" href="../index.php/telechargement-automatique-des-sous-titres-de-serie-avec-periscope/">Téléchargement automatique des sous-titres de série avec Periscope</a> et<a title="Lien permanent vers Installer Periscope depuis les sources + activation / désactivation des plugins" rel="bookmark" href="../index.php/installer-periscope-depuis-les-sources-activation-desactivation-des-plugins/"> Installer Periscope depuis les sources + activation / désactivation des plugins</a></p>
<p>&nbsp;</p>
<h2>Script de déplacement des fichiers</h2>
<p>Dernière étape, on a le fichier vidéo (téléchargé via Flexget et Transmission) et le fichier de sous-titre (téléchargé par Periscope), tous deux portent le même nom (merci Periscope) maitenant on veut pouvoir les ranger, c&#8217;est à dire les déplacer vers un autre espace disque où ils pourront être visionnées.</p>
<p>Ce répertoire est très spécifique à l&#8217;installation de chacun je vais ici décrire la mienne, à vous de l’adapter à votre architecture.</p>
<p>&nbsp;</p>
<p>Donc dans mon cas c&#8217;est mon <a title="7 sujets" href="../index.php/tag/dockstar/">dockstar</a> qui réalise toutes les opération de téléchargement, les séries sont ensuite déplacé vers le Freebox Server pour celle en HD et vers mon <a title="12 sujets" href="../index.php/tag/mediacenter/">mediacenter</a> pour les séries SD.</p>
<p>&nbsp;</p>
<p>Mon mediacenter est une machine Linux le plus simple est donc de monter le répertoire de destination via sshfs.</p>
<h3>Préparation déplacement de fichier via sshfs</h3>
<p>Sur la machine cible le client openssh (paquet openssh-client) devra être installé.</p>
<p>Sur la machine source (Dockstar) ayant réalisée les téléchargements et sur laquelle le script va tourner on crée ce qu&#8217;il faut pour établir une connexion SSH sans mot de passe (donc scriptable)</p>
<p>Création des clés :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-t</span> rsa <span style="color: #660033;">-b</span> <span style="color: #000000;">2048</span></pre></div></div>

<p>Ce qui donne :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Generating public/private rsa key pair.
 Enter file in which to save the key (/home/mon_user/.ssh/id_rsa):
 Enter passphrase (empty for no passphrase):
 Enter same passphrase again:
 Your identification has been saved in /home/mon_user/.ssh/id_rsa.
 Your public key has been saved in /home/mon_user/.ssh/id_rsa.pub.
 The key fingerprint is:
 bb:3c:91:f4:6f:cb:da:b1:32:7b:08:f8:4b:33:35:44 mon_user@mon_dockstar
 The key's randomart image is:
 +--[ RSA 2048]----+
 |          E      |
 |         .       |
 |          .      |
 |        ..       |
 |       oSoo      |
 |      . +o..     |
 |       .=o o.    |
 |       oo++o+o   |
 |        +ooB=.   |
 +-----------------+</pre></div></div>

<p>Copie de la clé  publique sur la mahcine cible (le mediacenter) :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ssh-copy-id <span style="color: #660033;">-i</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>mon_user<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub mon_user_distant<span style="color: #000000; font-weight: bold;">@</span>IP_machine_distante</pre></div></div>

<p>Ce qui donne :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Now try logging into the machine, with &quot;ssh 'mon_user_distant@IP_machine_distante'&quot;, and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.</pre></div></div>

<p>On obéit au recommandation ci-dessus et on se connecte en SSH sur la machine cible (mediacenter) et on ajoute l’ordinateur distant à liste des known_host, puis on se déconnecte.</p>
<p>On installe ensuite le paquet sshfs (2 879 ko sur mon Dockstar)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> sshfs</pre></div></div>

<p>Préparation du répertoire devant accueillir le montage via sshfs et gestion des droits utilisateur :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sweetbox
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> mon_user:mon_user <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sweetbox
<span style="color: #c20cb9; font-weight: bold;">sudo</span> adduser mon_user fuse
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> root:fuse <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>fuse</pre></div></div>

<p>Et on reboot, on peut ensuite (toujours du Dockstar) tester le montage sshfs :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">sshfs mon_user_distant<span style="color: #000000; font-weight: bold;">@</span>IP_mediacenter:<span style="color: #000000; font-weight: bold;">/</span>chemin<span style="color: #000000; font-weight: bold;">/</span>cible<span style="color: #000000; font-weight: bold;">/</span>vers<span style="color: #000000; font-weight: bold;">/</span>les<span style="color: #000000; font-weight: bold;">/</span>series <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sweetbox<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>Pour démonter :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">fusermount <span style="color: #660033;">-u</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sweetbox</pre></div></div>

<h3>Script de déplacement des fichiers</h3>
<p>Voici le script de déplacement des fichier de série proprement dit (voir les explication après le script) :</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
64
65
66
67
68
69
70
71
72
73
74
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #007800;">SERIESNONTRIE</span>=<span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>downloads<span style="color: #000000; font-weight: bold;">/</span>torrents<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">complete</span>
<span style="color: #007800;">SERIES_SD_PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sweetbox
<span style="color: #007800;">SERIES_HD_PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>freebox
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${0}</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #007800;">FREEBOX_MOUNTED</span>=<span style="color: #c20cb9; font-weight: bold;">false</span>
<span style="color: #000000; font-weight: bold;">function</span> chechAndMountFreebox <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$FREEBOX_MOUNTED</span> == <span style="color: #c20cb9; font-weight: bold;">false</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;Montage du répertoire contenant les séries de la Freebox&quot;</span>
    curlftpfs <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>192.168.1.254<span style="color: #000000; font-weight: bold;">/</span>Disque<span style="color: #000000; font-weight: bold;">%</span>20dur<span style="color: #000000; font-weight: bold;">/</span>Vidéos<span style="color: #000000; font-weight: bold;">/</span>Séries <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>freebox<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-o</span> <span style="color: #007800;">user</span>=freebox:password,<span style="color: #007800;">uid</span>=<span style="color: #000000;">1000</span>,<span style="color: #007800;">gid</span>=<span style="color: #000000;">1000</span>,<span style="color: #007800;">umask</span>=003
    <span style="color: #007800;">FREEBOX_MOUNTED</span>=<span style="color: #c20cb9; font-weight: bold;">true</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #007800;">SWEETBOX_MOUNTED</span>=<span style="color: #c20cb9; font-weight: bold;">false</span>
<span style="color: #000000; font-weight: bold;">function</span> chechAndMountSweetbox <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$SWEETBOX_MOUNTED</span> == <span style="color: #c20cb9; font-weight: bold;">false</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;Montage du répertoire contenant les séries de Sweetbox&quot;</span>
    .<span style="color: #000000; font-weight: bold;">/</span>wakeonlan.sh <span style="color: #ff0000;">&quot;adresse MAC&quot;</span> <span style="color: #ff0000;">&quot;Adresse IP&quot;</span>
    sshfs user_distant<span style="color: #000000; font-weight: bold;">@</span>adresse_ip:<span style="color: #000000; font-weight: bold;">/</span>chemin<span style="color: #000000; font-weight: bold;">/</span>cible<span style="color: #000000; font-weight: bold;">/</span>vers<span style="color: #000000; font-weight: bold;">/</span>les<span style="color: #000000; font-weight: bold;">/</span>series <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sweetbox<span style="color: #000000; font-weight: bold;">/</span>
    <span style="color: #007800;">SWEETBOX_MOUNTED</span>=<span style="color: #c20cb9; font-weight: bold;">true</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#pour tous les éléments présents dans le repertoire à trier </span>
<span style="color: #000000; font-weight: bold;">for</span> F <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$SERIESNONTRIE</span><span style="color: #000000; font-weight: bold;">/*</span>
<span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #666666; font-style: italic;"># si c'est un fichier</span>
  <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: #ff0000;">&quot;<span style="color: #007800;">$F</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
    <span style="color: #007800;">extension</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #800000;">${F##*.}</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #ff0000;">&quot;[:upper:]&quot;</span> <span style="color: #ff0000;">&quot;[:lower:]&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
    <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$extension</span> == <span style="color: #ff0000;">&quot;avi&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #007800;">SERIES_PATH</span>=<span style="color: #007800;">$SERIES_SD_PATH</span>
      chechAndMountSweetbox
    <span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$extension</span> == <span style="color: #ff0000;">&quot;mkv&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
      <span style="color: #007800;">SERIES_PATH</span>=<span style="color: #007800;">$SERIES_HD_PATH</span>
      chechAndMountFreebox
    <span style="color: #000000; font-weight: bold;">else</span>
      <span style="color: #7a0874; font-weight: bold;">continue</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># on deduit le nom de la serie à partir du nom du fichier</span>
    <span style="color: #007800;">serie</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">basename</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$F</span>&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/\([a-zA-Z.]*\.S[0-9]\{2\}\)E[0-9]\{2\}.*/\1/'</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># si il existe un fichier srt portant le meme nom dans le meme repertoire</span>
    <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: #ff0000;">&quot;<span style="color: #007800;">${F%.*}</span>.srt&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
&nbsp;
      <span style="color: #666666; font-style: italic;"># on deplace les 2 fichiers dans un repertoire portant le nom de la serie et de la saison</span>
      <span style="color: #7a0874; font-weight: bold;">echo</span> Deplacement de <span style="color: #ff0000;">&quot;<span style="color: #007800;">${F%.*}</span>.*&quot;</span> dans <span style="color: #007800;">$SERIES_PATH</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$serie</span>
&nbsp;
      <span style="color: #666666; font-style: italic;"># si le repertoire destination n'existe pas</span>
      <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #000000; font-weight: bold;">!</span> <span style="color: #660033;">-d</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$SERIES_PATH</span>/<span style="color: #007800;">$serie</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #666666; font-style: italic;"># on le crée</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> Creation <span style="color: #c20cb9; font-weight: bold;">du</span> repertoire <span style="color: #007800;">$SERIES_PATH</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$serie</span>
        <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$SERIES_PATH</span>/<span style="color: #007800;">$serie</span>/Vus&quot;</span>
      <span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
      <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #800000;">${F%.*}</span>.srt <span style="color: #007800;">$SERIES_PATH</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$serie</span>
      <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #800000;">${F%.*}</span>.<span style="color: #007800;">$extension</span> <span style="color: #007800;">$SERIES_PATH</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$serie</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
  <span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$FREEBOX_MOUNTED</span> == <span style="color: #c20cb9; font-weight: bold;">true</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;Démontage du répertoire contenant les séries de la Freebox&quot;</span>
  <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">umount</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>freebox<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$SWEETBOX_MOUNTED</span> == <span style="color: #c20cb9; font-weight: bold;">true</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;Démontage du répertoire contenant les séries de Sweetbox&quot;</span>
  fusermount <span style="color: #660033;">-u</span> <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>sweetbox
  .<span style="color: #000000; font-weight: bold;">/</span>shutdown.sh <span style="color: #ff0000;">&quot;mon_user_distant&quot;</span> <span style="color: #ff0000;">&quot;IP distante&quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></td></tr></table></div>

<p>&nbsp;</p>
<p>Le principe de ce script est le suivant, on parcours tous les  fichiers présents dans le répertoire où sont stocké les téléchargements  terminés (download/torrents/complete/)  (ligne 29)</p>
<p>Ligne 37 : Si le fichier à l&#8217;extension .mkv c&#8217;est une série en HD on va donc potentiellement le déplacer vers la Freebox.</p>
<p>On verifie donc que le disque dur de la Freebox est bien monté (via un booléen) sinon on le fait (voir mon article <a title="Lien permanent vers Monter le disque dur du Freebox Server (v6) en ligne de commande" rel="bookmark" href="../index.php/monter-le-disque-dur-du-freebox-server-v6-en-ligne-de-commande/">Monter le disque dur du Freebox Server (v6) en ligne de commande</a>) (ligne 39 et fonction en ligne 9-16)</p>
<p>Ligne 34 : Si  le fichier à l&#8217;extension .avi c&#8217;est une série en SD on va donc  potentiellement le déplacer vers le mediacenter (sweetbox) via sshfs.</p>
<p>Je  fais alors appel à mon script de démarrage via WakeOnLan qui démarre la  machine dont on passe l&#8217;adresse IP et MAC en paramètre si elle ne l&#8217;est  pas déjà, sinon on flag le fait que le mediacenter était déjà allumé  pour ne pas l&#8217;éteindre à la fin (voir <a title="Lien permanent vers Allumer / éteindre un PC sous Linux à distance (scripts)" rel="bookmark" href="../index.php/allumer-eteindre-un-pc-sous-linux-a-distance-scripts/">Allumer / éteindre un PC sous Linux à distance (scripts)</a>). Puis on monte le répertoire de destination. (ligne 36 et fonction en ligne 18-27)</p>
<p>Ligne 48 : on vérifie si on a un fichier de sous-titre, si oui on est OK pour déplacer les 2 fichiers (lignes 60-61) vers le chemin cible déterminé en fonction du type du fichier vidéo en cours de traitement (lignes 35 et 38)</p>
<p>Les séries sont rangé dans le répertoire cible dans un sous répertoire du nom de la série (ligne 45) que l&#8217;on crée le cas échéant (lignes 54-58)</p>
<p>Lignes 66-74 : Puis on range comme c&#8217;était avant notre arrivé, on démonte les point de montage et on n’éteint le mediacenter si ce dernier n&#8217;était pas allumé avant le script (voir <a title="Lien permanent vers Allumer / éteindre un PC sous Linux à distance (scripts)" rel="bookmark" href="../index.php/allumer-eteindre-un-pc-sous-linux-a-distance-scripts/">Allumer / éteindre un PC sous Linux à distance (scripts)</a>)</p>
<p>&nbsp;</p>
<h2>Planification</h2>
<p>Dans cette article de nombreux scripts ont été mis en œuvre il faut les planifier via CRON, en voici un exemple :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">MAILTO</span>=<span style="color: #ff0000;">&quot;&quot;</span>
 <span style="color: #007800;">LANG</span>=fr_FR.UTF-<span style="color: #000000;">8</span>
 <span style="color: #007800;">PATH</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>bin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>sbin:<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin:<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>sbin
 <span style="color: #666666; font-style: italic;">##########################################################</span>
 <span style="color: #666666; font-style: italic;">#minute (0-59),                                          #</span>
 <span style="color: #666666; font-style: italic;">#|  hour (0-23),                                         #</span>
 <span style="color: #666666; font-style: italic;">#|  |  day of the month (1-31),                          #</span>
 <span style="color: #666666; font-style: italic;">#|  |  |  month of the year (1-12),                      #</span>
 <span style="color: #666666; font-style: italic;">#|  |  |  |  day of the week (0-6 with 0=Sunday)         #</span>
 <span style="color: #666666; font-style: italic;">#|  |  |  |  |       commands                            #</span>
 <span style="color: #666666; font-style: italic;">##########################################################</span>
&nbsp;
<span style="color: #666666; font-style: italic;">##### Opérations pour Transmission</span>
<span style="color: #666666; font-style: italic;"># téléchargement d'une blocklist personnalisé une fois par semaine</span>
<span style="color: #000000;">0</span> <span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">0</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>blocklist_transmission.sh <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>maintenance<span style="color: #000000; font-weight: bold;">/</span>blocklist.log
<span style="color: #666666; font-style: italic;"># Toutes les 3h on vérifie s'il n'y a pas une téléchargement terminé à déplacer</span>
<span style="color: #000000;">30</span> <span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">3</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: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>remove_completed_torrents.sh
<span style="color: #666666; font-style: italic;"># Toutes les minutes on vérifie s'il n'y a pas un PC qui s'allume sur le réseau pour basculer en vitesse lente</span>
<span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">1</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: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>alt_speed_transmission.sh
&nbsp;
<span style="color: #666666; font-style: italic;">##### Téléchargement des séries, on enchaine flexget, periscope et le déplacement des fichier toutes les 3h (les 3 scripts étant espacé de 20 minutes)</span>
<span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">3</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> flexget <span style="color: #660033;">-v</span> <span style="color: #660033;">--cron</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>flexget.log
<span style="color: #000000;">20</span> <span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">3</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> periscope <span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>downloads<span style="color: #000000; font-weight: bold;">/</span>torrents<span style="color: #000000; font-weight: bold;">/</span>complete<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #000000;">40</span> <span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">3</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: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>move_tv_show.sh</pre></div></div>

<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><em><strong>Sources: </strong></em></span></p>
<p><em>Flexget : </em></p>
<ul>
<li><a href="http://flexget.com/wiki/Plugins/transmission">Plugins/transmission – FlexGet</a> : Plugin pour Transmission (pas utilisé)</li>
</ul>
<p><em>Transmission : </em></p>
<ul>
<li><a href="http://www.transmissionbt.com/">Transmission</a> : Site officiel </li>
<li><a href="http://www.transmissionbt.com/resources/">Transmission</a> : Liste de plugins sur le site officiel</li>
<li><a href="https://trac.transmissionbt.com/wiki/EditConfigFiles">EditConfigFiles – Transmission</a> : Description des option du fichier settings.json sur le site officiel</li>
<li><a href="http://papillon-butineur.blogspot.com/2010/08/blocklists-avec-transmissionrecopie.html">Papillon-butineur: Blocklists avec Transmission</a> : script de téléchargement des blocklists</li>
<li><a href="http://1000umbrellas.com/2010/10/04/updated-transmission-installationconfiguration-on-ubuntu-server">Updated: Transmission Installation/Configuration on Ubuntu Server &#8211; 1000umbrellas.com</a> : Exemple de configuration et manipulations à effectuer sur les répertoires accueillant les torrents si vous laissez Transmission tourner avec l&#8217;utilisateur debian-transmission</li>
<li><a href="http://www.d3vinside.fr/blog/installer-et-configurer-le-package-transmission-daemon-sous-debian-11">devINSIDE :: Blog :: Installer et configurer le package transmission-daemon sous debian</a> : configuration de base + interaction avec un Vhost apache (intérêt ?)</li>
<li><a href="http://www.realpeace.fr/blog/2010/07/09/installation-transmission-remote-sur-ubuntu-server/">Installation Transmission daemon sur Ubuntu Server « Realpeace&#8217;s Blog</a> : installation et configuration + quelques clients Transmission</li>
<li><a href="http://www.hahadopi.eu/tuto/transmission-daemon-sur-sa-seedbox/">HaHadopi » Transmission-daemon sur sa seedbox</a> : installation et configuration</li>
<li><a href="http://blog.shk-desktop.com/1002-configurer-transmission-pour-laccess-distance-cli">Configurer Transmission pour l’access a distance (CLI) | Shtark.fr</a> : installation et configuration</li>
<li><a href="http://flexget.com/wiki/Plugins/transmission">Plugins/transmission – FlexGet</a> : Plugin Flexget</li>
<li><a href="http://1000umbrellas.com/2010/10/05/updated-how-to-automatically-move-and-remove-transmission-daemon-downloads">Updated: How to Automatically Move and Remove Transmission-Daemon Downloads &#8211; 1000umbrellas.com</a>: Source du script de suppression des torrent terminés</li>
</ul>
<p><em>TVNamer (pas utilisé encore) : </em></p>
<ul>
<li><a href="http://hellnino.homelinux.com/blog/?p=169">HowTo : Renommer un épisode de série automatiquement avec TVNamer | Hellnino&#8217;s Blog</a></li>
<li><a href="http://1000umbrellas.com/2010/04/27/tvnamer-installationconfiguration">TVNamer Installation/Configuration &#8211; 1000umbrellas.com</a></li>
<li><a href="http://1000umbrellas.com/2010/10/10/using-tvnamer-to-move-completed-tv-torrent-downloads">Using TVNamer to Move Completed TV Torrent Downloads &#8211; 1000umbrellas.com</a></li>
<li><a href="https://github.com/dbr/tvnamer/">dbr/tvnamer &#8211; GitHub</a></li>
</ul>
<p><em>SSHFS : </em></p>
<ul>
<li><a href="http://doc.ubuntu-fr.org/sshfs">sshfs &#8211; Documentation Ubuntu Francophone</a></li>
<li><a href="http://www.howtogeek.com/howto/ubuntu/how-to-mount-a-remote-folder-using-ssh-on-ubuntu/">How to Mount a Remote Folder using SSH on Ubuntu &#8211; How-To Geek</a> : indique l&#8217;astuce pour monter un système de fichier distant sans le sudo</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/telechargement-automatique-de-series-avec-le-dockstar/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Monter le disque dur du Freebox Server (v6) en ligne de commande</title>
		<link>http://voidandany.free.fr/index.php/monter-le-disque-dur-du-freebox-server-v6-en-ligne-de-commande/</link>
		<comments>http://voidandany.free.fr/index.php/monter-le-disque-dur-du-freebox-server-v6-en-ligne-de-commande/#comments</comments>
		<pubDate>Thu, 21 Jul 2011 20:12:57 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[freebox]]></category>
		<category><![CDATA[mount]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4221</guid>
		<description><![CDATA[La nouvelle (enfin plus tant que ça) Freebox v6 possède un boîtier serveur (comme la v5), ce dernier est équipé d&#8217;un disque dur de 250 Go. Voici les différentes techniques que j&#8217;ai testé pour monter ce disque dur sous Linux &#8230; <a href="http://voidandany.free.fr/index.php/monter-le-disque-dur-du-freebox-server-v6-en-ligne-de-commande/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>La nouvelle (enfin plus tant que ça) Freebox v6 possède un boîtier serveur (comme la v5), ce dernier est équipé d&#8217;un disque dur de 250 Go.</p>
<p>Voici les différentes techniques que j&#8217;ai testé pour monter ce disque dur sous Linux (Debian/Ubuntu)</p>
<h2>Montage via Samba :</h2>
<p>Si vous ne l&#8217;avez pas déjà, installer le paquet cifs-utils (lors de l&#8217;installation une question relative au workgroup de travail est posé, ne pas s&#8217;en occuper)</p>
<p>La montage se fait ensuite via la commande mount :</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #660033;">-t</span> cifs <span style="color: #000000; font-weight: bold;">//</span>mafreebox.freebox.fr<span style="color: #000000; font-weight: bold;">/</span>Disque\ dur<span style="color: #000000; font-weight: bold;">/</span>Vidéos  <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>freebox<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-o</span> <span style="color: #007800;">user</span>=freebox,<span style="color: #007800;">password</span>=password,<span style="color: #007800;">uid</span>=<span style="color: #000000;">1000</span>,<span style="color: #007800;">gid</span>=<span style="color: #000000;">1000</span>,rw</pre></div></div>

</p>
<p>L&#8217;utilisateur et le mot de passe sont configurables via la console locale de la freebox (http://mafreebox.freebox.fr) :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_025.resized.png"><img class="aligncenter size-full wp-image-4223" title="Sélection_025.resized" src="http://voidandany.free.fr/wp-content/uploads/Sélection_025.resized.png" alt="" width="640" height="459" /></a>L&#8217;accès est anonyme par défaut (pas de login / mot de passe) mais si vous utilisez cette commande dans un script il faut mettre un login / mot de passe sinon la commande mount demande un mot de passe (pour lequel vous pouvez sisir n&#8217;importe quoi)</p>
<h2></h2>
<h2>Montage via FTP</h2>
<p>Installer le paquet curlftpfs, puis le montage se fait avec la commande du même nom :</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">curlftpfs <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>192.168.1.254<span style="color: #000000; font-weight: bold;">/</span>Disque<span style="color: #000000; font-weight: bold;">%</span>20dur<span style="color: #000000; font-weight: bold;">/</span>Vidéos <span style="color: #000000; font-weight: bold;">/</span>mnt<span style="color: #000000; font-weight: bold;">/</span>freebox<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-o</span> <span style="color: #007800;">user</span>=freebox:password,<span style="color: #007800;">uid</span>=<span style="color: #000000;">1000</span>,<span style="color: #007800;">gid</span>=<span style="color: #000000;">1000</span>,<span style="color: #007800;">umask</span>=003</pre></div></div>

</p>
<p>(pas besoin de sudo ici)</p>
<p>Le login, mot de passe est aussi défini dans la console locale de la freebox mais dans al zone FTP :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_026.resized.png"><img class="aligncenter size-full wp-image-4224" title="Sélection_026.resized" src="http://voidandany.free.fr/wp-content/uploads/Sélection_026.resized.png" alt="" width="640" height="430" /></a></p>
<p>Contrairement à l&#8217;accès Samba, l&#8217;accès au FTP n&#8217;autorise pas par défaut l’accès anonyme, mais vous pouvez le forcer.</p>
<p><a href="http://forum.ubuntu-fr.org/viewtopic.php?id=438943"><br />
</a></p>
<p><span style="text-decoration: underline;"><em><strong>Source : </strong></em></span></p>
<p><a href="http://forum.ubuntu-fr.org/viewtopic.php?id=438943">[resolu] Monter le HDD NAS d&#8217;une FreeBox V6 &#8216;revolution&#8217; ? &#8211; Forum Ubuntu-fr.org</a> : presque tout y est, sauf 2-3 réglage concernant les droits (uid / gid)</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/monter-le-disque-dur-du-freebox-server-v6-en-ligne-de-commande/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mon Dockstar ne boot plus sous Debian</title>
		<link>http://voidandany.free.fr/index.php/mon-dockstar-ne-boot-plus-sous-debian/</link>
		<comments>http://voidandany.free.fr/index.php/mon-dockstar-ne-boot-plus-sous-debian/#comments</comments>
		<pubDate>Thu, 23 Jun 2011 08:34:12 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[plug computer]]></category>
		<category><![CDATA[dockstar]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4176</guid>
		<description><![CDATA[Hier je bidouillais sur mon Dockstar et un programme que je testais s&#8217;est montré trop gourmand en ressource puis à crashé, mon système ne répondais plus du tout. Impatient j&#8217;ai rebooté électriquement mon Dockstar, erreur fatale, impossible après cela de &#8230; <a href="http://voidandany.free.fr/index.php/mon-dockstar-ne-boot-plus-sous-debian/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hier je bidouillais sur mon <a title="Marques-pages : Un mini serveur le Seagate Dockstar" href="http://voidandany.free.fr/index.php/marques-pages-un-mini-serveur-le-seagate-dockstar/">Dockstar </a>et un programme que je testais s&#8217;est montré trop gourmand en ressource puis à crashé, mon système ne répondais plus du tout. Impatient j&#8217;ai rebooté électriquement mon Dockstar, erreur fatale, impossible après cela de me connecter en SSH sur <a title="Installer Debian sur le Seagate Dockstar" href="http://voidandany.free.fr/index.php/installer-debian-sur-le-seagate-dockstar/">Debian</a>.</p>
<p>Voici les symptômes au début du boot le système est pingable, la lumière du Dockstar clignote en vert, puis le système ne répond plus au ping et la lumière s’éteint&#8230;.</p>
<p>Voici les étapes suivi pour ramener le Dockstar à la vie.</p>
<h2>Booter sous pogoplug</h2>
<p>Tout d’abord je me suis assuré que le problème venait de Debian et pas du Dockstar lui-même, pour cela il suffit de débrancher tous les périphériques USB et de rebooter, au bout d&#8217;un certain temps le système devrait être accessible en SSH avec l&#8217;utilisateur root (comme lors de la <a title="Marques-pages : Un mini serveur le Seagate Dockstar" href="http://voidandany.free.fr/index.php/marques-pages-un-mini-serveur-le-seagate-dockstar/">toute première connexion au Dockstar sous Pogoplug</a>) :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ssh</span> root<span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>Ip <span style="color: #c20cb9; font-weight: bold;">du</span> Dockstar<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>Avec le mot de passe stxadmin</p>
<p>Si ce n&#8217;est pas le cas il va vous falloir vous fabriquer un connecteur JTAG, heureusement pour moi je n&#8217;en ai pas eu besoin</p>
<h2>Installer le uBoot modifié</h2>
<p>Jeff Doozan (encore lui) à créé une version modifié du uBoot (Universal Bootloader) permettant d&#8217;interagir avec le dockstar lors du boot, nous allons l&#8217;installer (peut n&#8217;est ce pas nécessaire, je n&#8217;ai pas vérifié mais il semblerait que le uBoot modifié soit déjà installé dès lors que l&#8217;on à installé Debian avec le script de Jeff Doozan)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>tmp
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>jeff.doozan.com<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span>uboot<span style="color: #000000; font-weight: bold;">/</span>install_uboot_mtd0.sh
<span style="color: #c20cb9; font-weight: bold;">chmod</span> +x install_uboot_mtd0.sh
.<span style="color: #000000; font-weight: bold;">/</span>install_uboot_mtd0.sh</pre></div></div>

<h2>Configurer netconsole<a href="http://linuxfr.org/news/netconsole-log-de-messages-noyaux-via-udp"></a></h2>
<p><a href="http://linuxfr.org/news/netconsole-log-de-messages-noyaux-via-udp">Netconsole permet de transmettre les messages du noyaux via UDP (réseau)</a>, il faut configurer netconsole (inclus dans le noyau 2.6 de Linux) pour qu&#8217;il emette les message de boot vers un autre PC via le réseau.</p>
<p>On réalise cette configuration avec l&#8217;utilitaire fw_setenv installé par le uBoot de Jeff Dozan, dans mon cas cet utilitaire est présent dans /usr/sbin qui n&#8217;est pas dans mon path d&#8217;où le chemin complet à chaque fois :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><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>fw_setenv serverip <span style="color: #7a0874; font-weight: bold;">&#91;</span>adresse IP PC<span style="color: #7a0874; font-weight: bold;">&#93;</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>fw_setenv ipaddr <span style="color: #7a0874; font-weight: bold;">&#91;</span>adresse IP Dockstar<span style="color: #7a0874; font-weight: bold;">&#93;</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>fw_setenv if_netconsole <span style="color: #ff0000;">'ping $serverip'</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>fw_setenv start_netconsole <span style="color: #ff0000;">'setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;'</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>fw_setenv preboot <span style="color: #ff0000;">'run if_netconsole start_netconsole'</span></pre></div></div>

<h2>Diagnostiquer le boot du Dockstar</h2>
<p>Sur le PC qui recevra les messages netconsole lancer la commande :</p>
<p>nc -lu 6666</p>
<p>Pour Ubuntu (11.04) sur Debian il semblerait que ce soit nc -l -u -p 6666 ce qui m&#8217;a valu un peu de recherche&#8230;</p>
<p>Rebooter le Dockstar (shutdown -r now sur la console en SSH que vous devez avoir sous la main pour avoir fait les manip ci-dessus) et miracle sur votre autre console (celle avec le nc) les messages de boot s&#8217;affichent :</p>
<h3>Messages de boot sous pogoplug :</h3>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">U-Boot 2010.09 (Oct 23 2010 - 11:49:22)
 Marvell-Dockstar/Pogoplug by Jeff Doozan
 Hit any key to stop autoboot:  0
 (Re)start USB...
 USB:   Register 10011 NbrPorts 1
 USB EHCI 1.00
 scanning bus for devices... 2 USB Device(s) found
 scanning bus for storage devices... 0 Storage Device(s) found
 ** Block device usb 0 not supported
&nbsp;
** Invalid boot device **
 Creating 1 MTD partitions on &quot;nand0&quot;:
 0x000002500000-0x000010000000 : &quot;mtd=3&quot;
 UBI: attaching mtd1 to ubi0
 UBI: physical eraseblock size:   131072 bytes (128 KiB)
 UBI: logical eraseblock size:    129024 bytes
 UBI: smallest flash I/O unit:    2048
 UBI: sub-page size:              512
 UBI: VID header offset:          512 (aligned 512)
 UBI: data offset:                2048
 UBI: attached mtd1 to ubi0
 UBI: MTD device name:            &quot;mtd=3&quot;
 UBI: MTD device size:            219 MiB
 UBI: number of good PEBs:        1751
 UBI: number of bad PEBs:         1
 UBI: max. allowed volumes:       128
 UBI: wear-leveling threshold:    4096
 UBI: number of internal volumes: 1
 UBI: number of user volumes:     0
 UBI: available PEBs:             1730
 UBI: total number of reserved PEBs: 21
 UBI: number of PEBs reserved for bad PEB handling: 17
 UBI: max/mean erase counter: 1/1
 UBIFS error (pid 0): ubifs_get_sb: cannot open &quot;ubi:rootfs&quot;, error -19
 Error reading superblock on volume 'ubi:rootfs'!
 ** Block device usb 0 not supported
 ** Block device usb 1 not supported
 ** Block device usb 2 not supported
 ** Block device usb 3 not supported
 ** Block device usb 0 not supported
 ** Block device usb 0 not supported
 Wrong Image Format for bootm command
 ERROR: can't get kernel image!
 stopping USB..
 ### JFFS2 loading 'uboot-original-mtd0.kwb' to 0x800000
 Scanning JFFS2 FS: ........ done.
 ### JFFS2 load complete: 524288 bytes loaded to 0x800000
 ## Starting application at 0x00800200 ...</pre></div></div>

<p>J&#8217;ai ensuite rebranche ma clé USB qui contient mon système Debian et le disque dur qui contient divers point de montage et rebooté une autre fois le Dockstar</p>
<p>&nbsp;</p>
<h3>Messages de boot sous Debian :</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">U-Boot <span style="color: #000000;">2010.09</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>Oct <span style="color: #000000;">23</span> <span style="color: #000000;">2010</span> - <span style="color: #000000;">11</span>:<span style="color: #000000;">49</span>:<span style="color: #000000;">22</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
 Marvell-Dockstar<span style="color: #000000; font-weight: bold;">/</span>Pogoplug by Jeff Doozan
 Hit any key to stop autoboot:  <span style="color: #000000;">0</span>
 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Re<span style="color: #7a0874; font-weight: bold;">&#41;</span>start USB...
 USB:   Register <span style="color: #000000;">10011</span> NbrPorts <span style="color: #000000;">1</span>
 USB EHCI <span style="color: #000000;">1.00</span>
 scanning bus <span style="color: #000000; font-weight: bold;">for</span> devices... <span style="color: #000000;">4</span> USB Device<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span> found
 scanning bus <span style="color: #000000; font-weight: bold;">for</span> storage devices... <span style="color: #000000;">2</span> Storage Device<span style="color: #7a0874; font-weight: bold;">&#40;</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span> found
 Loading <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #ff0000;">&quot;/rescueme&quot;</span> from usb device <span style="color: #000000;">0</span>:<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>usbda1<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 <span style="color: #000000; font-weight: bold;">**</span> File not found <span style="color: #000000; font-weight: bold;">/</span>rescueme
 reading <span style="color: #000000; font-weight: bold;">/</span>rescueme.txt
&nbsp;
<span style="color: #000000; font-weight: bold;">**</span> Unable to <span style="color: #c20cb9; font-weight: bold;">read</span> <span style="color: #ff0000;">&quot;/rescueme.txt&quot;</span> from usb <span style="color: #000000;">0</span>:<span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">**</span>
 Creating <span style="color: #000000;">1</span> MTD partitions on <span style="color: #ff0000;">&quot;nand0&quot;</span>:
 0x000002500000-0x000010000000 : <span style="color: #ff0000;">&quot;mtd=3&quot;</span>
 UBI: attaching mtd1 to ubi0
 UBI: physical eraseblock <span style="color: #c20cb9; font-weight: bold;">size</span>:   <span style="color: #000000;">131072</span> bytes <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">128</span> KiB<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 UBI: logical eraseblock <span style="color: #c20cb9; font-weight: bold;">size</span>:    <span style="color: #000000;">129024</span> bytes
 UBI: smallest flash I<span style="color: #000000; font-weight: bold;">/</span>O unit:    <span style="color: #000000;">2048</span>
 UBI: sub-page <span style="color: #c20cb9; font-weight: bold;">size</span>:              <span style="color: #000000;">512</span>
 UBI: VID header offset:          <span style="color: #000000;">512</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>aligned <span style="color: #000000;">512</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
 UBI: data offset:                <span style="color: #000000;">2048</span>
 UBI: attached mtd1 to ubi0
 UBI: MTD device name:            <span style="color: #ff0000;">&quot;mtd=3&quot;</span>
 UBI: MTD device <span style="color: #c20cb9; font-weight: bold;">size</span>:            <span style="color: #000000;">219</span> MiB
 UBI: number of good PEBs:        <span style="color: #000000;">1751</span>
 UBI: number of bad PEBs:         <span style="color: #000000;">1</span>
 UBI: max. allowed volumes:       <span style="color: #000000;">128</span>
 UBI: wear-leveling threshold:    <span style="color: #000000;">4096</span>
 UBI: number of internal volumes: <span style="color: #000000;">1</span>
 UBI: number of user volumes:     <span style="color: #000000;">0</span>
 UBI: available PEBs:             <span style="color: #000000;">1730</span>
 UBI: total number of reserved PEBs: <span style="color: #000000;">21</span>
 UBI: number of PEBs reserved <span style="color: #000000; font-weight: bold;">for</span> bad PEB handling: <span style="color: #000000;">17</span>
 UBI: max<span style="color: #000000; font-weight: bold;">/</span>mean erase counter: <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1</span>
 UBIFS error <span style="color: #7a0874; font-weight: bold;">&#40;</span>pid <span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>: ubifs_get_sb: cannot open <span style="color: #ff0000;">&quot;ubi:rootfs&quot;</span>, error <span style="color: #660033;">-19</span>
 Error reading superblock on volume <span style="color: #ff0000;">'ubi:rootfs'</span><span style="color: #000000; font-weight: bold;">!</span>
 Loading <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #ff0000;">&quot;/boot/uImage&quot;</span> from usb device <span style="color: #000000;">0</span>:<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>usbda1<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 <span style="color: #000000;">1</span> bytes <span style="color: #c20cb9; font-weight: bold;">read</span>
 Found bootable drive on usb <span style="color: #000000;">0</span>:<span style="color: #000000;">1</span>
 Loading <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #ff0000;">&quot;/boot/uImage&quot;</span> from usb device <span style="color: #000000;">0</span>:<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>usbda1<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 <span style="color: #000000;">1433640</span> bytes <span style="color: #c20cb9; font-weight: bold;">read</span>
 Loading <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #ff0000;">&quot;/boot/uInitrd&quot;</span> from usb device <span style="color: #000000;">0</span>:<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>usbda1<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 <span style="color: #000000;">4887353</span> bytes <span style="color: #c20cb9; font-weight: bold;">read</span>
 <span style="color: #666666; font-style: italic;">## Booting kernel from Legacy Image at 00800000 ...</span>
 Image Name:   Debian kernel 2.6.32-<span style="color: #000000;">5</span>-kirkwood
 Image Type:   ARM Linux Kernel Image <span style="color: #7a0874; font-weight: bold;">&#40;</span>uncompressed<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 Data Size:    <span style="color: #000000;">1433576</span> Bytes = <span style="color: #000000;">1.4</span> MiB
 Load Address: 00008000
 Entry Point:  00008000
 Verifying Checksum ... OK
 <span style="color: #666666; font-style: italic;">## Loading init Ramdisk from Legacy Image at 01100000 ...</span>
 Image Name:   Debian ramdisk 2.6.32-<span style="color: #000000;">5</span>-kirkwood
 Image Type:   ARM Linux RAMDisk Image <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">gzip</span> compressed<span style="color: #7a0874; font-weight: bold;">&#41;</span>
 Data Size:    <span style="color: #000000;">4887289</span> Bytes = <span style="color: #000000;">4.7</span> MiB
 Load Address: 00000000
 Entry Point:  00000000
 Verifying Checksum ... OK
 Loading Kernel Image ... OK
 OK
&nbsp;
Starting kernel ...</pre></div></div>

<p>On voit / confirme alors que le boot du Dockstar fonctionne parfaitement puisque le kernel Debian démarre. Le problème se situe donc au niveau de ce dernier&#8230;</p>
<p>&nbsp;</p>
<h2>Réparer Debian</h2>
<p>Après avoir éteint le Dockstar, j&#8217;ai branché la clé USB contenant Debian sur mon PC et commencé par faire une vérification du disque :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> fsck <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sdb1</pre></div></div>

<p>La clé contenait une erreur :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">fsck de util-linux-ng 2.17.2
 e2fsck 1.41.14 (22-Dec-2010)
 /dev/sdb1 est monté.
&nbsp;
AVERTISSEMENT !!! Le système de fichiers est monté.   Si vous continuez
 vous ***ALLEZ*** causer des dommages ***SÉVÈRES*** au système de fichiers.
&nbsp;
Souhaitez-vous réellement continuer (o/n)? oui
&nbsp;
/dev/sdb1 contient un système de fichiers comportant des erreurs, vérification forcée.
 Passe 1 : vérification des i-noeuds, des blocs et des tailles
 Passe 2 : vérification de la structure des répertoires
 Passe 3 : vérification de la connectivité des répertoires
 Passe 4 : vérification des compteurs de référence
 I-noeud 8098 non attaché
 Connecter à /lost+found&lt;o&gt;? oui
&nbsp;
le compteur de référence de l'i-noeud 8098 est 2, devrait être 1. Corriger&lt;o&gt;? oui
&nbsp;
Passe 5 : vérification de l'information du sommaire de groupe
&nbsp;
/dev/sdb1: ***** LE SYSTÈME DE FICHIERS A ÉTÉ MODIFIÉ *****
 /dev/sdb1 : 28353/108864 fichiers (1.3% non contigus), 217045/435448 blocs</pre></div></div>

<p>J&#8217;ai ensuite re-généré l&#8217;image du kernel, pour cela on démarre le Dockstar sous pogoplug (sans clé USB) et on se connecte dessus en SSH (voir 1er paragraphe).</p>
<p>On connecte alors la clé USB contenant Debian, on la monte, on fait un chroot sur le point de montage et on régénère l&#8217;image du kernel :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda1 <span style="color: #000000; font-weight: bold;">/</span>mnt
<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><span style="color: #c20cb9; font-weight: bold;">chroot</span> <span style="color: #000000; font-weight: bold;">/</span>mnt
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mkimage <span style="color: #660033;">-A</span> arm <span style="color: #660033;">-O</span> linux <span style="color: #660033;">-T</span> kernel  <span style="color: #660033;">-C</span> none <span style="color: #660033;">-a</span> 0x00008000 <span style="color: #660033;">-e</span> 0x00008000 <span style="color: #660033;">-n</span> Linux-2.6.32-<span style="color: #000000;">5</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>boot<span style="color: #000000; font-weight: bold;">/</span>vmlinuz-2.6.32-<span style="color: #000000;">5</span>-kirkwood <span style="color: #000000; font-weight: bold;">/</span>boot<span style="color: #000000; font-weight: bold;">/</span>uImage</pre></div></div>

<p>Sortie de la commande :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Image Name:   Linux-2.6.32-5
 Created:      Tue Jun 21 23:58:21 2011
 Image Type:   ARM Linux Kernel Image (uncompressed)
 Data Size:    1433576 Bytes = 1399.98 kB = 1.37 MB
 Load Address: 0x00008000
 Entry Point:  0x00008000</pre></div></div>

<p>Puis</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>mkimage <span style="color: #660033;">-A</span> arm <span style="color: #660033;">-O</span> linux <span style="color: #660033;">-T</span> ramdisk <span style="color: #660033;">-C</span> <span style="color: #c20cb9; font-weight: bold;">gzip</span> <span style="color: #660033;">-a</span> 0x00000000 <span style="color: #660033;">-e</span> 0x00000000 <span style="color: #660033;">-n</span> initramfs <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>boot<span style="color: #000000; font-weight: bold;">/</span>initrd.img-2.6.32-<span style="color: #000000;">5</span>-kirkwood <span style="color: #000000; font-weight: bold;">/</span>boot<span style="color: #000000; font-weight: bold;">/</span>uInitrd</pre></div></div>

<p>&nbsp;</p>
<p>Sortie de la commande :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Image Name:   initramfs
 Created:      Tue Jun 21 23:58:25 2011
 Image Type:   ARM Linux RAMDisk Image (gzip compressed)
 Data Size:    4887289 Bytes = 4772.74 kB = 4.66 MB
 Load Address: 0x00000000
 Entry Point:  0x00000000</pre></div></div>

<p>&nbsp;</p>
<p>Laisser les périphériques branchés, sortir du chroot (exit) et rebooter et normalement miracle le Dockstar devrait démarrer sous Debian&#8230;</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><em><strong>Sources :</strong></em></span></p>
<ul>
<li><a href="http://jeff.doozan.com/debian/uboot/">Update uBoot on your Dockstar, GoFlex, or Pogoplug NAS</a></li>
<li><a href="http://forum.doozan.com/read.php?3,14,14">Use netconsole to troubleshoot uBoot without a serial cable</a></li>
<li><a href="http://www.pluc.fr/2011/02/seagate-dockstar-installation-et-amelioration/">Seagate dockstar installation et amélioration</a></li>
<li><a href="http://blog.slucas.fr/en/tips/dockstar-update-uimage-uinitrd">Update a Dockstar uImage/uInitrd after a kernel update [Technology and me]</a></li>
<li><a href="http://forum.hardware.fr/hfr/OSAlternatifs/Hardware-2/seagate-dockstar-computer-sujet_71314_50.htm#t1275403">Forum Hardware.fr sur le Dockstar </a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/mon-dockstar-ne-boot-plus-sous-debian/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sécurisation NGINX : mise en oeuvre de connexions https</title>
		<link>http://voidandany.free.fr/index.php/securisation-nginx-mise-en-oeuvre-de-connexions-https/</link>
		<comments>http://voidandany.free.fr/index.php/securisation-nginx-mise-en-oeuvre-de-connexions-https/#comments</comments>
		<pubDate>Wed, 22 Jun 2011 14:53:38 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=3678</guid>
		<description><![CDATA[Mon serveur web NGINX ne sert que du contenu privé protégé par mot de passe, mais si l&#8217;accès à ce contenu est protégé, les données qui transitent sur le réseau elles ne le sont pas. Pour cela il faut mettre &#8230; <a href="http://voidandany.free.fr/index.php/securisation-nginx-mise-en-oeuvre-de-connexions-https/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Mon serveur web NGINX ne sert que du <a title="Restreindre l’accès d’un site, d’un répertoire avec Nginx" href="../index.php/restreindre-lacces-dun-site-dun-repertoire-avec-nginx/">contenu privé protégé par mot de passe</a>, mais si l&#8217;accès à ce contenu est protégé, les données qui transitent sur le réseau elles ne le sont pas.</p>
<p>Pour cela il faut mettre en œuvre un chiffrage via <a href="http://fr.wikipedia.org/wiki/Hypertext_Transfer_Protocol#HTTPS">https</a>.</p>
<p>Https se base sur un <a href="http://fr.wikipedia.org/wiki/Transport_Layer_Security" target="_blank">système de clé de cryptage publique/certificat</a>, il existe plusieurs moyen pour obtenir ces fichiers :</p>
<ul>
<li>Acheter le certificat auprès d&#8217;un organisme reconnu, peut être très cher, exemple : <a href="http://www.thawte.fr/products/index.html">600€ pour 2 ans</a> ou moins cher : <a href="http://www.godaddy.com/ssl/ssl-certificates.aspx?ci=8979">Go Daddy</a>)</li>
<li>Avoir le certificat gratuit avec votre nom de domaine (<a href="http://www.gandi.net/ssl">chez Gandi par exemple pour 1 an</a>)</li>
<li>Avoir un certificat gratuit avec un organisme <a href="http://wiki.cacert.org/InclusionStatus" target="_blank">presque reconnu</a> comme <a href="http://www.cacert.org/" target="_blank">CAcert </a></li>
<li>Générer un certificat (certificat auto-signé)</li>
</ul>
<p>J&#8217;ai personnellement choisi cette dernière solution.</p>
<p>Dans mon article <a title="Lien permanent vers OpenSSL puissance et complexité" rel="bookmark" href="../index.php/openssl-puissance-et-complexite/">OpenSSL puissance et complexité</a>, j&#8217;ai listé/référencé les étapes et commandes openssl disponible pour créer un certificat.</p>
<p>&nbsp;</p>
<p>Voici les sujets abordé par cet article :</p>
<ul>
<li><a href="#para1">Gestion des certificats manuellement</a></li>
<li><a href="#para2">Gestion des certificats avec easyCA</a></li>
<li><a href="#para3">Configuration NGINX</a></li>
<li><a href="#para3">Configuration Firefox</a></li>
</ul>
<p>&nbsp;</p>
<h2><a name="para1"></a>Gestion des certificats manuellement</h2>
<h3>Préparation de l&#8217;environnement</h3>
<p>Je vais créer un répertoire myCa dans le /home de mon utilisateur et y placer tout ce qui sera nécessaire à gérer les certificats</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> myCA<span style="color: #000000; font-weight: bold;">/</span>certs <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> myCA<span style="color: #000000; font-weight: bold;">/</span>private <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> myCA<span style="color: #000000; font-weight: bold;">/</span>csr <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> myCA<span style="color: #000000; font-weight: bold;">/</span>newcerts <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> myCA<span style="color: #000000; font-weight: bold;">/</span>crl <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> myCA<span style="color: #000000; font-weight: bold;">/</span>tmp <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> myCA
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">'01'</span> <span style="color: #000000; font-weight: bold;">&gt;</span> serial  <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">touch</span> index.txt
<span style="color: #c20cb9; font-weight: bold;">cp</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>openssl.cnf .</pre></div></div>

<h3>Configuration d&#8217;openSSL</h3>
<p>On édite ensuite le fichier openssl.cnf copié dans notre répertoire myCA, pour modifier les éléments suivants :</p>
<p>Section [ CA_default ] on paramètre les dossiers, seul la première valeur est à modifier :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">dir</span>        = <span style="color: #000000; font-weight: bold;">&lt;</span>strong<span style="color: #000000; font-weight: bold;">&gt;/</span>home<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>utilisateur<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">/</span>myCA<span style="color: #000000; font-weight: bold;">&lt;/</span>strong<span style="color: #000000; font-weight: bold;">&gt;</span>            <span style="color: #666666; font-style: italic;"># Where everything is kept</span>
certs        = <span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>certs        <span style="color: #666666; font-style: italic;"># Where the issued certs are kept</span>
crl_dir        = <span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>crl        <span style="color: #666666; font-style: italic;"># Where the issued crl are kept</span>
database    = <span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>index.txt    <span style="color: #666666; font-style: italic;"># database index file.</span>
new_certs_dir    = <span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>newcerts        <span style="color: #666666; font-style: italic;"># default place for new certs.</span>
certificate    = <span style="color: #007800;">$certs</span><span style="color: #000000; font-weight: bold;">/</span>cacert.pem    <span style="color: #666666; font-style: italic;"># The CA certificate</span>
serial        = <span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>serial         <span style="color: #666666; font-style: italic;"># The current serial number</span>
crl        = <span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>crl.pem         <span style="color: #666666; font-style: italic;"># The current CRL</span>
private_key    = <span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>cakey.pem <span style="color: #666666; font-style: italic;"># The private key</span>
RANDFILE    = <span style="color: #007800;">$dir</span><span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>.rand    <span style="color: #666666; font-style: italic;"># private random number file</span></pre></div></div>

<p>Un peu plus loin dans cette même section, on paramètre la duré de validité par défaut des certificats et le cryptage utilisé :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">default_days    = 1825            # how long to certify for
default_crl_days= 30            # how long before next CRL
default_md    = sha1            # which md to use.</pre></div></div>

<p>Dans la section [ req_distinguished_name ] j&#8217;ai francisé les libellé et adpater les valeurs par défaut :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[ req_distinguished_name ]
 countryName                     = Pays (2 lettres)
 countryName_default             = FR
 countryName_min                 = 2
 countryName_max                 = 2
 stateOrProvinceName             = Region
 stateOrProvinceName_default     = PAYS DE LOIRE
 localityName                    = Ville
 localityName_default            = Nantes
 0.organizationName              = Societe
 0.organizationName_default      = VoidAndAny
 #organizationalUnitName         = Organizational Unit Name (eg, section)
 #organizationalUnitName_default =
 commonName                      = Site
 commonName_max                  = 64
 emailAddress                    = Email
 emailAddress_max                = 64
 emailAddress_default            = mon_email@free.fr</pre></div></div>

<p>Dès lors les questions sont les suivantes et il suffit de les valider par entrée pour avoir les valeurs par défaut (optionnel) :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Pays (2 lettres) [FR]:
Region [PAYS DE LOIRE]:
Ville [Nantes]:
Societe [VoidAndAny]:
Site []: mon_domaine.fr
Email [mon_email@free.fr]:</pre></div></div>

<p>Dans la section [ usr_cert ] j&#8217;ai modifié les commentaire qui seront embarqués dans les certificats :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">nsComment            = &quot;Void And Any Generated Certificate&quot;</pre></div></div>

<h3>Création de l&#8217;autorité de certification</h3>
<p>On va tout d&#8217;abord créer notre autorité de certification qui permettra de signer les certificats serveurs suivant.</p>
<p>Cela se fait avec la commande (se placer dans le répertoire myCA) :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-x509</span> <span style="color: #660033;">-config</span> .<span style="color: #000000; font-weight: bold;">/</span>openssl.cnf <span style="color: #660033;">-keyout</span> .<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>cakey.pem <span style="color: #660033;">-out</span> .<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>cacert.pem <span style="color: #660033;">-days</span> <span style="color: #000000;">1825</span></pre></div></div>

<p>Lors de la génération du certificat un mot de passe vous est demandé, en choisir un robuste et ne pas l&#8217;oublier sous peine de ne plus pouvoir vous servir de votre autorisé de certification.</p>
<h3>Création du/des certificats</h3>
<p>En 2 temps, création de la clé et de la demande de certificat :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-keyout</span> .<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>mondomaine.key <span style="color: #660033;">-out</span> .<span style="color: #000000; font-weight: bold;">/</span>csr<span style="color: #000000; font-weight: bold;">/</span>mondomaine.csr <span style="color: #660033;">-config</span> .<span style="color: #000000; font-weight: bold;">/</span>openssl.cnf <span style="color: #660033;">-nodes</span> <span style="color: #660033;">-days</span> <span style="color: #000000;">1825</span></pre></div></div>

<p>L’option -nodes permet d’indiquer que la clé qui doit être générée ne doit pas être protégée par un mot de passe (passphrase)</p>
<p>&nbsp;</p>
<p>La commande vous poseras quelques questions :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Generating a 2048 bit RSA private key
 .............+++
 ............................+++
 writing new private key to '/etc/nginx/certificates/test.key'
 -----
 You are about to be asked to enter information that will be incorporated
 into your certificate request.
 What you are about to enter is what is called a Distinguished Name or a DN.
 There are quite a few fields but you can leave some blank
 For some fields there will be a default value,
 If you enter '.', the field will be left blank.
 -----
 Country Name (2 letter code) [AU]:FR
 State or Province Name (full name) [Some-State]:PAYS DE LOIRE
 Locality Name (eg, city) []:Nantes
 Organization Name (eg, company) [Internet Widgits Pty Ltd]:VoidAndAny
 Organizational Unit Name (eg, section) []:
 Common Name (eg, YOUR name) []:mon_domaine.fr
 Email Address []:mon_email@free.fr</pre></div></div>

<p>La zone la plus importante est &laquo;&nbsp;Common name&nbsp;&raquo; qui doit correspondre au nom du domaine/sous-domaine que vous voulez protéger.</p>
<p>&nbsp;</p>
<p>Création du certificat à partir de la demande de certificat et signature de ce dernier avec notre autorité de certification :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl ca <span style="color: #660033;">-infiles</span> .<span style="color: #000000; font-weight: bold;">/</span>csr<span style="color: #000000; font-weight: bold;">/</span>mondomaine.csr <span style="color: #660033;">-out</span> .<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>mondomaine.crt <span style="color: #660033;">-config</span> .<span style="color: #000000; font-weight: bold;">/</span>openssl.cnf</pre></div></div>

<p>Les certificat et sa clé sont alors respectivement dans les sous-répertoires certs et private.</p>
<p>&nbsp;</p>
<p>Voila pour la création manuelle voici comment automatiser tout cela et ne pas avoir de ligne de commande à taper.</p>
<p>&nbsp;</p>
<h2><a name="para2"></a>Gestion des certificats avec easyCA</h2>
<p>EasyCA est un script qui n&#8217;est plus maintenu depuis 2005 et que l&#8217;on peut retrouver <a title="esayca" href="http://sourceforge.net/projects/easyca" target="_blank">ICI</a>, personnellement j&#8217;ai utilisé la <a href="http://blog.guiguiabloc.fr/index.php/2008/12/02/pki-pki-oh-pki-pki-ah/">version modifiée de GuiguiAbloc</a> que l&#8217;on trouve <a href="http://guiguiabloc.appspot.com/wp-content/2008/12/easyca.tgz">ICI</a></p>
<p>Je vais comme précédemment faire du répertoire myCA de mon home le lieu de travail. (si vous avez fait des essais manuellement il peut être conseillé de tout supprimer le contenu du dit répertoire ou d&#8217;en utiliser un autre)</p>
<p>Télécharger l&#8217;archive, la décompresser et rendre le script exécutable :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> ~<span style="color: #000000; font-weight: bold;">/</span>myCA <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> ~<span style="color: #000000; font-weight: bold;">/</span>myCA
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>guiguiabloc.appspot.com<span style="color: #000000; font-weight: bold;">/</span>wp-content<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2008</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">12</span><span style="color: #000000; font-weight: bold;">/</span>easyca.tgz
<span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-xvf</span> easyca.tgz
<span style="color: #c20cb9; font-weight: bold;">mv</span> easyca<span style="color: #000000; font-weight: bold;">/*</span> .
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">755</span> easyCA.sh</pre></div></div>

<p>Éditer le fichier openssl.cnf fournis, modifier les lignes préalablement décrites et supprimer la ligne :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># !!!!! remove this line after configuration as it is NOT_CONFIGURED yet !!!</pre></div></div>

<p><strong>Rque </strong>: j&#8217;ai en plus changé les différents paramètres nsComment en fin de fichier.</p>
<p>Lancer le script easyCA.sh, le menu suivant apparaît :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">=====================================================================
 Certificate Management System
 easyCA version 0.9(6) by Ferry Kemps and Guiguiabloc
 GPL Licensed
 =====================================================================
&nbsp;
 1) Sign a Certificate Signing Request (PKCS#10)
 2) Create a Server Certificate (PEM SelfSigned)
 3) Create a Client Certificate (PKCS#12)
 4) Create a Certificate Signing Request
 5) Generate Certificate Revocation List (CRL)
 6) List, Display and Revoke Certificates
&nbsp;
 I) Initialize Root Certificate Authority (CA)
 O) Initialize OCSP Server Certificate
 B) Backup &amp; Restore the Certificate environment
 R) Reinstall easyCA (erase)
&nbsp;
==&gt; Make your choice [none]:</pre></div></div>

<p>(dans les &laquo;&nbsp;copie d&#8217;écran&nbsp;&raquo; suivante je n&#8217;ai pas personnalisé mon openssl.cnf, d&#8217;où les localité, adresse mail par défaut)</p>
<h3>Création de l&#8217;autorité de certification</h3>
<p>Pour créer l&#8217;autorité de certification il suffit de choisir l&#8217;option I :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">-----------------------------------------------------------------------
 ----------------- Initialize root Certificate Authority ---------------
 -----------------------------------------------------------------------
&nbsp;
Are you sure you want to (re)initialize the Root CA? [y|n]: y
 &gt;&gt;&gt; Initializing Root CA &lt;&lt;&lt;
 Generating a 1024 bit RSA private key
 ...................++++++
 .............................................++++++
 writing new private key to './private/cakey.pem'
 Enter PEM pass phrase:
 Verifying - Enter PEM pass phrase:
 -----
 You are about to be asked to enter information that will be incorporated
 into your certificate request.
 What you are about to enter is what is called a Distinguished Name or a DN.
 There are quite a few fields but you can leave some blank
 For some fields there will be a default value,
 If you enter '.', the field will be left blank.
 -----
 Country Name (2 letter code) [NL]:
 State or Province Name (full name) [Gelderland]:
 Locality Name (eg, city) [Arnhem]:
 Organization Name (eg, company) [Your Company Name]:
 Organizational Unit Name (eg, section) [HQ]:
 Common Name (eg, your name or your server's hostname) []:
 Email Address [postmaster@domain.ext]:
&nbsp;
Press [enter] to continue</pre></div></div>

<p>Comme dans le paragraphe précédent il faut choisir une passphrase sécurisé et ne pas l&#8217;oublier. Le Common Name n&#8217;a que peut d&#8217;importance ici.</p>
<h3>Création du/des certificats</h3>
<p>Pour générer un certificat serveur, il faut procéder en 2 temps, la demande de certificat, option 4 du menu :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">-----------------------------------------------------------------------
 --------------- Generate Certificate Signing Request ------------------
 -----------------------------------------------------------------------
&nbsp;
Enter Certificate CN (Common name|FQDN) like www.example.com [none]: mondomaine
 Generating a 1024 bit RSA private key
 ..................++++++
 .......++++++
 writing new private key to './private/mondomaine-key.pem'
 -----
 You are about to be asked to enter information that will be incorporated
 into your certificate request.
 What you are about to enter is what is called a Distinguished Name or a DN.
 There are quite a few fields but you can leave some blank
 For some fields there will be a default value,
 If you enter '.', the field will be left blank.
 -----
 Country Name (2 letter code) [NL]:
 State or Province Name (full name) [Gelderland]:
 Locality Name (eg, city) [Arnhem]:
 Organization Name (eg, company) [Your Company Name]:
 Organizational Unit Name (eg, section) [HQ]:
 Common Name (eg, your name or your server's hostname) []:mondomaine.fr
 Email Address [postmaster@domain.ext]:
&nbsp;
Please enter the following 'extra' attributes
 to be sent with your certificate request
 A challenge password []:
 An optional company name []:
&nbsp;
Certificate Signing Request (CSR) stored as: ./csr/mondomaine.csr
 Certificate private-key stored as: ./private/mondomaine-key.pem
 Press [enter] to continue</pre></div></div>

<p>La première question (Enter Certificate CN (Common name|FQDN) like www.example.com [none]:) ne sert pas à alimenter le common name du certificat mais a déterminer le nom des fichier certificat et clé.</p>
<p>A la question common name, il faut ici indiquer le domaine sur lequel s&#8217;appliquera la certificat sous peine d&#8217;avoir des avertissement de sécurité dans les navigateurs.</p>
<p>&nbsp;</p>
<p>2ème étape obtenir le certificat et le signer , option 1 du menu :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">-----------------------------------------------------------------------
 --------------- Certifiace Signing Request handling -------------------
 -----------------------------------------------------------------------
&nbsp;
(CSR request files should be copied into directory: ./csr)
&nbsp;
1: mondomaine.csr
&nbsp;
==&gt; Select the CSR to sign [none]: 1
&nbsp;
==&gt; Add OCSP Extension to Certificate ? [y/N]: N
&nbsp;
==&gt; Select the Usage Key [server|client|none]: server
 Using configuration from ./openssl.cnf
 Enter pass phrase for ./private/cakey.pem:
 Check that the request matches the signature
 Signature ok
 Certificate Details:
 Serial Number: 1 (0x1)
&nbsp;
...
&nbsp;
 Certificate is to be certified until Jun 19 18:36:00 2016 GMT (1825 days)
 Sign the certificate? [y/n]:y
&nbsp;
1 out of 1 certificate requests certified, commit? [y/n]y
 Write out database with 1 new entries
 Data Base Updated
&nbsp;
Signed certificate stored as: ./certs/mondomaine.crt
 Return this certificate to the requesting party.
&nbsp;
Display Certificate? y/n [n] n</pre></div></div>

<p>On sélectionne les demande de certificat en cours (il peut y en avoir plusieurs), on indique le rôle du certificat à générer (server), on saisi le mot de passe de l&#8217;autorité de certification et voila&#8230;</p>
<p>L’utilisation de easyCA est quand même beaucoup plus simple que de se taper les lignes de commande&#8230;.</p>
<p>&nbsp;</p>
<p>Pour info voici les commandes par easyCA  qui sont lancées pour les 3 étapes décrites ci-dessus :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-x509</span> <span style="color: #660033;">-config</span> .<span style="color: #000000; font-weight: bold;">/</span>openssl.cnf <span style="color: #660033;">-keyout</span> .<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>cakey.pem <span style="color: #660033;">-out</span> .<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>cacert.pem <span style="color: #660033;">-days</span> <span style="color: #000000;">1825</span>
&nbsp;
openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-nodes</span> <span style="color: #660033;">-config</span> .<span style="color: #000000; font-weight: bold;">/</span>openssl.cnf <span style="color: #660033;">-days</span> <span style="color: #000000;">1825</span> <span style="color: #660033;">-keyout</span> .<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>mondomaine-key.pem <span style="color: #660033;">-out</span> .<span style="color: #000000; font-weight: bold;">/</span>csr<span style="color: #000000; font-weight: bold;">/</span>mondomaine.csr
&nbsp;
openssl ca <span style="color: #660033;">-config</span> .<span style="color: #000000; font-weight: bold;">/</span>openssl.cnf <span style="color: #660033;">-cert</span> .<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>cacert.pem <span style="color: #660033;">-extensions</span>  SERVEUR <span style="color: #660033;">-in</span> .<span style="color: #000000; font-weight: bold;">/</span>csr<span style="color: #000000; font-weight: bold;">/</span>mondomaine.csr <span style="color: #660033;">-out</span> .<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>mondomaine.crt</pre></div></div>

<p>Elle très très semblables à celles que j&#8217;ai décrite dans le premier paragraphe&#8230;</p>
<p><strong><br />
 </strong></p>
<h2><a name="para3"></a>Configuration NGINX</h2>
<p>Une fois un certificat généré pour votre site que ce soit manuellement ou via easyCA, il faut tout d&#8217;abord copier le clé et le dit certificat vers un répertoire qui sera accessible par NGINX.</p>
<p>Dans mon cas j&#8217;ai créé un répertoire certificates dans /etc/nginx.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> ~
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> myCA<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>mondomaine.crt <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>certificates
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> myCA<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>mondomaine-key.pem <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>certificates
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> root.root <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>certificates<span style="color: #000000; font-weight: bold;">/</span>mondomaine-key.pem
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">400</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>certificates<span style="color: #000000; font-weight: bold;">/</span>mondomaine-key.pem</pre></div></div>

<p>Il suffit ensuite d&#8217;indiquer à NGINX pour le site voulu l&#8217;écouter sur le port 443 (au lieu du 80) et l&#8217;utilisation du certificat et de la clé privée</p>
<pre>server {
    listen               443;
    server_name          mondomaine.fr;

    ssl                  on;
    ssl_certificate      /etc/nginx/certificates/mondomaine.crt;
    ssl_certificate_key  /etc/nginx/certificates/mondomaine-key.fr;

....
  }</pre>
<p>Et rediriger le port 443 vers votre serveur&#8230;</p>
<p>&nbsp;</p>
<h2><a name="para4"></a>Configuration Firefox</h2>
<p>Lorsque vous irez sur votre site pour la première fois vous aurez un message d&#8217;avertissement car votre autorité de certification (c&#8217;est à dire votre serveur) n&#8217;est pas reconnue par le navigateur :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/2011-06-22_161311.png"><img class="aligncenter size-full wp-image-4184" title="2011-06-22_161311" src="http://voidandany.free.fr/wp-content/uploads/2011-06-22_161311.png" alt="" width="641" height="324" /></a></p>
<p>Si on regarde les détail technique on a ceci :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/2011-06-22_161320.png"><img class="aligncenter size-full wp-image-4185" title="2011-06-22_161320" src="http://voidandany.free.fr/wp-content/uploads/2011-06-22_161320.png" alt="" width="433" height="104" /></a>Ou ceci <a href="http://voidandany.free.fr/wp-content/uploads/Sélection_00512m.png"><img class="aligncenter size-full wp-image-4190" title="Sélection_00512m" src="http://voidandany.free.fr/wp-content/uploads/Sélection_00512m.png" alt="" width="408" height="152" /></a>Dans le premeir cas je ne comprend pas très bien l&#8217;erreur, peut être est ce d^au fait que j&#8217;utilise un certificat joker mais ceci est une autre histoire, dans le 2ème cas on a 2 erreurs, le fait que le certificat est auto-signée et le fait que le common name donnée lors de la création du certification ne correspond pas au domaine sur lequel il a été appliqué.</p>
<p>Dans tous les cas pour passer outre il suffit d&#8217;importer le certificat racine publique de notre autorité de certification.</p>
<p>Il faut donc diffuser, copier le fichier cacert.pem contenu dans le répertoire certs sur votre serveur sur les machine clientes. ATTENTION il ne faut surtout pas diffuser la clé privé cakey.pem</p>
<p>&nbsp;</p>
<p>Ensuite sur les machines clientes dans Firefox aller dans le menu &laquo;&nbsp;Avancé&nbsp;&raquo; sur l&#8217;onglet &laquo;&nbsp;Chiffrement&nbsp;&raquo; et cliquer sur &laquo;&nbsp;Afficher les certificats&nbsp;&raquo; :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/2011-06-22_161336.png"><img class="aligncenter size-full wp-image-4186" title="2011-06-22_161336" src="http://voidandany.free.fr/wp-content/uploads/2011-06-22_161336.png" alt="" width="548" height="500" /></a>Dans l&#8217;onglet &laquo;&nbsp;Autorités&nbsp;&raquo; cliquer sur &laquo;&nbsp;Importer&#8230;&nbsp;&raquo; et sélectionner votre fichier (cacert.pem)</p>
<p>Sélectionner l&#8217;usage que vous souhaitez faire du certificat &laquo;&nbsp;identifier des sites web&nbsp;&raquo; :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/2011-06-22_161410.png"><img class="aligncenter size-full wp-image-4188" title="2011-06-22_161410" src="http://voidandany.free.fr/wp-content/uploads/2011-06-22_161410.png" alt="" width="515" height="291" /></a></p>
<p>Votre autorité de certification est désormais reconnue :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/2011-06-22_161503.png"><img class="aligncenter size-full wp-image-4183" title="2011-06-22_161503" src="http://voidandany.free.fr/wp-content/uploads/2011-06-22_161503.png" alt="" width="586" height="165" /></a></p>
<p>Et la page devrait s&#8217;afficher sans problème.</p>
<p>&nbsp;</p>
<p>Dans IE il faut aller dans Option Internet &gt; Onglet Contenu &gt; Bouton Certificats, puis onglet Autorités principales de confiance &gt; Bouton Importer</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><em><strong>Sources : </strong></em></span></p>
<p>Gestion des certificats : <span style="text-decoration: underline;"><em><strong><br />
 </strong></em></span></p>
<ul>
<li><a title="Be your own Certificate Authority (CA)" rel="bookmark" href="http://www.g-loaded.eu/2005/11/10/be-your-own-ca/">Be your own Certificate Authority (CA)</a></li>
<li><a href="http://artisan.karma-lab.net/creer-sa-propre-mini-pki">Créer sa propre (mini) PKI</a> : un article très très clair (comme tous les articles de ce site) sur les certificats, il devrait être obligatoire de le lire (malheureusement pour moi je ne l&#8217;ai trouvé que tard)</li>
<li><a href="http://blog.guiguiabloc.fr/index.php/2008/12/02/pki-pki-oh-pki-pki-ah/">PKI, PKI, oh ! PKI, PKI, ah !</a></li>
</ul>
<p>Configuration NGINX :</p>
<ul>
<li><a rel="next" href="http://blog.shk-desktop.com/565-nginx-serveur-web-complet-bluffant">nginx: serveur web complet bluffant</a></li>
<li><a title="Nginx , SSL et plus encore .." href="http://lindev.fr/index.php?post/2010/04/06/Ngins-%2C-SSL-et-plus-encore-..">Nginx , SSL et plus encore ..</a></li>
</ul>
<p>Autre :</p>
<ul>
<li><a href="http://www.tux-planet.fr/verifier-automatiquement-lexpiration-de-certificats-ssl/">Vérifier automatiquement l&#8217;expiration de certificats SSL &#8211; Tux-planet</a></li>
<li><a href="http://www.informathic.com/post/2010/12/24/installer-ssl-gandi-nginx">Installer un certificat Gandi SSL Standard sur Nginx</a></li>
</ul>
<ul>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/securisation-nginx-mise-en-oeuvre-de-connexions-https/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Ordre de tri des fichiers sous Ubuntu et Windows</title>
		<link>http://voidandany.free.fr/index.php/ordre-de-tri-des-fichiers-sous-ubuntu-et-windows/</link>
		<comments>http://voidandany.free.fr/index.php/ordre-de-tri-des-fichiers-sous-ubuntu-et-windows/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 19:34:28 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Nautilus]]></category>
		<category><![CDATA[tri]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=2653</guid>
		<description><![CDATA[Sous Windows j&#8217;ai pris l&#8217;habitude de préfixer certains fichier dossier d&#8217;un underscore (_) afin qu&#8217;il apparaissent en haut de la liste dans l&#8217;explorateur. Quand je suis passé sous Ubuntu ce mécanisme ne fonctionnait plus. Pire sous Nautilus je ne comprend &#8230; <a href="http://voidandany.free.fr/index.php/ordre-de-tri-des-fichiers-sous-ubuntu-et-windows/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sous Windows j&#8217;ai pris l&#8217;habitude de préfixer certains fichier dossier d&#8217;un underscore (_) afin qu&#8217;il apparaissent en haut de la liste dans l&#8217;explorateur.</p>
<p><br class="spacer_" /></p>
<p>Quand je suis passé sous Ubuntu ce mécanisme ne fonctionnait plus. Pire sous <span style="font-weight: bold;">Nautilus </span>je ne comprend même pas la <span style="font-weight: bold;">logique </span>utilisé pour <span style="font-weight: bold;">trier les fichiers</span>.</p>
<p>Enfin j&#8217;ai essayé divers autres gestionnaire de fichiers et aucun n&#8217;a le même ordre de tri !!!</p>
<p>Je savais que sous Linux on avait le choix des logiciels mais de là à avoir le choix du tri des fichiers&#8230;</p>
<p><br class="spacer_" /></p>
<p>Un exemple vaut mieux qu&#8217;un long discours, je me suis fait un jeu de test sous Ubuntu avec des fichiers ayant des nom court mais commençant par divers caractères : lettres (majuscule, minuscule), chiffres, caractères spéciaux (#_~), espace et points.</p>
<p>&nbsp;</p>
<h2>Windows <span style="font-weight: bold;"> </span> (ma référence) :</h2>
<p><a href="http://voidandany.free.fr/wp-content/uploads/2010-09-22_171821.png"><img class="size-full wp-image-2654 aligncenter" title="Tri fichiers Windows Explorer" src="http://voidandany.free.fr/wp-content/uploads/2010-09-22_171821.png" alt="" width="105" height="347" /></a>Les caractères spéciaux (dont l&#8217;espace et le point sont au début) suivi des chiffres puis les lettres (la distinction majuscule minuscule a été perdu puisque Windows est insensible à la casse)</p>
<p>A noter les chiffres sont triés numériquement 9 avant 100</p>
<p>&nbsp;</p>
<h2>Nautilus 2.30</h2>
<p>L&#8217;explorateur de fichier d&#8217;Ubuntu (v10.04)</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/2010-09-22_172143.png"><img class="size-full wp-image-2655 aligncenter" title="Tri fichier Nautilus" src="http://voidandany.free.fr/wp-content/uploads/2010-09-22_172143.png" alt="" width="253" height="565" /></a></p>
<h2>Nautilus Elementary 2.32.2</h2>
<p>Version patchée de Nautilus (voir<a title="Lien permanent vers Nautilus elementary" rel="bookmark" href="../index.php/nautilus-elementary/">Nautilus elementary</a>)</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/nautilusElementary.png"><img class="aligncenter size-full wp-image-4129" title="nautilusElementary-277x300" src="http://voidandany.free.fr/wp-content/uploads/nautilusElementary-277x300.png" alt="" width="277" height="300" /></a></p>
<h2>Thunar 1.0.2</h2>
<p>Explorateur de fichier de XFCE</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Thunar.png"><img class="aligncenter size-full wp-image-4131" title="Thunar-200x300" src="http://voidandany.free.fr/wp-content/uploads/Thunar-200x300.png" alt="" width="200" height="300" /></a></p>
<p>&nbsp;</p>
<h2>SunFlower 0.1a</h2>
<p>Nouvel explorateur de fichier : <a href="http://code.google.com/p/sunflower-fm/">sunflower-fm &#8211; Twin-panel file manager for Linux &#8211; Google Project Hosting</a></p>
<p style="text-align: center;"><a href="http://voidandany.free.fr/wp-content/uploads/Sunflower.png"><img class="aligncenter size-full wp-image-4130" title="Sunflower-300x284" src="http://voidandany.free.fr/wp-content/uploads/Sunflower-300x284.png" alt="" width="300" height="284" /></a></p>
<p>&nbsp;</p>
<h2>Dolphin 1.5</h2>
<p>L&#8217;explorateur de fichier de KDE</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_0108.png"><img class="aligncenter size-medium wp-image-4127" title="Sélection_010" src="http://voidandany.free.fr/wp-content/uploads/Sélection_0108-300x235.png" alt="" width="300" height="235" /></a></p>
<h2>Gnome Terminal</h2>
<p>avec la commande ls -hal :</p>
<p style="text-align: center;"><a href="http://voidandany.free.fr/wp-content/uploads/2010-09-22_172325.png"><img class="size-full wp-image-2656 aligncenter" title="Tri fichier ls" src="http://voidandany.free.fr/wp-content/uploads/2010-09-22_172325.png" alt="" width="174" height="495" /></a></p>
<p>&nbsp;</p>
<p>On constatera que sur 5 logiciels testés sous Linux on a 5 ordre de tri !!!</p>
<p>&nbsp;</p>
<p>Pour info voici mes locales (il semblerait que cela influe sur l&#8217;ordre de tri)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">LANG</span>=fr_FR.utf8
<span style="color: #007800;">LC_CTYPE</span>=<span style="color: #ff0000;">&quot;fr_FR.utf8&quot;</span>
<span style="color: #007800;">LC_NUMERIC</span>=<span style="color: #ff0000;">&quot;fr_FR.utf8&quot;</span>
<span style="color: #007800;">LC_TIME</span>=<span style="color: #ff0000;">&quot;fr_FR.utf8&quot;</span>
<span style="color: #007800;">LC_COLLATE</span>=<span style="color: #ff0000;">&quot;fr_FR.utf8&quot;</span>
<span style="color: #007800;">LC_MONETARY</span>=<span style="color: #ff0000;">&quot;fr_FR.utf8&quot;</span>
<span style="color: #007800;">LC_MESSAGES</span>=<span style="color: #ff0000;">&quot;fr_FR.utf8&quot;</span>
<span style="color: #007800;">LC_PAPER</span>=<span style="color: #ff0000;">&quot;fr_FR.utf8&quot;</span>
<span style="color: #007800;">LC_NAME</span>=<span style="color: #ff0000;">&quot;fr_FR.utf8&quot;</span>
<span style="color: #007800;">LC_ADDRESS</span>=<span style="color: #ff0000;">&quot;fr_FR.utf8&quot;</span>
<span style="color: #007800;">LC_TELEPHONE</span>=<span style="color: #ff0000;">&quot;fr_FR.utf8&quot;</span>
<span style="color: #007800;">LC_MEASUREMENT</span>=<span style="color: #ff0000;">&quot;fr_FR.utf8&quot;</span>
<span style="color: #007800;">LC_IDENTIFICATION</span>=<span style="color: #ff0000;">&quot;fr_FR.utf8&quot;</span>
<span style="color: #007800;">LC_ALL</span>=</pre></div></div>

<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p>Bref voici où j&#8217;en suis, dans la suite les liens que j&#8217;ai à étudier attentivement pour comprendre (si c&#8217;est possible).</p>
<p><a href="https://bugzilla.gnome.org/show_bug.cgi?id=458707">Bug 458707 – Sort order ignores special characters</a></p>
<p><a href="http://ubuntuforums.org/showthread.php?t=614593">nautilus sort order &#8211; Ubuntu Forums</a></p>
<p><a href="http://ubuntuforums.org/showthread.php?t=1551872&amp;highlight=sort+order+nautilus">[all variants] Directory Order in Console &#8211; Ubuntu Forums</a></p>
<p><a href="http://ubuntuforums.org/showthread.php?t=894734&amp;highlight=sort+order+nautilus">[all variants] sort order with LC_COLLATE: change to what? &#8211; Ubuntu Forums</a></p>
<p><a href="http://ubuntuforums.org/showthread.php?t=1495486&amp;highlight=sort+order+nautilus">[SOLVED] Nautilus sorting changed? &#8211; Ubuntu Forums</a></p>
<p><a href="http://ubuntuforums.org/showthread.php?t=471154">Sort order in nautilus &#8211; Ubuntu Forums</a></p>
<p><a href="http://bugzilla.gnome.org/show_bug.cgi?id=458707">http://bugzilla.gnome.org/show_bug.cgi?id=458707</a></p>
<p><a href="http://www.iac.es/sieinvens/siepedia/pmwiki.php?n=Tutorials.LinuxLocale">http://www.iac.es/sieinvens/siepedia/pmwiki.php?n=Tutorials.LinuxLocale</a></p>
<p><a href="http://www.linux.com/archive/articles/53781">http://www.linux.com/archive/articles/53781</a></p>
<p><a href="http://doc.dev.ubuntu-fr.org/doku.php?id=variables_d_environnement">http://doc.dev.ubuntu-fr.org/doku.php?id=variables_d_environnement</a></p>
<p><a href="http://ubuntuforums.org/archive/index.php/t-471154.html">http://ubuntuforums.org/archive/index.php/t-471154.html</a></p>
<p><br class="spacer_" /></p>
<p><a href="http://www.iac.es/sieinvens/siepedia/pmwiki.php?n=Tutorials.LinuxLocale">Locale in Linux &#8211; SIEpedia</a></p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/ordre-de-tri-des-fichiers-sous-ubuntu-et-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Allumer / éteindre un PC sous Linux à distance (scripts)</title>
		<link>http://voidandany.free.fr/index.php/allumer-eteindre-un-pc-sous-linux-a-distance-scripts/</link>
		<comments>http://voidandany.free.fr/index.php/allumer-eteindre-un-pc-sous-linux-a-distance-scripts/#comments</comments>
		<pubDate>Wed, 08 Jun 2011 09:15:58 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[Non classé]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4057</guid>
		<description><![CDATA[J&#8217;ai déjà indiqué comment allumer/démarrer un PC à distance via le wakeonlan et comment éteindre un PC à distance via ssh. Pour mon usage personnel j&#8217;ai intégré ces commandes dans des scripts afin d&#8217;y ajouter quelques fonctionnalités. Le script de &#8230; <a href="http://voidandany.free.fr/index.php/allumer-eteindre-un-pc-sous-linux-a-distance-scripts/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/tom-z/4159208974/"><img class="alignleft size-medium wp-image-4097" title="4159208974_0c34f5cd54" src="http://voidandany.free.fr/wp-content/uploads/4159208974_0c34f5cd54-199x300.jpg" alt="" width="199" height="300" /></a>J&#8217;ai déjà indiqué comment <a title="Démarrer un PC via le réseau : Wake on LAN" href="http://voidandany.free.fr/index.php/demarrer-un-pc-via-le-reseau-wake-on-lan/">allumer/démarrer un PC à distance via le wakeonlan</a> et comment <a title="Eteindre un PC à distance depuis linux" href="http://voidandany.free.fr/index.php/eteindre-un-pc-a-distance-depuis-linux/">éteindre un PC à distance</a> via ssh.</p>
<p>Pour mon usage personnel j&#8217;ai intégré ces commandes dans des scripts afin d&#8217;y ajouter quelques fonctionnalités.</p>
<p>Le script de démarrage que j&#8217;ai nommé wakeonlan.sh (original) prend en paramètre l&#8217;adresse MAC et l&#8217;adresse IP de la machine à réveiller et permet de faire n essais de réveil espacés de m secondes avant de rendre la main.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># Wake up remote machine</span>
<span style="color: #666666; font-style: italic;"># Usage: $0 mac_adress ip_adress</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Check interval</span>
<span style="color: #007800;">SLEEPTIME</span>=<span style="color: #000000;">60</span>
<span style="color: #666666; font-style: italic;"># Temp directory where to store a file to indicate that the computer was already turn on (used for shutdow)</span>
<span style="color: #007800;">TEMP_DIRECTORY</span>=<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>tmp
<span style="color: #666666; font-style: italic;"># Number of retries</span>
<span style="color: #007800;">RETRY</span>=<span style="color: #000000;">20</span>
&nbsp;
die <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span> <span style="color: #ff0000;">&quot;$@&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$#&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">2</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> die <span style="color: #ff0000;">&quot;Usage : $0 Mac_adress IP_adress&quot;</span>
<span style="color: #007800;">HOST_MAC</span>=<span style="color: #007800;">$1</span>
<span style="color: #007800;">HOST_IP</span>=<span style="color: #007800;">$2</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$directory</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #007800;">$directory</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">ping</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">2</span> <span style="color: #660033;">-w</span> <span style="color: #000000;">15</span> <span style="color: #007800;">$HOST_IP</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
<span style="color: #007800;">RESULT</span>=<span style="color: #007800;">$?</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$RESULT</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</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;Host <span style="color: #007800;">$HOST_IP</span> is already up - exiting&quot;</span>
 <span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #007800;">$TEMP_DIRECTORY</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOST_IP</span>
 <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
<span style="color: #000000; font-weight: bold;">else</span>  
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Trying to wake up <span style="color: #007800;">$HOST_IP</span>&quot;</span>
 <span style="color: #007800;">TEST_NUMBER</span>=<span style="color: #000000;">0</span>
 <span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$RESULT</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">do</span>
  <span style="color: #007800;">TEST_NUMBER</span>=<span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">expr</span> <span style="color: #007800;">$TEST_NUMBER</span> + <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">`</span>
  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Test #<span style="color: #007800;">$TEST_NUMBER</span>)&quot;</span>
  wakeonlan <span style="color: #007800;">$HOST_MAC</span>
  <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #007800;">$SLEEPTIME</span>
  <span style="color: #c20cb9; font-weight: bold;">ping</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">2</span> <span style="color: #660033;">-w</span> <span style="color: #000000;">15</span> <span style="color: #007800;">$HOST_IP</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
  <span style="color: #007800;">RESULT</span>=<span style="color: #007800;">$?</span>
  <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$RESULT</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$TEST_NUMBER</span> <span style="color: #660033;">-eq</span> <span style="color: #007800;">$RETRY</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;<span style="color: #007800;">$RETRY</span> retry unsuccessful - leave&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>
 <span style="color: #000000; font-weight: bold;">done</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>On pourra remarquer que si la machine est déjà allumé, le script crée un fichier portant son adresse IP, ce fichier est utilisé par le script d&#8217;arrêt.</p>
<p>Pour fonctionner ce script à besoin du paquet wakeonlan.</p>
<p>&nbsp;</p>
<p>Ce dernier nommé shutdown.sh (encore original) n&#8217;arrête l&#8217;ordinateur que si ce dernier n&#8217;était pas déjà allumé avant le wakeonlan (état connu par la présence au non du fichier nommé de l&#8217;adresse IP de la machine à réveiller / éteindre)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># Shutdown a remote machine</span>
<span style="color: #666666; font-style: italic;"># Usage: $0 user ip_adress</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Temp directory where to check a file that indicate if the computer doesn't need to shutdown (file created by wakeonlan script)</span>
<span style="color: #007800;">TEMP_DIRECTORY</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>tmp
&nbsp;
die <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
 <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span> <span style="color: #ff0000;">&quot;$@&quot;</span>
 <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$#&quot;</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">2</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">||</span> die <span style="color: #ff0000;">&quot;Usage : $0 user IP_adress&quot;</span>
 <span style="color: #007800;">USER</span>=<span style="color: #007800;">$1</span>
 <span style="color: #007800;">HOST_IP</span>=<span style="color: #007800;">$2</span>
&nbsp;
<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: #007800;">$TEMP_DIRECTORY</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOST_IP</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;The host <span style="color: #007800;">$HOST_IP</span> was already turned on so we don't shutdown it&quot;</span>
 <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$TEMP_DIRECTORY</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$HOST_IP</span>
 <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</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;Shuting down <span style="color: #007800;">$HOST_IP</span>&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">ssh</span> <span style="color: #007800;">$USER</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$HOST_IP</span> <span style="color: #ff0000;">&quot;sudo shutdown -h now&quot;</span></pre></div></div>

<p>Ce script prend en paramètre l&#8217;adresse IP de la machine à éteindre et l&#8217;utilisateur qui  lancera la commande shutdown via SSH.</p>
<p>La machine cible doit avoir sudo (toujours le cas sur Ubuntu) et la commande shutdown ne doit pas demander de mot de passe (paramétré dans le sudoer)</p>
<p>&nbsp;</p>
<p>Image par <a href="http://www.flickr.com/photos/tom-z/">tom.z</a> sous CC BY-NY-SA<strong id="yui_3_3_0_3_1307447442090976"><br />
 </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/allumer-eteindre-un-pc-sous-linux-a-distance-scripts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Déplacer/enlever les téléchargements terminés de Transmission (démon)</title>
		<link>http://voidandany.free.fr/index.php/deplacerenlever-les-telechargements-termines-de-transmission-demon/</link>
		<comments>http://voidandany.free.fr/index.php/deplacerenlever-les-telechargements-termines-de-transmission-demon/#comments</comments>
		<pubDate>Tue, 07 Jun 2011 19:15:02 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[torrent]]></category>
		<category><![CDATA[Transmission]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4054</guid>
		<description><![CDATA[Par défaut une fois les téléchargements terminés Transmission partage indéfiniment le fichier. Pour changer ce comportement il faut utiliser les paramètres ratio-limit (= valeur numérique) et ratio-limit-enabled (= true). Dés lors Transmission partagera jusqu’à ce que le ratio téléchargement / &#8230; <a href="http://voidandany.free.fr/index.php/deplacerenlever-les-telechargements-termines-de-transmission-demon/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Par défaut une fois les téléchargements terminés Transmission partage indéfiniment le fichier.</p>
<p>Pour changer ce comportement il faut utiliser les paramètres ratio-limit (= valeur numérique) et ratio-limit-enabled (= true). Dés lors Transmission partagera jusqu’à ce que le ratio téléchargement / partage défini dans ratio-limit soit atteint. Ensuite le fichier sera mis en état arrêté mais restera dans Transmission.</p>
<p>Le script ci-dessous (remove_completed_torrents.sh qui n&#8217;est pas de moi voir les sources) à exécuter à intervalle régulier via une tache Cron vérifie l&#8217;état des fichiers/torrents et pour ceux qui sont stoppés (dont le ratio de partage est atteint) les déplace dans un autre répertoire (complete dans mon cas, <a href="http://voidandany.free.fr/index.php/installer-et-configurer-transmission-en-tant-que-demon/">voir mon arborescence de fichier</a>) et les supprime de Transmission</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #666666; font-style: italic;"># script to check for complete torrents in transmission folder, then stop and move them</span>
&nbsp;
<span style="color: #007800;">AUTH</span>=<span style="color: #ff0000;">&quot;--netrc=<span style="color: #007800;">$HOME</span>/.netrc&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># either hard-code the MOVEDIR variable here</span>
<span style="color: #007800;">MOVEDIR</span>=<span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>downloads<span style="color: #000000; font-weight: bold;">/</span>torrents<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">complete</span> <span style="color: #666666; font-style: italic;"># the folder to move completed downloads to</span>
<span style="color: #666666; font-style: italic;"># or set MOVEDIR using the first command-line argument</span>
<span style="color: #666666; font-style: italic;"># MOVEDIR=%1</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># use transmission-remote to get torrent list from transmission-remote list</span>
<span style="color: #666666; font-style: italic;"># use sed to delete first / last line of output, and remove leading spaces</span>
<span style="color: #666666; font-style: italic;"># use cut to get first field from each line</span>
<span style="color: #007800;">TORRENTLIST</span>=<span style="color: #000000; font-weight: bold;">`</span>transmission-remote <span style="color: #660033;">--list</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">'1d;$d;s/^ *//'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">--only-delimited</span> <span style="color: #660033;">--delimiter</span>=<span style="color: #ff0000;">&quot; &quot;</span> <span style="color: #660033;">--fields</span>=<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># for each torrent in the list</span>
<span style="color: #000000; font-weight: bold;">for</span> TORRENTID <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #007800;">$TORRENTLIST</span>
    <span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;* * * * * Operations on torrent ID <span style="color: #007800;">$TORRENTID</span> starting. * * * * *&quot;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># check if torrent download is completed</span>
    <span style="color: #007800;">DL_COMPLETED</span>=<span style="color: #000000; font-weight: bold;">`</span>transmission-remote <span style="color: #007800;">$AUTH</span> <span style="color: #660033;">--torrent</span> <span style="color: #007800;">$TORRENTID</span> <span style="color: #660033;">--info</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;Percent Done: 100%&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># check torrent’s current state is Stopped, Finished, or Idle</span>
    <span style="color: #007800;">STATE_STOPPED</span>=<span style="color: #000000; font-weight: bold;">`</span>transmission-remote <span style="color: #660033;">--torrent</span> <span style="color: #007800;">$TORRENTID</span> <span style="color: #660033;">--info</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #ff0000;">&quot;State: Finished&quot;</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
    <span style="color: #666666; font-style: italic;"># if the torrent is Stopped, Finished, or Idle after downloading 100%</span>
    <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;">$DL_COMPLETED</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$STATE_STOPPED</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
        <span style="color: #666666; font-style: italic;"># move the files and remove the torrent from Transmission</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Torrent #<span style="color: #007800;">$TORRENTID</span> is completed.&quot;</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Moving downloaded file(s) to <span style="color: #007800;">$MOVEDIR</span>.&quot;</span>
        transmission-remote <span style="color: #660033;">--torrent</span> <span style="color: #007800;">$TORRENTID</span> <span style="color: #660033;">--move</span> <span style="color: #007800;">$MOVEDIR</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Removing torrent from list.&quot;</span>
        transmission-remote <span style="color: #660033;">--torrent</span> <span style="color: #007800;">$TORRENTID</span> <span style="color: #660033;">--remove</span>
    <span style="color: #000000; font-weight: bold;">else</span>
        <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Torrent #<span style="color: #007800;">$TORRENTID</span> is not completed. Ignoring.&quot;</span>
    <span style="color: #000000; font-weight: bold;">fi</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;* * * * * Operations on torrent ID <span style="color: #007800;">$TORRENTID</span> completed. * * * * *&quot;</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>Ce script utilise la commande transmission-remote du paquet transmission-cli à installer si ce n&#8217;est déjà fait.</p>
<p>Pour certaines opérations transmission-remote à besoin d&#8217;informations de connexion (login / mot de passe), plutôt que d&#8217;utiliser l&#8217;option &#8211;auth j&#8217;ai préféré utiliser l&#8217;option &#8211;netrc, il faut donc créer un fichier .netrc dans le home de votre utilisateur (ou si vous souhaitez le mettre ailleurs il faudra modifier la variable AUTH) et y mettre les informations suivantes :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">machine localhost login [votre login] password [votre mot de passe]</pre></div></div>

<p>Du Fait des information sensible de ce fichier on le protégera en faisant un :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">600</span> ~<span style="color: #000000; font-weight: bold;">/</span>.netrc</pre></div></div>

<p>&nbsp;</p>
<p>Lorsque l&#8217;on exécute le script on aura ce genre de sortie :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">./bin/remove_complet_torrent.sh
 * * * * * Operations on torrent ID 1 starting. * * * * *
 Torrent #1 is completed.
 Moving downloaded file(s) to /data/downloads/torrents/complete.
 localhost:9091 responded: &quot;success&quot;
 Removing torrent from list.
 localhost:9091 responded: &quot;success&quot;
 * * * * * Operations on torrent ID 1 completed. * * * * *</pre></div></div>

<p>&nbsp;</p>
<p><strong>Rque :</strong> dans le script d&#8217;origine les fichiers étaient déplacés dès lors que leur statut était stopped ou idle ou finished. J&#8217;ai supprimé les 2 premiers statuts sinon les fichiers étaient enlevés alors que le ratio de partage n&#8217;était pas atteint&#8230;</p>
<p>&nbsp;</p>
<p><em><span style="text-decoration: underline;"><strong>Sources :</strong></span><br />
 </em></p>
<ul>
<li><a href="http://www.transmissionbt.com/">Transmission</a> : Site officiel </li>
<li><a href="http://1000umbrellas.com/2010/10/05/updated-how-to-automatically-move-and-remove-transmission-daemon-downloads">Updated: How to Automatically Move and Remove Transmission-Daemon Downloads &#8211; 1000umbrellas.com</a>: Source du script de suppression des torrent terminés</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/deplacerenlever-les-telechargements-termines-de-transmission-demon/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSSL puissance et complexité</title>
		<link>http://voidandany.free.fr/index.php/openssl-puissance-et-complexite/</link>
		<comments>http://voidandany.free.fr/index.php/openssl-puissance-et-complexite/#comments</comments>
		<pubDate>Wed, 01 Jun 2011 11:33:52 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=3947</guid>
		<description><![CDATA[Dans le but de mettre une connexion https sur certains de mes sites NGINX je me suis intéressé à la génération du certificat et de la clé nécessaire pour cette opération. Au fil de mes lectures j&#8217;ai pu constater la &#8230; <a href="http://voidandany.free.fr/index.php/openssl-puissance-et-complexite/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/epitti/2585357353/"><img class="size-full wp-image-3981 alignleft" title="Enigma" src="http://voidandany.free.fr/wp-content/uploads/2585357353_9974cf0559_m.jpg" alt="" width="240" height="180" /></a>Dans le but de mettre une <strong>connexion https</strong> sur certains de mes sites NGINX je me suis intéressé à la génération du certificat et de la clé nécessaire pour cette opération.</p>
<p>Au fil de mes lectures j&#8217;ai pu constater la puissance de la <strong>commande openssl </strong>permettant de générer ces fichiers mais aussi la difficulté à en appréhender le fonctionnement.</p>
<p>En effet pour réaliser une même tache il est possible de lancer x commandes différentes avec y options différentes.</p>
<p>De même pour passer un site en https, certains décrivent la création d&#8217;une clé et d&#8217;un certificat auto-signé directement utilisé par le serveur web et d&#8217;autres créent d&#8217;abord une autorité de certification (sous la forme d&#8217;une clé et d&#8217;un certificat auto-signé) qu&#8217;ils utilisent ensuite pour signer un autre certificat qui lui sera paramétré dans le serveur Web.</p>
<p>Ci-dessous les 3 types d&#8217;opérations trouvés :</p>
<ul>
<li>Génération d&#8217;un certificat serveur auto-signé (et de sa clé) pour utilisation directe par le serveur web.</li>
<li>Création d&#8217;une autorité de certification </li>
<li>Génération d&#8217;un certificat serveur et signature de ce dernier pour une autorité de certification </li>
</ul>
<p>Pour chacune des ces opérations j&#8217;ai listés (non exhaustif) les différentes syntaxes trouvées (j&#8217;ai arrangé l&#8217;ordre des paramètres pour faciliter la comparaison)</p>
<p>L&#8217;objectif de cet article n&#8217;est pas de donner un mode opération pour créer un certificat et sa clé (je le ferais dans un autre article) mais il s&#8217;agit de mettre en avant la richesse et la difficulté à comprendre ce qui est fait avec la commande openssl&#8230;</p>
<p>(il s&#8217;agit d&#8217;un travail de débroussaillage pour choisir mon mode opératoire)</p>
<p>&nbsp;</p>
<p>Premier point un peu en dehors du sujet, les extensions des fichiers, on trouve de tout :</p>
<ul>
<li>clé :  key,  pem</li>
<li>demande de certificat : csr, pem</li>
<li>certificat : crt, pem</li>
</ul>
<p>Cela montre sans même rentrer dans le détail des commandes la difficulté à s&#8217;y retrouver&#8230;.</p>
<p>&nbsp;</p>
<h2>Création d&#8217;un certificat serveur auto-signé</h2>
<h3>Solution 1 : Génération de la clé et du certificat auto-signé en 1 seule fois</h3>
<p><a rel="next" href="http://blog.shk-desktop.com/565-nginx-serveur-web-complet-bluffant">nginx: serveur web complet bluffant</a></p>
<pre>openssl req -x509 -nodes -days 365 -newkey rsa:1024 -out /etc/nginx/conf.d/default.pem -keyout /etc/nginx/conf.d/default.key
chmod 440 /etc/nginx/conf.d/default.pem /etc/nginx/conf.d/default.key</pre>
<p><a title="Nginx , SSL et plus encore .." href="http://lindev.fr/index.php?post/2010/04/06/Ngins-%2C-SSL-et-plus-encore-..">Nginx , SSL et plus encore ..</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>certificats
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/</span>certificats
openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-x509</span> <span style="color: #660033;">-nodes</span> <span style="color: #660033;">-out</span> mon-site.fr.crt <span style="color: #660033;">-keyout</span> mon-site.fr.key</pre></div></div>

<p>&nbsp;</p>
<h3>Solution 2 : en plusieurs commandes</h3>
<p><a href="#src8">(8)</a></p>
<p>Génération de la clé, génération de la demande de certificat, suppression de la passphrase et auto-signature du certificat</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /usr/local/nginx/conf</span>
<span style="color: #666666; font-style: italic;"># openssl genrsa -des3 -out server.key 1024</span>
<span style="color: #666666; font-style: italic;"># openssl req -new -key server.key -out server.csr</span>
<span style="color: #666666; font-style: italic;"># cp server.key server.key.org</span>
<span style="color: #666666; font-style: italic;"># openssl rsa -in server.key.org -out server.key</span>
<span style="color: #666666; font-style: italic;"># openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt</span></pre></div></div>

<p>&nbsp;</p>
<h2>Création d&#8217;une autorité de certification</h2>
<p>La création de l&#8217;autorité de certification peut se faire en plus ou moins d&#8217;étapes, avec divers options voici celles trouvées de ci de là.</p>
<h3>Solution 1 : Génération de la clé et du certificat en 1 seule fois</h3>
<p><a href="#src3">(3)</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-x509</span> <span style="color: #660033;">-newkey</span> rsa:<span style="color: #000000;">2048</span> <span style="color: #660033;">-days</span> <span style="color: #000000;">1825</span> <span style="color: #660033;">-keyout</span> private<span style="color: #000000; font-weight: bold;">/</span>cacertkey.pem <span style="color: #660033;">-out</span> cacert.pem</pre></div></div>

<p><a href="#src4">(4)</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-x509</span> <span style="color: #660033;">-newkey</span> rsa:<span style="color: #000000;">2048</span> <span style="color: #660033;">-new</span> <span style="color: #660033;">-days</span> <span style="color: #000000;">3650</span> <span style="color: #660033;">-keyout</span> private<span style="color: #000000; font-weight: bold;">/</span>cacert.key <span style="color: #660033;">-out</span> cacert.pem</pre></div></div>

<p><a href="#src6">(6)</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-x509</span> <span style="color: #660033;">-new</span> <span style="color: #660033;">-days</span> <span style="color: #000000;">1825</span> <span style="color: #660033;">-config</span> openssl.my.cnf <span style="color: #660033;">-extensions</span> v3_ca <span style="color: #660033;">-keyout</span> private<span style="color: #000000; font-weight: bold;">/</span>myca.key <span style="color: #660033;">-out</span> certs<span style="color: #000000; font-weight: bold;">/</span>myca.crt</pre></div></div>

<p>Quelques remarque sur ces syntaxes :</p>
<p>-new est optionnel lorsque -newkey rsa:xxx est spécifié (syntaxe 4) , en en effet ce dernier crée une clé et une demande de certificat tandis que -new ne crée que la demande de certificat.</p>
<p>Dans la syntaxe 6 la clé est générée malgré la seul présence de l&#8217;option -new qui n&#8217;est sensée ne générer que le certificat. Mais en l&#8217;absence du mot-clé -key spécifiant une clé à utiliser pour créer le certificat, une nouvelle clé est générée en utilisant les données du fichier de configuration openssl.conf (ici l&#8217;auteur précise un autre fichier de configuration à utiliser plutôt que celui standard avec l&#8217;option -config)</p>
<p>Enfin il ne s&#8217;agit pas d&#8217;une demande de certificat qui est généré comme indiqué ci-dessus mais directement un certificat grâce à l’adjonction de l&#8217;option -x509</p>
<p>&nbsp;</p>
<h3>Solution 2 : Création de la clé privé puis création du certificat auto-signé</h3>
<p><a href="#src1">(1)</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl genrsa <span style="color: #660033;">-des3</span> <span style="color: #000000;">2048</span> <span style="color: #660033;">-out</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>CA<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>my-ca.key
openssl <span style="color: #660033;">-req</span> x509 <span style="color: #660033;">-key</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>CA<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>my-ca.key <span style="color: #660033;">-days</span> <span style="color: #000000;">3650</span> <span style="color: #000000; font-weight: bold;">&gt;</span> my-ca.crt</pre></div></div>

<p><a href="#src7">(7)</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl genrsa <span style="color: #660033;">-des3</span> <span style="color: #000000;">2048</span> <span style="color: #660033;">-out</span> elao-ca.key
openssl req <span style="color: #660033;">-x509</span> <span style="color: #660033;">-new</span> <span style="color: #660033;">-key</span> elao-ca.key <span style="color: #660033;">-days</span> <span style="color: #000000;">3650</span> <span style="color: #660033;">-out</span> elao-ca.crt</pre></div></div>

<p>La différence entre ces 2 sources réside dans l&#8217;utilisation de 2 commandes différentes.</p>
<ul>
<li>req qui permet de générer un nouveau (-new) certificat auto-signé (-x509)</li>
<li>x509 utilitaire de gestion des certificats (affichage, conversion) utilisé ici pour créer un nouveau certificat (-req)</li>
</ul>
<p>Et de la méthode sortie (option out contre redirection)</p>
<h3>Solution 3 : Création de la clé privé, demande de certificat et signature du certificat</h3>
<p><a href="#src2">(2)</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl genrsa <span style="color: #660033;">-des3</span> <span style="color: #660033;">-out</span> ca.key <span style="color: #000000;">2048</span>
openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-key</span> ca.key <span style="color: #660033;">-out</span> ca.csr
openssl x509 <span style="color: #660033;">-req</span> <span style="color: #660033;">-days</span> <span style="color: #000000;">3650</span> <span style="color: #660033;">-in</span> ca.csr <span style="color: #660033;">-signkey</span> ca.key <span style="color: #660033;">-out</span> ca.crt</pre></div></div>

<p>&nbsp;</p>
<h2>Création d&#8217;un certificat serveur et signature par l&#8217;autorité de certification</h2>
<h3>Solution 1 : Création de la clé, suppression du mot de passe, demande de certificat, signature du certificat avec notre autorité</h3>
<p><a href="#src2">(2)</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl genrsa <span style="color: #660033;">-des3</span> <span style="color: #660033;">-out</span> server.key <span style="color: #000000;">1024</span>
openssl rsa <span style="color: #660033;">-in</span> server.key <span style="color: #660033;">-out</span> server.key
openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-key</span> server.key <span style="color: #660033;">-out</span> server.csr
openssl x509 <span style="color: #660033;">-req</span> <span style="color: #660033;">-in</span> server.csr <span style="color: #660033;">-out</span> server.crt <span style="color: #660033;">-CA</span> ca.crt <span style="color: #660033;">-CAkey</span> ca.key <span style="color: #660033;">-CAcreateserial</span></pre></div></div>

<p><a href="#src7">(7)</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl genrsa <span style="color: #660033;">-des3</span> <span style="color: #660033;">-out</span> elao-server.key <span style="color: #000000;">1024</span>
openssl rsa <span style="color: #660033;">-in</span> elao-server.key <span style="color: #660033;">-out</span> elao-server.key.insecure
openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-key</span> elao-server.key <span style="color: #660033;">-out</span> elao-server.csr
openssl x509 <span style="color: #660033;">-req</span> <span style="color: #660033;">-in</span> elao-server.csr <span style="color: #660033;">-out</span> elao-server.crt <span style="color: #660033;">-sha1</span> <span style="color: #660033;">-CA</span> elao-ca.crt <span style="color: #660033;">-CAkey</span> elao-ca.key <span style="color: #660033;">-CAcreateserial</span> <span style="color: #660033;">-days</span> <span style="color: #000000;">3650</span></pre></div></div>

<p>L&#8217;option -CAcreateserial n&#8217;est nécessaire que lors de la signature du premier certificat par notre autorité de certification, elle peut même ne pas être nécessaire du tout si on a créé préalablement le fichier paramétré sous le nome database dans le fichier openssl.conf.</p>
<p>&nbsp;</p>
<h3>Solution 2 : Création de la clé sans mot de passe,  demande de certificat, signature du certificat avec notre autorité</h3>
<p><a href="#src1">(1)</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl genrsa <span style="color: #000000;">1024</span> <span style="color: #660033;">-out</span> www.test.net.key
openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-key</span> www.test.net.key <span style="color: #660033;">-out</span> www.test.net.csr
openssl ca <span style="color: #660033;">-in</span> www.test.net.csr <span style="color: #660033;">-out</span> www.test.net.crt</pre></div></div>

<p>Le fait de ne pas mettre l&#8217;option -des3 génère une clé directement sans mot de passe</p>
<p>La signature se fait avec la commande ca au lieu de x509, mais je ne comprends pas pas où l&#8217;on spécifie que l&#8217;on doit utiliser notre autorité de certification, son certificat et sa clé (my-ca.crt et my-ca.key, voir ci-dessus solution 2)</p>
<p>Pour moi avec cette méthode le certificat généré est auto-signé ce qui n&#8217;est pas le but recherché.</p>
<p>&nbsp;</p>
<h3>Solution 3 : Création de la clé et de la demande de certificat, signature du certificat avec notre autorité</h3>
<p><a href="#src3">(3)</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-newkey</span> rsa:<span style="color: #000000;">2048</span> <span style="color: #660033;">-keyout</span> private<span style="color: #000000; font-weight: bold;">/</span>server.key <span style="color: #660033;">-out</span> server-req.pem
openssl ca <span style="color: #660033;">-in</span> serveur-req.pem <span style="color: #660033;">-out</span> signedcerts<span style="color: #000000; font-weight: bold;">/</span>serveur-cert.pem <span style="color: #660033;">-cert</span> cacert.pem <span style="color: #660033;">-keyfile</span> private<span style="color: #000000; font-weight: bold;">/</span>cacertkey.pem <span style="color: #660033;">-days</span> <span style="color: #000000;">365</span></pre></div></div>

<p><a href="#src6">(6)</a></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl req <span style="color: #660033;">-new</span> <span style="color: #660033;">-keyout</span> private<span style="color: #000000; font-weight: bold;">/</span>server.key <span style="color: #660033;">-out</span> server.csr <span style="color: #660033;">-config</span> openssl.my.cnf <span style="color: #660033;">-nodes</span> <span style="color: #660033;">-days</span> <span style="color: #000000;">365</span>
openssl ca <span style="color: #660033;">-infiles</span> server.csr <span style="color: #660033;">-out</span> certs<span style="color: #000000; font-weight: bold;">/</span>server.crtc <span style="color: #660033;">-config</span> openssl.my.cnf <span style="color: #660033;">-policy</span> policy_anything</pre></div></div>

<p>Concernant les commande de génération de al clé et de la demande de certificat :</p>
<ul>
<li>-new ne  crée que la clé sauf si on n&#8217;utilise pas l&#8217;option -key auquel cas la clé est aussi générée</li>
<li>-newkey rsa:xxx crée une clé et un certificat</li>
<li>Ce sont des demandes de certificat qui sont générés (contrairement aux commandes que l&#8217;on a utilisé pour la création de l&#8217;autorité de certification solution 1) car nous n&#8217;avons pas l&#8217;option -x509</li>
<li>L&#8217;option -nodes permet d&#8217;indiquer que la clé qui doit être générée ne doit pas être protégée par un mot de passe (passphrase)</li>
</ul>
<p>Enfin les commande de signature des certificats doivent pouvoir être simplifiées comme dans la solution 2 (juste -in et -out)</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><em><strong>Sources :</strong></em></span></p>
<ol>
<li><a name="src1"></a><a rel="prev" href="http://www.404blog.net/?p=122">Openssl – création d’une autorité de certification</a> et <a href="http://www.404blog.net/?p=165">Openssl – générer et signer une demande de signature(CSR) | 404Blog</a></li>
<li><a name="src2"></a><a title="Permalink to Autorité de certification openssl" href="http://linux-attitude.fr/post/autorite-de-certification-openssl">Autorité de certification openssl</a> et <a title="Permalink to Autorité de certification, le retour" href="http://linux-attitude.fr/post/autorite-de-certification-le-retour">Autorité de certification, le retour</a></li>
<li><a name="src3"></a><a href="http://www.k-tux.com/openssl-creation-et-mise-en-place-dune-pki/2">OpenSSL : création et mise en place d’une PKI &#8211; K-Tux</a></li>
<li><a name="src4"></a><a href="http://www.systemx.fr/linux/openssl/openssl-p.html">Openssl pratique</a></li>
<li><a name="src5"></a><a title="Nginx , SSL et plus encore .." href="http://lindev.fr/index.php?post/2010/04/06/Ngins-%2C-SSL-et-plus-encore-..">Nginx , SSL et plus encore ..</a></li>
<li><a name="src6"></a><a title="Be your own Certificate Authority (CA)" rel="bookmark" href="http://www.g-loaded.eu/2005/11/10/be-your-own-ca/">Be your own Certificate Authority (CA)</a></li>
<li><a name="src7"></a><a title="Permanent Link to Créer une autorité de certification et des certificats SSL auto-signés" rel="bookmark" href="http://www.elao.org/linux/creer-une-autorite-de-certification-et-des-certificats-ssl-auto-signes.html">Créer une autorité de certification et des certificats SSL auto-signés</a></li>
<li><a name="src8"></a><a href="http://www.cyberciti.biz/tips/linux-unix-bsd-nginx-webserver-security.html">Top 20 Nginx WebServer Best Security Practices</a></li>
</ol>
<p>A voir pour les extensions de  fichier :</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/X.509">http://en.wikipedia.org/wiki/X.509</a></li>
<li><a href="http://marc.info/?l=openssl-users&amp;m=128008468329998&amp;w=2">http://marc.info/?l=openssl-users&amp;m=128008468329998&amp;w=2</a></li>
<li><a title="Be your own Certificate Authority (CA)" rel="bookmark" href="http://www.g-loaded.eu/2005/11/10/be-your-own-ca/">Be your own Certificate Authority (CA)</a></li>
</ul>
<p>Source d&#8217;info sur les commandes les pages MAN (par contre il faut s&#8217;y retrouver avec toutes les options !!)</p>
<ul>
<li><a href="http://www.openssl.org/docs/apps/req.html#">req</a></li>
<li><a href="http://www.openssl.org/docs/apps/x509.html#">x509</a></li>
<li><a href="http://www.openssl.org/docs/apps/openssl.html">openssl</a></li>
<li><a href="http://www.openssl.org/docs/apps/ca.html#">ca</a></li>
<li><a href="http://www.openssl.org/docs/apps/genrsa.html#">genrsa</a></li>
</ul>
<p>Image par <a href="http://www.flickr.com/photos/epitti/">Erik Pitti</a> (photo de la machine Enigma utilisé par les Allemands lors de la 2de guerre mondial pour crypter leur communication)</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/openssl-puissance-et-complexite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Limiter l&#8217;usage de la bande passante par Transmission automatiquement</title>
		<link>http://voidandany.free.fr/index.php/limiter-lusage-de-la-bande-passante-par-transmission-automatiquement/</link>
		<comments>http://voidandany.free.fr/index.php/limiter-lusage-de-la-bande-passante-par-transmission-automatiquement/#comments</comments>
		<pubDate>Tue, 31 May 2011 14:12:40 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[torrent]]></category>
		<category><![CDATA[Transmission]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4055</guid>
		<description><![CDATA[Avec Transmission il est possible de gérer 2 modes de vitesse (normal et alternatif : alt)  en téléchargement et en upload et de planifier selon les heures et jour la bascule entre ces 2 modes (voir le paragraphe Vitesse de &#8230; <a href="http://voidandany.free.fr/index.php/limiter-lusage-de-la-bande-passante-par-transmission-automatiquement/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/15535329@N08/4539064129"><img class="alignleft size-medium wp-image-4079" title="4539064129_50a2c4c888" src="http://voidandany.free.fr/wp-content/uploads/4539064129_50a2c4c888-300x214.jpg" alt="" width="300" height="214" /></a>Avec <strong>Transmission </strong>il est possible de gérer <strong>2 modes de vitesse</strong> (normal  et alternatif : alt)  en téléchargement et en upload et de planifier selon les heures et jour la bascule entre ces 2 modes (voir le paragraphe Vitesse de mon article <a title="Lien permanent vers Installer et configurer Transmission en tant que démon" rel="bookmark" href="../index.php/installer-et-configurer-transmission-en-tant-que-demon/">Installer et configurer Transmission en tant que démon</a>) La bascule entre ces 2 modes est aussi paramétrable selon les jours et les heures.</p>
<p>Bien que très pratique ce mécanisme n&#8217;est pas optimal en effet Transmission passe d&#8217;un mode à un autre pour une plage horaire et certains jours données or mon besoin est que Transmission passe du mode normal (sans limitation) au mode alternatif (vitesses limités, mode turtle/tortue) <strong>uniquement si un des mes PC est allumé,</strong> préservant ainsi ma bande passante pour pouvoir avoir un usage normal d&#8217;Internet.</p>
<p>Et dès que tous les PCs sont éteint on re-bascule en mode normal.</p>
<p>Voici le script que j&#8217;ai fait :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${0}</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #c20cb9; font-weight: bold;">read</span> HOST_IP;
<span style="color: #000000; font-weight: bold;">do</span>
    <span style="color: #c20cb9; font-weight: bold;">ping</span> <span style="color: #660033;">-c</span> <span style="color: #000000;">5</span> <span style="color: #660033;">-w</span> <span style="color: #000000;">15</span> <span style="color: #007800;">$HOST_IP</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
    <span style="color: #007800;">RESULT</span>=<span style="color: #007800;">$?</span>
&nbsp;
        <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$RESULT</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</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;">break</span>
        <span style="color: #000000; font-weight: bold;">fi</span>
 <span style="color: #000000; font-weight: bold;">done</span> <span style="color: #000000; font-weight: bold;">&lt;</span> alt_speed_IP
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$RESULT</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</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;At least 1 computer on, set alt speed&quot;</span>
    transmission-remote <span style="color: #660033;">-as</span>
<span style="color: #000000; font-weight: bold;">else</span>  
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;no computer on, max speed&quot;</span>
    transmission-remote <span style="color: #660033;">-AS</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>Ce script attend un fichier alt_speed_IP contenant un liste d&#8217;adresse IP à surveiller (1 par ligne)</p>
<p>Pour chacun des adresses IP il essai de les pinguer, si au moins une adresse répond c&#8217;est qu&#8217;au moins un ordinateur de &laquo;&nbsp;bureau&nbsp;&raquo; est allumé et qu&#8217;il faut mettre Transmission en mode tortue pour préserver la bande passante.</p>
<p>Si au terme du ping de toutes les adresse du fichier alt_speed_IP aucun ordinateur n&#8217;a répondu Transmission peut repasser en mode normal.</p>
<p>Le changement de mode se fait avec la commande tranmission-remote du paquet transmission-cli&#8230;</p>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><em><strong>Source : </strong></em></span></p>
<p>Image par <a href="http://www.flickr.com/photos/photo-impressionism/">Stephen D&#8217;Agostino &#8211; its time to organize a show</a> sous CC BY-NC-ND</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/limiter-lusage-de-la-bande-passante-par-transmission-automatiquement/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Logs NGINX et Logrotate</title>
		<link>http://voidandany.free.fr/index.php/logs-nginx-et-logrotate/</link>
		<comments>http://voidandany.free.fr/index.php/logs-nginx-et-logrotate/#comments</comments>
		<pubDate>Tue, 31 May 2011 13:38:56 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[logrotate]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4009</guid>
		<description><![CDATA[J&#8217;ai déjà parlé de NGINX, ce formidable serveur web rapide et surtout léger installé sur mon Dockstar. J&#8217;ai aussi installé logrotate sur mon serveur, outil qui permet de faire tourner et d&#8217;archiver les fichiers de logs Pour que les 2 &#8230; <a href="http://voidandany.free.fr/index.php/logs-nginx-et-logrotate/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>J&#8217;ai déjà parlé de <a href="http://voidandany.free.fr/index.php/tag/nginx/">NGINX</a>, ce formidable serveur web rapide et surtout léger installé sur mon <a title="Marques-pages : Un mini serveur le Seagate Dockstar" href="http://voidandany.free.fr/index.php/marques-pages-un-mini-serveur-le-seagate-dockstar/">Dockstar</a>.</p>
<p>J&#8217;ai aussi<a href="http://voidandany.free.fr/index.php/configuration-de-base-du-dockstar/"> installé logrotate sur mon serveur</a>, outil qui permet de faire tourner et d&#8217;archiver les fichiers de logs</p>
<p>Pour que les 2 fonctionnent ensemble il  faut ajouter une configuration dans logrotate pour qu&#8217;il prennent en compte NGINX, ce dernier n&#8217;étant pas reconnu  par logrotate lors de son installation.</p>
<p>Il faut donc créer un fichier nginx sous /etc/logrotate.d/ et y coller ceci (à adapter) :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/var/log/nginx/*.log {
	#rotate the logfile(s) daily
	daily
	# adds extension like YYYYMMDD instead of simply adding a number
	dateext
	# If log file is missing, go on to next one without issuing an error msg
	missingok
	# Save logfiles for the last 10 days
	rotate 10
	# Old versions of log files are compressed with gzip
	compress
	# Postpone compression of the previous log file to the next rotation cycle
	delaycompress
	# Do not rotate the log if it is empty
	notifempty
	#after logfile is rotated and nginx.pid exists, send the USR1 signal
	postrotate
		[ ! -f /var/run/nginx.pid  ] || kill -USR1 `cat /var/run/nginx.pid`
	endscript
}</pre></div></div>

<p>C&#8217;est la directive postrotate qui est spécifique à NGINX et qui est  importante : une fois les log tournées / archivées on lance un signal  d&#8217;arrêt à NGINX pour qu&#8217;il recrée les fichiers de logs.</p>
<p>On testera la configuration avec la commande :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> logrotate <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>logrotate.d<span style="color: #000000; font-weight: bold;">/</span>nginx</pre></div></div>

<p>Voila pour le paramétrage de base.</p>
<p>&nbsp;</p>
<p>J&#8217;y ai personnellement ajouté l&#8217;appel à un script de mon crû avant que logrotate ne fasse tourner les logs.</p>
<p>Ce script analyse les logs d&#8217;accès de NGINX et effectue une petite analyse des IPs et des utilisateurs qui se connectent :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">dirname</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">${0}</span>&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">log</span>=<span style="color: #7a0874; font-weight: bold;">&#91;</span>nom et chemin <span style="color: #c20cb9; font-weight: bold;">du</span> fichier log<span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">date</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$log</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>  <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$log</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #c20cb9; font-weight: bold;">file</span> <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>nginx<span style="color: #000000; font-weight: bold;">/*</span>access.log
<span style="color: #000000; font-weight: bold;">do</span>
     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #800000;">${file}</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$log</span>
&nbsp;
     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Nb accès par IP&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$log</span>
     <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #800000;">${file}</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $1}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">uniq</span> -c  <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$log</span>
     <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">'s/\(81..125.231.15$\)/\1 : Travail/'</span> <span style="color: #007800;">$log</span>
     <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-i</span> <span style="color: #ff0000;">'s/\(89.5.45.52$\)/\1 : Maison/'</span>  <span style="color: #007800;">$log</span>
&nbsp;
     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>Nb accès par utilisateur&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$log</span>
     <span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #800000;">${file}</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $3}'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">uniq</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$log</span>
&nbsp;
     <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>-------------------------<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$log</span>
<span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>&nbsp;</p>
<p>qui produit ce genre de rapport :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">jeudi 14 avril 2011, 13:35:21 (UTC+0200)
&nbsp;
/var/log/nginx/access.log
&nbsp;
Nb accès par IP
1 121.162.199.215
6 192.168.1.100 : Maison
1 208.80.194.29
1 222.187.222.26
&nbsp;
Nb accès par utilisateur
4 -
5 mon_utilisateur
&nbsp;
-------------------------
/var/log/nginx/xxxx.access.log
&nbsp;
Nb accès par IP
250 125.54.42.12
&nbsp;
Nb accès par utilisateur
250 utilisateur2
-------------------------
/var/log/nginx/yyyy.access.log
Nb accès par IP
Nb accès par utilisateur
-------------------------</pre></div></div>

<p>Pour prendre en compte ce script et le faire exécuter j&#8217;ai ajouté les directives suivantes au fichier nginx de logrotate  :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># scripts are runned only once
sharedscripts
&nbsp;
# before rotation log are analyzed
prerotate
    /chemin/statistiques_nginx.sh
endscript</pre></div></div>

<p>Ainsi avant de faire tourner les logs NGINX logrotate exécute une seule fois le script que j&#8217;ai nommé statistiques_nginx.sh. Ce dernier produit un rapport que je m’envoie par email (via un autre script)</p>
<p>&nbsp;</p>
<p>A noter qu&#8217;il existe des solutions clé en main et beaucoup plus  évoluées, complètes d&#8217;analyse et de statistiques pour les logs des  serveurs Web (voir dans les sources), mais cela me semble un peu trop  pour mon usage.</p>
<p>&nbsp;</p>
<p><em><strong>Sources : </strong></em></p>
<p>Logrotate :</p>
<ul>
<li><a href="http://serverfault.com/questions/248096/nginx-logrotate-config">nginx logrotate config</a></li>
<li><a href="https://wincent.com/wiki/nginx_log_rotation">nginx log rotation</a></li>
<li><a href="http://ahabdo.wordpress.com/2010/10/16/how-to-configure-logrotate-nginx-log-in-freebsd-and-linux-machine/">How To Configure Logrotate Nginx Log in FreeBSD and Linux Machine.</a></li>
</ul>
<p>Autres solutions de rotation des logs :</p>
<ul>
<li><a href="http://serverfault.com/questions/65118/proper-way-to-rotate-nginx-logs">Proper way to rotate Nginx logs</a></li>
<li><a href="http://pjkh.com/articles/2007/03/15/nginx-and-cronolog/">Nginx and Cronolog</a></li>
</ul>
<p>Script analyse des logs :</p>
<ul>
<li><a href="http://fak3r.com/geek/howto-sort-web-server-logs-to-find-top-users/">HOWTO sort web-server logs to find top users</a></li>
<li><a href="http://bash.cyberciti.biz/web-server/find-top-ipaddress-hitting-webserver/">Shell Script List All Top IP Address Accessing Apache / Lighttpd</a></li>
</ul>
<p>Analyse des logs plus évoluées :</p>
<ul>
<li><a title="Permanent Link to Analysis access logs of Nginx by awstats" rel="bookmark" href="http://www.goitworld.com/analysis-access-logs-of-nginx-by-awstats/">Analysis access logs of Nginx by awstats</a></li>
<li><a title="Permanent Link to nginx log rotation and analysis with webalizer" rel="bookmark" href="http://www.edoxy.net/weblog/2009/08/nginx-log-rotation-and-analysis-with-webalizer/">nginx log rotation and analysis with webalizer</a></li>
<li><a href="http://www.w3perl.com/">w3perl</a></li>
<li><a href="http://awstats.sourceforge.net/">awstats</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/logs-nginx-et-logrotate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Utiliser des listes de blocage personnalisées (blocklist) avec le démon Transmission</title>
		<link>http://voidandany.free.fr/index.php/utiliser-des-listes-de-blocage-personnalisees-blocklist-avec-le-demon-transmission/</link>
		<comments>http://voidandany.free.fr/index.php/utiliser-des-listes-de-blocage-personnalisees-blocklist-avec-le-demon-transmission/#comments</comments>
		<pubDate>Thu, 26 May 2011 13:04:02 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[torrent]]></category>
		<category><![CDATA[Transmission]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4038</guid>
		<description><![CDATA[Une blocklist est une liste d&#8217;adresse IP dans un format pré-défini pouvant être utilisée par divers logiciels (notamment les clients torrents) pour bloquer l&#8217;accès du dit logiciel aux utilisateurs des ces IPs (= liste noire d&#8217;adresses IP). Transmission supporte évidemment &#8230; <a href="http://voidandany.free.fr/index.php/utiliser-des-listes-de-blocage-personnalisees-blocklist-avec-le-demon-transmission/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flickr.com/photos/louect/4796593945/"><img class="alignleft size-full wp-image-4039" title="4796593945_03585924eb" src="http://voidandany.free.fr/wp-content/uploads/4796593945_03585924eb.jpg" alt="" width="263" height="350" /></a>Une <strong>blocklist </strong>est une liste d&#8217;adresse IP dans un format pré-défini pouvant être utilisée par divers logiciels (notamment les clients torrents) pour bloquer l&#8217;accès du dit logiciel aux utilisateurs des ces IPs (<strong>= liste noire d&#8217;adresses IP</strong>).</p>
<p>Transmission supporte évidemment les blocklists, mais la liste utilisée n&#8217;est pas paramétrable, Transmission télécharge une liste de niveau 1 sur son <a href="http://update.transmissionbt.com/level1.gz">URL mirroir</a></p>
<p>De plus la mise à jour de la liste n&#8217;est pas automatique. Sur le client lourd (transmission GTK) il existe un bouton permettant de mettre à jour la liste, mais évidemment sur le démon il n&#8217;ya pas de bouton.</p>
<p>Nous allons donc voir comment dans un premier temps <strong>mettre à jour la liste lorsque l&#8217;on utilise le démon</strong> puis ensuite comment<strong> utiliser des listes personnalisées </strong>et les mettre à jour automatiquement&#8230;</p>
<p>Dans les 2 cas il faut que le paramètre blocklist-enabled soit positionné à true dans votre fichier settings.json</p>
<p>&nbsp;</p>
<p>Pour mettre à jour la liste de blocage Transmission lorsqu&#8217;on utilise le démon il faut passer par le commande transmission-remote du paquet transmission-cli :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#! /bin/sh</span>
<span style="color: #007800;">username</span>=<span style="color: #ff0000;">'username'</span>
<span style="color: #007800;">password</span>=<span style="color: #ff0000;">'password'</span>
transmission-remote <span style="color: #660033;">--auth</span> <span style="color: #007800;">$username</span>:<span style="color: #007800;">$password</span> <span style="color: #660033;">--blocklist-update</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</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>transmission-daemon restart</pre></div></div>

<p>A la fin on re-démarre le démon pour qu&#8217;il prenne ne compte la nouvelle liste, si comme moi vous utilisez sudo et que vous exécutez ce script avec votre utilisateur il faudra autoriser la commande de re-démarrage dans votre sudoer (voir en fin de éème solution)</p>
<p>Il suffira alors de mettre ce script dans une tache cron et le tour est joué&#8230;</p>
<p><strong>Rque :</strong> comme ce script contient les login et mot de passe en clair de transmission RPC il conviendra de restreindre ses droits d&#8217;accès (chmod 700 script.sh)</p>
<p>&nbsp;</p>
<p>Je n&#8217;ai pas testé ce script puisque j&#8217;utilise la deuxième solution qui consiste à gérer la <strong>mise à jour et l&#8217;origine de la liste</strong> de blocage :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># Télécharge des blockslist à partir de http://iblocklist.com/lists.php</span>
<span style="color: #666666; font-style: italic;"># et les intégre dans le répertoire de Transmission</span>
<span style="color: #666666; font-style: italic;"># répertoire de travail</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># répertoire de travail / temporaire</span>
<span style="color: #007800;">travail</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>blocklists
<span style="color: #666666; font-style: italic;"># réperoire où Transmission stock les fichiers blocklist</span>
<span style="color: #007800;">transmissionBlocklist</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>.config<span style="color: #000000; font-weight: bold;">/</span>transmission-daemon<span style="color: #000000; font-weight: bold;">/</span>blocklists
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;******** Compilation d'une Bloclist pour Transmissionbt ***********&quot;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">$travail</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: #660033;">-e</span> <span style="color: #ff0000;">&quot;Répertoire de travail <span style="color: #007800;">$travail</span> &quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #007800;">$travail</span>
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$travail</span><span style="color: #000000; font-weight: bold;">/*</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#récupération des fichiers http://iblocklist.com/lists.php</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>********* Téléchargements des listes de blocage *******************&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>list.iblocklist.com<span style="color: #000000; font-weight: bold;">/</span>?<span style="color: #007800;">list</span>=bt_level1 <span style="color: #660033;">-O</span> <span style="color: #007800;">$travail</span><span style="color: #000000; font-weight: bold;">/</span>bt_level1.gz
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>list.iblocklist.com<span style="color: #000000; font-weight: bold;">/</span>?<span style="color: #007800;">list</span>=bt_level2 <span style="color: #660033;">-O</span> <span style="color: #007800;">$travail</span><span style="color: #000000; font-weight: bold;">/</span>bt_level2.gz
&nbsp;
<span style="color: #666666; font-style: italic;">#décompression</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>********* Décompression des listes téléchargées *******************&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">gunzip</span> <span style="color: #660033;">-v</span> <span style="color: #007800;">$travail</span><span style="color: #000000; font-weight: bold;">/*</span>.gz
&nbsp;
<span style="color: #666666; font-style: italic;">#concaténer les fichiers</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>********* Création d'une seule liste sans redondance des données **&quot;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;traitement en cours ...Patientez SVP...&quot;</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #007800;">$travail</span>
<span style="color: #007800;">list1</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">ls</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #660033;">-u</span> <span style="color: #007800;">$list1</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> blocklist <span style="color: #000000; font-weight: bold;">&amp;&amp;</span>
<span style="color: #7a0874; font-weight: bold;">cd</span> -
&nbsp;
<span style="color: #666666; font-style: italic;">#Déplacement du fichier blocklist dans le répertoire de Transmission</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>********* Déplacement de la Blocklist *****************************&quot;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$transmissionBlocklist</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: #660033;">-e</span> <span style="color: #ff0000;">&quot;Copie de sauvegarde de l'ancien fichier&quot;</span>
    <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$transmissionBlocklist</span><span style="color: #000000; font-weight: bold;">/</span>blocklist <span style="color: #007800;">$travail</span><span style="color: #000000; font-weight: bold;">/</span>blocklist.bak
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;Déplacement du nouveau fichier dans le répertoire de Transmission&quot;</span>
    <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$travail</span><span style="color: #000000; font-weight: bold;">/</span>blocklist <span style="color: #007800;">$transmissionBlocklist</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Rechargement de Transmission</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;Rechargement de la configuration de Transmission&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</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>transmission-deamon reload
<span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #007800;">$transmissionBlocklist</span><span style="color: #000000; font-weight: bold;">/</span>blocklist <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</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: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>*********** Opération terminée ************************************&quot;</span>
<span style="color: #000000; font-weight: bold;">else</span>
    <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span> *** KO **** !! Le fichier bloklist est vide !! *** KO *** &quot;</span>
<span style="color: #000000; font-weight: bold;">fi</span></pre></div></div>

<p>Le script télécharge les listes voulues (ici les niveaux 1 et 2), les dézippe et les concatène en excluant les doublons, la liste résultante est ensuite copié dans le répertoire utilisé par Transmission et le démon est rechargé.</p>
<p>Comme indiqué précédemment pour que la commande de rechargement du démon puisse être exécuté via sudo sans demande de mot de passe il faut modifier le sudoer ce qui se fait en lançant la commande</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> visudo</pre></div></div>

<p>&nbsp;</p>
<p>Et en ajoutant une ligne du type :</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mon_utilisateur ALL= NOPASSWD: /etc/init.d/transmission-daemon</pre></div></div>

<p>&nbsp;</p>
<p>De même que pour la première solution on mettra ce script dans une tache cron (à la semaine par exemple)</p>
<p>&nbsp;</p>
<p>Pour finir quelques mots sur les listes de blocage.</p>
<p>Transmission supporte les formats P2P Plaintext (Nom:IP_Début:IP_Fin) et DAT (format binaire non éditable)</p>
<p>On pourra trouver des listes de blocage P2P sur les sites suivants :</p>
<ul>
<li><a href="http://tbg.iblocklist.com/">http://tbg.iblocklist.com/</a></li>
<li> <a href="http://iblocklist.com/lists.php">http://iblocklist.com/</a></li>
</ul>
<p>On recommande la liste de iblocklist de <a href="http://www.iblocklist.com/list.php?list=bt_level1">niveau 1</a> (IP impliqués dans la lutte contre le piratage)  en général et la liste de <a href="http://www.iblocklist.com/list.php?list=bt_level2">niveau 2 </a>(IP des sociétés en général, des laboratoires et proxy) éventuellement.</p>
<p>&nbsp;</p>
<p><em>Edit : </em>31/05/2011 : correction la variable d&#8217;environnement $USER n&#8217;est pas connu dans CRON, utilisation de $HOME à la place (mieux en plus)</p>
<p><span style="text-decoration: underline;"><em><strong>Sources : </strong></em></span></p>
<ul>
<li><a href="http://papillon-butineur.blogspot.com/2010/08/blocklists-avec-transmissionrecopie.html">Papillon-butineur: Blocklists avec Transmission</a> : source du script initial que j&#8217;ai modifié</li>
<li><a href="https://trac.transmissionbt.com/wiki/Blocklists">Blocklists – Transmission</a> : documentation officielle sur les blocklist</li>
<li><a href="https://trac.transmissionbt.com/wiki/Scripts/BlockListUpdater">Scripts/BlockListUpdater – Transmission</a> : script de mise à jour des blocklist (beaucoup moins évolué que celui de papillon-butineur)</li>
<li><a href="http://blog.shvetsov.com/2010/09/automatically-update-transmission-block.html">Random Stuff: Automatically update Transmission&#8217;s block list </a>: Script moins complet</li>
<li><a href="https://forum.transmissionbt.com/viewtopic.php?f=2&amp;t=9790&amp;sid=669acbc24cad9feef9355797fbf358fc">transmission-remote and blocklist-update</a> : script pour mettre à jour la blocklist</li>
</ul>
<p>Image par <a href="http://www.flickr.com/photos/louect/">Lou Ect</a> sous CC BY-NC-ND<strong><br />
 </strong></p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/utiliser-des-listes-de-blocage-personnalisees-blocklist-avec-le-demon-transmission/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ignorer le message &#171;&#160;impossible de préserver l&#8217;appartenance pour xxx : Permission non accordée&#160;&#187;</title>
		<link>http://voidandany.free.fr/index.php/ignorer-le-message-impossible-de-preserver-lappartenance-pour-xxx-permission-non-accordee/</link>
		<comments>http://voidandany.free.fr/index.php/ignorer-le-message-impossible-de-preserver-lappartenance-pour-xxx-permission-non-accordee/#comments</comments>
		<pubDate>Wed, 25 May 2011 20:01:31 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[Brèves]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[bash]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4044</guid>
		<description><![CDATA[Si vous utilisez la commande mv pour déplacer un fichier d&#8217;un système de fichiers Linux vers un système de fichiers Windows (FAT par exemple) vous aurez un message du type : mv: impossible de préserver l'appartenance pour « nom_du_fichier »: &#8230; <a href="http://voidandany.free.fr/index.php/ignorer-le-message-impossible-de-preserver-lappartenance-pour-xxx-permission-non-accordee/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Si vous utilisez la commande mv pour déplacer un fichier d&#8217;un système de fichiers Linux vers un système de fichiers Windows (FAT par exemple) vous aurez un message du type :</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">mv: impossible de préserver l'appartenance pour « nom_du_fichier »: Permission non accordée</pre></div></div>

</p>
<p>Je n&#8217;ai pas trouvé d&#8217;options dans le man de mv pour ignorer les permissions lors du déplacement et avoir ces erreurs dans les logs de mon script m&#8217;embêtait un peu, voici donc la solution trouvée :</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mv</span> nom_du_fichier destination <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #c20cb9; font-weight: bold;">pr</span>éserver</pre></div></div>

</p>
<p>Je re-dirige la sortie des erreurs vers la sortie standard (2&gt;&amp;1) et j&#8217;ignore les messages contenant le mot-clé &laquo;&nbsp;préserver&nbsp;&raquo;</p>
<p>Ce n&#8217;est pas l&#8217;idéal mais c&#8217;est la seule solution que j&#8217;ai trouvé pour l&#8217;instant (si quelqu&#8217;un connait mieux je suis preneur)</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/ignorer-le-message-impossible-de-preserver-lappartenance-pour-xxx-permission-non-accordee/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installer et configurer Transmission en tant que démon</title>
		<link>http://voidandany.free.fr/index.php/installer-et-configurer-transmission-en-tant-que-demon/</link>
		<comments>http://voidandany.free.fr/index.php/installer-et-configurer-transmission-en-tant-que-demon/#comments</comments>
		<pubDate>Wed, 25 May 2011 15:13:05 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[torrent]]></category>
		<category><![CDATA[Transmission]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4022</guid>
		<description><![CDATA[Je fais les choses à l&#8217;envers, présentant une configuration précise de Transmission (Exécuter Transmission avec l’utilisateur de son choix et déplacer son fichier de configuration vers $HOME) avant son installation et sa configuration générique, mais bon&#8230; Le but est ici &#8230; <a href="http://voidandany.free.fr/index.php/installer-et-configurer-transmission-en-tant-que-demon/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://voidandany.free.fr/wp-content/uploads/5709517594_6fceb20d15.jpg"><img class="alignleft size-medium wp-image-4013" title="Transmission" src="http://voidandany.free.fr/wp-content/uploads/5709517594_6fceb20d15-199x300.jpg" alt="" width="199" height="300" /></a>Je fais les choses à l&#8217;envers, présentant une configuration précise de Transmission (<a title="Lien permanent vers Exécuter Transmission avec l’utilisateur de son choix et déplacer son fichier de configuration vers $HOME" rel="bookmark" href="../index.php/executer-transmission-avec-lutilisateur-de-son-choix-et-deplacer-son-fichier-de-configuration-vers-home/">Exécuter Transmission avec l’utilisateur de son choix et déplacer son fichier de configuration vers $HOME</a>) avant son installation et sa configuration générique, mais bon&#8230;</p>
<p>Le but est ici d&#8217;installer le client torrent Transmission et de le paramétrer sur une machine headless (pas d&#8217;interface graphique, pas d&#8217;écran, accessible par SSH) comme le <a title="Marques-pages : Un mini serveur le Seagate Dockstar" href="http://voidandany.free.fr/index.php/marques-pages-un-mini-serveur-le-seagate-dockstar/">Dockstar</a></p>
<p>&nbsp;</p>
<h2>Installation</h2>
<p>Pour installer Transmission, simple comme d&#8217;habitude :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> transmission-daemon transmission-cli</pre></div></div>

<p>Le paquet transmission-daemon installe le démon (service) comme son nom l&#8217;indique et met à disposition l&#8217;interface Web, transmission-cli n&#8217;est à proprement parler pas nécessaire pour le fonctionnement de transmission, il met à disposition l&#8217;utilitaire transmission-remote très pratique pour interagir avec Transmission par script (pratique pour automatiser certaines taches que je décrirais dans une autre article)</p>
<p>&nbsp;</p>
<h2>Paramétrage</h2>
<p>Tout d&#8217;abord avant d&#8217;attaquer la configuration proprement dite de Transmission, on va créer les répertoires destinés à accueillir et classer les fichiers.</p>
<p>Chez tout est rangé dans un répertoire /data/downloads/torrents, ce dernier contient 4 sous-répertoires :</p>
<ul>
<li>watch : répertoire surveillé par Transmission, tout fichier .torrent placé ici sera automatiquement ajouté à Transmission et le téléchargement débutera</li>
<li>downloading : répertoire contenant les fichiers en cours de téléchargement (fichiers renommés avec l&#8217;extension .part car incomplets)</li>
<li>seeding : les fichiers une fois finis de téléchargés seront déplacés ici et y resteront tout le temps qu&#8217;il seront en partage (jusqu&#8217;a ce que le ratio soit atteint)</li>
<li>complete : les fichiers téléchargés ayant atteint le ratio de partage seront déplacés ici (pas réalisé par Transmission mais par script, objet d&#8217;un autre article)</li>
</ul>
<p>&nbsp;</p>
<p>Le paramétrage du démon Transmission se fait dans un fichier settings.json.</p>
<p>Par défaut sous Debian, Transmission est lancé avec un utilisateur debian-transmission mais il est peut être intéressant de changer cet utilisateur par son propre utilisateur et de déplacer le fichier de configuration de /etc/transmission-daemon vers le répertoire $HOME de cet utilisateur, pour cela se reporter à <a title="Lien permanent vers Exécuter Transmission avec l’utilisateur de son choix et déplacer son fichier de configuration vers $HOME" rel="bookmark" href="../index.php/executer-transmission-avec-lutilisateur-de-son-choix-et-deplacer-son-fichier-de-configuration-vers-home/">Exécuter Transmission avec l’utilisateur de son choix et déplacer son fichier de configuration vers $HOME</a></p>
<p><strong>Avant d&#8217;éditer le fichier de configuration il est important d&#8217;arrêter le démon</strong>, ce dernier écrivant sa configuration à son arrêt vous risqueriez de perdre votre paramétrage.</p>
<p>Éditez votre fichier de configuration /etc/transmission-daemon/settings.json ou $HOME/.config/transmission-daemon/settings.json ce dernier au format <a href="http://fr.wikipedia.org/wiki/JavaScript_Object_Notation">JSON</a> contient un ensemble de pair clé/valeur :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">{
 &quot;alt-speed-down&quot;: 50,
 &quot;alt-speed-enabled&quot;: false,
 &quot;alt-speed-time-begin&quot;: 540,
 ...
 &quot;upload-limit-enabled&quot;: 0,
 &quot;upload-slots-per-torrent&quot;: 4
}</pre></div></div>

<p>La description des ces paramètres est disponible sur le Wiki de Transmission (<a href="https://trac.transmissionbt.com/wiki/EditConfigFiles">EditConfigFiles – Transmission</a>), mais voici ma traduction de ceux que j&#8217;utilise classés par catégories :</p>
<h3>Répertoires :</h3>
<p>Conformément à la structure de répertoire décrite ci-dessus on réalise le paramétrage suivant.</p>
<ul>
<li>incomplete-dir : &laquo;&nbsp;/data/downloads/torrents/downloading&nbsp;&raquo;</li>
<li>incomplete-dir-enabled : true</li>
<li>download-dir : &laquo;&nbsp;/data/downloads/torrents/seeding&nbsp;&raquo;</li>
<li>watch-dir : &laquo;&nbsp;/data/downloads/torrents/watch&nbsp;&raquo;</li>
<li>watch-dir-enabled : true</li>
</ul>
<p>incomplete-dir indique le répertoire où sont stockés les fichiers en cours de téléchargement et incomplete-dir-enabled active cette fonctionnalité (sinon ces fichiers sont stockés dans le répertoire download-dir)</p>
<p>download-dir contient le répertoire où sont stockés les fichiers en cours de partage et terminés (nous verrons dans un autre article comment déplacer les fichier terminés vers un autre répertoire)</p>
<p>watch-dir contient le répertoire scruté pour ajout automatique de téléchargement par dépôt de fichier .torrent (fonctionnalité activé par watch-dir-enabled)</p>
<p>Quelques paramétrages associés :</p>
<ul>
<li>start-added-torrents : true</li>
<li>trash-original-torrent-files : true</li>
<li>rename-partial-files : true</li>
</ul>
<p>start-added-torrents, indique qu&#8217;il faut directement démarrer le téléchargement de torrents ajoutés.</p>
<p>trash-original-torrent-files supprime les fichiers .torrent du répertoire watch-dir après qu&#8217;ils aient été pris en compte</p>
<p>rename-partial-files indique que les fichiers encours de téléchargement doivent avoir une extension .part. Pas utile dans mon cas puisque ces derniers sont déjà dans une répertoire à part, mais cela ne fait pas de mal.</p>
<h3>Réseau :</h3>
<ul>
<li>peer-port : xxx</li>
<li>peer-port-random-high : 65535</li>
<li>peer-port-random-low : 49152</li>
<li>peer-port-random-on-start : false</li>
</ul>
<p>peer-port contient le port d&#8217;écoute de Transmission, il faut que ce port soit ouvert sur votre routeur, peer-port-random-on-start indique que Transmission ne choisi aps son port de façon aléatoire et écoute donc toujours sur le port peer-port. Dès lors les paramètres peer-port-random-high et peer-port-random-low sont inutiles</p>
<h3>Partage :</h3>
<ul>
<li>ratio-limit : 1.0000</li>
<li>ratio-limit-enabled : true</li>
</ul>
<p>Transmission partage le fichiers jusqu’à ce que le ratio (quantité téléchargée / quantité partagée) paramétré dans ratio-limit soit atteint (ratio-limit-enabled : activation de la fonctionnalité)</p>
<p>Si on laisse ratio-limit-enabled: false, Transmission ignorera le paramètre ratio-limit et partagera le fichier infiniment (enfin jusqu’à ce que vous l&#8217;enleviez)</p>
<p>Un ratio de 1 est un minimum, car il indique que vous partagez autant que vous téléchargez</p>
<h3>Accès distant :</h3>
<ul>
<li>rpc-authentication-required : true</li>
<li>rpc-bind-address : &laquo;&nbsp;0.0.0.0&#8243;</li>
<li>rpc-enabled : true</li>
<li>rpc-password : &laquo;&nbsp;xxxx&nbsp;&raquo;</li>
<li>rpc-port : 9091</li>
<li>rpc-username : &laquo;&nbsp;xxxx&nbsp;&raquo;</li>
<li>rpc-whitelist : &laquo;&nbsp;127.0.0.1&#8243;</li>
<li>rpc-whitelist-enabled : false</li>
</ul>
<p><a href="http://fr.wikipedia.org/wiki/Remote_procedure_call">RPC veut dire Remote Procedure Call</a> autrement dit cela permet l&#8217;accès à distance à un service. Dans le cas de Transmission cela paramétre l&#8217;accès au démon par l&#8217;interface Web (fournis par défaut avec le démon) mais aussi à tous les autres services distants (par exemple client lourd distant <a href="http://code.google.com/p/transmisson-remote-gui/">transmission-remote-gui</a>)</p>
<p>On active le service avec rpc-enabled et on active la connexion par login / mot de passe (rpc-authentication-required / rpc-username / rpc-password)</p>
<p>Concernant rpc-password on met le mot de passe en clair et lors de la prise en compte du fichier de configuration par Transmission ce dernier crypte le mot de passe</p>
<p>rpc-port défini le port d&#8217;écoute, ainsi si on saisie dans la barre d&#8217;adresse de son navigateur l&#8217;adresse IP du serveur hébergeant Transmission sur la port 9091 on arrive sur l&#8217;interface Web.</p>
<p>Enfin il est possible de paramétrer une liste d&#8217;adresse IP autorisé à se connecter en RPC avec les options rpc-whitelist-enabled et rpc-whitelist. Je n&#8217;utilise pour l&#8217;instant pas cette option.</p>
<h3>Vitesses :</h3>
<p>Sur Transmission il est possible de gérer 2 modes de vitesse (normal et alternatif : alt)  et ce pour le téléchargement et l&#8217;upload.</p>
<p>La bascule entre ces 2 modes est aussi paramétrable selon les jours et les heures.</p>
<p>Concrètement on peut déterminer d&#8217;avoir ou pas de limite de vitesse en mode normal et d&#8217;autres limites de vitesse (ou pas) dans le mode alternatif.</p>
<p>Dans l&#8217;exemple suivant en mode normal il n&#8217;y aucune limite de vitesse ni en téléchargement speed-limit-down-enabled  (dès lors speed-limit-down est inutile) ni en upload speed-limit-up (speed-limit-up-enabled inutile).</p>
<p>Par contre on active le mode alternatif (alt-speed-enabled) et sa planification (alt-speed-time-enabled).</p>
<p>Entre 9h du matin (alt-speed-time-begin, 540 nombre minute depuis minuit = 9*60) et 23h (alt-speed-time-end, 1380 = 23*60 minutes) tous les jours de la semaine (cf. <a href="https://trac.transmissionbt.com/wiki/EditConfigFiles#Scheduling">Scheduling</a>) on limite le téléchargement (alt-speed-down) et l&#8217;upload (alt-speed-up)</p>
<p>Dès lors la bande passante est préservée durant les heures &laquo;&nbsp;d&#8217;éveil&nbsp;&raquo; rendant possible/agréable la navigation sur Internet tandis que durant la nuit Transmission télécharge à fond&#8230;.</p>
<ul>
<li>speed-limit-down : 100</li>
<li>speed-limit-down-enabled : false</li>
<li>speed-limit-up : 40</li>
<li>speed-limit-up-enabled : false</li>
<li>alt-speed-down : 50</li>
<li>alt-speed-enabled : true</li>
<li>alt-speed-time-begin : 540</li>
<li>alt-speed-time-day : 127</li>
<li>alt-speed-time-enabled : true</li>
<li>alt-speed-time-end : 1380</li>
<li>alt-speed-up : 50</li>
</ul>
<p>On verra dans un prochain article comment rendre ce système de mode normal / alternatif encore plus performant en ne le planifiant pas mais en basculant entres les 2 modes selon le besoin&#8230;</p>
<h3>Sécurité :</h3>
<ul>
<li>blocklist-enabled : true</li>
</ul>
<p>Active le blocage des adresse IP, Transmission télécharge à intervalle régulier la liste des adresses IP de niveau 1 appartenant à des sociétés et des associations et les bloquent.</p>
<p>Inutile quand on a rien a se reprocher&#8230;</p>
<p>&nbsp;</p>
<h3>Autres paramétrages non utilisés :</h3>
<ul>
<li>bind-address-ipv4 : &laquo;&nbsp;0.0.0.0&#8243;</li>
<li>bind-address-ipv6 :  &laquo;&nbsp;::&nbsp;&raquo;</li>
<li>dht-enabled : true</li>
<li>encryption : 1</li>
<li>lazy-bitfield-enabled : true</li>
<li>lpd-enabled : false</li>
<li>message-level : 2</li>
<li>open-file-limit : 32</li>
<li>peer-limit-global : 240</li>
<li>peer-limit-per-torrent : 60</li>
<li>peer-socket-tos : 0</li>
<li>pex-enabled : true</li>
<li>port-forwarding-enabled : false</li>
<li>preallocation : 1</li>
<li>proxy : &laquo;&nbsp;&nbsp;&raquo;</li>
<li>proxy-auth-enabled : false</li>
<li>proxy-auth-password : &laquo;&nbsp;&nbsp;&raquo;</li>
<li>proxy-auth-username : &laquo;&nbsp;&nbsp;&raquo;</li>
<li>proxy-enabled : false</li>
<li>proxy-port : 80</li>
<li>proxy-type : 0</li>
<li>script-torrent-done-enabled : false</li>
<li>script-torrent-done-filename : &laquo;&nbsp;&nbsp;&raquo;</li>
<li>upload-slots-per-torrent : 4</li>
<li>umask : 18  (en décimal = 22 en octal)</li>
</ul>
<p>Il y a même des paramètres qui sont obsolètes car remplacés par d&#8217;autres</p>
<ul>
<li>download-limit : 100</li>
<li>download-limit-enabled : 0</li>
<li>upload-limit : 100</li>
<li>upload-limit-enabled : 0</li>
<li>max-peers-global : 200</li>
</ul>
<p>&nbsp;</p>
<p><em><span style="text-decoration: underline;">Sources :</span><br />
 </em></p>
<ul>
<li><a href="http://www.transmissionbt.com/">Transmission</a> : Site officiel </li>
<li><a href="http://www.transmissionbt.com/resources/">Transmission</a> : Liste de plugins sur le site officiel</li>
<li><a href="https://trac.transmissionbt.com/wiki/EditConfigFiles">EditConfigFiles – Transmission</a> : Description des option du fichier settings.json sur le site officiel</li>
<li><a href="http://1000umbrellas.com/2010/10/04/updated-transmission-installationconfiguration-on-ubuntu-server">Updated: Transmission Installation/Configuration on Ubuntu Server &#8211; 1000umbrellas.com</a> : Exemple de configuration et manipulations à effectuer sur les  répertoires accueillant les torrents si vous laissez Transmission  tourner avec l&#8217;utilisateur debian-transmission</li>
<li><a href="http://www.d3vinside.fr/blog/installer-et-configurer-le-package-transmission-daemon-sous-debian-11">devINSIDE :: Blog :: Installer et configurer le package transmission-daemon sous debian</a> : configuration de base + interaction avec un Vhost apache (intérêt ?)</li>
<li><a href="http://www.realpeace.fr/blog/2010/07/09/installation-transmission-remote-sur-ubuntu-server/">Installation Transmission daemon sur Ubuntu Server « Realpeace&#8217;s Blog</a> : installation et configuration + quelques clients Transmission</li>
<li><a href="http://www.hahadopi.eu/tuto/transmission-daemon-sur-sa-seedbox/">HaHadopi » Transmission-daemon sur sa seedbox</a> : installation et configuration</li>
<li><a href="http://blog.shk-desktop.com/1002-configurer-transmission-pour-laccess-distance-cli">Configurer Transmission pour l’access a distance (CLI) | Shtark.fr</a> : installation et configuration</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/installer-et-configurer-transmission-en-tant-que-demon/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Surveiller sa bande passante en ligne de commande</title>
		<link>http://voidandany.free.fr/index.php/surveiller-sa-bande-passante-en-ligne-de-commande/</link>
		<comments>http://voidandany.free.fr/index.php/surveiller-sa-bande-passante-en-ligne-de-commande/#comments</comments>
		<pubDate>Tue, 24 May 2011 20:42:50 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[Brèves]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[CLI]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=4029</guid>
		<description><![CDATA[Article court pour présenter ma dernière trouvaille, un outil pour surveiller sa bande passante, pour connaitre son trafic réseau : Bandwith Monitor NG Pour l&#8217;installer il suffit d&#8217;ajouter le paquet bwm-ng et pour le lancer on lance la commande du &#8230; <a href="http://voidandany.free.fr/index.php/surveiller-sa-bande-passante-en-ligne-de-commande/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Article court pour présenter ma dernière trouvaille, un outil pour surveiller sa bande passante, pour connaitre son trafic réseau :<a href="http://www.gropp.org/?id=projects&amp;sub=bwm-ng"> Bandwith Monitor NG</a></p>
<p>Pour l&#8217;installer il suffit d&#8217;ajouter le paquet <strong>bwm-ng</strong> et pour le lancer on lance la commande du même nom (bwm-ng)</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_00515.png"><img class="alignleft size-full wp-image-4030" title="Bandwidth Monitor NG" src="http://voidandany.free.fr/wp-content/uploads/Sélection_00515.png" alt="" width="634" height="142" /></a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Très pratique dans mon cas pour connaitre la vitesse de transfert réseau entre mon <a title="Marques-pages : Un mini serveur le Seagate Dockstar" href="http://voidandany.free.fr/index.php/marques-pages-un-mini-serveur-le-seagate-dockstar/">Dockstar</a> et ma Freebox lors d&#8217;une grosse copie que je trouvais particulièrement lente (et pour cause 2.5 Mo/s)</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/surveiller-sa-bande-passante-en-ligne-de-commande/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installer Dropbox 1.x sous Ubuntu</title>
		<link>http://voidandany.free.fr/index.php/installer-dropbox-1-x-sous-ubuntu/</link>
		<comments>http://voidandany.free.fr/index.php/installer-dropbox-1-x-sous-ubuntu/#comments</comments>
		<pubDate>Mon, 09 May 2011 19:34:46 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[Brèves]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[dropbox]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=3932</guid>
		<description><![CDATA[Par défaut la nouvelle version de Dropbox n&#8217;est pas poussée sur Ubuntu (au moins le 10.10), il est cependant facile de faire la mise à jour. Pas besoin d&#8217;installer Dropbox depuis le source, il suffit d&#8217;arrêter le service Dropbox (clic &#8230; <a href="http://voidandany.free.fr/index.php/installer-dropbox-1-x-sous-ubuntu/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Par défaut la nouvelle version de Dropbox n&#8217;est pas poussée sur Ubuntu (au moins le 10.10), il est cependant facile de faire la mise à jour.</p>
<p>Pas besoin d&#8217;<a href="http://blog.nicolargo.com/2010/12/comment-installer-vraiment-dropbox-1-0-sous-gnulinux.html">installer Dropbox depuis le source</a>, il suffit d&#8217;arrêter le service Dropbox (clic droit sur l&#8217;icône dans la barre des taches et &laquo;&nbsp;Stop dropbox&nbsp;&raquo;), renommer le fichier .dropbox-dist sous votre home et redémarrer Dropbox (Applications &gt; Internet &gt; Dropbox).</p>
<p>En ligne de commande :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dropbox stop
<span style="color: #c20cb9; font-weight: bold;">mv</span> ~<span style="color: #000000; font-weight: bold;">/</span>.dropbox-dist ~<span style="color: #000000; font-weight: bold;">/</span>.dropbox-dist.OLD
dropbox start</pre></div></div>

<p>La nouvelle version sera téléchargée et installée.</p>
<p>Bonus pour installer les icônes monochrome plus intégrées au bureau Ubuntu, un <a href="http://dl.dropbox.com/u/209989/mono-icons/index.html">paquet est disponible</a></p>
<p><span style="text-decoration: underline;"><em><strong>Source :</strong></em></span><strong><em> </em></strong><a title="What’s New in Dropbox 1.0 for Ubuntu" rel="bookmark" href="http://www.starryhope.com/linux/ubuntu/2010/install-or-upgrade-to-dropbox-1-0-on-ubuntu/">What’s New in Dropbox 1.0 for Ubuntu</a></p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/installer-dropbox-1-x-sous-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installer un serveur Firefox Sync minimal avec NGINX (ex Weave)</title>
		<link>http://voidandany.free.fr/index.php/installer-un-serveur-firefox-sync-minimal-avec-nginx-ex-weave/</link>
		<comments>http://voidandany.free.fr/index.php/installer-un-serveur-firefox-sync-minimal-avec-nginx-ex-weave/#comments</comments>
		<pubDate>Fri, 29 Apr 2011 14:47:36 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[serveur]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=3581</guid>
		<description><![CDATA[Une des première application de mon serveur Web NGINX à été de mettre en œuvre un serveur de synchronisation pour Firefox. Cette fonctionnalité de synchronisation est nommée Firefox Sync (ex Weave), elle est intégrée par défaut dans Firefox 4 (pour &#8230; <a href="http://voidandany.free.fr/index.php/installer-un-serveur-firefox-sync-minimal-avec-nginx-ex-weave/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://voidandany.free.fr/wp-content/uploads/sync-logo.png"><img class="alignleft size-medium wp-image-3877" title="sync-logo" src="http://voidandany.free.fr/wp-content/uploads/sync-logo-300x95.png" alt="" width="300" height="95" /></a>Une des première application de mon serveur Web <a title="Installer un serveur web (nginx) sur le Seagate Dockstar" href="http://voidandany.free.fr/index.php/installer-un-serveur-web-nginx-sur-le-seagate-dockstar/">NGINX</a> à été de mettre en œuvre un <strong>serveur de synchronisation pour Firefox</strong>.</p>
<p>Cette fonctionnalité de synchronisation est nommée Firefox Sync (ex Weave), elle est <strong>intégrée par défaut dans Firefox 4</strong> (pour les version antérieure il faut passer par <a href="https://addons.mozilla.org/fr/firefox/addon/firefox-sync/">une extension</a>).</p>
<p>« Firefox Sync » est un service qui vous permet de synchroniser vos  marque-pages, votre historique, vos mots de passe et vos onglets ouverts  avec une autre copie de Firefox – comme, par exemple, avec une sur un  autre ordinateur ou sur un terminal mobile &#8211; <a href="http://support.mozilla.com/fr/kb/quest-ce-que-firefox-sync">source</a></p>
<p>&nbsp;</p>
<h2>Xmarks Sync vs Firefox Sync</h2>
<p>Pour remplir ce rôle jusqu&#8217;alors j&#8217;utilisais l&#8217;extension <a href="https://addons.mozilla.org/fr/firefox/addon/xmarks-sync/">Xmarks Sync</a>, mais ces dernier temps la synchronisation se faisait de plus en plus longue, voir n&#8217;aboutissait pas pour les mots de passe.</p>
<p>De plus pourquoi ajouter une extension ralentissant potentiellement Firefox alors que ce dernier embarque désormais la fonctionnalité.</p>
<p>Autres différences (non exhaustif) :</p>
<ol>
<li>Firefox Sync est libre et soutenu par la foncdation Mozilla, Xmarks est une société commerciale, le service à failli disparaitre (<a title="Permanent Link to Xmarks is Dead. Long Live Xmarks?" rel="bookmark" href="http://blog.xmarks.com/?p=1945">Xmarks is Dead. Long Live Xmarks?</a>) avant son <a href="http://blog.xmarks.com/?p=2033">acquisition par Lastpass</a></li>
<li>Firefox Sync crypte les mots de passe avant d&#8217;envoyer les données vers le serveur alors que Xmark fait l&#8217;inverse</li>
<li>Firefox Sync synchronise les marques-page, l&#8217;historique, les préférences, les onglets ouverts et les mots de passe, Xmarks ne synchronise pas les préférences</li>
<li>Xmarks est multi-navigateur, Firefox Sync n&#8217;est que pour Firefox</li>
<li>Xmarks propose une interface de consultation des ses bookmarks via le web, Firefox Sync non</li>
<li>Xmarks sauvegarde l&#8217;historique des bookmark il est ainsi possible de revenir en arrière si on a supprimé par mégarde des marques-page, Firefox Sync je ne penses pas</li>
<li>Xmarks gère des notion de profil permettant par exemple de ne synchroniser qu&#8217;une partie des ses marques pages (au boulot par exemple), Firefox Sync non</li>
<li>Xmarks à une notion de partage de bookmark, Firefox Sync non</li>
<li>Xmarks modifie la page des résultats Google pour ajouter une prévisualisation et un système de notation</li>
<li>Xmarks est plus paramétrable et plus &laquo;&nbsp;loquace&nbsp;&raquo; sur ce qu&#8217;il fait</li>
<li>Xmarks et Firefox Sync permettent l&#8217;utilisation de son propre serveur, en HTTP(s) pour Firefox Sync, contre FTP(s) ou WebDav sur HTTP(s) pour Xmarks</li>
</ol>
<p>Bref Xmarks possède nombre d&#8217;options en plus mais Firefox Sync est plus libre&#8230;.</p>
<p>Toutes les informations (spécifications / API / Sources)  concernant le serveur Sync sont disponibles sur la page <a href="https://wiki.mozilla.org/Services/Sync">Firefox Sync du Wiki Mozilla</a></p>
<p>&nbsp;</p>
<h2>Installation Firefox Sync</h2>
<p>Sync nécessite une plateforme LAMP ce qui n&#8217;est pas pour me plaire car je souhaite autant que possible <a title="Installer et configurer Mysql sur le Dockstar" href="http://voidandany.free.fr/index.php/installer-et-configurer-mysql-sur-le-dockstar/">me passer de MySQL</a> et n&#8217;est pas forcément aisé à mettre en œuvre (cf. les sources) mais il existe une version light du serveur Sync.</p>
<p>Le <strong>serveur Firefox Sync minimal</strong> nécessite un serveur Web avec support du php (<a title="Installer un serveur web (nginx) sur le Seagate Dockstar" href="http://voidandany.free.fr/index.php/installer-un-serveur-web-nginx-sur-le-seagate-dockstar/">NGINX</a> sur mon <a title="Marques-pages : Un mini serveur le Seagate Dockstar" href="http://voidandany.free.fr/index.php/marques-pages-un-mini-serveur-le-seagate-dockstar/">Dockstar</a>) et <a title="Ajouter le support SQLite à php" href="http://voidandany.free.fr/index.php/ajouter-le-support-sqlite-a-php/">SQLite</a>.</p>
<p>Créer un répertoire dans votre arborescence web et donner les droits à l&#8217;utilisateur sous lequel votre serveur Web tourne (le plus souvent www-data) :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">drwxrwxr-x  2 www-data www-data 4,0K 25/03/2011 20:54 weave/</pre></div></div>

<p>Récupérer la dernière <strong>archive des scripts</strong> du serveur Firefox Sync minimal : <a href="http://people.mozilla.org/~telliott/">http://people.mozilla.org/~telliott/</a></p>
<p>Décompresser cette archive dans le dossier précédemment créé.</p>
<p>&nbsp;</p>
<p><strong>Paramétrer votre serveur Web</strong> pour rendre accessible le répertoire et le documentation (fichier README) indique qu&#8217;il faut créer un alias du type :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Alias /weave /&lt;chemin vers weave&gt;/index.php</pre></div></div>

<p>Ce qui sous NGINX se traduit ainsi :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">location /weave {
    include /etc/nginx/fastcgi_params;
    fastcgi_pass   127.0.0.1:9000;
    fastcgi_index  index.php;
    fastcgi_param   SCRIPT_FILENAME $document_root/weave/index.php;
    fastcgi_param   SCRIPT_NAME $document_root/weave/index.php;
    if ( $request_uri ~ &quot;/weave/([^?]*)&quot; ) {
        set $path_info  /$1;
     }
    fastcgi_param   PATH_INFO       $path_info;
 }</pre></div></div>

<p>Il faut ensuite <strong>aller à l&#8217;adresse suivante</strong> :</p>
<p style="padding-left: 30px;">http://[adresse de votre serveur]/weave/1.0/blah/info/collection</p>
<p>Une <strong>authentification </strong>vous est réclamé :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Authentification-requise_019.png"><img class="aligncenter size-medium wp-image-3593" title="Authentification requise_019" src="http://voidandany.free.fr/wp-content/uploads/Authentification-requise_019-300x77.png" alt="" width="300" height="77" /></a>Saisir :</p>
<ul>
<li>Utilisateur : blah</li>
<li>Mot de passe : n&#8217;importe quoi</li>
</ul>
<p>Dans le répertoire contenant les scripts php, une base SQLite doit avoir été créée :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">-rw-r--r-- 1 www-data www-data 5,4M 25/03/2011 20:54 weave_db</pre></div></div>

<p>On peut considérer Firefox Sync installé.</p>
<p>&nbsp;</p>
<h2>Configuration du/des utilisateur(s)</h2>
<p>La version minimale du serveur Firefox Sync ne possède pas d&#8217;interface pour gérer les utilisateurs, il faut les créer &laquo;&nbsp;à la main&nbsp;&raquo; sur le serveur, ce qui offre l&#8217;avantage de ne pas avoir de risque de voir son serveur Sync sqatté&#8230;</p>
<p>La <strong>création d&#8217;un utilisateur</strong> se fait avec le script php create_user que l&#8217;on lance <strong>en ligne de commande</strong>.</p>
<p>Il faut pour cela avoir installé le paquet php5-cli.</p>
<p>Puis on lance le script et on répond aux question</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">sudo</span> php create_user
<span style="color: #7a0874; font-weight: bold;">&#40;</span>c<span style="color: #7a0874; font-weight: bold;">&#41;</span>reate, <span style="color: #7a0874; font-weight: bold;">&#40;</span>d<span style="color: #7a0874; font-weight: bold;">&#41;</span>elete or change <span style="color: #7a0874; font-weight: bold;">&#40;</span>p<span style="color: #7a0874; font-weight: bold;">&#41;</span>assword: c
Please enter email: aa
Please enter password: aa
aa created</pre></div></div>

<p>A noter qu&#8217;il n&#8217;est pas nécessaire de saisir un email comme indiqué mais le login souhaité</p>
<p>Et voila&#8230;</p>
<p>&nbsp;</p>
<h2>Configuration de Firefox 4</h2>
<p>Dans Firefox 4 aller dans le bouton Firefox et sélectionner &laquo;&nbsp;Configurer sync&#8230;&nbsp;&raquo;</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_0098.png"><img class="aligncenter size-medium wp-image-3592" title="Sélection_009" src="http://voidandany.free.fr/wp-content/uploads/Sélection_0098-281x300.png" alt="" width="281" height="300" /></a></p>
<p>Sélectionner &laquo;&nbsp;J&#8217;ai déjà un compte sync, se connecter&nbsp;&raquo; :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_010.png"><img class="aligncenter size-medium wp-image-3594" title="Configuration de Firefox Sync_010" src="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_010-300x239.png" alt="" width="300" height="239" /></a></p>
<p>&nbsp;</p>
<p>Sélectionner &laquo;&nbsp;Je n&#8217;ai pas l&#8217;appareil avec moi&nbsp;&raquo;</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_011.png"><img class="aligncenter size-medium wp-image-3595" title="Configuration de Firefox Sync_011" src="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_011-300x239.png" alt="" width="300" height="239" /></a></p>
<p>2 cas de figure se présentent dès lors :</p>
<p>&nbsp;</p>
<h3>1ère configuration de Firefox</h3>
<p>C&#8217;est le <strong>premier Firefox</strong> que vous configurez avec le compte utilisateur, le serveur Firefox Sync ne contient donc aucunes données.</p>
<p>Saisir votre login et mot de passe choisis lors de la création de l&#8217;utilisateur.</p>
<p>Dans la liste déroulante &laquo;&nbsp;Serveur&nbsp;&raquo; choisir &laquo;&nbsp;Utiliser un serveur personnalisé&nbsp;&raquo;, puis saisir l&#8217;URL d&#8217;accès à Firefox Sync sur votre serveur.</p>
<p>Saisir une <strong>clé au hasard</strong> , elle ne sera pas prise en compte et Firefox en générera une autre.</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_012.png"><img class="aligncenter size-medium wp-image-3596" title="Configuration de Firefox Sync_012" src="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_012-300x239.png" alt="" width="300" height="239" /></a></p>
<p>Firefox détecte que c&#8217;est votre première configuration, il <strong>génère une nouvelle clé</strong> (que vous pouvez re-générer) :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Modifier-votre-clé-de-synchronisation_013.png"><img class="aligncenter size-medium wp-image-3600" title="Modifier votre clé de synchronisation_013" src="http://voidandany.free.fr/wp-content/uploads/Modifier-votre-clé-de-synchronisation_013-300x239.png" alt="" width="300" height="239" /></a></p>
<p><strong>Noter cette clé, ou l&#8217;enregistrer</strong> dans une endroit sûr, elle vous sera nécessaire pour configurer les autres Firefox que vous souhaiter synchroniser.</p>
<p>Cliquer sur &laquo;&nbsp;Modifier la clé de synchronisation&nbsp;&raquo;.</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_017.png"><img class="aligncenter size-medium wp-image-3599" title="Configuration de Firefox Sync_017" src="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_017-300x239.png" alt="" width="300" height="239" /></a><br />
 Cette alerte vous avertit que les données des autres appareils synchronisés avec le compte utilisateur choisi seront écrasées avec les données du Firefox en-cours de configuration.</p>
<p>Ce n&#8217;est pas grave puisque nous configurons le premier Firefox à synchroniser.</p>
<p>Cliquer sur Terminer :</p>
<p style="text-align: center;"><a href="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_015.png"><img class="aligncenter" title="Configuration de Firefox Sync_015" src="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_015-300x239.png" alt="" width="300" height="239" /></a></p>
<p>Vous pouvez alors choisir les <strong>options de synchronisation</strong> en cliquant sur le bouton du même nom.</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_016.png"><img class="aligncenter size-medium wp-image-3598" title="Configuration de Firefox Sync_016" src="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_016-300x239.png" alt="" width="300" height="239" /></a></p>
<p>Choisir quelle données synchroniser et le mode de première synchronisation, dans mon cas mon Firefox contenant déjà tous mes Bookmark et rien sur le serveur j&#8217;ai choisi de remplacer les données du serveur par celle de mon Firefox.</p>
<p>&nbsp;</p>
<h3>Configuration des Firefox suivants</h3>
<p>Vous avez déjà <strong>au moins un Firefox de paramétré</strong>, synchronisé, le serveur contient donc déjà des données pour l&#8217;utilisateur choisi et vous souhaitez en ajouter un autre.</p>
<p>Comme précédemment saisir votre login et mot de passe de l&#8217;utilisateur choisi, l&#8217;URL de votre serveur de synchronisation.</p>
<p>Saisir la clé générée lors de la configuration du 1er Firefox</p>
<p style="text-align: center;"><a href="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_012.png"><img class="aligncenter" title="Configuration de Firefox Sync_012" src="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_012-300x239.png" alt="" width="300" height="239" /></a></p>
<p>Cliquer sur Suivant, Firefox vérifie le login/mdp et la clé saisie.</p>
<p style="text-align: center;"><a href="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_015.png"><img class="aligncenter" title="Configuration de Firefox Sync_015" src="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_015-300x239.png" alt="" width="300" height="239" /></a></p>
<p>La configuration est terminée, de même qu&#8217;auparavant choisir les options de synchronisation.</p>
<p style="text-align: center;"><a href="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_016.png"><img class="aligncenter" title="Configuration de Firefox Sync_016" src="http://voidandany.free.fr/wp-content/uploads/Configuration-de-Firefox-Sync_016-300x239.png" alt="" width="300" height="239" /></a></p>
<p>Par contre contrairement à au paragraphe précédent (et à la copie d&#8217;écran), il faut choisir soit :</p>
<ul>
<li>de remplacer les donnée de ce Firefox par celle du serveur, si vous n&#8217;avez pas de bookmark sur l&#8217;ordinateur en cours</li>
<li>de fusionner les données du serveur avec celle de l’ordinateur en cours de paramétrage</li>
</ul>
<p>&nbsp;</p>
<p><strong>Rque</strong> : les options de paramétrage sont ensuite modifiables dans les options Firefox :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Préférences-de-Firefox_018.png"><img class="aligncenter size-medium wp-image-3880" title="Préférences-de-Firefox_018" src="http://voidandany.free.fr/wp-content/uploads/Préférences-de-Firefox_018-300x242.png" alt="" width="300" height="242" /></a>A noter que le menu Gestion du compte &gt; modifier le mot de passe ne fonctionne pas avec la version minimal du serveur Firefox Sync.</p>
<p>&nbsp;</p>
<h2>Sécurisation HTTPS</h2>
<p>Pour plus de sécurité il est conseillé de mettre en œuvre une connexion HTTPs, le flux HTTP est alors crypté avant d&#8217;être envoyé sur le réseau (internet).</p>
<p>Pour créer une connexion HTTPs avec NGINx je vais prochainement publier un article.</p>
<p>Une chose à savoir si vous utilisez un certificat auto-signé sur votre serveur Web (90% des cas, non ?), il vous faudra aller sur l&#8217;adresse de Firefox Sync sur votre serveur avec Firefox, et accepter l&#8217;alerte de sécurité avant de paramétrer Firefox Sync sur ce même Firefox.</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_00511.png"><img class="aligncenter size-medium wp-image-3882" title="Sélection_00511" src="http://voidandany.free.fr/wp-content/uploads/Sélection_00511-300x212.png" alt="" width="300" height="212" /></a><a href="http://voidandany.free.fr/wp-content/uploads/Ajout-dune-exception-de-sécurité_006.png"><img class="aligncenter size-medium wp-image-3879" title="Ajout-dune-exception-de-sécurité_006" src="http://voidandany.free.fr/wp-content/uploads/Ajout-dune-exception-de-sécurité_006-295x300.png" alt="" width="295" height="300" /></a></p>
<p><span style="text-decoration: underline;"><em><strong>Sources : </strong></em></span></p>
<p>Installation d&#8217;un serveur complet :</p>
<p><a href="http://wiki.gromez.fr/linux/howto/weave_server#installation_d_un_serveur_weave">Installation d&#8217;un serveur Weave</a><a href="http://www.dev-se.com/post/2011/04/02/Install-Setup-a-custom-Firefox-SyncWeave-server.aspx"></a></p>
<p><a href="http://www.dev-se.com/post/2011/04/02/Install-Setup-a-custom-Firefox-SyncWeave-server.aspx">Install &amp; Setup a custom Firefox Sync/Weave server</a></p>
<p>Installation d&#8217;un serveur minimal :</p>
<p><a href="http://tobyelliott.wordpress.com/2009/09/11/weave-minimal-server/">Weave Minimal Server « Tapestry</a></p>
<p><a href="http://gege2061.homecomputing.fr/content/installation-dun-serveur-firefox-sync/">Installation d’un serveur Firefox sync | Gege2061&#8242;s blog</a></p>
<p>Serveur Firefox Sync et NGINX :</p>
<p><a href="http://tobyelliott.wordpress.com/2010/07/06/more-alternate-server-possibilities/">More alternate server possibilities « Tapestry</a></p>
<p><a href="http://superhack.dk/2010/3/2/got-mozilla-weave-working-with-nginx">Got Mozilla Weave working with Nginx — Hasse&#8217;s technical ramblings</a></p>
<p><a href="http://publications.jbfavre.org/web/firefox-minimal-sync-server-php-fpm-nginx.fr">► Installer son propre serveur Firefox sync avec PHP-FPM et Nginx ◄ &#8211; Jean Baptiste Favre</a></p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/installer-un-serveur-firefox-sync-minimal-avec-nginx-ex-weave/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Changer l&#8217;icône de Parcellite</title>
		<link>http://voidandany.free.fr/index.php/changer-licone-de-parcellite/</link>
		<comments>http://voidandany.free.fr/index.php/changer-licone-de-parcellite/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 09:06:46 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[desktop]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=3857</guid>
		<description><![CDATA[Sous Ubuntu si on copie un texte et que l&#8217;on ferme l&#8217;application dans laquelle on a copié le texte, le texte copié est effacé. Un bug existe sur le launchpad, cela ne semble pas affecter toutes les applications mais uniquement &#8230; <a href="http://voidandany.free.fr/index.php/changer-licone-de-parcellite/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sous Ubuntu si on copie un texte et que l&#8217;on ferme l&#8217;application dans laquelle on a copié le texte, le texte copié est effacé.</p>
<p>Un <a href="https://bugs.launchpad.net/ubuntu/+bug/11334?comments=all">bug existe sur le launchpad</a>, cela ne semble pas affecter toutes les applications mais uniquement celle qui ne respectent pas les <a href="http://www.freedesktop.org/wiki/ClipboardManager">recommandations freedesktop</a> concernant le presse papier.</p>
<p>La solution de contournement est d&#8217;installer un gestionnaire du presse-papier évolué comme <a href="http://parcellite.sourceforge.net/"><em><em>Parcellite</em></em></a></p>
<p>Le problème concernant parcellite  : l&#8217;icône de la barre des taches n&#8217;est pas monochrome faisant tache dans le thème Humanity.</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_00611.png"><img class="aligncenter size-full wp-image-3858" title="Sélection_006" src="http://voidandany.free.fr/wp-content/uploads/Sélection_00611.png" alt="" width="326" height="23" /></a></p>
<p>Des icônes monochrome de remplacement sont disponibles :</p>
<ul>
<li><a href="http://ramzea.deviantart.com/art/Ubuntu-Mono-Parcellite-Icon-161002817">Ubuntu Mono Parcellite Icon</a></li>
<li><a href="http://gnome-look.org/content/show.php/Humanity+for+Parcellite?content=115123">Humanity for parcellite</a></li>
</ul>
<p>Il faut ensuite copier l&#8217;icône choisie dans /usr/share/icons/Humanity/actions/24/ sous le nom edit-paste.svg.</p>
<p>Ce qui donne :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>icons<span style="color: #000000; font-weight: bold;">/</span>Humanity<span style="color: #000000; font-weight: bold;">/</span>actions<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span><span style="color: #000000; font-weight: bold;">/</span>edit-paste.svg <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>icons<span style="color: #000000; font-weight: bold;">/</span>Humanity<span style="color: #000000; font-weight: bold;">/</span>actions<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span><span style="color: #000000; font-weight: bold;">/</span>edit-paste_ini.svg
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>votre icône<span style="color: #7a0874; font-weight: bold;">&#93;</span>.svg <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>icons<span style="color: #000000; font-weight: bold;">/</span>Humanity<span style="color: #000000; font-weight: bold;">/</span>actions<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span><span style="color: #000000; font-weight: bold;">/</span>edit-paste.svg</pre></div></div>

<p>Re-démarrer et voila :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_00612.png"><img class="aligncenter size-full wp-image-3862" title="Sélection_006" src="http://voidandany.free.fr/wp-content/uploads/Sélection_00612.png" alt="" width="301" height="26" /></a>(Reste à m&#8217;occuper de Dropbox : <a href="http://voidandany.free.fr/index.php/installer-dropbox-1-x-sous-ubuntu/">Fait</a>)</p>
<p><strong>Rque : </strong>ne fonctionne que pour parcellite 0.9.x mais pas pour les versions 1.x</p>
<p><span style="text-decoration: underline;"><em><strong>Source : </strong></em></span></p>
<p><a href="http://www.omgubuntu.co.uk/2009/11/humanity-style-icons-for-parcellite/">Humanity Style Icons for Parcellite</a></p>
<p><a href="http://doc.ubuntu-fr.org/parcellite"><em>parcellite</em> &#8211; Documentation Ubuntu Francophone</a> : le chemin indiqué dans cet article est faux</p>
<p>A voir :<a href="http://rafeviper.deviantart.com/art/Tray-Icons-for-Gnome-v0-8-186176990">Tray Icons for Gnome v0.8</a></p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/changer-licone-de-parcellite/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Connaitre tous les détail d&#8217;une vidéo en ligne de commande</title>
		<link>http://voidandany.free.fr/index.php/connaitre-tous-les-detail-dune-video-en-ligne-de-commande/</link>
		<comments>http://voidandany.free.fr/index.php/connaitre-tous-les-detail-dune-video-en-ligne-de-commande/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 19:14:59 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[Brèves]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=3841</guid>
		<description><![CDATA[Mon besoin connaitre tout d&#8217;une vidéo en ligne de commande, le codec, la qualité, le nombre de voie pour le son, le nombre de piste, etc&#8230; Bref tout ce qui est possible, en gros un Gspot pour Linux et en &#8230; <a href="http://voidandany.free.fr/index.php/connaitre-tous-les-detail-dune-video-en-ligne-de-commande/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Mon besoin <strong>connaitre tout d&#8217;une vidéo en ligne de commande</strong>, le codec, la qualité, le nombre de voie pour le son, le nombre de piste, etc&#8230;</p>
<p>Bref tout ce qui est possible, en gros un Gspot pour Linux et en ligne de commande.</p>
<p>Cette pépite s&#8217;appelle <strong>mediainfo</strong>.</p>
<p>Son installation :</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> mediainfo</pre></div></div>

<p>&nbsp;</p>
<p>Son utilisation :</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mediainfo <span style="color: #7a0874; font-weight: bold;">&#91;</span>nom <span style="color: #c20cb9; font-weight: bold;">du</span> fichier vidéo<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>Exemple d&#8217;infos :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">General
Unique ID                        : 0 (0x0)
Complete name                    : /data/multimedia/NonTries/xxx.mkv
Format                           : Matroska
File size                        : 1.46 GiB
Duration                         : 1h 1mn
Overall bit rate                 : 3 385 Kbps
Encoded date                     : UTC 2010-02-22 21:41:29
Writing application              : no_variable_data
Writing library                  : no_variable_data
&nbsp;
Video
ID                               : 2
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : High@L3.1
Format settings, CABAC           : Yes
Format settings, ReFrames        : 3 frames
Codec ID                         : V_MPEG4/ISO/AVC
Duration                         : 1h 1mn
Bit rate                         : 2 994 Kbps
Width                            : 1 280 pixels
Height                           : 720 pixels
Display aspect ratio             : 16:9
Frame rate                       : 23.976 fps
Color space                      : YUV
Chroma subsampling               : 4:2:0
Bit depth                        : 8 bits
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.135
Stream size                      : 1.26 GiB (87%)
Writing library                  : x264 core 85 r1442tw
Encoding settings                : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=6 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=30 / sliced_threads=0 / nr=0 / decimate=1 / mbaff=0 / constrained_intra=0 / bframes=6 / b_pyramid=1 / b_adapt=1 / b_bias=0 / direct=1 / wpredb=1 / wpredp=0 / keyint=240 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=2994 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00
Language                         : English
&nbsp;
Audio
ID                               : 1
Format                           : AC-3
Format/Info                      : Audio Coding 3
Mode extension                   : CM (complete main)
Codec ID                         : A_AC3
Duration                         : 1h 1mn
Bit rate mode                    : Constant
Bit rate                         : 384 Kbps
Channel(s)                       : 6 channels
Channel positions                : Front: L C R, Side: L R, LFE
Sampling rate                    : 48.0 KHz
Bit depth                        : 16 bits
Compression mode                 : Lossy
Stream size                      : 169 MiB (11%)</pre></div></div>

<p><strong>Rque :</strong> il existe une version avec une interface graphique : mediainfo-gui mais je ne l&#8217;ai pas testée</p>
<p><a href="http://forum.ubuntu-fr.org/viewtopic.php?id=59964">Source</a></p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/connaitre-tous-les-detail-dune-video-en-ligne-de-commande/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Régler les paramètres d&#8217;une application KDE sous Gnome</title>
		<link>http://voidandany.free.fr/index.php/regler-les-parametres-dune-application-kde-sous-gnome/</link>
		<comments>http://voidandany.free.fr/index.php/regler-les-parametres-dune-application-kde-sous-gnome/#comments</comments>
		<pubDate>Thu, 21 Apr 2011 17:20:16 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[KDE]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=3831</guid>
		<description><![CDATA[J&#8217;utilise KMyMoney comme logiciel de comptabilité, ce dernier étant le logiciel qui s&#8217;approche le plus de MS Money. KMyMoney commes son nom l&#8217;indique est une application KDE que je fais tourner sous Gnome (Ubuntu) et j&#8217;avais comme problème le séparateur &#8230; <a href="http://voidandany.free.fr/index.php/regler-les-parametres-dune-application-kde-sous-gnome/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>J&#8217;utilise<em><em> </em></em><a href="http://kmymoney2.sourceforge.net/"><em><em>KMyMoney</em></em></a> comme logiciel de comptabilité, ce dernier étant le logiciel qui s&#8217;approche le plus de MS Money.</p>
<p>KMyMoney commes son nom l&#8217;indique est une application KDE que je fais tourner sous Gnome (Ubuntu) et j&#8217;avais comme problème le séparateur décimal qui était la virgule au lieu du point (du pavé numérique).</p>
<p>Pour paramétrer le séparateur décimal sous KDE il faut passer par l&#8217;application de configuration du système fournis avec le package systemsettings;</p>
<p>Installer ce package si ce n&#8217;est pas déjà fait (KMyMoney l&#8217;a en tant que dépendance) et lancer l&#8217;application en ligne de commande :</p>
<p>
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">systemsettings</pre></div></div>

</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Configuration-du-système_004.png"><img class="aligncenter size-full wp-image-3832" title="System Settings KDE 4" src="http://voidandany.free.fr/wp-content/uploads/Configuration-du-système_004.png" alt="" width="644" height="531" /></a></p>
<p>Dans le cas du séparateur décimal la configuration se fait dans Localisation &gt; Nombre et Monnaies (aux 2 endroits)</p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/regler-les-parametres-dune-application-kde-sous-gnome/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comment rendre rendre Firefox 4 aussi beau sous Ubuntu que sous XP ?</title>
		<link>http://voidandany.free.fr/index.php/comment-rendre-rendre-firefox-4-sous-ubuntu-aussi-beau-que-sous-xp/</link>
		<comments>http://voidandany.free.fr/index.php/comment-rendre-rendre-firefox-4-sous-ubuntu-aussi-beau-que-sous-xp/#comments</comments>
		<pubDate>Wed, 20 Apr 2011 20:08:05 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[firefox]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=3819</guid>
		<description><![CDATA[Dans un article précédent, je me posais la question de savoir pourquoi Firefox 4 était il moins beau sous Ubuntu que sous XP ? Dans cette article je vais décrire comment arranger cette injustice. Pour rappel les grandes différences d&#8217;apparence &#8230; <a href="http://voidandany.free.fr/index.php/comment-rendre-rendre-firefox-4-sous-ubuntu-aussi-beau-que-sous-xp/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Dans un article précédent, je me posais la question de savoir <a title="Lien permanent vers Pourquoi Firefox 4 est il moins beau sous Ubuntu que sous XP ?" rel="bookmark" href="../index.php/pourquoi-firefox-4-est-il-moins-beau-sous-ubuntu-que-sous-xp-2/">pourquoi Firefox 4 était il moins beau sous Ubuntu que sous XP ?</a></p>
<p>Dans cette article je vais décrire comment arranger cette injustice.</p>
<p>Pour rappel les grandes différences d&#8217;apparence entre Firefox 4 sous Ubuntu et sous XP sont les suivantes :</p>
<p>Pas d’icônes monochrome (que se soit les icône par défauts de FF ou  celle de all-in-one sidebar), le bouton Firefox n’est pas dans la barre  de titre et n’est pas orange, les onglets ne sont pas dans la barre de  titre, les onglets d’arrière plan sont noirs.</p>
<p>Avec ce mode opératoire ne seront corrigés que les icônes en couleurs et les onglets d&#8217;arrière plan noirs.</p>
<p>Le gros du travail est réalisé par l&#8217;installation d&#8217;un thème :<a href="https://addons.mozilla.org/fr/firefox/addon/strata-xp-on-linux/"> Strata XP on Linux</a></p>
<p>Au terme duquel les boutons des barres de titres seront devenus monochrome et les onglets d&#8217;arrière plan gris légérement plus foncé que ceux de premier plan :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_0079.png"><img class="aligncenter size-large wp-image-3821" title="strat xp on linux" src="http://voidandany.free.fr/wp-content/uploads/Sélection_0079-650x68.png" alt="" width="640" height="66" /></a></p>
<p>&nbsp;</p>
<p>Par contre si vous utilisez l&#8217;extension <a href="https://addons.mozilla.org/fr/firefox/addon/all-in-one-sidebar/">All-in-One Sidebar</a> les icônes sont partiellement monochromes :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Sélection_00810.png"><img class="aligncenter size-full wp-image-3822" title="All in one sidebar avec strata xp on linux" src="http://voidandany.free.fr/wp-content/uploads/Sélection_00810.png" alt="" width="40" height="232" /></a></p>
<p>Pour remédier à ce problème la solution est beaucoup moins simple.</p>
<p>Il faut que vous téléchargiez cette image (les petites icônes sont celles du thème XP et les grandes je les ai créées / re-travaillées) :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/toolbar_linux.png"><img class="aligncenter size-full wp-image-3823" title="toolbar_linux" src="http://voidandany.free.fr/wp-content/uploads/toolbar_linux.png" alt="" width="240" height="40" /></a></p>
<p>Et que vous sauvegardiez cette image dans le répertoire skin du répertoire de l&#8217;extension All in One Sidebar de votre profil, ce qui chez moi (Ubuntu 10.10) est :</p>
<p>&nbsp;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>utilisateur<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">/</span>.mozilla<span style="color: #000000; font-weight: bold;">/</span>firefox<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>profil<span style="color: #7a0874; font-weight: bold;">&#93;</span>.default<span style="color: #000000; font-weight: bold;">/</span>extensions<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>097d3191-e6fa-<span style="color: #000000;">4728</span>-<span style="color: #000000;">9826</span>-b533d755359d<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">/</span>skin<span style="color: #000000; font-weight: bold;">/</span>icons</pre></div></div>

<p>&nbsp;</p>
<p>(faite une sauvegarde du fichier d&#8217;origine)</p>
<p>Re-démarrez Firefox et tada :</p>
<p><a href="http://voidandany.free.fr/wp-content/uploads/Page-de-démarrage-de-Mozilla-Firefox-Mozilla-Firefox_009.png"><img class="aligncenter size-full wp-image-3824" title="Page de démarrage de Mozilla Firefox - Mozilla Firefox_009-pte" src="http://voidandany.free.fr/wp-content/uploads/Page-de-démarrage-de-Mozilla-Firefox-Mozilla-Firefox_009-pte.png" alt="" width="600" height="500" /></a></p>
<p><span style="text-decoration: underline;"><strong>Rque : </strong></span></p>
<ul>
<li>L&#8217;icône flashblock reste en couleur mais c&#8217;est pareil sous XP</li>
<li>le rendu des grandes icônes n&#8217;est pas super dans la barre d&#8217;AIO sidebar, mais je n&#8217;ai pas envie de les refaire (en plus je ne les utilise pas)</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/comment-rendre-rendre-firefox-4-sous-ubuntu-aussi-beau-que-sous-xp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Restreindre l&#8217;accès d&#8217;un site, d&#8217;un répertoire avec Nginx</title>
		<link>http://voidandany.free.fr/index.php/restreindre-lacces-dun-site-dun-repertoire-avec-nginx/</link>
		<comments>http://voidandany.free.fr/index.php/restreindre-lacces-dun-site-dun-repertoire-avec-nginx/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 15:00:58 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[sécurité]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=3537</guid>
		<description><![CDATA[La plupart des sites Web que je vais héberger sur mon Dockstar sont privés. Par exemple je ne souhaite pas que mes photos de familles soient visible par tous le monde&#8230;. Pour restreindre l&#8217;accès à ces applications/sites web, j&#8217;aurais pu &#8230; <a href="http://voidandany.free.fr/index.php/restreindre-lacces-dun-site-dun-repertoire-avec-nginx/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>La plupart des <strong>sites Web</strong> que je vais héberger sur mon <a title="Marques-pages : Un mini serveur le Seagate Dockstar" href="http://voidandany.free.fr/index.php/marques-pages-un-mini-serveur-le-seagate-dockstar/">Dockstar</a> sont <strong>privés</strong>. Par exemple je ne souhaite pas que mes photos de familles soient visible par tous le monde&#8230;.</p>
<p>Pour restreindre l&#8217;accès à ces applications/sites web, j&#8217;aurais pu choisir des scripts php qui intégraient une gestion utilisateurs. Mais il est déjà difficile de trouver un script php qui fasse ce que l&#8217;on veut et qui soit léger donc si il faut en plus qu&#8217;il intègre une gestion complète et sécurisée des accès utilisateurs cela devient mission impossible&#8230;.</p>
<p>Surtout qu&#8217;il existe une alternative : <strong>déléguer l&#8217;accès à un site au serveur web.</strong></p>
<p><strong><br />
 </strong></p>
<h2>Authentification par mot de passe</h2>
<p>Avec Apache cela se fait avec les fichiers .htacces, sous <a title="Installer un serveur web (nginx) sur le Seagate Dockstar" href="http://voidandany.free.fr/index.php/installer-un-serveur-web-nginx-sur-le-seagate-dockstar/">Nginx</a> cela se fait dans le fichier de configuration du site avec le module <a href="http://wiki.nginx.org/HttpAuthBasicModule">HttpAuthBasicModule</a>.</p>
<p>La configuration d&#8217;un site se fait via la création d&#8217;un fichier dans le répertoire /etc/nginx/sites-enabled/, pour restreindre l&#8217;accès à un répertoire d&#8217;un site il suffit d&#8217;ajouter les directives <a href="http://wiki.nginx.org/HttpAuthBasicModule#auth_basic">auth_basic</a> et <a href="http://wiki.nginx.org/HttpAuthBasicModule#auth_basic_user_file">auth_basic_user_file</a> dans le fichier du site.</p>
<ul>
<li>La directive <a href="http://wiki.nginx.org/HttpAuthBasicModule#auth_basic">auth_basic</a> indique que l&#8217;on utilise une authentification, les texte après sera affiché dans la boite de dialogue d&#8217;authentification :</li>
<li>La directive <a href="http://wiki.nginx.org/HttpAuthBasicModule#auth_basic_user_file">auth_basic_user_file</a> indique le chemin vers le fichier contenant les couple login / mot de passe (crypté) autorisé à accéder au répertoire.</li>
</ul>
<p>Voici ma configuration :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">server {
	listen       80;
	server_name  localhost;
	root         /var/www;
&nbsp;
	# Security
	location ~ /\.ht {
		deny  all;
	}
&nbsp;
	location /Repertoire_protege/ {
		auth_basic            &quot;Qui va là&quot;;
		auth_basic_user_file  /$document_root/Repertoire_protege/.htpasswd;
&nbsp;
		index  index.html index.htm index.php;
&nbsp;
		location ~ \.php$ {
			include /etc/nginx/fastcgi_params;
			fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
			fastcgi_pass    127.0.0.1:9000;
		}
	}
}</pre></div></div>

<p>J&#8217;ai personnellement choisi de stocker le fichier contenant les login/mots de passe dans le répertoire à protéger lui même mais on peut le mettre où l&#8217;on souhaite (/etc/nginx, etc&#8230;), de même le nom est par convention/ habitude .htpasswd (héritage d&#8217;Apache) mais on peut choisir le nom que l&#8217;on veut.</p>
<p>Par sécurité (indispensable) dès lors que l&#8217;on stock ce fichier dans un répertoire accessible par Nginx, il convient d&#8217;<strong>interdire son accès</strong> (sinon il pourra être affiché/télécharger). Dans mon cas il s&#8217;agit de la directive &laquo;&nbsp;location ~ /\.ht&nbsp;&raquo; qui interdit l&#8217;accès à tous fichier commençant par .ht</p>
<p>&nbsp;</p>
<h3>Création du fichier des login / mot de passe</h3>
<p>Pour créer le fichier .htpasswd contenant les login et le mot de passe crypté, il est communément conseillé d&#8217;utiliser le programme htpasswd du package apache2-utils.</p>
<p>Lorsque l&#8217;on utilise Nginx, il est toujours un peu dérangeant d&#8217;installer un package apache (même si ce dernier est petit : 1.3Mo), il existe donc des alternative sous forme de script perl par exemple.</p>
<p>Le premier que j&#8217;ai trouvé/testé est basique  :</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span>
 <span style="color: #000000; font-weight: bold;">use</span> strict<span style="color: #339933;">;</span>
 <span style="color: #000066;">chomp</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$username</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$ARGV</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000066;">chomp</span><span style="color: #009900;">&#40;</span><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$password</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$ARGV</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 <span style="color: #000066;">print</span> <span style="color: #0000ff;">$username</span><span style="color: #339933;">.</span><span style="color: #ff0000;">&quot;:&quot;</span><span style="color: #339933;">.</span><span style="color: #000066;">crypt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$password</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$username</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Il prend en paramètre le login et le mot de passe (en clair), crypte le mot de passe et écrit sur la sortie standard le couple login / mot de passe crypté avec la format attendu d&#8217;un ficheir .htpasswd.</p>
<p>&nbsp;</p>
<p>Le second (que j&#8217;ai gardé) est plus ressemblant à htpasswd d&#8217;Apache <a href="http://www.intuitive.com/wicked/examples/htpasswd-b.html">htpasswd-b: a smart replacement for the Apache htpasswd utility</a></p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span> <span style="color: #000066;">scalar</span> <span style="color: #339933;">@</span><span style="color: #000000; font-weight: bold;">ARGV</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;Usage: htpasswd-b passwordfile user password<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000066;">print</span> <span style="color: #ff0000;">&quot;(this program automatically creates the pw file if needed.)<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000066;">exit</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">@saltsource</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #ff0000;">'a'</span><span style="color: #339933;">..</span><span style="color: #ff0000;">'z'</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'A'</span><span style="color: #339933;">..</span><span style="color: #ff0000;">'Z'</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">'0'</span><span style="color: #339933;">..</span><span style="color: #ff0000;">'9'</span><span style="color: #339933;">,</span><span style="color: #ff0000;">'.'</span><span style="color: #339933;">,</span><span style="color: #ff0000;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$randum_num</span> <span style="color: #339933;">=</span> <span style="color: #000066;">int</span><span style="color: #009900;">&#40;</span><span style="color: #000066;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #000066;">scalar</span> <span style="color: #0000ff;">@saltsource</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$salt</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">$saltsource</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">$randum_num</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$randum_num</span> <span style="color: #339933;">=</span> <span style="color: #000066;">int</span><span style="color: #009900;">&#40;</span><span style="color: #000066;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #000066;">scalar</span> <span style="color: #0000ff;">@saltsource</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$salt</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">$saltsource</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">$randum_num</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #0000ff;">$outf</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$ARGV</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$user</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$ARGV</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$passwd</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$ARGV</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$user</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #0000ff;">$passwd</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #0000ff;">$encrypted</span> <span style="color: #339933;">=</span> <span style="color: #000066;">crypt</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$passwd</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;$salt&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span>f <span style="color: #0000ff;">$outf</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span>OUT<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;&gt;&gt;$outf&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000066;">die</span> <span style="color: #ff0000;">&quot;htpasswd-b error: $!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000066;">open</span><span style="color: #009900;">&#40;</span>OUT<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;&gt;$outf&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #000066;">die</span> <span style="color: #ff0000;">&quot;htpasswd-b error: $!<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066;">print</span> OUT <span style="color: #ff0000;">&quot;$user:$encrypted<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000066;">close</span><span style="color: #009900;">&#40;</span>OUT<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000066;">exit</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Créer un fichier (par exemple htpasswd-perl.pl), y copier le texte ci-dessus, le rendre exécutable (chmod). Il suffit ensuite d’appeler ce script avec le nom du fichier à créer / compléter, le login et le mot de passe en clair.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>htpasswd-perl.pl <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>Repertoire_protege<span style="color: #000000; font-weight: bold;">/</span>.htpasswd utilisateur mot_de_passe</pre></div></div>

<p>Enfin j&#8217;ai trouvé mais non testé un troisième script qui semble très complet :</p>
<p><a href="http://blog.shk-desktop.com/749-htpasswd-perl-mon-replacement-de-htpasswd">htpasswd-perl: mon replacement de htpasswd | Shtark.fr</a></p>
<p>&nbsp;</p>
<h3>Authentification par mot de passe et php</h3>
<p>Si votre site doit servir des pages php vous aurez surement une directive du type &laquo;&nbsp;location ~ \.php$&nbsp;&raquo; indiquant le paramétrage fastCGI. Il est très important de mettre cette directive dans le bloc location protégé (cf ma configuration ci-dessus) sinon l&#8217;accès au répertoire sera protégé :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">http:/localhost/Repertoire_protege</pre></div></div>

<p><a href="http://voidandany.free.fr/wp-content/uploads/2011-04-04_174936.png"><img class="aligncenter size-full wp-image-3685" title="2011-04-04_174936" src="http://voidandany.free.fr/wp-content/uploads/2011-04-04_174936.png" alt="" width="600" height="209" /></a>Mais pas l&#8217;accès directe à une page php sur le même site :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">http:/localhost/Repertoire_protege/index.php</pre></div></div>

<p><a href="http://voidandany.free.fr/wp-content/uploads/2011-04-04_175002.png"><img class="aligncenter size-full wp-image-3686" title="2011-04-04_175002" src="http://voidandany.free.fr/wp-content/uploads/2011-04-04_175002.png" alt="" width="600" height="223" /></a></p>
<h2>Restriction d&#8217;accès par IP</h2>
<p>Pour être encore plus sécurisé on peut carrément restreindre l&#8217;accès d&#8217;un site ou d&#8217;un répertoire à une liste fini d&#8217;adresse IP avec les directives <a href="http://wiki.nginx.org/HttpAccessModule#allow">allow</a> et <a href="http://wiki.nginx.org/HttpAccessModule#deny">deny</a> :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">	location /Repertoire_protege/ {
		auth_basic            &quot;Qui va là&quot;;
		auth_basic_user_file  /$document_root/Repertoire_protege/.htpasswd;
&nbsp;
		allow 127.0.0.1;
		deny all;
&nbsp;
		index  index.html index.htm index.php;
&nbsp;
		location ~ \.php$ {
			include /etc/nginx/fastcgi_params;
			fastcgi_param   SCRIPT_FILENAME  $document_root$fastcgi_script_name;
			fastcgi_pass    127.0.0.1:9000;
		}
	}</pre></div></div>

<p>Allow liste les IP autorisés et deny celle qui sont interdites, dans l&#8217;exemple ci-dessus toutes les IP sont interdites sauf l&#8217;IP locale (127.0.0.1)</p>
<p>Enfin on peut affiner le comportement de la restriction par IP avec la restriction par mot de passe avec la directive <a href="http://wiki.nginx.org/HttpCoreModule#satisfy">satisfy</a> qui indique si les 2 restrictions (IP + mot de passe) doivent être remplies (satisfy all) ou 1 seule d&#8217;entre elle (satisfy any) :</p>
<p>Exemple si on a une restriction par mot de passe + la restriction suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">allow 192.168.1.100;
deny all;</pre></div></div>

<p>Voici les résultats en fonction de la machine accédant au site/répertoire :</p>
<table border="0">
<tbody>
<tr>
<td style="text-align: center;"><strong>Accès depuis</strong></td>
<td><strong>satisfy any</strong></td>
<td><strong>satisfy all</strong></td>
</tr>
<tr>
<td>192.168.1.100</td>
<td>accès direct au site
</td>
<td>prompt de connexion</td>
</tr>
<tr>
<td>autre</td>
<td>prompt de connexion</td>
<td>403 forbiden</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p><span style="text-decoration: underline;"><em><strong>Sources :</strong></em></span></p>
<p><a title="Permanent Link to Password protect folders with NGINX the right way" rel="bookmark" href="http://cutfromthenorth.com/password-protect-folders-with-nginx-the-right-way/">Password protect folders with NGINX the right way</a> : Indique la &laquo;&nbsp;ruse&nbsp;&raquo; de protection d&#8217;un répertoire avec php</p>
<p><a title="Permanent Link: Restriction of the access with the help of Nginx" rel="bookmark" href="http://www.alrond.com/en/2007/apr/12/restriction-access-with-nginx/">Restriction of the access with the help of Nginx</a> : voir restriction sur IP</p>
<p><a href="http://nginx.org/en/docs/http/request_processing.html#simple_php_site_configuration">How nginx processes a request</a></p>
<p><a href="http://serverfault.com/questions/228031/nginx-auth-password-or-ip">nginx auth password or ip &#8211; Server Fault</a></p>
]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/restreindre-lacces-dun-site-dun-repertoire-avec-nginx/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Usage conjoint de screen et su</title>
		<link>http://voidandany.free.fr/index.php/usage-conjoint-de-screen-et-su/</link>
		<comments>http://voidandany.free.fr/index.php/usage-conjoint-de-screen-et-su/#comments</comments>
		<pubDate>Thu, 07 Apr 2011 14:15:49 +0000</pubDate>
		<dc:creator>voidAndAny</dc:creator>
				<category><![CDATA[Brèves]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://voidandany.free.fr/?p=1738</guid>
		<description><![CDATA[Screen est un multiplexeur de terminaux tandis que su permet de changer d&#8217;utilisateur dans un terminal. Si vous changez d&#8217;utilisateur avec su puis que vous lancez screen utilisateur1 $ su utilisateur2 Mot de passe : xxx utilisateur2 $ screen vous &#8230; <a href="http://voidandany.free.fr/index.php/usage-conjoint-de-screen-et-su/">Continuer la lecture <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a class="l" href="http://doc.ubuntu-fr.org/screen"><em><em>Screen</em></em></a> est un multiplexeur de terminaux tandis que <a class="wikilink1" title="su" href="http://doc.ubuntu-fr.org/su">su</a> permet de changer d&#8217;utilisateur dans un terminal.</p>
<p>Si vous changez d&#8217;utilisateur avec su puis que vous lancez screen</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">utilisateur1 $ <span style="color: #c20cb9; font-weight: bold;">su</span> utilisateur2 
Mot de passe : xxx 
utilisateur2 $ <span style="color: #c20cb9; font-weight: bold;">screen</span></pre></div></div>

<p>vous aurez le <strong>message d&#8217;erreur </strong>suivant :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Cannot open your terminal '/dev/pts/0' - please check.</pre></div></div>

<p>Et effectivement si vous regardez les droits du fichier /dev/pts/0, il appartient bien à l&#8217;utilisateur connecté (et non pas celui modifié via su) :</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">crw--w---- 1 utilisateur1 tty 136, 0 2010-01-27 13:36 /dev/pts/0</pre></div></div>

<p><strong>La solution</strong> : on ne peut plus simple inverser l&#8217;ordre des commandes : lancer screen puis faire le su dans screen</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">utilisateur2 $ <span style="color: #c20cb9; font-weight: bold;">screen</span> 
utilisateur1 $ <span style="color: #c20cb9; font-weight: bold;">su</span> utilisateur2 
Mot de passe : xxx</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://voidandany.free.fr/index.php/usage-conjoint-de-screen-et-su/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
