<?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>Marwan KHELIF &#187; Sécurité</title>
	<atom:link href="http://www.mkhelif.fr/tag/securite/feed" rel="self" type="application/rss+xml" />
	<link>http://www.mkhelif.fr</link>
	<description>Le blog d&#039;un développeur</description>
	<lastBuildDate>Sun, 25 Jul 2010 21:30:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Authentification SSH par clé privée/clé publique</title>
		<link>http://www.mkhelif.fr/2008/11/24/authentification-ssh-par-cl-privecl-publique.html</link>
		<comments>http://www.mkhelif.fr/2008/11/24/authentification-ssh-par-cl-privecl-publique.html#comments</comments>
		<pubDate>Mon, 24 Nov 2008 14:36:44 +0000</pubDate>
		<dc:creator>mkhelif</dc:creator>
				<category><![CDATA[Cryptographie]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sécurité]]></category>
		<category><![CDATA[Tutoriel]]></category>

		<guid isPermaLink="false">http://www.mkhelif.fr/2008/11/24/authentification-ssh-par-cl-privecl-publique.html</guid>
		<description><![CDATA[En voyant l&#8217;intérêt que les visiteurs de mon blog porte à l&#8217;installation d&#8217;un serveur de mail multi-domaines, j&#8217;ai décidé d&#8217;écrire un autre tutoriel sur la configuration d&#8217;un serveur SSH pour utiliser une connexion par clé publique/clé privée.

Fonctionnement
L&#8217;objectif d&#8217;une authentification par clés est de supprimer l&#8217;envoi de mots de passe par le réseau. Pour cela il [...]]]></description>
			<content:encoded><![CDATA[<p>En voyant l&#8217;intérêt que les visiteurs de mon blog porte à l&#8217;installation d&#8217;un serveur de mail multi-domaines, j&#8217;ai décidé d&#8217;écrire un autre tutoriel sur la configuration d&#8217;un serveur SSH pour utiliser une connexion par clé publique/clé privée.</p>
<p><span id="more-156"></span></p>
<p><strong>Fonctionnement</strong></p>
<p>L&#8217;objectif d&#8217;une authentification par clés est de supprimer l&#8217;envoi de mots de passe par le réseau. Pour cela il faut deux clés : une clé privée (seul l&#8217;utilisateur doit pouvoir y avoir accès) et une clé publique (doit être déployée sur toutes les machines où l&#8217;on souhaite se connecter).</p>
<p>La clé publique peut crypter les données et seule la clé privée peut les décrypter. Dans l&#8217;autre sens la clé privée <strong>signe</strong> les messages, la clé publique permet alors de s&#8217;assurer que le message vient bien du bon utilisateur. C&#8217;est le cryptage asymétrique.</p>
<p>Pour SSH, c&#8217;est exactement la même chose. Le serveur envoi un <em>challenge</em> au client : message crypté à partir de la clé publique. La connexion ne sera acceptée uniquement si le client répond correctement à ce message (c&#8217;est à dire qu&#8217;il a réussi à décrypter le message).</p>
<h3>Configuration du serveur SSH</h3>
<p>Par défaut le serveur SSH n&#8217;accepte pas les connections par clés mais uniquement par mot de passe. On va donc activer cette méthode d&#8217;authentification :</p>
<blockquote><p><span style="color: #333333;">Dans le fichier : <em>/etc/ssh/sshd_config</em></span></p>
<pre>RSAAuthentication    yes
PubkeyAuthentication yes
AuthorizedKeysFile   %h/.ssh/authorized_keys</pre>
</blockquote>
<p>Pour des questions de sécurité vous pouvez désactiver la connexion avec le login <strong>root</strong> :</p>
<blockquote>
<pre>PermitRootLogin no</pre>
</blockquote>
<p>Il suffit de redémarrer le serveur SSH : <em>/etc/init.d/ssh restart</em></p>
<p>Si vous souhaitez refuser l&#8217;authentification par mot de passe (pour éviter les attaques bruteforce et ainsi que les logs se remplissent pour rien) il faut positionner l&#8217;option suivante :</p>
<blockquote>
<pre>PasswordAuthentication no</pre>
</blockquote>
<h3>Création des clés</h3>
<p>Il y a deux manières pour créer les clés :</p>
<ol>
<li>Sur un poste Linux :
<ol>
<li>Lancer la commande suivante : <em>ssh-keygen -t rsa</em></li>
<li><em>Laisser les noms par défaut et entrer le mot de passe pour la clé privée.</em></li>
</ol>
</li>
<li>Sur un poste Windows :
<ol>
<li>Utiliser <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" target="_blank">PuttyGen</a> pour générer les clés.</li>
</ol>
</li>
</ol>
<p>Ensuite il faut copier la clé publique <em>id_rsa.pub</em> sur le serveur auquel on souhaite se connecter et conserver la clé privée sur le poste client.</p>
<p>Dans le répertoire de l&#8217;utilisateur on crée un répertoire <em>.ssh </em>(répertoire par défaut où le serveur SSH va chercher les clés publiques) et on renomme le fichier en <em>authorized_keys</em>.</p>
<p>Ensuite il faut <strong>absolument</strong> que ce fichier ai les droits suivants : <em>chmod 600 authorized_keys.</em></p>
<p>À partir de ce moment toutes les personnes ayant la clé privée et le mot de passe ayant servi à la générer peuvent se connecter au serveur.</p>
<h3>Première connexion</h3>
<p>Afin de se connecter avec <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" target="_blank">Putty</a> vous devez spécifier la clé privée : <em>Connection / SSH / Auth</em>.</p>
<p>Si vous avez créé votre paire de clés grâce à <em>ssh-keygen</em>, vous devez convertir votre clé privée au format Putty. Pour cela vous devez utiliser <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" target="_blank">PuttyGen</a> : menu <em>Conversions / Import key</em>, entrer alors le mot de passe de la clé, puis <strong>Save private key</strong>.</p>
<p>Lors de chaque connexion Putty vous demande le mot de passe de la clé, quel intérêt alors de se connecter en utilisant une paire de clé si on doit rentrer à chaque fois le mot de passe de la clé privée. C&#8217;est là qu&#8217;intervient <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" target="_blank">Pageant</a>, c&#8217;est un outils de la suite Putty qui permet de stocker pour une clé privée son mot de passe. L&#8217;utilisation de ce programme est extrêmement simple, je n&#8217;en parlerai donc pas ici. Pour Linux il suffit d&#8217;installer ssh-agent qui joue exactement le même rôle.<br />
<h3>Pour suivre votre lecture</h3>
<ul class="related_post">
<li><a href="http://www.mkhelif.fr/2008/06/23/apache2-systeme-de-blacklist.html" title="Apache2 : système de blacklist">Apache2 : système de blacklist</a></li>
<li><a href="http://www.mkhelif.fr/2008/05/23/serveur-de-mails-multi-domaines.html" title="Serveur de mails multi-domaines">Serveur de mails multi-domaines</a></li>
<li><a href="http://www.mkhelif.fr/2009/11/19/chrome-os-premire-prsentation.html" title="Chrome OS : premi&egrave;re pr&eacute;sentation">Chrome OS : premi&egrave;re pr&eacute;sentation</a></li>
<li><a href="http://www.mkhelif.fr/2009/09/07/ruby-on-rails-dployer-une-application-sur-tomcat-avec-jruby.html" title="Ruby on Rails : d&eacute;ployer une application sur Tomcat avec JRuby">Ruby on Rails : d&eacute;ployer une application sur Tomcat avec JRuby</a></li>
<li><a href="http://www.mkhelif.fr/2009/07/08/google-annonce-chrome-os.html" title="Google annonce Chrome OS">Google annonce Chrome OS</a></li>
<li><a href="http://www.mkhelif.fr/2008/07/30/oracle-faille-critique-dans-weblogic.html" title="Oracle : faille critique dans WebLogic [corrigé]">Oracle : faille critique dans WebLogic [corrigé]</a></li>
<li><a href="http://www.mkhelif.fr/2008/06/18/passerelle-entre-apache-et-tomcat.html" title="Passerelle entre Apache et Tomcat">Passerelle entre Apache et Tomcat</a></li>
</ul>
       ]]></content:encoded>
			<wfw:commentRss>http://www.mkhelif.fr/2008/11/24/authentification-ssh-par-cl-privecl-publique.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oracle : faille critique dans WebLogic [corrigé]</title>
		<link>http://www.mkhelif.fr/2008/07/30/oracle-faille-critique-dans-weblogic.html</link>
		<comments>http://www.mkhelif.fr/2008/07/30/oracle-faille-critique-dans-weblogic.html#comments</comments>
		<pubDate>Wed, 30 Jul 2008 14:45:43 +0000</pubDate>
		<dc:creator>mkhelif</dc:creator>
				<category><![CDATA[Actualités]]></category>
		<category><![CDATA[J2EE]]></category>
		<category><![CDATA[Sécurité]]></category>

		<guid isPermaLink="false">http://www.mkhelif.fr/2008/07/30/oracle-faille-critique-dans-weblogic.html</guid>
		<description><![CDATA[Une faille critique vient d&#8217;être découverte dans le module mod_server, permettant la connexion de Apache à WebLogic (racheté à BEA par Oracle). Elle permettrait d&#8217;avoir accès à distance aux données du serveur sans aucune authentification.
Cette faille est notée comme très élevée (1.0 sur l&#8217;échelle CVSS Common Vulnerability Scoring System) et un correctif est déjà en [...]]]></description>
			<content:encoded><![CDATA[<p>Une faille critique vient d&#8217;être découverte dans le module <em>mod_server</em>, permettant la connexion de Apache à WebLogic (racheté à BEA par Oracle). Elle permettrait d&#8217;avoir accès à distance aux données du serveur sans aucune authentification.</p>
<p>Cette faille est notée comme très élevée (1.0 sur l&#8217;échelle CVSS Common Vulnerability Scoring System) et un correctif est déjà en préparation par Oracle.</p>
<p>Les versions de Oracle WebLogic Server affectées par cette faille sont : <em>6.1</em>, <em>7.0</em>, <em>8.1</em>, <em>9.0</em>, <em>9.1</em>, <em>9.2</em>, <em>10.0</em>.</p>
<p><a href="http://www.oracle.com/technology/deploy/security/alerts/alert_cve2008-3257.html" target="_blank">Voir le bulletin d&#8217;alerte de Oracle.</a></p>
<p>Mise à jour 08/08/2008 : <a href="https://support.bea.com/application_content/product_portlets/securityadvisories/2793.html">Oracle a fourni un correctif à cette faille</a>.<br />
<h3>Pour suivre votre lecture</h3>
<ul class="related_post">
<li><a href="http://www.mkhelif.fr/2010/01/14/gwt-2-0-les-nouvelles-fonctionnalits.html" title="GWT 2.0 : les nouvelles fonctionnalités">GWT 2.0 : les nouvelles fonctionnalités</a></li>
<li><a href="http://www.mkhelif.fr/2009/09/07/ruby-on-rails-dployer-une-application-sur-tomcat-avec-jruby.html" title="Ruby on Rails : d&eacute;ployer une application sur Tomcat avec JRuby">Ruby on Rails : d&eacute;ployer une application sur Tomcat avec JRuby</a></li>
<li><a href="http://www.mkhelif.fr/2009/08/21/tests-en-charge-dec2-gae-et-azure.html" title="Tests en charge d&rsquo;EC2, GAE et Azure">Tests en charge d&rsquo;EC2, GAE et Azure</a></li>
<li><a href="http://www.mkhelif.fr/2009/04/08/google-gwt-version-16-et-consorts.html" title="Google : GWT version 1.6 et consorts">Google : GWT version 1.6 et consorts</a></li>
<li><a href="http://www.mkhelif.fr/2008/11/24/authentification-ssh-par-cl-privecl-publique.html" title="Authentification SSH par clé privée/clé publique">Authentification SSH par clé privée/clé publique</a></li>
<li><a href="http://www.mkhelif.fr/2008/10/21/gwt-16-tomcat-ou-jetty.html" title="GWT 1.6 : Tomcat ou Jetty ?">GWT 1.6 : Tomcat ou Jetty ?</a></li>
<li><a href="http://www.mkhelif.fr/2008/06/23/apache2-systeme-de-blacklist.html" title="Apache2 : système de blacklist">Apache2 : système de blacklist</a></li>
</ul>
       ]]></content:encoded>
			<wfw:commentRss>http://www.mkhelif.fr/2008/07/30/oracle-faille-critique-dans-weblogic.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache2 : système de blacklist</title>
		<link>http://www.mkhelif.fr/2008/06/23/apache2-systeme-de-blacklist.html</link>
		<comments>http://www.mkhelif.fr/2008/06/23/apache2-systeme-de-blacklist.html#comments</comments>
		<pubDate>Mon, 23 Jun 2008 14:43:06 +0000</pubDate>
		<dc:creator>mkhelif</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sécurité]]></category>
		<category><![CDATA[Tutoriel]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.mkhelif.fr/?p=57</guid>
		<description><![CDATA[Après avoir installé mon serveur web (Apache) et un serveur d&#8217;applications J2EE (GlassFish) je me suis vite rendu compte, après une semaine d&#8217;exécution, que les logs du serveur prennaient de plus en plus de place.
En regardant rapidement les fichiers de logs on se rend très vite compte que le serveur se fait &#171;&#160;spammer&#160;&#187; des URL [...]]]></description>
			<content:encoded><![CDATA[<p>Après avoir installé mon serveur web (Apache) et un serveur d&#8217;applications J2EE (GlassFish) je me suis vite rendu compte, après une semaine d&#8217;exécution, que les logs du serveur prennaient de plus en plus de place.</p>
<p>En regardant rapidement les fichiers de logs on se rend très vite compte que le serveur se fait &laquo;&nbsp;spammer&nbsp;&raquo; des URL du type : <strong>phpmyadmin</strong>, <strong>admin</strong>, <strong>mysql</strong>, &#8230;</p>
<p>J&#8217;ai décidé de mettre en place un système de blacklistage instégré à Apache.</p>
<p><span id="more-57"></span></p>
<h3>Configuration de Apache</h3>
<p>Pour cela il faut installer le module mod_rewrite (inclus par défaut avec Apache2).</p>
<p>On ajoute donc les règles dans le fichier de configuration d&#8217;apache (<strong>/etc/apache2/sites-avaible/</strong>)</p>
<blockquote>
<pre>RewriteEngine On

RewriteMap hosts-deny txt:/etc/apache2/hosts.deny
RewriteCond ${hosts-deny:%{REMOTE_HOST}|NOT-FOUND} !=NOT-FOUND [OR]
RewriteCond ${hosts-deny:%{REMOTE_ADDR}|NOT-FOUND} !=NOT-FOUND
RewriteRule ^/.* - [F]</pre>
</blockquote>
<p>Ainsi les adresses IP ou nom de domaine listés dans le fichier <strong>/etc/apache2/hosts.deny</strong> recevront le code réponse : <em>403 Forbidden</em>.</p>
<p>On crée le fichier <strong>/etc/apache2/hosts.deny</strong> :</p>
<blockquote>
<pre>adresse_ip -
nom_de_domaine -</pre>
</blockquote>
<p>Penser à ajouter le tiret &laquo;&nbsp;-&nbsp;&raquo; à la fin de chaque entrée dans ce fichier.</p>
<h3>Page d&#8217;erreur personnalisée</h3>
<p>Si vous voulez rediriger les adresses blacklilstées vers une page personnalisée il faut modifier les règles dans le fichier de configuration de Apache :</p>
<blockquote>
<pre>Remplacez :
RewriteRule ^/.* - [F]

Par :
RewriteRule ^/.* /blacklisted.html [L]</pre>
</blockquote>
<p>Créez alors le fichier <strong>blacklisted.html</strong>.</p>
<p><strong>Source :</strong> <a title="Apache.org" href="http://httpd.apache.org/docs/2.0/misc/rewriteguide.html">http://httpd.apache.org/docs/2.0/misc/rewriteguide.html</a></p>
<h3>Pour suivre votre lecture</h3>
<ul class="related_post">
<li><a href="http://www.mkhelif.fr/2008/05/23/serveur-de-mails-multi-domaines.html" title="Serveur de mails multi-domaines">Serveur de mails multi-domaines</a></li>
<li><a href="http://www.mkhelif.fr/2009/11/19/chrome-os-premire-prsentation.html" title="Chrome OS : premi&egrave;re pr&eacute;sentation">Chrome OS : premi&egrave;re pr&eacute;sentation</a></li>
<li><a href="http://www.mkhelif.fr/2009/09/07/ruby-on-rails-dployer-une-application-sur-tomcat-avec-jruby.html" title="Ruby on Rails : d&eacute;ployer une application sur Tomcat avec JRuby">Ruby on Rails : d&eacute;ployer une application sur Tomcat avec JRuby</a></li>
<li><a href="http://www.mkhelif.fr/2008/11/24/authentification-ssh-par-cl-privecl-publique.html" title="Authentification SSH par clé privée/clé publique">Authentification SSH par clé privée/clé publique</a></li>
<li><a href="http://www.mkhelif.fr/2008/06/18/passerelle-entre-apache-et-tomcat.html" title="Passerelle entre Apache et Tomcat">Passerelle entre Apache et Tomcat</a></li>
<li><a href="http://www.mkhelif.fr/2010/01/14/gwt-2-0-les-nouvelles-fonctionnalits.html" title="GWT 2.0 : les nouvelles fonctionnalités">GWT 2.0 : les nouvelles fonctionnalités</a></li>
<li><a href="http://www.mkhelif.fr/2009/12/15/goo-gl-le-raccourcisseur-durl-by-google.html" title="Goo.gl : le raccourcisseur d&rsquo;URL by Google">Goo.gl : le raccourcisseur d&rsquo;URL by Google</a></li>
</ul>
       ]]></content:encoded>
			<wfw:commentRss>http://www.mkhelif.fr/2008/06/23/apache2-systeme-de-blacklist.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Serveur de mails multi-domaines</title>
		<link>http://www.mkhelif.fr/2008/05/23/serveur-de-mails-multi-domaines.html</link>
		<comments>http://www.mkhelif.fr/2008/05/23/serveur-de-mails-multi-domaines.html#comments</comments>
		<pubDate>Fri, 23 May 2008 17:57:58 +0000</pubDate>
		<dc:creator>mkhelif</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Tutoriel]]></category>
		<category><![CDATA[Sécurité]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.mkhelif.fr/?p=34</guid>
		<description><![CDATA[Ayant voulu créer un serveur de mail avec des comptes et des domaines virtuels je me suis très vite rendu compte que les différents tutoriels ne fonctionnaient pas dans ma configuration.
J&#8217;ai donc décidé de créer ce billet pour présenter le fonctionnement d&#8217;une telle infrastructure et comment la mettre en place.

Infrastructure du serveur
Le serveur va se [...]]]></description>
			<content:encoded><![CDATA[<p>Ayant voulu créer un serveur de mail avec des comptes et des domaines virtuels je me suis très vite rendu compte que les différents tutoriels ne fonctionnaient pas dans ma configuration.</p>
<p>J&#8217;ai donc décidé de créer ce billet pour présenter le fonctionnement d&#8217;une telle infrastructure et comment la mettre en place.</p>
<p><span id="more-51"></span></p>
<h3>Infrastructure du serveur</h3>
<p>Le serveur va se composer de quatre services : l&#8217;agent de livraison (<a href="http://www.postfix.org/" target="_blank">Postfix</a>), le serveur de mails IMAP (<a href="http://www.courier-mta.org/" target="_blank">Courier</a>) et le serveur web (<a href="http://www.apache.org/" target="_blank">Apache</a> + <a href="http://www.php.net/" target="_blank">PHP</a>) et la base de données (<a href="http://www.mysql.com/" target="_blank">MySQL</a>). Pour accéder au mails j&#8217;ai décidé d&#8217;utiliser <a title="RoundCube" href="http://www.roundcube.net/" target="_blank">RoundCube</a> et <a title="PostfixAdmin" href="http://postfixadmin.sourceforge.net/" target="_blank">PostfixAdmin</a> pour administrer les utilisateurs, les alias et les domaines.</p>
<p style="text-align: center"><a href="http://www.mkhelif.fr/wp-content/uploads/2008/06/infrastructure.png"><img class="alignnone size-full wp-image-61" title="infrastructure" src="http://www.mkhelif.fr/wp-content/uploads/2008/06/infrastructure.png" alt="Infrastructure serveur de mails multi-domaines" width="500" height="330" /></a></p>
<p style="text-align: left">
<h3>Création du compte virtuel</h3>
<p>On va d&#8217;abord créer un utilisateur sur le serveur qui stockera les mails des utilisateurs :</p>

<div class="wp_codebox"><table><tr id="p5128"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p51code28"><pre class="sh" style="font-family:monospace;">addgroup --gid 20001 virtual
adduser --uid 20001 --gid 20001 virtual</pre></td></tr></table></div>

<h3>Installation des services</h3>
<p>On va commencer par le plus simple : Apache et MySQL. On va tout simplement les récupérer dans les dépots :</p>

<div class="wp_codebox"><table><tr id="p5129"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p51code29"><pre class="sh" style="font-family:monospace;">apt-get install apache2 mysql-server-5.0 php5 php5-mysql php5-gd</pre></td></tr></table></div>

<p>Je n&#8217;aborderai pas ici la configuration d&#8217;Apache ni de PHP (penser juste à activer l&#8217;extension pour MySQL si ce n&#8217;est pas fait).</p>
<h4>Base de données</h4>
<p>Il faut créer la base de données que vont utiliser les autres services pour identifier les utilisateurs. Il suffit d&#8217;exécuter le script SQL suivant : <a href="http://www.mkhelif.fr/wp-content/uploads/2008/06/postfixmysql.sql">PostfixMySQL.sql</a>. Penser à modifier l&#8217;identifiant et le mot de passe pour le compte (ici : postfix / postfix).</p>

<div class="wp_codebox"><table><tr id="p5130"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p51code30"><pre class="sql" style="font-family:monospace;">mysql
<span style="color: #66cc66;">...</span>
mysql<span style="color: #66cc66;">&gt;</span>CREATE <span style="color: #993333; font-weight: bold;">DATABASE</span> postfix;
mysql<span style="color: #66cc66;">&gt;</span>GRANT <span style="color: #993333; font-weight: bold;">ALL</span> PRIVILEGES <span style="color: #993333; font-weight: bold;">ON</span> postfix<span style="color: #66cc66;">.*</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'postfix'</span>@<span style="color: #ff0000;">'localhost'</span> <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'postfix'</span>;
mysql<span style="color: #66cc66;">&gt;</span>\<span style="color: #66cc66;">.</span> PostfixMySQL<span style="color: #66cc66;">.</span>sql</pre></td></tr></table></div>

<p>On ajoute l&#8217;administrateur de PostfixAdmin directement dans la base de données :</p>

<div class="wp_codebox"><table><tr id="p5131"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code" id="p51code31"><pre class="sql" style="font-family:monospace;">mysql<span style="color: #66cc66;">&gt;</span>INSERT <span style="color: #993333; font-weight: bold;">INTO</span> domain <span style="color: #66cc66;">&#40;</span>domain<span style="color: #66cc66;">,</span> description<span style="color: #66cc66;">&#41;</span>
      <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'mkhelif.fr'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'Domaine personnel'</span><span style="color: #66cc66;">&#41;</span>;
Query OK<span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span> row affected <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.00</span> sec<span style="color: #66cc66;">&#41;</span>
&nbsp;
mysql<span style="color: #66cc66;">&gt;</span>INSERT <span style="color: #993333; font-weight: bold;">INTO</span> admin <span style="color: #66cc66;">&#40;</span>username<span style="color: #66cc66;">,</span> password<span style="color: #66cc66;">,</span> active<span style="color: #66cc66;">&#41;</span>
      <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'postmaster@mkhelif.fr'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'$1$CeeAzXb...J8njWAw1'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">&#41;</span>;
Query OK<span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span> row affected <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.00</span> sec<span style="color: #66cc66;">&#41;</span>
&nbsp;
mysql<span style="color: #66cc66;">&gt;</span>INSERT <span style="color: #993333; font-weight: bold;">INTO</span> domain_admins <span style="color: #66cc66;">&#40;</span>username<span style="color: #66cc66;">,</span> domain<span style="color: #66cc66;">,</span> active<span style="color: #66cc66;">&#41;</span>
      <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'postmaster@mkhelif.fr'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'ALL'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">&#41;</span>;
Query OK<span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span> row affected <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.00</span> sec<span style="color: #66cc66;">&#41;</span>
&nbsp;
mysql<span style="color: #66cc66;">&gt;</span>INSERT <span style="color: #993333; font-weight: bold;">INTO</span> mailbox <span style="color: #66cc66;">&#40;</span>username<span style="color: #66cc66;">,</span> password<span style="color: #66cc66;">,</span> name<span style="color: #66cc66;">,</span> maildir<span style="color: #66cc66;">,</span> domain<span style="color: #66cc66;">,</span> active<span style="color: #66cc66;">&#41;</span>
      <span style="color: #993333; font-weight: bold;">VALUES</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'postmaster@mkhelif.fr'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'$1$ExhxBRG6$...qhF/unIwe0Kk1'</span><span style="color: #66cc66;">,</span>
              <span style="color: #ff0000;">'Marwan KHELIF'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'postaster@mkhelif.fr/'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'mkhelif.fr'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'1'</span><span style="color: #66cc66;">&#41;</span>;
Query OK<span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span> row affected <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.00</span> sec<span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p style="padding-left: 30px"><strong>Note</strong> : le mot de passe est hashé en MD5 avec du sel. Voici un script PHP pour encoder votre mot de passe :</p>

<div class="wp_codebox"><table><tr id="p5132"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p51code32"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #990000;">crypt</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>On vérifie que l&#8217;utilisateur que l&#8217;on vient de créer a bien accès à la base de données :</p>

<div class="wp_codebox"><table><tr id="p5133"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p51code33"><pre class="sql" style="font-family:monospace;">mysql postfix <span style="color: #66cc66;">-</span>u postfix <span style="color: #66cc66;">-</span>p
Enter password: postfix
<span style="color: #66cc66;">...</span>
mysql<span style="color: #66cc66;">&gt;</span></pre></td></tr></table></div>

<p>Voilà la base de données est prête à être utilisée par les différents services.</p>
<h4>Postfix</h4>
<p>On commence par installer Postfix et le module de connexion à la base de données. Attention lors de l&#8217;installation si Exim4 est installé il sera supprimé et remplacé par Postfix.</p>

<div class="wp_codebox"><table><tr id="p5134"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p51code34"><pre class="sh" style="font-family:monospace;">apt-get install postfix postfix-mysql</pre></td></tr></table></div>

<p style="padding-left: 30px">Note : pendant l&#8217;installation sélectionner <em>Site Internet</em>.</p>
<p>Une fois installé il faut modifier le fichier suivant : <strong>/etc/postfix/main.cf</strong>. Rajouter les propriétés suivantes à la fin du fichier :</p>

<div class="wp_codebox"><table><tr id="p5135"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p51code35"><pre class="properties" style="font-family:monospace;"><span style="color: #000080; font-weight:bold;">virtual_transport</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> maildrop</span>
<span style="color: #000080; font-weight:bold;">virtual_mailbox_base</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> /home/virtual</span>
<span style="color: #000080; font-weight:bold;">virtual_alias_maps</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> proxy:mysql:/etc/postfix/mysql_virtual_alias_maps.cf</span>
<span style="color: #000080; font-weight:bold;">virtual_mailbox_domains</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> proxy:mysql:/etc/postfix/mysql_virtual_domains_maps.cf</span>
<span style="color: #000080; font-weight:bold;">virtual_mailbox_maps</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> proxy:mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf</span>
<span style="color: #000080; font-weight:bold;">virtual_minimum_uid</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> 20001</span>
<span style="color: #000080; font-weight:bold;">virtual_uid_maps</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> static:20001</span>
<span style="color: #000080; font-weight:bold;">virtual_gid_maps</span> <span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;"> static:20001</span></pre></td></tr></table></div>

<p>On crée alors les fichiers de mapping avec la base de données :</p>

<div class="wp_codebox"><table><tr id="p5136"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p51code36"><pre class="text" style="font-family:monospace;">Fichier : /etc/postfix/mysql_virtual_alias_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT goto FROM alias WHERE address = '%s' and active = '1'</pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p5137"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p51code37"><pre class="text" style="font-family:monospace;">Fichier : /etc/postfix/mysql_virtual_domains_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT domain FROM domain WHERE domain = '%s' and active = '1'</pre></td></tr></table></div>


<div class="wp_codebox"><table><tr id="p5138"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p51code38"><pre class="text" style="font-family:monospace;">Fichier : /etc/postfix/mysql_virtual_mailbox_maps.cf
user = postfix
password = postfix
hosts = localhost
dbname = postfix
query = SELECT maildir FROM mailbox WHERE username = '%s' and active = '1'</pre></td></tr></table></div>

<p>Modifier le fichier /etc/postfix/master.cf afin de modifier la livraison par maildrop :</p>

<div class="wp_codebox"><table><tr id="p5139"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p51code39"><pre class="text" style="font-family:monospace;">Remplacer la ligne :
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
&nbsp;
par :
maildrop  unix  -       n       n       -       -       pipe
   flags=DRhu user=virtual argv=/usr/bin/maildrop -w 90 -d ${user}@${nexthop}
   ${extension} ${recipient} ${user} ${nexthop} ${sender}</pre></td></tr></table></div>

<p>On redémarre alors le service :</p>

<div class="wp_codebox"><table><tr id="p5140"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p51code40"><pre class="sh" style="font-family:monospace;">/etc/init.d/postfix restart</pre></td></tr></table></div>

<h4>Maildrop</h4>
<p>On va alors installer le livreur de mails : maildrop.</p>

<div class="wp_codebox"><table><tr id="p5141"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p51code41"><pre class="sh" style="font-family:monospace;">apt-get install maildrop</pre></td></tr></table></div>

<p>On créer le fichier <em>/home/virtual/.mailfilter</em> de livraison, si vous souhaitez spécifier certaines règles de livraisons (mailinglists, spams, &#8230;) vous devez modifier ce fichier ou en créer un dans les dossiers de vos utilisateurs :</p>

<div class="wp_codebox"><table><tr id="p5142"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code" id="p51code42"><pre class="text" style="font-family:monospace;">Fichier : /home/virtual/.mailfilter
logfile &quot;/home/virtual/.maildrop.log&quot;
`[ -d $DEFAULT ] || (maildirmake $DEFAULT &amp;&amp; maildirmake -f Spam $DEFAULT &amp;&amp; maildirmake -f sent-mail $DEFAULT &amp;&amp; maildirmake -f SpamToLearn $DEFAULT &amp;&amp;
maildirmake -f SpamFalse $DEFAULT)`
&nbsp;
`test -r $HOME/$DEFAULT.mailfilter`
if( $RETURNCODE == 0 )
{
    log &quot;(==)  Including $HOME/$DEFAULT.mailfilter&quot;
    exception {
        include $HOME/$DEFAULT.mailfilter
    }
}</pre></td></tr></table></div>

<p>Une fois ce fichier créé il faut modifier les droits à ce fichier :</p>

<div class="wp_codebox"><table><tr id="p5143"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p51code43"><pre class="sh" style="font-family:monospace;">chmod 600 .mailfilter</pre></td></tr></table></div>

<h4>Courier</h4>
<p>On installe de la même façon Courier et le module de connexion à la base de données :</p>

<div class="wp_codebox"><table><tr id="p5144"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p51code44"><pre class="sh" style="font-family:monospace;">apt-get install courier-imap courier-authlib-mysql</pre></td></tr></table></div>

<p style="padding-left: 30px"><strong>Note</strong> : pendant l&#8217;installation choisissez <em>NON </em>lorsqu&#8217;il vous propose de créer les répertoires Web.</p>
<p>Modifier les paramètres dans les fichiers suivants :</p>

<div class="wp_codebox"><table><tr id="p5145"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code" id="p51code45"><pre class="properties" style="font-family:monospace;">Fichier : /etc/courier/authdaemonrc
<span style="color: #000080; font-weight:bold;">authmodulelist</span><span style="color: #000000;">=</span><span style="color: #933;">&quot;authmysql&quot;</span>
&nbsp;
Fichier : /etc/courier/authmysqlrc
MYSQL_SERVER	localhost
MYSQL_USERNAME	postfix
MYSQL_PASSWORD	postfix
MYSQL_SOCKET	/var/run/mysqld/mysqld.sock
MYSQL_PORT	<span style="">3306</span>
MYSQL_OPT	<span style="">0</span>
&nbsp;
MYSQL_DATABASE	postfix
MYSQL_USER_TABLE	mailbox
MYSQL_CRYPT_FIELD	password
MYSQL_LOGIN_FIELD	username
MYSQL_HOME_FIELD	'/home/virtual'
MYSQL_UID_FIELD		'<span style="">20001</span>'
MYSQL_GID_FIELD		'<span style="">20001</span>'
MYSQL_NAME_FIELD	name
MYSQL_MAILDIR_FIELD	maildir
MYSQL_WHERE_CLAUSE	active<span style="color: #000000;">=</span><span style="color: #008000; font-weight:bold;">'1'</span></pre></td></tr></table></div>

<p style="padding-left: 30px;"><strong>Note</strong> : vérifier qu&#8217;il n&#8217;y ai que des tabulations entre le nom et la valeur d&#8217;une propriété.</p>
<p>Il faut donner les accès à l&#8217;utilisateur virtual :</p>

<div class="wp_codebox"><table><tr id="p5146"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p51code46"><pre class="sh" style="font-family:monospace;">chown virtual /usr/lib/courier/authdaemon
chmod 750 /usr/lib/courier/authdaemon</pre></td></tr></table></div>

<p>On redémarre alors les services IMAP et AuthDaemon de Courier :</p>

<div class="wp_codebox"><table><tr id="p5147"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p51code47"><pre class="sh" style="font-family:monospace;">/etc/init.d/courier-imap restart
/etc/init.d/courier-authdaemon restart</pre></td></tr></table></div>

<p>Pour vérifier que le serveur IMAP arrive bien à se connecter à la base de données on exécute un test d&#8217;authentification :</p>

<div class="wp_codebox"><table><tr id="p5148"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p51code48"><pre class="sh" style="font-family:monospace;">authtest postmaster@mkhelif.fr
Authentication succeeded.
&nbsp;
     Authenticated: postmaster@mkhelif.fr  (uid 20001, gid 20001)
    Home Directory: /home/virtual
           Maildir: postmaster@mkhelif.fr/
             Quota: 0S
Encrypted Password: $1$CeeAzXb...J8njWAw1
Cleartext Password: (none)
           Options: (none)</pre></td></tr></table></div>

<p>Maintenant tous les services sont configurés et communiquent entre eux, on peut configurer les accès Web.</p>
<h4>PostfixAdmin et Roundcube</h4>
<p>Tout d&#8217;abord on récupère les archives (récupérer les dernières versions depuis <a title="RoundCube" href="http://www.roundcube.net/" target="_blank">RoundCube</a> et <a title="PostfixAdmin" href="http://postfixadmin.sourceforge.net/" target="_blank">PostfixAdmin</a>) :</p>

<div class="wp_codebox"><table><tr id="p5149"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p51code49"><pre class="sh" style="font-family:monospace;">wget http://garr.dl.sourceforge.net/sourceforge/roundcubemail/roundcubemail-0.1.1.tar.gz
wget http://dfn.dl.sourceforge.net/sourceforge/postfixadmin/postfixadmin_2.2.0.tar.gz</pre></td></tr></table></div>

<p>On extrait alors les sources :</p>

<div class="wp_codebox"><table><tr id="p5150"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p51code50"><pre class="sh" style="font-family:monospace;">tar -xzf roundcubemail-0.1.1.tar.gz
tar -xzf postfixadmin_2.2.0.tar.gz</pre></td></tr></table></div>

<h5>Configuration de PostfixAdmin</h5>
<p>Pour configurer PostfixAdmin il faut modifier les paramètres suivants du fichier <strong>config.inc.php</strong> et supprimer le fichier <strong>setup.php</strong> :</p>

<div class="wp_codebox"><table><tr id="p5151"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code" id="p51code51"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$CONF</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'configured'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$CONF</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'postfix_admin_url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http://www.mkhelif.fr/'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$CONF</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'create_default_folders'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$CONF</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'database_type'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'mysqli'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$CONF</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'database_host'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$CONF</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'database_user'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'postfix'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$CONF</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'database_password'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'postfix'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$CONF</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'database_name'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'postfix'</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Vous pouvez modifier les autres propriétés selon vos besoins.</p>
<h5>Configuration de RoundCube</h5>
<p>On va tout d&#8217;abord créer la base de données que va utiliser RoundCube :</p>

<div class="wp_codebox"><table><tr id="p5152"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p51code52"><pre class="sql" style="font-family:monospace;">mysql
<span style="color: #66cc66;">...</span>
mysql<span style="color: #66cc66;">&gt;</span>CREATE <span style="color: #993333; font-weight: bold;">DATABASE</span> roundcube;
Query OK<span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span> row affected <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.00</span> sec<span style="color: #66cc66;">&#41;</span>
&nbsp;
mysql<span style="color: #66cc66;">&gt;</span>GRANT <span style="color: #993333; font-weight: bold;">ALL</span> PRIVILEGES <span style="color: #993333; font-weight: bold;">ON</span> roundcube<span style="color: #66cc66;">.*</span> <span style="color: #993333; font-weight: bold;">TO</span> <span style="color: #ff0000;">'roundcube'</span>@<span style="color: #ff0000;">'localhost'</span> <span style="color: #993333; font-weight: bold;">IDENTIFIED</span> <span style="color: #993333; font-weight: bold;">BY</span> <span style="color: #ff0000;">'roundcube'</span>;
Query OK<span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span> row affected <span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0.00</span> sec<span style="color: #66cc66;">&#41;</span></pre></td></tr></table></div>

<p>Pour configurer RoundCube il faut déplacer les fichiers :</p>

<div class="wp_codebox"><table><tr id="p5153"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p51code53"><pre class="sh" style="font-family:monospace;">mv ./config/db.inc.php.dist ./config/db.inc.php
mv ./config/main.inc.php.dist ./config/main.inc.php</pre></td></tr></table></div>

<p>Et modifier les paramètres :</p>

<div class="wp_codebox"><table><tr id="p5154"><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code" id="p51code54"><pre class="php" style="font-family:monospace;">Fichier <span style="color: #339933;">:</span> config<span style="color: #339933;">/</span>db<span style="color: #339933;">.</span>inc<span style="color: #339933;">.</span>php
<span style="color: #000088;">$rcmail_config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'db_dsnw'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'mysqli://roundcube:roundcube@localhost/roundcube'</span><span style="color: #339933;">;</span>
&nbsp;
Fichier <span style="color: #339933;">:</span> config<span style="color: #339933;">/</span>main<span style="color: #339933;">.</span>inc<span style="color: #339933;">.</span>php
<span style="color: #000088;">$rcmail_config</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'default_host'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<h3>Problèmes rencontrés</h3>
<blockquote><p>La commande <em>authtest</em> échoue</p>
</blockquote>
<p>Cela signifie généralement que le serveur IMAP n&#8217;arrive pas à accéder à la base de données. Vérifier tous les paramètres du fichier <strong>/etc/courier/authmysqlrc</strong> et que le nom et la valeur des propriétés soient bien séparés par des tabulations et pas des espaces.</p>
<p>Pour activer les logs au niveau de Courier il faut modifier le fichier <strong>/etc/courier/authdaemonrc</strong> et positionner le paramètre <em>DEBUG_LOGIN</em> à 1.</p>
<blockquote><p>J&#8217;obtiens l&#8217;erreur suivante : <em>imapd: authentication error: Input/output error</em></p>
</blockquote>
<p>J&#8217;avais rencontré ce problème car IMAP n&#8217;arrivai pas à se connecter à la base de données (mauvais mot de passe). Il faut vérifier le fichier <strong>/etc/courier/authmysqlrc</strong>.</p>
<blockquote><p>RoundCube n&#8217;authentifie pas les utilisateurs</p>
</blockquote>
<p>J&#8217;ai rencontré ce problème dans le cas où Apache n&#8217;a pas accès pour créer les répertoire par défaut d&#8217;un utilisateur (<em>Inbox</em>, <em>Sent</em>, <em>Trash</em>, <em>Spam</em>, <em>Drafts</em>), vérifier bien que le dossier existe et que le propriétaire est bien <em>virtual</em>. Sinon créer les répertoires grâce à la commande : <em>maildirmake </em> en vérifiant les droits : <em>755</em>.<em><br />
</em></p>
<h3>Conclusion</h3>
<p>Voilà votre serveur de mails multi-domaines est prêt. Vous pouvez ajouter d&#8217;autres services : antispam (<a title="SpamAssassin" href="http://spamassassin.apache.org/" target="_blank">SpamAssassin</a>), antivirus (<a title="ClamAV" href="http://www.clamav.net/" target="_blank">ClamAV</a>), gestion de quotas, &#8230;Mais je n&#8217;aborderai pas ces points là dans ce tutoriel.</p>
<h3>Pour suivre votre lecture</h3>
<ul class="related_post">
<li><a href="http://www.mkhelif.fr/2008/06/23/apache2-systeme-de-blacklist.html" title="Apache2 : système de blacklist">Apache2 : système de blacklist</a></li>
<li><a href="http://www.mkhelif.fr/2009/11/19/chrome-os-premire-prsentation.html" title="Chrome OS : premi&egrave;re pr&eacute;sentation">Chrome OS : premi&egrave;re pr&eacute;sentation</a></li>
<li><a href="http://www.mkhelif.fr/2009/09/07/ruby-on-rails-dployer-une-application-sur-tomcat-avec-jruby.html" title="Ruby on Rails : d&eacute;ployer une application sur Tomcat avec JRuby">Ruby on Rails : d&eacute;ployer une application sur Tomcat avec JRuby</a></li>
<li><a href="http://www.mkhelif.fr/2008/11/24/authentification-ssh-par-cl-privecl-publique.html" title="Authentification SSH par clé privée/clé publique">Authentification SSH par clé privée/clé publique</a></li>
<li><a href="http://www.mkhelif.fr/2008/06/18/passerelle-entre-apache-et-tomcat.html" title="Passerelle entre Apache et Tomcat">Passerelle entre Apache et Tomcat</a></li>
<li><a href="http://www.mkhelif.fr/2010/01/14/gwt-2-0-les-nouvelles-fonctionnalits.html" title="GWT 2.0 : les nouvelles fonctionnalités">GWT 2.0 : les nouvelles fonctionnalités</a></li>
<li><a href="http://www.mkhelif.fr/2009/12/15/goo-gl-le-raccourcisseur-durl-by-google.html" title="Goo.gl : le raccourcisseur d&rsquo;URL by Google">Goo.gl : le raccourcisseur d&rsquo;URL by Google</a></li>
</ul>
       ]]></content:encoded>
			<wfw:commentRss>http://www.mkhelif.fr/2008/05/23/serveur-de-mails-multi-domaines.html/feed</wfw:commentRss>
		<slash:comments>73</slash:comments>
		</item>
		<item>
		<title>Chiffre de César</title>
		<link>http://www.mkhelif.fr/2008/01/17/chiffre-de-cesar.html</link>
		<comments>http://www.mkhelif.fr/2008/01/17/chiffre-de-cesar.html#comments</comments>
		<pubDate>Thu, 17 Jan 2008 15:05:44 +0000</pubDate>
		<dc:creator>mkhelif</dc:creator>
				<category><![CDATA[Cryptographie]]></category>
		<category><![CDATA[Sécurité]]></category>

		<guid isPermaLink="false">http://wiki.mkhelif.fr/beta/2008/01/17/chiffre-de-cesar.html</guid>
		<description><![CDATA[Le chiffre de César consiste simplement à décaler les lettres de l&#8217;alphabet de quelques crans vers la droite ou la gauche.Le chiffre de César (on parle aussi d&#8217;alphabet décalé) est un cas particulier d&#8217;alphabet désordonné.
Par exemple si nous décidons que le décalage est de 5 vers la droite, nous aurons pourrons chiffrer un message avec [...]]]></description>
			<content:encoded><![CDATA[<p>Le chiffre de César consiste simplement à décaler les lettres de l&#8217;alphabet de quelques crans vers la droite ou la gauche.Le chiffre de César (on parle aussi d&#8217;alphabet décalé) est un cas particulier d&#8217;alphabet désordonné.</p>
<p><span id="more-34"></span>Par exemple si nous décidons que le décalage est de <strong>5</strong> vers la droite, nous aurons pourrons chiffrer un message avec un nouvel alphabet :</p>
<table class="inline" style="border: 1px solid #444444; height: 32px;" border="0" width="477">
<tbody>
<tr>
<th class="centeralign">Alphabet</th>
<td class="centeralign">a</td>
<th class="centeralign">b</th>
<td class="centeralign">c</td>
<th class="centeralign">d</th>
<td class="centeralign">e</td>
<th class="centeralign">f</th>
<td class="centeralign">g</td>
<th class="centeralign">h</th>
<td class="centeralign">i</td>
<th class="centeralign">j</th>
<td class="centeralign">k</td>
<th class="centeralign">l</th>
<td class="centeralign">m</td>
<th class="centeralign">n</th>
<td class="centeralign">o</td>
<th class="centeralign">p</th>
<td class="centeralign">q</td>
<th class="centeralign">r</th>
<td class="centeralign">s</td>
<th class="centeralign">t</th>
<td class="centeralign">u</td>
<th class="centeralign">v</th>
<td class="centeralign">w</td>
<th class="centeralign">x</th>
<td class="centeralign">y</td>
<th class="centeralign">z</th>
</tr>
<tr>
<th class="centeralign">Chiffré</th>
<td class="centeralign">f</td>
<th class="centeralign">g</th>
<td class="centeralign">h</td>
<th class="centeralign">i</th>
<td class="centeralign">j</td>
<th class="centeralign">k</th>
<td class="centeralign">l</td>
<th class="centeralign">m</th>
<td class="centeralign">n</td>
<th class="centeralign">o</th>
<td class="centeralign">p</td>
<th class="centeralign">q</th>
<td class="centeralign">r</td>
<th class="centeralign">s</th>
<td class="centeralign">t</td>
<th class="centeralign">u</th>
<td class="centeralign">v</td>
<th class="centeralign">w</th>
<td class="centeralign">x</td>
<th class="centeralign">y</th>
<td class="centeralign">z</td>
<th class="centeralign">a</th>
<td class="centeralign">b</td>
<th class="centeralign">c</th>
<td class="centeralign">d</td>
<th class="centeralign">e</th>
</tr>
</tbody>
</table>
<p>On peut donc chiffrer un texte :</p>
<pre class="code">  Le mot  : chiffre de cesar
  Devient : hmnkkwj ij hjxfw</pre>
<p>Le problème de cette méthode vient du fait que lorsque l&#8217;on chiffre un texte assez important, il est assez facile de revenir au texte clair sans avoir le <span class="curid"><span class="wikilink1">chiffre de César</span></span>.<br />
En effet toutes les lettres de l&#8217;alphabet ont une fréquence d&#8217;apparition. On peut donc analyser le texte est retrouver les lettres d&#8217;origines.</p>
<p>Image <a class="urlextern" title="http://fr.wikipedia.org/wiki/Fr%C3%A9quence_d'apparition_des_lettres_en_fran%C3%A7ais" rel="nofollow" href="http://fr.wikipedia.org/wiki/Fr%C3%A9quence_d%27apparition_des_lettres_en_fran%C3%A7ais">Wikipedia</a> de la répartition des lettres en français.</p>
<p style="text-align: center;"><a href="http://www.mkhelif.fr/wp-content/uploads/2008/06/frequence-lettres.png"><img class="size-full wp-image-63" title="Fréquence des lettres" src="http://www.mkhelif.fr/wp-content/uploads/2008/06/frequence-lettres.png" alt="Fréquence des lettres en Français" width="500" height="194" /></a></p>
<h3>Pour suivre votre lecture</h3>
<ul class="related_post">
<li><a href="http://www.mkhelif.fr/2008/11/24/authentification-ssh-par-cl-privecl-publique.html" title="Authentification SSH par clé privée/clé publique">Authentification SSH par clé privée/clé publique</a></li>
<li><a href="http://www.mkhelif.fr/2008/07/30/oracle-faille-critique-dans-weblogic.html" title="Oracle : faille critique dans WebLogic [corrigé]">Oracle : faille critique dans WebLogic [corrigé]</a></li>
<li><a href="http://www.mkhelif.fr/2008/06/23/apache2-systeme-de-blacklist.html" title="Apache2 : système de blacklist">Apache2 : système de blacklist</a></li>
<li><a href="http://www.mkhelif.fr/2008/05/23/serveur-de-mails-multi-domaines.html" title="Serveur de mails multi-domaines">Serveur de mails multi-domaines</a></li>
<li><a href="http://www.mkhelif.fr/2008/01/17/chiffre-de-vigenere.html" title="Chiffre de Vigénère">Chiffre de Vigénère</a></li>
<li><a href="http://www.mkhelif.fr/2008/01/16/chiffre-de-beaufort.html" title="Chiffre de Beaufort">Chiffre de Beaufort</a></li>
</ul>
       ]]></content:encoded>
			<wfw:commentRss>http://www.mkhelif.fr/2008/01/17/chiffre-de-cesar.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chiffre de Vigénère</title>
		<link>http://www.mkhelif.fr/2008/01/17/chiffre-de-vigenere.html</link>
		<comments>http://www.mkhelif.fr/2008/01/17/chiffre-de-vigenere.html#comments</comments>
		<pubDate>Thu, 17 Jan 2008 15:04:51 +0000</pubDate>
		<dc:creator>mkhelif</dc:creator>
				<category><![CDATA[Cryptographie]]></category>
		<category><![CDATA[Sécurité]]></category>

		<guid isPermaLink="false">http://wiki.mkhelif.fr/beta/2008/01/17/chiffre-de-vigenere.html</guid>
		<description><![CDATA[Le chiffre de Vigenère est une amélioration décisive du chiffre de César. Sa force réside dans l&#8217;utilisation non pas d&#8217;un, mais de 26 alphabets décalés pour chiffrer un message.

On peut résumer ces décalages avec un carré de Vigenère. Ce chiffre utilise une clef qui définit le décalage pour chaque lettre du message (A: décalage de [...]]]></description>
			<content:encoded><![CDATA[<p>Le chiffre de Vigenère est une amélioration décisive du <a href="http://wiki.mkhelif.fr/2008/01/17/chiffre-de-cesar.html">chiffre de César</a>. Sa force réside dans l&#8217;utilisation non pas d&#8217;un, mais de 26 alphabets décalés pour chiffrer un message.</p>
<p><span id="more-33"></span></p>
<p>On peut résumer ces décalages avec un carré de Vigenère. Ce chiffre utilise une clef qui définit le décalage pour chaque lettre du message (A: décalage de 0, B: 1, C: 2, …, Z: 25).</p>
<p>Voici un exemple simple :</p>
<pre class="code">Texte en clair     : chiffre de vigenere
Clé de chiffrement : secret</pre>
<p>On construit alors la table suivante :</p>
<table class="inline" style="border: 1px solid #444444; height: 49px; text-align: center;" border="0" width="421">
<tbody>
<tr>
<th class="centeralign">Clair</th>
<td class="centeralign">c</td>
<th class="centeralign">h</th>
<td class="centeralign">i</td>
<th class="centeralign">f</th>
<td class="centeralign">f</td>
<th class="centeralign">r</th>
<td class="centeralign">e</td>
<th class="rightalign"></th>
<td class="centeralign">d</td>
<th class="centeralign">e</th>
<td class="rightalign"></td>
<th class="centeralign">v</th>
<td class="centeralign">i</td>
<th class="centeralign">g</th>
<td class="centeralign">e</td>
<th class="centeralign">n</th>
<td class="centeralign">e</td>
<th class="centeralign">r</th>
<td class="centeralign">e</td>
</tr>
<tr>
<th class="centeralign">Clé</th>
<td class="centeralign">s</td>
<th class="centeralign">e</th>
<td class="centeralign">c</td>
<th class="centeralign">r</th>
<td class="centeralign">e</td>
<th class="centeralign">t</th>
<td class="centeralign">s</td>
<th class="rightalign"></th>
<td class="centeralign">e</td>
<th class="centeralign">c</th>
<td class="rightalign"></td>
<th class="centeralign">r</th>
<td class="centeralign">e</td>
<th class="centeralign">t</th>
<td class="centeralign">s</td>
<th class="centeralign">e</th>
<td class="centeralign">c</td>
<th class="centeralign">r</th>
<td class="centeralign">e</td>
</tr>
<tr>
<th class="centeralign">Décalage</th>
<td class="centeralign">17</td>
<th class="centeralign">4</th>
<td class="centeralign">2</td>
<th class="centeralign">17</th>
<td class="centeralign">4</td>
<th class="centeralign">19</th>
<td class="centeralign">17</td>
<th class="rightalign"></th>
<td class="centeralign">17</td>
<th class="centeralign">4</th>
<td class="rightalign"></td>
<th class="centeralign">2</th>
<td class="centeralign">17</td>
<th class="centeralign">4</th>
<td class="centeralign">19</td>
<th class="centeralign">17</th>
<td class="centeralign">17</td>
<th class="centeralign">4</th>
<td class="centeralign">2</td>
</tr>
<tr>
<th class="centeralign">Chiffré</th>
<td class="centeralign">u</td>
<th class="centeralign">l</th>
<td class="centeralign">k</td>
<th class="centeralign">w</th>
<td class="centeralign">j</td>
<th class="centeralign">k</th>
<td class="centeralign">w</td>
<th class="rightalign"></th>
<td class="centeralign">h</td>
<th class="centeralign">g</th>
<td class="rightalign"></td>
<th class="centeralign">m</th>
<td class="centeralign">m</td>
<th class="centeralign">z</th>
<td class="centeralign">w</td>
<th class="centeralign">r</th>
<td class="centeralign">g</td>
<th class="centeralign">i</th>
<td class="centeralign">i</td>
</tr>
</tbody>
</table>
<p>L&#8217;intérêt de cette méthode par rapport au <a href="http://wiki.mkhelif.fr/2008/01/17/chiffre-de-cesar.html">chiffre de César</a> est que chaque lettre peut être chiffré de façons différentes. Si on calcule les fréquences des lettres d&#8217;une fable de la Fontaine on obtient des résultats marquants :</p>
<p>Texte clair :</p>
<p><a href="http://www.mkhelif.fr/wp-content/uploads/2008/06/vigenere-clair.png"><img class="alignnone size-medium wp-image-60" title="Texte clair" src="http://www.mkhelif.fr/wp-content/uploads/2008/06/vigenere-clair-300x184.png" alt="" width="300" height="184" /></a></p>
<p>Texte chiffré :</p>
<p><a href="http://www.mkhelif.fr/wp-content/uploads/2008/06/vigenere-chiffre.png"><img class="alignnone size-medium wp-image-59" title="Texte chiffré" src="http://www.mkhelif.fr/wp-content/uploads/2008/06/vigenere-chiffre-300x185.png" alt="" width="300" height="185" /></a></p>
<p>Source des images : <a class="urlextern" title="http://www.apprendre-en-ligne.net/crypto/vigenere/index.html" rel="nofollow" href="http://www.apprendre-en-ligne.net/crypto/vigenere/index.html">Ars Cryptographica</a></p>
<h3>Pour suivre votre lecture</h3>
<ul class="related_post">
<li><a href="http://www.mkhelif.fr/2008/11/24/authentification-ssh-par-cl-privecl-publique.html" title="Authentification SSH par clé privée/clé publique">Authentification SSH par clé privée/clé publique</a></li>
<li><a href="http://www.mkhelif.fr/2008/07/30/oracle-faille-critique-dans-weblogic.html" title="Oracle : faille critique dans WebLogic [corrigé]">Oracle : faille critique dans WebLogic [corrigé]</a></li>
<li><a href="http://www.mkhelif.fr/2008/06/23/apache2-systeme-de-blacklist.html" title="Apache2 : système de blacklist">Apache2 : système de blacklist</a></li>
<li><a href="http://www.mkhelif.fr/2008/05/23/serveur-de-mails-multi-domaines.html" title="Serveur de mails multi-domaines">Serveur de mails multi-domaines</a></li>
<li><a href="http://www.mkhelif.fr/2008/01/17/chiffre-de-cesar.html" title="Chiffre de César">Chiffre de César</a></li>
<li><a href="http://www.mkhelif.fr/2008/01/16/chiffre-de-beaufort.html" title="Chiffre de Beaufort">Chiffre de Beaufort</a></li>
</ul>
       ]]></content:encoded>
			<wfw:commentRss>http://www.mkhelif.fr/2008/01/17/chiffre-de-vigenere.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chiffre de Beaufort</title>
		<link>http://www.mkhelif.fr/2008/01/16/chiffre-de-beaufort.html</link>
		<comments>http://www.mkhelif.fr/2008/01/16/chiffre-de-beaufort.html#comments</comments>
		<pubDate>Wed, 16 Jan 2008 15:07:51 +0000</pubDate>
		<dc:creator>mkhelif</dc:creator>
				<category><![CDATA[Cryptographie]]></category>
		<category><![CDATA[Sécurité]]></category>

		<guid isPermaLink="false">http://wiki.mkhelif.fr/beta/2008/01/16/chiffre-de-beaufort.html</guid>
		<description><![CDATA[Le chiffre de Beaufort est une variante du chiffre de Vigenère. Il utilise le carré de Vigenère d&#8217;une autre manière. Au lieu d&#8217;additionner la clef au message clair, Beaufort soustrait le message clair de la clef.
Pour suivre votre lecture

Authentification SSH par clé privée/clé publique
Oracle : faille critique dans WebLogic [corrigé]
Apache2 : système de blacklist
Serveur de [...]]]></description>
			<content:encoded><![CDATA[<p>Le chiffre de Beaufort est une variante du <a href="http://wiki.mkhelif.fr/2008/01/17/chiffre-de-vigenere.html">chiffre de Vigenère</a>. Il utilise le carré de <a href="http://wiki.mkhelif.fr/2008/01/17/chiffre-de-vigenere.html">Vigenère</a> d&#8217;une autre manière. Au lieu d&#8217;additionner la clef au message clair, Beaufort soustrait le message clair de la clef.</p>
<h3>Pour suivre votre lecture</h3>
<ul class="related_post">
<li><a href="http://www.mkhelif.fr/2008/11/24/authentification-ssh-par-cl-privecl-publique.html" title="Authentification SSH par clé privée/clé publique">Authentification SSH par clé privée/clé publique</a></li>
<li><a href="http://www.mkhelif.fr/2008/07/30/oracle-faille-critique-dans-weblogic.html" title="Oracle : faille critique dans WebLogic [corrigé]">Oracle : faille critique dans WebLogic [corrigé]</a></li>
<li><a href="http://www.mkhelif.fr/2008/06/23/apache2-systeme-de-blacklist.html" title="Apache2 : système de blacklist">Apache2 : système de blacklist</a></li>
<li><a href="http://www.mkhelif.fr/2008/05/23/serveur-de-mails-multi-domaines.html" title="Serveur de mails multi-domaines">Serveur de mails multi-domaines</a></li>
<li><a href="http://www.mkhelif.fr/2008/01/17/chiffre-de-cesar.html" title="Chiffre de César">Chiffre de César</a></li>
<li><a href="http://www.mkhelif.fr/2008/01/17/chiffre-de-vigenere.html" title="Chiffre de Vigénère">Chiffre de Vigénère</a></li>
</ul>
       ]]></content:encoded>
			<wfw:commentRss>http://www.mkhelif.fr/2008/01/16/chiffre-de-beaufort.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
