<?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>Werk &#187; mac</title>
	<atom:link href="http://werk.feub.net/category/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://werk.feub.net</link>
	<description>Pourquoi Werk? ^.^</description>
	<lastBuildDate>Tue, 06 Dec 2011 14:18:13 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Triste jour</title>
		<link>http://werk.feub.net/2011/10/triste-jour/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=triste-jour</link>
		<comments>http://werk.feub.net/2011/10/triste-jour/#comments</comments>
		<pubDate>Thu, 06 Oct 2011 07:17:51 +0000</pubDate>
		<dc:creator>Fabien</dc:creator>
				<category><![CDATA[général]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[au revoir]]></category>
		<category><![CDATA[steve jobs]]></category>

		<guid isPermaLink="false">http://werk.feub.net/?p=891</guid>
		<description><![CDATA[On a beau se dire que cela ne nous concerne pour ainsi dire pas, qu&#8217;il s&#8217;agit de sphères hors de portée, très éloignées, mais ça fait quand même un sacré quelque chose à l&#8217;intérieur, un peu mal aux tripes, un gros pincement au cœur. Steve Jobs a passé le relais.. pour de bon.Au revoir iPapy.]]></description>
			<content:encoded><![CDATA[<p><img src="http://werk.feub.net/medias/2011/10/black_apple64.png" alt="" class="floatleft" />On a beau se dire que cela ne nous concerne pour ainsi dire pas, qu&#8217;il s&#8217;agit de sphères hors de portée, très éloignées, mais ça fait quand même un sacré quelque chose à l&#8217;intérieur, un peu mal aux tripes, un gros pincement au cœur. Steve Jobs a passé le relais.. pour de bon.<br /><a href="http://www.apple.com/stevejobs/" title="http://www.apple.com/stevejobs/" target="_blank">Au revoir iPapy</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://werk.feub.net/2011/10/triste-jour/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sauvegarder son compte Gmail avec getmail</title>
		<link>http://werk.feub.net/2011/05/sauvegarder-son-compte-gmail-avec-getmail/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=sauvegarder-son-compte-gmail-avec-getmail</link>
		<comments>http://werk.feub.net/2011/05/sauvegarder-son-compte-gmail-avec-getmail/#comments</comments>
		<pubDate>Wed, 04 May 2011 14:24:21 +0000</pubDate>
		<dc:creator>Fabien</dc:creator>
				<category><![CDATA[BSD]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[fetchmail]]></category>
		<category><![CDATA[getmail]]></category>
		<category><![CDATA[gmail]]></category>
		<category><![CDATA[google apps]]></category>
		<category><![CDATA[maildir]]></category>
		<category><![CDATA[mbox]]></category>
		<category><![CDATA[sauvegarde]]></category>

		<guid isPermaLink="false">http://werk.feub.net/?p=772</guid>
		<description><![CDATA[getmail est un script en python écrit par Charles Cazabon qui permet de rapatrier les courriers d&#8217;une ou plusieurs boites aux lettres d&#8217;une façon simple (mais efficace). Selon les mots de son auteur, getmail est conçu pour être sécurisé, flexible, fiable et facile d&#8217;utilisation. Il est un remplaçant potentiel de fetchmail. Ce petit tutoriel est [...]]]></description>
			<content:encoded><![CDATA[<p>
<img src="http://werk.feub.net/medias/2011/05/gmail_red.png" alt="" class="floatleft" /><a href="http://pyropus.ca/software/getmail/">getmail</a> est un script en python écrit par Charles Cazabon qui permet de rapatrier les courriers d&#8217;une ou plusieurs boites aux lettres d&#8217;une façon simple (mais efficace). Selon les mots de son auteur, getmail est conçu pour être sécurisé, flexible, fiable et facile d&#8217;utilisation. Il est un remplaçant potentiel de <a href="http://fetchmail.berlios.de/">fetchmail</a>.
</p>
<p>
Ce petit tutoriel est fait sur une distribution <a href="http://www.centos.org/">CentOS</a> et c&#8217;est la procèdure de sauvegarde que j&#8217;utilise pour mon compte Gmail (Google Apps). La boite aux lettres de destination est de type <a href="https://secure.wikimedia.org/wikipedia/fr/wiki/Maildir">Maildir</a>, c&#8217;est-à-dire que chaque courrier est dans un fichier unique contrairement à <a href="https://secure.wikimedia.org/wikipedia/fr/wiki/Mbox">Mbox</a> qui place tous les courriers dans un fichier unique.
</p>
<p><span id="more-772"></span></p>
<h4>Installation de getmail</h4>
<p>
Choisissez votre gestionnaire de paquets préféré, pour les habitués des distributions à base de Red Hat, ce sera <em>yum</em> :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># yum install getmail</span></pre></div></div>

<h4>Création des répertoires</h4>
<p>
Le script ne crée pas par lui-même les répertoires et fichiers nécessaires au bon fonctionnement de getmail, il faut donc les ajouter à la main. On commence par l&#8217;arborescence de type Maildir qui accueillera les emails :
</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>Maildir<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>new,tmp,cur<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>
Je ne m&#8217;attarde pas sur les trois répertoires <em>cur</em>, <em>tmp</em> et <em>new</em>, c&#8217;est l&#8217;arborescence de <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Maildir#Technical_operation">fonctionnement de Maildir</a>. Ensuite, il faut créer le répertoire qui contiendra le fichier de configuration et les logs de getmail :
</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>.getmail
$ <span style="color: #c20cb9; font-weight: bold;">vim</span> ~<span style="color: #000000; font-weight: bold;">/</span>.getmail<span style="color: #000000; font-weight: bold;">/</span>gmailrc
$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-R</span> <span style="color: #000000;">700</span> ~<span style="color: #000000; font-weight: bold;">/</span>.getmail</pre></div></div>

<h4>Configuration</h4>
<p>
Voici mon fichier de configuration pour sauvegarder un compte <a href="http://www.google.com/apps/">Google Apps</a> en utilisant IMAP :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#91;</span>retriever<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #7a0874; font-weight: bold;">type</span> = SimpleIMAPSSLRetriever
server = imap.gmail.com
mailboxes = <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;[Gmail]/All Mail&quot;</span>,<span style="color: #7a0874; font-weight: bold;">&#41;</span>
username = nom<span style="color: #000000; font-weight: bold;">@</span>domaine.net
password = mot_de_passe
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span>destination<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #7a0874; font-weight: bold;">type</span> = Maildir
path = ~<span style="color: #000000; font-weight: bold;">/</span>Maildir<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">&#91;</span>options<span style="color: #7a0874; font-weight: bold;">&#93;</span>
<span style="color: #666666; font-style: italic;"># Mode verbeux</span>
<span style="color: #666666; font-style: italic;"># 0 : n'affiche que les warnings et les erreurs</span>
<span style="color: #666666; font-style: italic;"># 1 : affiche les notifications de récupération et de suppression de messages</span>
<span style="color: #666666; font-style: italic;"># 2 : toutes les actions</span>
verbose = <span style="color: #000000;">2</span>
message_log = ~<span style="color: #000000; font-weight: bold;">/</span>.getmail<span style="color: #000000; font-weight: bold;">/</span>gmail.log
&nbsp;
<span style="color: #666666; font-style: italic;"># ne récupére que les nouveaux messages</span>
<span style="color: #666666; font-style: italic;"># idéal pour de la sauvegarde régulière</span>
read_all = <span style="color: #c20cb9; font-weight: bold;">false</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># n'altère pas les messages</span>
delivered_to = <span style="color: #c20cb9; font-weight: bold;">false</span>
received = <span style="color: #c20cb9; font-weight: bold;">false</span></pre></div></div>

<h4>Lancement du script</h4>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ getmail <span style="color: #660033;">-r</span> ~<span style="color: #000000; font-weight: bold;">/</span>.getmail<span style="color: #000000; font-weight: bold;">/</span>gmailrc</pre></div></div>

<p>
Le script commence le rapatriement des messages et les place dans l&#8217;arborescence Maildir.
</p>
<p>
<strong>Note</strong> : Google n&#8217;autorise le transfert que d&#8217;un nombre limité de messages à la fois, si votre boite aux lettres est assez importante il faut relancer cette commande plusieurs fois, car seuls les nouveaux messages sont récupérés, ou alors le faire de façon automatisée (voir ci-dessous).
</p>
<h4>Automatisation</h4>
<p>
Afin d&#8217;automatiser cette sauvegarde, un job peut être ajouté dans le <a href="https://secure.wikimedia.org/wikipedia/fr/wiki/Cron">cron</a>. L&#8217;option <em>-q</em> rend l&#8217;opération silentieuse, sauf pour les erreurs :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Le script est lancé à la 7ème minute de chaque heure ^.^</span>
<span style="color: #000000;">7</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>getmail <span style="color: #660033;">-q</span> <span style="color: #660033;">-r</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>fabien<span style="color: #000000; font-weight: bold;">/</span>.getmail<span style="color: #000000; font-weight: bold;">/</span>getmailrc</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://werk.feub.net/2011/05/sauvegarder-son-compte-gmail-avec-getmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Créer un dépôt SVN local</title>
		<link>http://werk.feub.net/2011/04/creer-un-depot-svn-local/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creer-un-depot-svn-local</link>
		<comments>http://werk.feub.net/2011/04/creer-un-depot-svn-local/#comments</comments>
		<pubDate>Fri, 15 Apr 2011 15:43:42 +0000</pubDate>
		<dc:creator>Fabien</dc:creator>
				<category><![CDATA[BSD]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[webdev]]></category>
		<category><![CDATA[commit]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[repository]]></category>
		<category><![CDATA[revisions]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[versions]]></category>

		<guid isPermaLink="false">http://werk.feub.net/?p=755</guid>
		<description><![CDATA[Subversion, désormais Apache Subversion est un système de gestion de versions, celui-ci permet d&#8217;historiser les modifications effectuées sur des fichiers afin de pouvoir revenir sur des versions anciennes. Bien que très utilisé pour le développement, Subversion &#8211; en bref SVN &#8211; ne se limite pas à cela et peut fonctionner pour n&#8217;importe quel type d&#8217;utilisation [...]]]></description>
			<content:encoded><![CDATA[<p>
<img src="http://werk.feub.net/medias/2011/04/svn_logo.png" alt="" class="floatleft" />Subversion, désormais <a href="http://fr.wikipedia.org/wiki/Apache_Subversion">Apache Subversion</a> est un <a href="http://fr.wikipedia.org/wiki/Syst%C3%A8me_de_gestion_de_versions">système de gestion de versions</a>, celui-ci permet d&#8217;historiser les modifications effectuées sur des fichiers afin de pouvoir revenir sur des versions anciennes. Bien que très utilisé pour le développement, Subversion &#8211; en bref SVN &#8211; ne se limite pas à cela et peut fonctionner pour n&#8217;importe quel type d&#8217;utilisation (documents, images, etc), il faut juste garder à l&#8217;esprit que SVN est principalement fait pour gérer des fichiers dont le contenu évolue dans le temps. Par exemple, pour simplement partager des photos ou de la musique, SVN ne serait pas vraiment approprié car un fichier photo ou musical ne changent en principe pas dans le temps, alors qu&#8217;une lettre type, une documentation en cours ou des fichiers de développement bougent sans cesse et il est possible d&#8217;avoir besoin de revenir sur d&#8217;anciennes versions.
</p>
<p>
Cette article explique comment mettre en place un dépôt SVN pour les fichiers d&#8217;un site web. Le tutoriel est assez global, mais pour information il a été réalisé sur une Fedora 14.
</p>
<h4>Fonctionnement</h4>
<p>
Voici briévement comment fonctionne SVN. C&#8217;est un système de fichiers virtuels, on ajoute, édite, supprime des fichiers ou répertoires comme dans un système de fichiers traditionnel, mais tout se passe <em>en interne</em>, les différentes révisions des fichiers ne sont pas vraiment physiquement présentes. Pour mettre en pratique ce tutoriel, nous allons tout d&#8217;abord créer un dépôt (repository) où toute la gestion sera faite. Puis, dans un second temps nous allons importer un projet existant pour qu&#8217;il soit géré par SVN et c&#8217;est après que la magie s&#8217;opère ^.^
</p>
<p><span id="more-755"></span></p>
<h4>Création d&#8217;un dépôt local</h4>
<p>
Subversion possède deux commandes principales, l&#8217;une d&#8217;administration <em>svnadmin</em> et la commande de gestion <em>svn</em>. Pour créer un nouveau dépôt <em>svn_projet</em>, nous utilisons la première :
</p>
<pre>
$ svnadmin create --fs-type fsfs /chemin/depot/svn_projet
</pre>
<p>
Un nouveau dossier <em>svn_projet</em> est crée, voici son contenu :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> svn_projet<span style="color: #000000; font-weight: bold;">/</span>
total <span style="color: #000000;">368</span>
drwxr-xr-x  <span style="color: #000000;">2</span> fabien subversion   <span style="color: #000000;">4096</span> Apr  <span style="color: #000000;">8</span> <span style="color: #000000;">11</span>:<span style="color: #000000;">52</span> conf
drwxr-sr-x  <span style="color: #000000;">6</span> fabien subversion   <span style="color: #000000;">4096</span> Apr  <span style="color: #000000;">8</span> <span style="color: #000000;">11</span>:<span style="color: #000000;">52</span> db
<span style="color: #660033;">-r--r--r--</span>  <span style="color: #000000;">1</span> fabien subversion      <span style="color: #000000;">2</span> Apr  <span style="color: #000000;">8</span> <span style="color: #000000;">11</span>:<span style="color: #000000;">52</span> format
drwxr-xr-x  <span style="color: #000000;">2</span> fabien subversion   <span style="color: #000000;">4096</span> Apr  <span style="color: #000000;">8</span> <span style="color: #000000;">11</span>:<span style="color: #000000;">52</span> hooks
drwxr-xr-x  <span style="color: #000000;">2</span> fabien subversion   <span style="color: #000000;">4096</span> Apr  <span style="color: #000000;">8</span> <span style="color: #000000;">11</span>:<span style="color: #000000;">52</span> locks
<span style="color: #660033;">-rw-r--r--</span>  <span style="color: #000000;">1</span> fabien subversion    <span style="color: #000000;">229</span> Apr  <span style="color: #000000;">8</span> <span style="color: #000000;">11</span>:<span style="color: #000000;">52</span> README.txt</pre></div></div>

<p>
Il est rare d&#8217;aller voir les fichiers à l&#8217;intérieur du dépôt et il n&#8217;est pas recommandé d&#8217;y toucher. Voyons les informations sur notre nouveau dépôt :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> info <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>chemin<span style="color: #000000; font-weight: bold;">/</span>depot<span style="color: #000000; font-weight: bold;">/</span>svn_projet<span style="color: #000000; font-weight: bold;">/</span>
Path: svn_projet
URL: <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>chemin<span style="color: #000000; font-weight: bold;">/</span>depot<span style="color: #000000; font-weight: bold;">/</span>svn_projet
Repository Root: <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>chemin<span style="color: #000000; font-weight: bold;">/</span>depot<span style="color: #000000; font-weight: bold;">/</span>svn_projet
Repository UUID: d9d451c0-72b9-<span style="color: #000000;">4830</span>-93bf-3f8829278afe
Revision: <span style="color: #000000;">0</span>
Node Kind: directory
Last Changed Rev: <span style="color: #000000;">0</span>
Last Changed Date: <span style="color: #000000;">2011</span>-04-08 <span style="color: #000000;">11</span>:<span style="color: #000000;">52</span>:00 +0200 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Fri, 08 Apr <span style="color: #000000;">2011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>
On peut voir que la syntaxe pour interroger ce dépôt commence par <code>file://</code> pour une gestion locale. Ceci pourrait etre remplacé par <code>http://</code>,  <code>ssh://</code>, <code>svn://</code> ou <code>svn+ssh://</code> pour un dépôt distant. Pour l&#8217;exemple, nous partons avec un projet tout simple composé d&#8217;un fichier <em>index.html</em> et d&#8217;un fichier <em>style.css</em> dans un répertoire <em>css</em> :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">tree</span> <span style="color: #660033;">-a</span> <span style="color: #000000; font-weight: bold;">/</span>chemin<span style="color: #000000; font-weight: bold;">/</span>projet<span style="color: #000000; font-weight: bold;">/</span>web
<span style="color: #000000; font-weight: bold;">/</span>chemin<span style="color: #000000; font-weight: bold;">/</span>projet<span style="color: #000000; font-weight: bold;">/</span>web<span style="color: #000000; font-weight: bold;">/</span>
├── css
│   └── style.css
└── index.html
&nbsp;
<span style="color: #000000;">1</span> directory, <span style="color: #000000;">2</span> files</pre></div></div>

<p>
Nous allons maintenant importer les fichiers <em>non encore gérés par SVN</em> dans le dépôt, ceci se fait avec la commande <em>svn import</em>. Je ne vais pas m&#8217;attarder là-dessus, mais par convention, il est bon de créer 3 répertoires dans notre dépôt : <em>trunk</em>, <em>tags</em> et <em>branches</em>. Le premier sera les fichiers du projet les plus récents, il s&#8217;agit de la version de travail la plus actuelle. <em>tags</em> contiendra en général les versions historisés (version 1, version 2, etc) et <em>branches</em> représente des dérivations dans le temps de l&#8217;évolution des éléments.<br />
Assez de blabla, importons!
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #7a0874; font-weight: bold;">cd</span> projet
$ <span style="color: #c20cb9; font-weight: bold;">svn</span> import <span style="color: #000000; font-weight: bold;">/</span>chemin<span style="color: #000000; font-weight: bold;">/</span>projet<span style="color: #000000; font-weight: bold;">/</span>web <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>chemin<span style="color: #000000; font-weight: bold;">/</span>depot<span style="color: #000000; font-weight: bold;">/</span>svn_projet<span style="color: #000000; font-weight: bold;">/</span>trunk <span style="color: #660033;">-m</span> <span style="color: #ff0000;">'Initial import.'</span>
Adding         web<span style="color: #000000; font-weight: bold;">/</span>css
Adding         web<span style="color: #000000; font-weight: bold;">/</span>css<span style="color: #000000; font-weight: bold;">/</span>style.css
Adding         web<span style="color: #000000; font-weight: bold;">/</span>index.html
&nbsp;
Committed revision <span style="color: #000000;">1</span>.</pre></div></div>

<p>
Le projet est importé, celui-ci existe désormais dans le dépôt, il s&#8217;agit de la version, plus précisément de la révision 1 et un commentaire est ajouté dans le log avec l&#8217;option <em>-m</em>, sans cette option l&#8217;éditeur par défaut s&#8217;ouvrirait et il serait demandé d&#8217;écrire une petite bafouille, sans quoi, pas de <em>commit</em>. L&#8217;action <em>commit</em> permet de figer un numéro de révision et ainsi de pouvoir y revenir plus tard. Chaque <em>commit</em> incrémente le compteur.
</p>
<p>
Nous pouvons vérifier notre log :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> log <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>chemin<span style="color: #000000; font-weight: bold;">/</span>depot<span style="color: #000000; font-weight: bold;">/</span>svn_projet
<span style="color: #660033;">------------------------------------------------------------------------</span>
r1 <span style="color: #000000; font-weight: bold;">|</span> amannf <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">2011</span>-04-<span style="color: #000000;">15</span> <span style="color: #000000;">15</span>:<span style="color: #000000;">10</span>:<span style="color: #000000;">46</span> +0200 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Fri, <span style="color: #000000;">15</span> Apr <span style="color: #000000;">2011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">1</span> line
&nbsp;
Initial import.
<span style="color: #660033;">------------------------------------------------------------------------</span></pre></div></div>

<p>
A ce stade, il faut comprendre que notre site web est géré par SVN, une première révision existe belle et bien, il est donc possible de supprimer les anciens fichiers non historisés :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #000000; font-weight: bold;">/</span>chemin<span style="color: #000000; font-weight: bold;">/</span>projet<span style="color: #000000; font-weight: bold;">/</span>web</pre></div></div>

<p>
On se retrouve sans rien&#8230; ou presque. Le site est connu de SVN mais nous n&#8217;avons plus de fichiers de travail, il faut alors les (re)créer avec l&#8217;option <em>checkout</em> de la commande <em>svn</em>, celle-ci permet d&#8217;extraire une version qui servira de base au futur développement.
</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>chemin<span style="color: #000000; font-weight: bold;">/</span>travail<span style="color: #000000; font-weight: bold;">/</span>web
$ <span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>chemin<span style="color: #000000; font-weight: bold;">/</span>travail<span style="color: #000000; font-weight: bold;">/</span>web
$ <span style="color: #c20cb9; font-weight: bold;">svn</span> checkout <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>chemin<span style="color: #000000; font-weight: bold;">/</span>depot<span style="color: #000000; font-weight: bold;">/</span>svn_projet <span style="color: #000000; font-weight: bold;">/</span>chemin<span style="color: #000000; font-weight: bold;">/</span>travail<span style="color: #000000; font-weight: bold;">/</span>web
A    trunk
A    trunk<span style="color: #000000; font-weight: bold;">/</span>css
A    trunk<span style="color: #000000; font-weight: bold;">/</span>css<span style="color: #000000; font-weight: bold;">/</span>style.css
A    trunk<span style="color: #000000; font-weight: bold;">/</span>index.html
Checked out revision <span style="color: #000000;">1</span>.</pre></div></div>

<p>
D&#8217;accord, mais pourquoi à l&#8217;étape précèdente nous avons supprimé nos fichiers pour maintenant les rajouter, car il s&#8217;agit des mêmes.. Simplement parce que désormais cette copie va être gérée par SVN, nous pouvons d&#8217;ailleurs voir qu&#8217;il y a un répertoire <em>.svn</em> à la racine de chaque répertoire et sous-répertoire de notre copie de travail. Attention à ne jamais les supprimer, au risque de passer un précieux temps à remettre sur pieds un dépôt bancal.<br />
Au passage, on peut de nouveau vérifier l&#8217;état du dépôt :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> info <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>chemin<span style="color: #000000; font-weight: bold;">/</span>depot<span style="color: #000000; font-weight: bold;">/</span>svn_projet<span style="color: #000000; font-weight: bold;">/</span>
Path: svn_projet
URL: <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>chemin<span style="color: #000000; font-weight: bold;">/</span>depot<span style="color: #000000; font-weight: bold;">/</span>svn_projet
Repository Root: <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>chemin<span style="color: #000000; font-weight: bold;">/</span>depot<span style="color: #000000; font-weight: bold;">/</span>svn_projet
Repository UUID: d9d451c0-72b9-<span style="color: #000000;">4830</span>-93bf-3f8829278afe
Revision: <span style="color: #000000;">1</span>
Node Kind: directory
Last Changed Author: amannf
Last Changed Rev: <span style="color: #000000;">1</span>
Last Changed Date: <span style="color: #000000;">2011</span>-04-08 <span style="color: #000000;">12</span>:<span style="color: #000000;">52</span>:00 +0200 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Fri, 08 Apr <span style="color: #000000;">2011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<h4>Faire des modifications de structure</h4>
<p>
Nous allons ajouter un répertoire <em>js</em> contenant un fichier <em>fonctions.js</em> :
</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>chemin<span style="color: #000000; font-weight: bold;">/</span>travail<span style="color: #000000; font-weight: bold;">/</span>web
$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> trunk<span style="color: #000000; font-weight: bold;">/</span>js
$ <span style="color: #c20cb9; font-weight: bold;">touch</span> trunk<span style="color: #000000; font-weight: bold;">/</span>js<span style="color: #000000; font-weight: bold;">/</span>fonction.js</pre></div></div>

<p>
Le répertoire doit être pris en compte par le dépôt maintenant. Ceci ne vas pas faire un <em>commit</em> mais juste indiquer au dépôt la présence de ce nouveau dossier (et de ce qu&#8217;il contient) :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> add trunk<span style="color: #000000; font-weight: bold;">/</span>js
A         trunk<span style="color: #000000; font-weight: bold;">/</span>js
A         trunk<span style="color: #000000; font-weight: bold;">/</span>js<span style="color: #000000; font-weight: bold;">/</span>fonction.js</pre></div></div>

<p>
Notre version a évolué avec ce nouveau répertoire <em>js</em>, il est temps de faire notre premier <em>commit</em>, c&#8217;est-à-dire d&#8217;incrémenter le numéro de révision de notre site web :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">'First commit.'</span>
Adding         trunk<span style="color: #000000; font-weight: bold;">/</span>js
Adding         trunk<span style="color: #000000; font-weight: bold;">/</span>js<span style="color: #000000; font-weight: bold;">/</span>fonction.js
Transmitting <span style="color: #c20cb9; font-weight: bold;">file</span> data ..
Committed revision <span style="color: #000000;">2</span>.</pre></div></div>

<p>
Voilà, nous sommes passés en révision 2 ^.^ Le principe est le même avec la suppression de fichiers/répertoires, le mot clé est &#8211; je vous le donne en mille &#8211; <em>delete</em>, par example :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> delete trunk<span style="color: #000000; font-weight: bold;">/</span>js<span style="color: #000000; font-weight: bold;">/</span>fonctions.js
D         trunk<span style="color: #000000; font-weight: bold;">/</span>js<span style="color: #000000; font-weight: bold;">/</span>fonction.js</pre></div></div>

<p>
Pour valider le changement :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">'Delete fonctions.js file.'</span>
Deleting       trunk<span style="color: #000000; font-weight: bold;">/</span>js<span style="color: #000000; font-weight: bold;">/</span>fonction.js
&nbsp;
Committed revision <span style="color: #000000;">3</span>.</pre></div></div>

<p>
Et voilà la révision 3. Nous estimons que ceci va correspondre à notre première version officielle, fini la beta! C&#8217;est là qu&#8217;entre le principe des <em>tags</em>, nous allons créer un <em>tags</em> pour la version 1, c&#8217;est-à-dire faire une copie à ce stade, et le développement normal continuera sur le <em>trunk</em>. Vous avez saisi le système du <em>trunk</em> et des <em>branches</em> maintenant. Alors, dans l&#8217;ordre cela donne :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">mkdir</span> tags
$ <span style="color: #c20cb9; font-weight: bold;">svn</span> add tags
A         tags
$ <span style="color: #c20cb9; font-weight: bold;">svn</span> copy trunk<span style="color: #000000; font-weight: bold;">/</span> tags<span style="color: #000000; font-weight: bold;">/</span>version_1.0
A         tags<span style="color: #000000; font-weight: bold;">/</span>version_1.0</pre></div></div>

<p>
Voilà, notre version 1.0 est historisée. Presque. Il manque le <em>commit</em> :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> commit <span style="color: #660033;">-m</span> <span style="color: #ff0000;">'Tagged version 1.0.'</span> tags<span style="color: #000000; font-weight: bold;">/</span>
Adding         tags
Adding         tags<span style="color: #000000; font-weight: bold;">/</span>version_1.0
Adding         tags<span style="color: #000000; font-weight: bold;">/</span>version_1.0<span style="color: #000000; font-weight: bold;">/</span>js
Deleting       tags<span style="color: #000000; font-weight: bold;">/</span>version_1.0<span style="color: #000000; font-weight: bold;">/</span>js<span style="color: #000000; font-weight: bold;">/</span>fonction.js
Adding         tags<span style="color: #000000; font-weight: bold;">/</span>version_1.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">test</span>
&nbsp;
Committed revision <span style="color: #000000;">4</span>.</pre></div></div>

<p>
Petite vérification du log :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> log <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>chemin<span style="color: #000000; font-weight: bold;">/</span>depot<span style="color: #000000; font-weight: bold;">/</span>svn_projet<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #660033;">------------------------------------------------------------------------</span>
r4 <span style="color: #000000; font-weight: bold;">|</span> amannf <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">2011</span>-04-<span style="color: #000000;">15</span> <span style="color: #000000;">15</span>:<span style="color: #000000;">57</span>:<span style="color: #000000;">49</span> +0200 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Fri, <span style="color: #000000;">15</span> Apr <span style="color: #000000;">2011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">1</span> line
&nbsp;
Tagged version <span style="color: #000000;">1.0</span>.
<span style="color: #660033;">------------------------------------------------------------------------</span>
r3 <span style="color: #000000; font-weight: bold;">|</span> amannf <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">2011</span>-04-<span style="color: #000000;">15</span> <span style="color: #000000;">15</span>:<span style="color: #000000;">48</span>:<span style="color: #000000;">30</span> +0200 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Fri, <span style="color: #000000;">15</span> Apr <span style="color: #000000;">2011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">1</span> line
&nbsp;
Delete fonctions.js file.
<span style="color: #660033;">------------------------------------------------------------------------</span>
r2 <span style="color: #000000; font-weight: bold;">|</span> amannf <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">2011</span>-04-<span style="color: #000000;">15</span> <span style="color: #000000;">15</span>:<span style="color: #000000;">41</span>:<span style="color: #000000;">28</span> +0200 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Fri, <span style="color: #000000;">15</span> Apr <span style="color: #000000;">2011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">1</span> line
&nbsp;
First commit.
<span style="color: #660033;">------------------------------------------------------------------------</span>
r1 <span style="color: #000000; font-weight: bold;">|</span> amannf <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">2011</span>-04-<span style="color: #000000;">15</span> <span style="color: #000000;">15</span>:<span style="color: #000000;">10</span>:<span style="color: #000000;">46</span> +0200 <span style="color: #7a0874; font-weight: bold;">&#40;</span>Fri, <span style="color: #000000;">15</span> Apr <span style="color: #000000;">2011</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000;">1</span> line
&nbsp;
Initial import.
<span style="color: #660033;">------------------------------------------------------------------------</span></pre></div></div>

<h4>Revenir sur une ancienne version</h4>
<p>
C&#8217;est bien beau de gérer les révisions de projets, mais encore faut-il pouvoir au besoin revenir sur une ancienne version. Rien de plus simple. Le plus difficile étant de savoir où revenir, d&#8217;où la nécessité de bien documenter ses <em>commits</em> (option <em>-m</em>). Dans notre cas, je veux revenir à la version avec le fichier <em>fonctions.js</em> avant sa suppression donc, d&#8217;après notre log du point précédent, on voit qu&#8217;il faut revenir en r1 :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> <span style="color: #660033;">-r</span> <span style="color: #000000;">1</span> <span style="color: #c20cb9; font-weight: bold;">file</span>:<span style="color: #000000; font-weight: bold;">///</span>chemin<span style="color: #000000; font-weight: bold;">/</span>depot<span style="color: #000000; font-weight: bold;">/</span>svn_projet<span style="color: #000000; font-weight: bold;">/</span>trunk <span style="color: #000000; font-weight: bold;">/</span>nouveau<span style="color: #000000; font-weight: bold;">/</span>chemin<span style="color: #000000; font-weight: bold;">/</span>
A    css
A    css<span style="color: #000000; font-weight: bold;">/</span>style.css
A    index.html
Checked out revision <span style="color: #000000;">1</span>.</pre></div></div>

<p>
La révision 1 est désormais accessible sous <em>/nouveau/chemin</em>.
</p>
<h4>Conclusion</h4>
<p>
Voici une introduction par la pratique de Subversion, certe un peu rapide, mais les grands principes sont là et cela permet de se lancer dans l&#8217;aventure.</p>
]]></content:encoded>
			<wfw:commentRss>http://werk.feub.net/2011/04/creer-un-depot-svn-local/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Apache et SSL, accéder à un site en https</title>
		<link>http://werk.feub.net/2011/03/apache-et-ssl-acceder-a-un-site-en-https/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=apache-et-ssl-acceder-a-un-site-en-https</link>
		<comments>http://werk.feub.net/2011/03/apache-et-ssl-acceder-a-un-site-en-https/#comments</comments>
		<pubDate>Tue, 01 Mar 2011 16:42:39 +0000</pubDate>
		<dc:creator>Fabien</dc:creator>
				<category><![CDATA[BSD]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[mode rewrite]]></category>
		<category><![CDATA[serveur]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://werk.feub.net/?p=701</guid>
		<description><![CDATA[Petit tutoriel décrivant la mise en place d&#8217;un certificat SSL pour accéder à un serveur web Apache en mode sécurisé (avec https:// à la place de http://). Ce qui suit sous-entend que le serveur Apache est fonctionnel. Comme d&#8217;habitude, ceci est fait sur une Fedora 14, mais reste général. Le module SSL devrait être installé [...]]]></description>
			<content:encoded><![CDATA[<p>
<img src="http://werk.feub.net/medias/2010/03/fedora-logo_64.png" alt="" title="" class="floatleft" />Petit tutoriel décrivant la mise en place d&#8217;un certificat <a href="http://fr.wikipedia.org/wiki/SSL" title="Wikipedia">SSL</a> pour accéder à un serveur web <a href="http://httpd.apache.org/" title="Apache">Apache</a> en mode sécurisé (avec https:// à la place de http://). Ce qui suit sous-entend que le serveur Apache est fonctionnel. Comme d&#8217;habitude, ceci est fait sur une <a href="http://www.fedora-fr.org/" title="Fedora France">Fedora 14</a>, mais reste général.
</p>
<p><span id="more-701"></span></p>
<p>Le module SSL devrait être installé par défaut, sinon il faut l&#8217;ajouter :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># yum -y install mod_ssl</span></pre></div></div>

<h4>Création de la clé</h4>
<p>
Pour accepter les requêtes SSL, Apache a besoin d&#8217;une clé pour le serveur et d&#8217;un certificat signé. Les noms de ces fichiers n&#8217;ayant pas d&#8217;importance, dans ce tutoriel, elles seront respectivement nommées <em>server.key</em> et <em>server.crt</em>. Un certificat personnel &#8211; gratuit &#8211; va ainsi être crée, pour une utilisation professionnelle, il faudrait préférer un certificat &#8211; payant &#8211; délivré par une autorité comme <a href="http://www.verisign.com/" title="Verisign">Verisign</a>. La seule différence avec une clé <em>faîte maison</em> sera un avertissement par le navigateur lors de l&#8217;accès à une ressource SSL. La sécurité est la même, que le certificat soit signé par vous même ou par un organisme. La clé va être ajoutée sous <em>/etc/pki/tls/certs</em> :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># cd /etc/pki/tls/certs</span>
<span style="color: #666666; font-style: italic;"># make server.key</span>
<span style="color: #7a0874; font-weight: bold;">umask</span> <span style="color: #000000;">77</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>openssl genrsa <span style="color: #660033;">-des3</span> <span style="color: #000000;">1024</span> <span style="color: #000000; font-weight: bold;">&gt;</span> server.key
Generating RSA private key, <span style="color: #000000;">1024</span> bit long modulus
......................................................++++++
.............++++++
e is <span style="color: #000000;">65537</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>0x10001<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Enter pass phrase: <span style="color: #000000; font-weight: bold;">//</span> Entrer une pass phrase
Verifying - Enter pass phrase: <span style="color: #000000; font-weight: bold;">//</span> Vérification</pre></div></div>

<p>Il est ennuyeux de toujours saisir la pass phrase, elle est donc retirée de la clé privée :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># openssl rsa -in server.key -out server.key</span></pre></div></div>

<h4>Ajout du certificat</h4>
<p>
Pour la création du certificat, plusieurs renseignements vont être demandés afin d&#8217;être incorporés dans celui-ci, certaines informations sont toutefois facultatives :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># make server.csr</span>
<span style="color: #7a0874; font-weight: bold;">umask</span> <span style="color: #000000;">77</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>openssl req <span style="color: #660033;">-utf8</span> <span style="color: #660033;">-new</span> <span style="color: #660033;">-key</span> server.key <span style="color: #660033;">-out</span> server.csr
&nbsp;
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 <span style="color: #ff0000;">'.'</span>, the field will be left blank.
<span style="color: #660033;">-----</span>
Country Name <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span> letter code<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>GB<span style="color: #7a0874; font-weight: bold;">&#93;</span>: FR
State or Province Name <span style="color: #7a0874; font-weight: bold;">&#40;</span>full name<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Berkshire<span style="color: #7a0874; font-weight: bold;">&#93;</span>: Lorraine
Locality Name <span style="color: #7a0874; font-weight: bold;">&#40;</span>eg, city<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>Newbury<span style="color: #7a0874; font-weight: bold;">&#93;</span>: Ramonchamp <span style="color: #000000; font-weight: bold;">//</span> Yes<span style="color: #000000; font-weight: bold;">!</span> ;<span style="color: #7a0874; font-weight: bold;">&#125;</span>
Organization Name <span style="color: #7a0874; font-weight: bold;">&#40;</span>eg, company<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>My Company Ltd<span style="color: #7a0874; font-weight: bold;">&#93;</span>:
Organizational Unit Name <span style="color: #7a0874; font-weight: bold;">&#40;</span>eg, section<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>:
Common Name <span style="color: #7a0874; font-weight: bold;">&#40;</span>eg, your server<span style="color: #ff0000;">'s hostname) []: mondomaine.net
Email Address []: nom@mondomaine.net
Please enter the following '</span>extra<span style="color: #ff0000;">' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:</span></pre></div></div>

<p>Création du certificat pour une durée de 10 ans :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># openssl x509 -in server.csr -out server.crt -req -signkey server.key -days 3650</span>
Signature ok
<span style="color: #007800;">subject</span>=<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">C</span>=FR<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">ST</span>=Lorraine<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">L</span>=Ramonchamp<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">O</span>=mondomaine<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">OU</span>=mondomaine<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">CN</span>=mondomaine.net<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">emailAddress</span>=nom<span style="color: #000000; font-weight: bold;">@</span>mondomaine.net Getting Private key</pre></div></div>

<p>On change les droits sur ces fichiers désormais importants avant de passer à la suite :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># chmod 400 server.*</span></pre></div></div>

<h4>Directives Apache</h4>
<p>
Il ne reste plus qu&#8217;à ajouter les directives Apache pour prendre en compte le SSL. Comme Fedora fait bien le boulot, ce travail est pré-mâché dans un fichier de configuration sous <code>/etc/httpd/conf.d/ssl.conf</code>. Il faut dé-commenter les lignes suivantes dans ce fichier :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">DocumentRoot <span style="color: #ff0000;">&quot;/var/www/html&quot;</span> <span style="color: #000000; font-weight: bold;">//</span> Environ ligne <span style="color: #000000;">84</span>
ServerName www.mondomaine.net:<span style="color: #000000;">443</span> <span style="color: #000000; font-weight: bold;">//</span> Environ ligne <span style="color: #000000;">85</span>
SSLCertificateFile <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pki<span style="color: #000000; font-weight: bold;">/</span>tls<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>server.crt <span style="color: #000000; font-weight: bold;">//</span> Environ ligne <span style="color: #000000;">112</span>
SSLCertificateKeyFile <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>pki<span style="color: #000000; font-weight: bold;">/</span>tls<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>server.key <span style="color: #000000; font-weight: bold;">//</span> Environ ligne <span style="color: #000000;">119</span></pre></div></div>

<p>Redémarrage d&#8217;httpd :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># service httpd restart</span></pre></div></div>

<p>
C&#8217;est terminé, les pages peuvent désormais être accédées par <strong><a href="https://www.mon-domaine.net/" title="https://www.mon-domaine.net/" rel="nofollow">https://www.mon-domaine.net/</a></strong>.
</p>
<h4>Forcer la consultation des pages en https</h4>
<p>
Ce qui peut être intéressant, c&#8217;est de forcer l&#8217;accès aux pages en https uniquement, pour faire ceci on va utiliser le mode rewrite. Ajouter ce qui suit au fichier httpd.conf (préfèrable) ou dans un fichier <em>.htaccess</em> :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">RewriteEngine On
RewriteCond <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>SERVER_PORT<span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #000000; font-weight: bold;">!</span>^<span style="color: #000000;">443</span>$
RewriteRule ^<span style="color: #7a0874; font-weight: bold;">&#40;</span>.<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>$  https:<span style="color: #000000; font-weight: bold;">//%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>SERVER_NAME<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #000000; font-weight: bold;">/</span>admin<span style="color: #000000; font-weight: bold;">/</span>? <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">R</span>=<span style="color: #000000;">301</span>,L<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>
Après avoir redémarré Apache, on voit qu&#8217;en tapant <strong>http</strong>://www.mondonaine.net, on passe tout de suite en <strong>https</strong>://www.mondonaine.net ^.^
</p>
<p><!-- cette article m'a été copié par ce site : http://wiki.games-over.org/index.php?title=SSL_-_Activer_et_configurer_SSL_pour_Apache --></p>
]]></content:encoded>
			<wfw:commentRss>http://werk.feub.net/2011/03/apache-et-ssl-acceder-a-un-site-en-https/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Changer le port SSH par défaut d’OS X</title>
		<link>http://werk.feub.net/2011/01/changer-le-port-ssh-par-defaut-d%e2%80%99os-x/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=changer-le-port-ssh-par-defaut-d%25e2%2580%2599os-x</link>
		<comments>http://werk.feub.net/2011/01/changer-le-port-ssh-par-defaut-d%e2%80%99os-x/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 13:13:28 +0000</pubDate>
		<dc:creator>Fabien</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://werk.feub.net/?p=608</guid>
		<description><![CDATA[Ce n’est pas nouveau, mais depuis Tiger, et maintenant sous Snow Leopard, la gestion de SSH est reléguée au démon launchd et non plus à xinetd. Ainsi pour changer le numéro de port de SSH, une petite gymnastique s’impose. Comme beaucoup de démons sous OS X, le fichier de configuration se trouve sous /System/Library/LaunchDaemons et [...]]]></description>
			<content:encoded><![CDATA[<p>
<img src="http://werk.feub.net/medias/2010/03/finder-logo_64.png" alt="" title="" width="64" height="64" class="floatleft" />Ce n’est pas nouveau, mais depuis Tiger, et maintenant sous <a title="apple.com" target="_blank" href="http://www.apple.com/fr/macosx/">Snow Leopard</a>, la gestion de SSH est reléguée au démon <a title="apple.com" target="_blank" href="http://developer.apple.com/MacOsX/launchd.html">launchd</a> et non plus à <a title="Wikipedia : xinetd" target="_blank" href="http://fr.wikipedia.org/wiki/Xinetd">xinetd</a>. Ainsi pour changer le numéro de port de SSH, une petite gymnastique s’impose.
</p>
<p>Comme beaucoup de démons sous OS X, le fichier de configuration se trouve sous <code>/System/Library/LaunchDaemons</code> et celui qui nous intéresse se nomme naturellement <code>ssh.plist</code>.
</p>
<p><span id="more-608"></span></p>
<p>
Lorsque l’on édite ce fichier de configuration, on peut trouver ces lignes qui renseignent sur le port du service ssh.
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>SockServiceName<span style="color: #000000; font-weight: bold;">&lt;/</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>string<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #c20cb9; font-weight: bold;">ssh</span><span style="color: #000000; font-weight: bold;">&lt;/</span>string<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>
Oui, mais cela ne ressemble pas à un numéro de port. Juste. En fait, pourquoi faire simple quand on peut compliquer un petit peu, la chaîne ssh renvoie au fichier <code>/etc/services</code>, et on trouve bien que SSH est sur le port standard 22 (en UDP et TCP).
</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: #000000;">22</span><span style="color: #000000; font-weight: bold;">/</span>udp     <span style="color: #666666; font-style: italic;"># SSH Remote Login Protocol</span>
<span style="color: #c20cb9; font-weight: bold;">ssh</span>              <span style="color: #000000;">22</span><span style="color: #000000; font-weight: bold;">/</span>tcp     <span style="color: #666666; font-style: italic;"># SSH Remote Login Protocol</span></pre></div></div>

<p>
Il suffit donc de rajouter un nouveau nom avec le port correspondant, par exemple si l’on veut utiliser SSH sur le port 2222 au lieu de 22 :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ssh2              <span style="color: #000000;">2222</span><span style="color: #000000; font-weight: bold;">/</span>udp     <span style="color: #666666; font-style: italic;"># SSH Remote Login Protocol</span>
ssh2              <span style="color: #000000;">2222</span><span style="color: #000000; font-weight: bold;">/</span>tcp     <span style="color: #666666; font-style: italic;"># SSH Remote Login Protocol</span></pre></div></div>

<p>
Et d’aller bien sur renommer la chaîne correspondant au SockServiceName dans le <code>ssh.plist</code>, comme ceci :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>SockServiceName<span style="color: #000000; font-weight: bold;">&lt;/</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>ssh2<span style="color: #000000; font-weight: bold;">&lt;/</span>string<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>
On relance le service :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># launchctl stop /System/Library/LaunchDaemons/ssh.plist</span>
<span style="color: #666666; font-style: italic;"># launchctl start /System/Library/LaunchDaemons/ssh.plist</span></pre></div></div>

<p>
Et le tour est joué. Il suffit de bien penser à se connecter sur le bon port désormais : <code>$ ssh -p 2222</code>.
</p>
<p>​</p>
<hr />
<p>
<em>Cette article est la mise-à-jour d&#8217;un billet de juillet 2008.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://werk.feub.net/2011/01/changer-le-port-ssh-par-defaut-d%e2%80%99os-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Activer Postfix sous Mac OS X</title>
		<link>http://werk.feub.net/2011/01/activer-postfix-sous-mac-os-x/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=activer-postfix-sous-mac-os-x</link>
		<comments>http://werk.feub.net/2011/01/activer-postfix-sous-mac-os-x/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 09:20:57 +0000</pubDate>
		<dc:creator>Fabien</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[messagerie]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://werk.feub.net/?p=35</guid>
		<description><![CDATA[Envoyer des emails avec le serveur de messagerie de Tiger et Leopard]]></description>
			<content:encoded><![CDATA[<p>
<img src="http://werk.feub.net/medias/2010/03/finder-logo_64.png" alt="" title="" width="64" height="64" class="floatleft" />Il se peut que vous désiriez envoyer des emails en local avec le serveur SMTP de votre Mac. Les raisons peuvent être diverses, avec un portable hors de chez vous, certains fournisseurs d&#8217;accès refusent les emails sortants depuis certaines IP ou vous avez des scripts qui nécessitent l&#8217;envoi d&#8217;emails (de logs par exemple, c&#8217;est mon cas), donc il vous faut pouvoir les envoyer localement.
</p>
<p>
Mac OS X (depuis Panther) possède un serveur de messagerie, le renommé <a href="http://www.postfix.org/" title="Postfix">Postfix</a>. Nous allons voir comment le faire tourner grâce au daemon <a href="http://en.wikipedia.org/wiki/Launchd" title="Wikipedia EN">launchd</a>.<br />
Ce document décrit la mise en route de Postfix, mais ne traite pas de sa configuration, voir sa <a href="http://www.postfix.org/" title="Postfix">documentation</a> pour aller plus loin.
</p>
<p><span id="more-35"></span></p>
<p>
Les opérations suivantes doivent être réalisées en tant que <strong>root</strong>. En ce qui me concerne, j&#8217;utiliserai l&#8217;éditeur <a href="http://fr.wikipedia.org/wiki/Vim" title="Wikipedia">VIM</a>.
</p>
<h4>main.cf</h4>
<p>
La première chose à faire et d&#8217;éditer <code>main.cf</code>, le principal fichier de configuration de Postfix qui se trouve sous <code>/etc/postfix/</code>. Au préalable, il est bon de faire une copie du fichier présent.
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># mv /etc/postfix/main.cf /etc/postfix/main.cf.fab</span>
<span style="color: #666666; font-style: italic;"># vim /etc/postfix/main.cf</span></pre></div></div>

<p>
Les paramètres <em>myhostname</em>, <em>mydomain</em>, <em>myorigin</em> et <em>mynetworks_style</em> doivent être renseignés. Le premier <em>myhostname</em> désigne la machine sur lequel tourne Postfix, il est tout à fait possible de laisser la valeur générique <em>localhost.localdomain</em>, mais je vais renseigner le <a href="http://fr.wikipedia.org/wiki/FQDN" title="Wikipedia">FQDN</a> de mon iBook sur mon réseau, représenté par le nom de la machine et du nom de domaine :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">myhostname = osgiliath.feub.net</pre></div></div>

<p>
Ensuite, <em>mydomain</em> comme son nom l&#8217;indique représente le (les) nom de domaine pour lequel Postfix officiera. En général, il s&#8217;agit de la partie domaine du myhostname :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mydomain = feub.net</pre></div></div>

<p>
<em>myorigin</em> est le nom de domaine qui apparait dans le courrier envoyé à partir de ma machine. Il est usuel de mettre </em>myhostname</em> voir <em>mydomain</em> :
</p>

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

<p>
Postfix ne relaie le courrier que des clients autorisés, il est donc bon de lui dire de qui avec le paramètre<br />
<em>mynetworks_style</em>. Dans mon mon cas, j&#8217;autorise les machines du sous-réseau :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mynetworks_style = subnet</pre></div></div>

<p>
A noter que <em>mynetworks</em> pourrait être utilisé en spécifiant une adresse de réseau autorisée à la place d&#8217;un <em>style</em>. Par exemple :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mynetworks = 192.168.1.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span></pre></div></div>

<p>
C&#8217;est l&#8217;un ou l&#8217;autre, si les deux paramètres <em>mynetworks_style</em> et <em>mynetworks</em> sont renseignés, <em>mynetworks</em> sera pris en compte.<br />
Voilà pour la configuration du <em>main.cf</em>.
</p>
<p>
Enfin, pour relayer les courriers sortants, le paramètre <em>relayhost</em> doit être renseigné avec un serveur SMTP valide sur internet, par exemple celui d&#8217;Orange :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">relayhost = <span style="color: #7a0874; font-weight: bold;">&#91;</span>smtp.orange.fr<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<h4>org.isc.named.plist</h4>
<p>
Nous allons maintenant éditer le fichier plist de lancement de Postfix. Par défaut, celui-ci n&#8217;est pas démarré, il est en mode <em>on demand</em>, et nous voulons qu&#8217;il tourne toujours. Nous allons donc éditer le fichier <code>org.postfix.master.plist</code> qui se situe sous <code>/System/Library/LaunchDaemons/</code> (il est bon d&#8217;en faire une copie de sauvegarde avant de le modifier) :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>?xml <span style="color: #007800;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #007800;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span>?<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;!</span>DOCTYPE plist PUBLIC <span style="color: #ff0000;">&quot;-//Apple Computer//DTD PLIST 1.0//EN&quot;</span>
<span style="color: #ff0000;">&quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>plist <span style="color: #007800;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>dict<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>Label<span style="color: #000000; font-weight: bold;">&lt;/</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>	
	<span style="color: #000000; font-weight: bold;">&lt;</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>org.postfix.master<span style="color: #000000; font-weight: bold;">&lt;/</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>Program<span style="color: #000000; font-weight: bold;">&lt;/</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>string<span style="color: #000000; font-weight: bold;">&gt;/</span>usr<span style="color: #000000; font-weight: bold;">/</span>libexec<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">&lt;/</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>ProgramArguments<span style="color: #000000; font-weight: bold;">&lt;/</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>array<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>master<span style="color: #000000; font-weight: bold;">&lt;/</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>-e<span style="color: #000000; font-weight: bold;">&lt;/</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>
		<span style="color: #000000; font-weight: bold;">&lt;</span>string<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000;">60</span><span style="color: #000000; font-weight: bold;">&lt;/</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>array<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>QueueDirectories<span style="color: #000000; font-weight: bold;">&lt;/</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>array<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>string<span style="color: #000000; font-weight: bold;">&gt;/</span>var<span style="color: #000000; font-weight: bold;">/</span>spool<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>maildrop<span style="color: #000000; font-weight: bold;">&lt;/</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;/</span>array<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>OnDemand<span style="color: #000000; font-weight: bold;">&lt;/</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>true<span style="color: #000000; font-weight: bold;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>dict<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>plist<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>
Il faut supprimer les paramètres <em>-e 60</em> et dire au daemon qu&#8217;on ne veut pas le démarrer <em>OnDemand</em>, mais en <em>RunAtLoad</em>, car on veut qu&#8217;il soit toujours en fonctionnement. Voici donc le fichier modifié :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>?xml <span style="color: #007800;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #007800;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span>?<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;!</span>DOCTYPE plist PUBLIC <span style="color: #ff0000;">&quot;-//Apple Computer//DTD PLIST 1.0//EN&quot;</span>
<span style="color: #ff0000;">&quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>plist <span style="color: #007800;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>dict<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>Label<span style="color: #000000; font-weight: bold;">&lt;/</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>
  	<span style="color: #000000; font-weight: bold;">&lt;</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>org.postfix.master<span style="color: #000000; font-weight: bold;">&lt;/</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>
  	<span style="color: #000000; font-weight: bold;">&lt;</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>Program<span style="color: #000000; font-weight: bold;">&lt;/</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>
  	<span style="color: #000000; font-weight: bold;">&lt;</span>string<span style="color: #000000; font-weight: bold;">&gt;/</span>usr<span style="color: #000000; font-weight: bold;">/</span>libexec<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>master<span style="color: #000000; font-weight: bold;">&lt;/</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>
  	<span style="color: #000000; font-weight: bold;">&lt;</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>ProgramArguments<span style="color: #000000; font-weight: bold;">&lt;/</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>
  	<span style="color: #000000; font-weight: bold;">&lt;</span>array<span style="color: #000000; font-weight: bold;">&gt;</span>
  		<span style="color: #000000; font-weight: bold;">&lt;</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>master<span style="color: #000000; font-weight: bold;">&lt;/</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>
  	<span style="color: #000000; font-weight: bold;">&lt;/</span>array<span style="color: #000000; font-weight: bold;">&gt;</span>
  	<span style="color: #000000; font-weight: bold;">&lt;</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>QueueDirectories<span style="color: #000000; font-weight: bold;">&lt;/</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>
  	<span style="color: #000000; font-weight: bold;">&lt;</span>array<span style="color: #000000; font-weight: bold;">&gt;</span>
  		<span style="color: #000000; font-weight: bold;">&lt;</span>string<span style="color: #000000; font-weight: bold;">&gt;/</span>var<span style="color: #000000; font-weight: bold;">/</span>spool<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>maildrop<span style="color: #000000; font-weight: bold;">&lt;/</span>string<span style="color: #000000; font-weight: bold;">&gt;</span>
  	<span style="color: #000000; font-weight: bold;">&lt;/</span>array<span style="color: #000000; font-weight: bold;">&gt;</span>
  	<span style="color: #000000; font-weight: bold;">&lt;</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>RunAtLoad<span style="color: #000000; font-weight: bold;">&lt;/</span>key<span style="color: #000000; font-weight: bold;">&gt;</span>
	<span style="color: #000000; font-weight: bold;">&lt;</span>true<span style="color: #000000; font-weight: bold;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>dict<span style="color: #000000; font-weight: bold;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;/</span>plist<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>
Il faut maintenant démarrer ou redémarrer Postfix à l&#8217;aide de launchd :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># launchctl stop org.postfix.master</span>
<span style="color: #666666; font-style: italic;"># launchctl start org.postfix.master</span></pre></div></div>

<p>
Pour voir si Postfix fonctionne, envoyer un email comme ceci :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># date | mail -s test nom @ mon@adresse.net</span></pre></div></div>

<p>
Si cela ne fonctionne pas, voir les logs sous <em>/var/log/mail.log</em>.
</pre>
<h4>Utiliser le serveur comme SMTP local</h4>
<p>
Il est maintenant possible d'utiliser Postfix comme serveur SMTP pour le courrier sortant. Pour ce faire, il faut mettre <em>localhost</em> comme serveur SMTP dans Mail.app ou tout autre client de messagerie.
</p>
<hr />
<p>
<em>Cette article est la mise-à-jour d'un billet du 22 juillet 2008.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://werk.feub.net/2011/01/activer-postfix-sous-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Utiliser rTorrent</title>
		<link>http://werk.feub.net/2011/01/utiliser-rtorrent/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=utiliser-rtorrent</link>
		<comments>http://werk.feub.net/2011/01/utiliser-rtorrent/#comments</comments>
		<pubDate>Mon, 10 Jan 2011 10:46:58 +0000</pubDate>
		<dc:creator>Fabien</dc:creator>
				<category><![CDATA[BSD]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[archlinux]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[rtorrent]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[torrent]]></category>

		<guid isPermaLink="false">http://werk.feub.net/?p=43</guid>
		<description><![CDATA[Utilisation de rTorrent pour télécharger et partager vos fichiers]]></description>
			<content:encoded><![CDATA[<p>
<img src="http://werk.feub.net/medias/2011/01/rtorrent_logo64.png" alt="" title="" class="floatleft" /><a title="rakshasa.no" target="_blank" href="http://libtorrent.rakshasa.no/">rTorrent</a> est un client bittorrent non graphique que j&#8217;utilise depuis plusieurs années pour sa simplicité, sa faible empreinte niveau ressources et ses possibilités de configuration poussées. Au début il peut dérouter, mais après un temps d&#8217;adaptation, on découvre toute sa souplesse et sa puissance. Il suffit simplement d&#8217;un accès <a title="Wikipedia : SSH" target="_blank" href="http://fr.wikipedia.org/wiki/SSH">SSH</a> pour pouvoir gérer ses téléchargements depuis n&#8217;importe où, très utile. Une particularité très intéressante de rTorrent est qu&#8217;il scrute le contenu d&#8217;un répertoire donné qui recevra les fichiers <em>.torrent</em>, ainsi dès qu&#8217;un nouveau torrent est ajouté dans celui-ci, le téléchargement débute automatiquement.
</p>
<p><span id="more-43"></span></p>
<h4>Installation et configuration</h4>
<p>
J&#8217;avais originellement écrit cet article pour Archlinux, donc pour cette distro, rTorrent est dans les dépôts, pacman l&#8217;installe donc sans soucis, ainsi que <a title="Wikipedia : screen" target="_blank" href="http://fr.wikipedia.org/wiki/Screen">screen</a> le multiplexeur de terminaux :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># pacman -S rtorrent screen</span></pre></div></div>

<p>
Pour du Fedora :
</p>
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># yum install rtorrent screen</span></pre></div></div>

<p>
Ensuite, il va falloir structurer les quelques répertoires nécessaires à son bon fonctionnement. J&#8217;ai ainsi crée quatre répertoires dans mon <em>home</em> sous <em>~/bt</em> : data, completed, watch et sessions, qui respectivement serviront à stocker les fichiers en cours de téléchargement, stocker les fichiers completement téléchargés, fournir un répertoire pour les fichiers <em>.torrent</em> que rtorrent scrutera régulièrement et un répertoire pour les sessions en cours :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># mkdir -p ~/bt/{data,sessions,watch,completed}</span></pre></div></div>

<p>
Il faut maintenant créer le fichier de configuration <em>~/.rtorrent.rc</em>, voici le mien :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Limite en upload et download</span>
upload_rate = <span style="color: #000000;">30</span>
download_rate = <span style="color: #000000;">6000</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Répertoire de destination des fichiers téléchargés et des sessions</span>
directory = <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>fabien<span style="color: #000000; font-weight: bold;">/</span>bt<span style="color: #000000; font-weight: bold;">/</span>data<span style="color: #000000; font-weight: bold;">/</span>
session = <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>fabien<span style="color: #000000; font-weight: bold;">/</span>bt<span style="color: #000000; font-weight: bold;">/</span>sessions
&nbsp;
<span style="color: #666666; font-style: italic;"># Ports utilisés et diverses options</span>
port_range = <span style="color: #000000;">6881</span>-<span style="color: #000000;">6999</span>
port_random = no
check_hash = <span style="color: #c20cb9; font-weight: bold;">yes</span>
max_memory_usage = <span style="color: #000000;">268435456</span>
encryption = allow_incoming,enable_retry,prefer_plaintext
&nbsp;
<span style="color: #666666; font-style: italic;"># Répertoire de dépôt des fichiers .torrent</span>
schedule = watch_directory,<span style="color: #000000;">15</span>,<span style="color: #000000;">15</span>,<span style="color: #007800;">load_start</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>fabien<span style="color: #000000; font-weight: bold;">/</span>bt<span style="color: #000000; font-weight: bold;">/</span>watch<span style="color: #000000; font-weight: bold;">/*</span>.torrent
schedule = tied_directory,<span style="color: #000000;">15</span>,<span style="color: #000000;">15</span>,<span style="color: #007800;">start_tied</span>=
schedule = untied_directory,<span style="color: #000000;">15</span>,<span style="color: #000000;">15</span>,<span style="color: #007800;">stop_untied</span>=
&nbsp;
<span style="color: #666666; font-style: italic;"># Répertoire où déplacer les fichiers lorsqu'ils sont complets</span>
system.method.set_key = event.download.finished,move_complete,<span style="color: #ff0000;">&quot;execute=mv, <span style="color: #000099; font-weight: bold;">\
</span>-u,<span style="color: #007800;">$d</span>.get_base_path=,/home/fabien/bt/completed ; <span style="color: #000099; font-weight: bold;">\
</span>d.set_directory=/home/fabien/bt/completed&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># On envoie un email pour prévenir qu'un fichier est téléchargé</span>
system.method.set_key = event.download.finished,notify_me, \
<span style="color: #ff0000;">&quot;execute=/home/fabien/bin/rtorrent_mail.sh,<span style="color: #007800;">$d</span>.get_name=&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Ferme le torrent lorsque l'espace disque est minimal</span>
schedule = low_diskspace,<span style="color: #000000;">5</span>,<span style="color: #000000;">60</span>,<span style="color: #007800;">close_low_diskspace</span>=100M
&nbsp;
<span style="color: #666666; font-style: italic;"># Ratio de 1:1 pour les fichiers inferieurs à 500Mo, sinon ratio de 2:1</span>
ratio.min.set=<span style="color: #000000;">100</span>
ratio.upload.set=200M
ratio.max.set=<span style="color: #000000;">200</span></pre></div></div>

<p>
Je passe sur son explication, c&#8217;est assez explicite. Pour plus d&#8217;informations, se reporter à la documentation du <a title="rakshasa.no" target="_blank" href="http://libtorrent.rakshasa.no/">site de rTorrent</a>.
</p>
<p>
Pour aider au lancement du programme, voici un script bash lançant rTorrent dans un screen :</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: #c20cb9; font-weight: bold;">screen</span> <span style="color: #660033;">-dmS</span> rtorrent <span style="color: #c20cb9; font-weight: bold;">nice</span> <span style="color: #660033;">-n</span> <span style="color: #000000;">15</span> rtorrent</pre></div></div>

<p>
Ce deuxième script permet de visualiser le déroulement de rTorrent (en ré-attachant le screen) :
</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: #c20cb9; font-weight: bold;">stty</span> stop undef
<span style="color: #c20cb9; font-weight: bold;">stty</span> start undef
<span style="color: #c20cb9; font-weight: bold;">screen</span> <span style="color: #660033;">-rd</span> bt</pre></div></div>

<p>
En ce qui me concerne, mes scripts sont sous <em>~/bin</em>, ne pas oublier de leur attribuer les droits en exécution :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">chmod</span> +x ~<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>btlaunch ~<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>btview</pre></div></div>

<p>
Et voici un script <a title="archlinux.fr" target="_blank" href="http://wiki.archlinux.fr/howto/comprendre/demarrage#rcconf_et_rcd">rc</a> qui permet de gérer rTorrent à la sauce Archlinux et de le démarrer en tant que <a title="Wikipedia : daemon" target="_blank" href="http://fr.wikipedia.org/wiki/Daemon">daemon</a> avec la machine, <em>rtorrent</em> :
</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: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.conf
. <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.d<span style="color: #000000; font-weight: bold;">/</span>functions
&nbsp;
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
stat_busy <span style="color: #ff0000;">&quot;Starting rtorrent&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">su</span> fabien <span style="color: #660033;">-c</span> <span style="color: #ff0000;">'screen -d -m -S bt rtorrent'</span> <span style="color: #000000; font-weight: bold;">&amp;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
<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;">-gt</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>
stat_fail
<span style="color: #000000; font-weight: bold;">else</span>
add_daemon rtorrent
stat_done
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">;;</span>
stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
stat_busy <span style="color: #ff0000;">&quot;Stopping rtorrent&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">killall</span> <span style="color: #660033;">-w</span> <span style="color: #660033;">-s</span> <span style="color: #000000;">2</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>rtorrent <span style="color: #000000; font-weight: bold;">&amp;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null
<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;">-gt</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>
stat_fail
<span style="color: #000000; font-weight: bold;">else</span>
rm_daemon rtorrent
stat_done
<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #000000; font-weight: bold;">;;</span>
restart<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #007800;">$0</span> stop
<span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">1</span>
<span style="color: #007800;">$0</span> start
<span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;usage: $0 {start|stop|restart}&quot;</span>
<span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p>
Et enfin le petit bash d&#8217;envoi de l&#8217;email en fin de téléchargement, <em>rtorrent_mail.sh</em> :
</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;">echo</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(date)</span> : $1 - Download completed.&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> mail <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;[rtorrent] - Download completed : $1&quot;</span> mon<span style="color: #000000; font-weight: bold;">@</span>adresse.net</pre></div></div>

<h4>Lancement et utilisation</h4>
<p>
Voilà, c’est terminé, il ne reste plus qu’à lancer le daemon et accessoirement de visualiser l’état avec les scripts :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ ~<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>btlaunch.sh
$ ~<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>btview.sh</pre></div></div>

<p>
Lancement/arrêt/re-démarrage avec la commande rc :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># /etc/rc.d/rtorrent start</span>
<span style="color: #666666; font-style: italic;"># /etc/rc.d/rtorrent stop</span>
<span style="color: #666666; font-style: italic;"># /etc/rc.d/rtorrent restart</span></pre></div></div>

<p>
Mais pour voir l’évolution, il faut bien entendu ajouter des torrents, pour se faire, copier simplement les fichiers <em>.torrent</em> dans le répertoire <em>watch</em>. Et vous verrez les téléchargements débuter. Ensuite l&#8217;utilisation se fait par quelques commandes, en voici quelques unes :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">CTRL+d         Stoppe un torrent <span style="color: #7a0874; font-weight: bold;">&#40;</span>ou supprime un torrent arrêté<span style="color: #7a0874; font-weight: bold;">&#41;</span>
CTRL+q         Quitte rTorrent <span style="color: #7a0874; font-weight: bold;">&#40;</span>ferme le <span style="color: #c20cb9; font-weight: bold;">screen</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
CTRL+s         Démarre un torrent arrêté
CTRL+a puis d     Détache le <span style="color: #c20cb9; font-weight: bold;">screen</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>rTorrent tourne toujours<span style="color: #7a0874; font-weight: bold;">&#41;</span>
a ou s ou d ou     Augmente l’upload de 1Kb<span style="color: #000000; font-weight: bold;">/</span>s ou 5Kb<span style="color: #000000; font-weight: bold;">/</span>s ou 50Kb<span style="color: #000000; font-weight: bold;">/</span>s
z ou x ou c     Réduit l’upload de 1Kb<span style="color: #000000; font-weight: bold;">/</span>s ou 5Kb<span style="color: #000000; font-weight: bold;">/</span>s ou 50Kb<span style="color: #000000; font-weight: bold;">/</span>s
A ou S ou D ou     Augmente le download de 1Kb<span style="color: #000000; font-weight: bold;">/</span>s ou 5Kb<span style="color: #000000; font-weight: bold;">/</span>s ou 50Kb<span style="color: #000000; font-weight: bold;">/</span>s
Z ou X ou C     Réduit le download de 1Kb<span style="color: #000000; font-weight: bold;">/</span>s ou 5Kb<span style="color: #000000; font-weight: bold;">/</span>s ou 50Kb<span style="color: #000000; font-weight: bold;">/</span>s</pre></div></div>

<p>​</p>
<p>
<em>Cet article fut publié pour la première fois le 18 février 2008.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://werk.feub.net/2011/01/utiliser-rtorrent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mise à jour un peu douloureuse d&#8217;edoras en Fedora 11</title>
		<link>http://werk.feub.net/2009/06/mise-a-jour-un-peu-douloureuse-dedoras-en-fedora-11/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mise-a-jour-un-peu-douloureuse-dedoras-en-fedora-11</link>
		<comments>http://werk.feub.net/2009/06/mise-a-jour-un-peu-douloureuse-dedoras-en-fedora-11/#comments</comments>
		<pubDate>Thu, 18 Jun 2009 10:08:14 +0000</pubDate>
		<dc:creator>Fabien</dc:creator>
				<category><![CDATA[3615 tavie]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[dhcp]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[itunes]]></category>
		<category><![CDATA[yum]]></category>

		<guid isPermaLink="false">http://werk.feub.net/?p=160</guid>
		<description><![CDATA[Et passage à l'OS 3.0 dans la foulée]]></description>
			<content:encoded><![CDATA[<p><img src="http://werk.feub.net/medias/2010/03/fedora-logo_64.png" alt="" width="64" height="64" class="ico-float-left" />Petite anecdote pour commencer ce billet, il m&#8217;aura fallu toutes ces années pour me rendre compte que le nom de mon petit serveur domestique <a href="http://fr.wikipedia.org/wiki/Edoras">edoras</a> est à une lettre près (bon allez deux, mais l&#8217;autre est plutôt muette) <a href="http://www.fedora-fr.org/">Fedora</a>. Youpie!
</p>
<h4>Leonidas est dans la place</h4>
<p>
Après une tentative plutôt infructueuse par le biais de <a href="http://fedoraproject.org/wiki/Features/PreUpgrade">preupgrade</a> &#8211; tout se passait <em>bien</em>, mais après la demande de redémarrage, j&#8217;étais toujours sous F10 &#8211; j&#8217;ai décidé de télécharger le DVD de Leonidas, ne serait-ce que pour l&#8217;avoir, et de faire la mise-à-jour.
</p>
<p>
Celle-ci s&#8217;est bien passée, mais les problèmes ont débuté avec <a href="http://fr.wikipedia.org/wiki/Yellow_dog_Updater,_Modified">YUM</a> qui n&#8217;était plus là : <strong>no module named yum</strong> et un soucis de version du paquet rpm-python. J&#8217;ai vite vu que c&#8217;était toujours la version F10 du gestionnaire de paquets qui était présente, d&#8217;où le problème de dépendance relatif à python. J&#8217;ai donc installé le <a href="http://fr.wikipedia.org/wiki/RPM_Package_Manager">RPM</a> de YUM pour F11 et tout est rentré dans l&#8217;ordre. J&#8217;ai pu mettre à jour cette F11 <em>(pas vraiment)</em> fraîchement installée.
</p>
<p>
Le gros du soucis a été du côté du serveur <a href="http://fr.wikipedia.org/wiki/Dynamic_host_configuration_protocol">DHCP</a>, celui-ci ne voulant absolument pas démarrer. Les logs m&#8217;indiquaient qu&#8217;il fallait spécifier l&#8217;interface réseau utilisée dans le <em>dhcpd.conf</em> comme j&#8217;ai deux cartes réseaux. J&#8217;ai retourné la doc d&#8217;<a href="http://www.isc.org/">ISC</a> et les forums pendant une bonne heure et demi (je n&#8217;ose pas dire deux..) pour m&#8217;apercevoir que désormais le fichier de configuration se trouve sous <em>/etc/dhcp</em> et non plus directement sous <em>/etc</em>. L&#8217;adage &laquo;&nbsp;<em>Petite cause, grands effets</em>&nbsp;&raquo; est souvent de mise en informatique &#8211; genre pour les problèmes en séries &#8211; mais là c&#8217;était &laquo;&nbsp;<em>Grand effet, petite cause</em>&laquo;&nbsp;.
</p>
<h4>OS 3.0 pour iPhone</h4>
<p>
Le passage a F11 m&#8217;a permis la mise-à-jour de l&#8217;<a href="http://www.apple.com/fr/iphone/">iPhone</a> également. Petite étape en <a href="http://www.apple.com/fr/iphone/softwareupdate/">OS</a> officiel avant le <a href="http://fr.wikipedia.org/wiki/Jailbreak_(apple)">jailbreak</a> dès qu&#8217;il sera disponible.<br />
D&#8217;apparence aucun lien entre les deux sujets de ce billet si ce n&#8217;est que j&#8217;avais besoin d&#8217;edoras pour cette opération car ma bibliothèque <a href="http://www.apple.com/fr/itunes/overview/">iTunes</a> est sur un volume <a href="http://fr.wikipedia.org/wiki/Network_File_System">NFS</a> du serveur linux, donc pas d&#8217;iTunes, pas de mise-à-jour de l&#8217;iPhone.
</p>
<p>
Au menu des nouveautés en vrac donc : enfin le copier-coller-couper, dictaphone, MMS, mode paysage généralisé, Spotlight, synchro des notes, secouer l&#8217;appareil pour mélanger&#8230;.</p>
]]></content:encoded>
			<wfw:commentRss>http://werk.feub.net/2009/06/mise-a-jour-un-peu-douloureuse-dedoras-en-fedora-11/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DIG par l&#8217;exemple</title>
		<link>http://werk.feub.net/2009/02/dig-par-lexemple/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=dig-par-lexemple</link>
		<comments>http://werk.feub.net/2009/02/dig-par-lexemple/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 07:28:53 +0000</pubDate>
		<dc:creator>Fabien</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[dns]]></category>

		<guid isPermaLink="false">http://werk.feub.net/?p=4</guid>
		<description><![CDATA[Interrogeons les serveurs DNS]]></description>
			<content:encoded><![CDATA[<p><a title="Wikipedia" href="http://fr.wikipedia.org/wiki/Dig_(programme_informatique)">dig</a> est un outil en ligne de commande d&#8217;interrogation de serveurs <a title="Wikipedia" href="http://fr.wikipedia.org/wiki/Domain_Name_System">DNS</a>. Il permet d&#8217;avoir des renseignements sur tout les types d&#8217;enregistrements (NS, A, CNAME, etc) et plus encore. Il n&#8217;est pas aisé de trouver des infos sur son fonctionnement et la page de manuel ne comporte aucun exemple. Voici quelques utilisations classiques, mais bien utiles.</p>
<h4>Utilisation</h4>
<p>L&#8217;utilisation de la commande dig est la suivante :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">dig</span> <span style="color: #000000; font-weight: bold;">@</span>serveur nom <span style="color: #7a0874; font-weight: bold;">type</span></pre></div></div>

<p><strong>@serveur</strong> : le serveur DNS utilisé pour la requête. <strong>nom</strong> : le nom du serveur DNS à interroger. <strong>type</strong> : le type d&#8217;enregistrement à vérifier. Mais la forme la plus simple est l&#8217;appel de la commande suivi du nom d&#8217;hôte à vérifier :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">dig</span> feub.net</pre></div></div>

<p>Qui retourne quelque chose comme :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">; <span style="color: #000000; font-weight: bold;">&amp;</span>lt;<span style="color: #000000; font-weight: bold;">&amp;</span>lt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; DiG 9.5.1-P1-RedHat-9.5.1-<span style="color: #000000;">1</span>.P1.fc10 <span style="color: #000000; font-weight: bold;">&amp;</span>lt;<span style="color: #000000; font-weight: bold;">&amp;</span>lt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt; feub.net
<span style="color: #000000; font-weight: bold;">;;</span> global options:  printcmd
<span style="color: #000000; font-weight: bold;">;;</span> Got answer:
<span style="color: #000000; font-weight: bold;">;;</span> -<span style="color: #000000; font-weight: bold;">&amp;</span>gt;<span style="color: #000000; font-weight: bold;">&amp;</span>gt;HEADER<span style="color: #000000; font-weight: bold;">&amp;</span>lt;<span style="color: #000000; font-weight: bold;">&amp;</span>lt;- opcode: QUERY, status: NOERROR, <span style="color: #c20cb9; font-weight: bold;">id</span>: <span style="color: #000000;">10503</span>
<span style="color: #000000; font-weight: bold;">;;</span> flags: qr rd ra; QUERY: <span style="color: #000000;">1</span>, ANSWER: <span style="color: #000000;">1</span>, AUTHORITY: <span style="color: #000000;">2</span>, ADDITIONAL: <span style="color: #000000;">2</span>
<span style="color: #000000; font-weight: bold;">;;</span> QUESTION SECTION:
;feub.net.                      IN      A
<span style="color: #000000; font-weight: bold;">;;</span> ANSWER SECTION:
feub.net.               <span style="color: #000000;">75788</span>   IN      A       80.93.82.79
<span style="color: #000000; font-weight: bold;">;;</span> AUTHORITY SECTION:
feub.net.               <span style="color: #000000;">75788</span>   IN      NS      NS31B.HAISOFT.net.
feub.net.               <span style="color: #000000;">75788</span>   IN      NS      NS31A.HAISOFT.net.
<span style="color: #000000; font-weight: bold;">;;</span> ADDITIONAL SECTION:
NS31A.HAISOFT.net.      <span style="color: #000000;">47403</span>   IN      A       80.93.82.79
NS31B.HAISOFT.net.      <span style="color: #000000;">41905</span>   IN      A       80.93.82.217
<span style="color: #000000; font-weight: bold;">;;</span> Query <span style="color: #000000; font-weight: bold;">time</span>: <span style="color: #000000;">2</span> msec
<span style="color: #000000; font-weight: bold;">;;</span> SERVER: 192.168.75.1<span style="color: #666666; font-style: italic;">#53(192.168.75.1)</span>
<span style="color: #000000; font-weight: bold;">;;</span> WHEN: Mon Feb  <span style="color: #000000;">2</span> <span style="color: #000000;">10</span>:<span style="color: #000000;">58</span>:<span style="color: #000000;">33</span> <span style="color: #000000;">2009</span>
<span style="color: #000000; font-weight: bold;">;;</span> MSG SIZE  rcvd: <span style="color: #000000;">122</span></pre></div></div>

<p>Beaucoup d&#8217;informations sont retournées. Le première partie renseigne sur la version même de dig utilisée, suivi des options globales, dans cet exemple : <em>printcmd</em> qui peut ne pas être affiché en utilisant l&#8217;option <em>+nocmd</em> juste après le dig. La partie qui suit &#8211; <em>Got answer</em> &#8211; apporte des informations sur le serveur. Cette partie ne sera pas affichée en ajoutant l&#8217;option <em>+nocomments</em>, mais attention car elle supprime également les entêtes de sections.<br />
Arrive la section <em>QUESTION SECTION</em> qui comme son nom l&#8217;indique affiche la question que vous avez posé au serveur DNS. Dans la forme simplifiée utilisée ici, la recherche est par défaut faite sur les enregistrements A. En général, vous savez ce que vous avez demandé, donc pour neutraliser cette partie dans le résultat, utiliser l&#8217;option <em>+noquestion</em>.<br />
Pour terminer, la réponse est affichée dans la section <em>ANSWER SECTION</em>. L&#8217;IP de feub.net est 80.93.82.79. Même cette partie du résultat peut être neutralisée avec l&#8217;option <em>+noanswer</em> (mais je ne vois pas dans quel cas on demande quelque chose sans être intéressé par la réponse&#8230;).<br />
La section <em>AUTHORITY SECTION</em> renseigne sur les serveurs DNS autoritaires du domaine. Pour ne pas afficher cette section, c&#8217;est l&#8217;option <em>+noauthority</em>.<br />
La fin affiche la section <em>ADDITIONAL SECTION</em> qui donne les IP des serveurs DNS autoritaires utilisés pour la requête. On devine comment ne pas l&#8217;afficher : <em>+noadditional</em><br />
Et le résultat se termine par des statistiques sur la requête, que l&#8217;on désactive par l&#8217;option <em>+nostats</em>.</p>
<p><span id="more-4"></span></p>
<h4>Quelques exemples</h4>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Obtenir l'adresse du serveur hébergeant feub.net</span>
$ <span style="color: #c20cb9; font-weight: bold;">dig</span> feub.net A +noall +answer
<span style="color: #666666; font-style: italic;"># Obtenir la liste des serveurs de messagerie de Google</span>
$ <span style="color: #c20cb9; font-weight: bold;">dig</span> google.com MX +noall +answer
<span style="color: #666666; font-style: italic;"># Obtenir la liste des serveur DNS autoritaires pour Google</span>
$ <span style="color: #c20cb9; font-weight: bold;">dig</span> google.com NS +noall +answer
<span style="color: #666666; font-style: italic;"># Obtenir toutes les informations demandées ci-dessus</span>
$ <span style="color: #c20cb9; font-weight: bold;">dig</span> google.com ANY +noall +answer</pre></div></div>

<p>Pour avoir un résultat court :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ <span style="color: #c20cb9; font-weight: bold;">dig</span> google.com +short</pre></div></div>

<p>Beaucoup de possibilité avec toutes ces petites options.</p>
]]></content:encoded>
			<wfw:commentRss>http://werk.feub.net/2009/02/dig-par-lexemple/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Apache : Protéger un répertoire web</title>
		<link>http://werk.feub.net/2008/12/apache-proteger-un-repertoire-web/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=apache-proteger-un-repertoire-web</link>
		<comments>http://werk.feub.net/2008/12/apache-proteger-un-repertoire-web/#comments</comments>
		<pubDate>Fri, 05 Dec 2008 08:43:17 +0000</pubDate>
		<dc:creator>Fabien</dc:creator>
				<category><![CDATA[mac]]></category>
		<category><![CDATA[httpd]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://werk.feub.net/?p=10</guid>
		<description><![CDATA[Authentification HTTP]]></description>
			<content:encoded><![CDATA[<p>
Sujet vu des milliers de fois sur le web, l&#8217;<a href="http://fr.wikipedia.org/wiki/HTTP_Authentification" title="Wikipedia">authentification <em>basique</em> HTTP</a> est relativement simple à mettre en pratique pour qui connait un peu le serveur web Apache. Ce petit article me fait office de mémo, petite piqure de rappel, sous <a href="http://www.fedora-fr.org/" title="Fedora France">Fedora 10</a>.
</p>
<h4>Configuration d&#8217;Apache</h4>
<p>
Il faut s&#8217;assurer que le serveur web <a href="http://httpd.apache.org/" title="Apache">Apache</a> puisse utiliser les fichiers .htaccess. Pour ce faire, il faut lui ajouter la directive AllowOverride AuthConfig. Ceci peut se faire directement dans le httpd.conf, mais il est recommandé &#8211; et plus clair &#8211; de ne pas y toucher et d&#8217;ajouter ses propres fichiers de configurations sous <code>/etc/httpd/conf.d/</code>. Il est en effet plus simple d&#8217;avoir plusieurs fichiers bien nommés qu&#8217;un énorme qu&#8217;il serait fastidieux d&#8217;éditer. Dans mon cas, j&#8217;ai détaché les directives concernant <code>/var/www</code> du <code>httpd.conf</code> dans un fichier <code>fab_docroot.conf</code> sous <code>/etc/httpd/conf.d/</code> (petite entorse à ce qui est dit plus haut de ne pas toucher au fichier principal. Mais c&#8217;est pour la bonne cause ;} ). Attention, je ne fais ceci que parce que je n&#8217;héberge qu&#8217;un seul site qui est directement sous <code>/var/www</code>.
</p>
<p>
Voici donc la tête des directives en question pour accepter l&#8217;authentification par .htaccess :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>Directory <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;">&gt;</span>
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
Allow from all
<span style="color: #000000; font-weight: bold;">&lt;/</span>Directory<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

<p>
Sauvegarder le fichier et redémarrer Apache :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># service httpd restart</span></pre></div></div>

<p><span id="more-10"></span></p>
<h4>Créer un fichier .htpasswd</h4>
<p>
Ce dernier ce crée avec la commande &#8230;.. <code>htpasswd</code> (sans le point bien sur), facile ;} Celle-ci génére un fichier texte contenant le (ou plusieurs) nom d&#8217;utilisateur et un hash du mot de passe associé pour l&#8217;authentification HTTP.
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># htpasswd -c /chemin/vers/fichier/du/mot-de-passe fabien</span></pre></div></div>

<p>
L&#8217;option -c crée un nouveau fichier. Pour mettre à jour un mot de passe existant, il suffit de l&#8217;enlever.
</p>
<p>
Il est conseillé de créer ce fichier en dehors de la racine des documents Apache pour que seul celui-ci puisse y avoir accès et ainsi que personne (visiteur du site) puisse le voir.<br />
Il faut s&#8217;assurer également que l&#8217;utilisateur Apache puisse le lire pour que l&#8217;authentification fonctionne. Normalement avec Fedora, cet utilisateur s&#8217;appelle Apache, le vérifier comme suit :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># grep -e '^User' /etc/httpd/conf/httpd.conf</span>
User apache</pre></div></div>

<p>
Changer le propriétaire et les droits :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># chown apache:apache /chemin/vers/fichier/du/mot-de-passe</span>
<span style="color: #666666; font-style: italic;"># chmod 0660 /chemin/vers/fichier/du/mot-de-passe</span></pre></div></div>

<p>
L&#8217;utilisateur fabien est désormais ajouté. La dernière étape consiste à configurer le serveur web pour qu&#8217;il demande de s&#8217;authentifier pour un répertoire donné. Pour l&#8217;exemple, le répertoire protégé sera sous <code>/var/www/html/secured</code>.
</p>
<p>
Création du répertoire :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># mkdir /var/www/html/secured</span></pre></div></div>

<p>
Création du fichier .htaccess avec ces directives :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">AuthType Basic
AuthName <span style="color: #ff0000;">&quot;Zone sécurisée&quot;</span>
AuthUserFile <span style="color: #000000; font-weight: bold;">/</span>chemin<span style="color: #000000; font-weight: bold;">/</span>vers<span style="color: #000000; font-weight: bold;">/</span>fichier<span style="color: #000000; font-weight: bold;">/</span>du<span style="color: #000000; font-weight: bold;">/</span>mot-de-passe
Require user fabien</pre></div></div>

<h4>Tester la configuration</h4>
<p>
Il suffit de se rendre à l&#8217;URI sécurisée pour voir la boîte de dialogue de demande d&#8217;un utilisateur apparaître : http://www.mon-site.net/admin
</p>
<div class="image">
<img src="http://feub.net/werk/images/uploads/200812/authbox.png" width="511" height="145" class="photoTips" title="Firefox :: Demande d'authentification" /><br />
Demande d&#8217;authentification
</div>
<p>
En cas de problème, vérifier les log d&#8217;erreurs Apache :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># tail -f /var/log/httpd/error_log</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://werk.feub.net/2008/12/apache-proteger-un-repertoire-web/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using apc (Feed is rejected)
Page Caching using apc
Object Caching 735/864 objects using memcached

Served from: werk.feub.net @ 2012-02-05 21:59:02 -->
