<?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; serveur</title>
	<atom:link href="http://werk.feub.net/tag/serveur/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>Serveur de messagerie simple avec Postfix et Dovecot</title>
		<link>http://werk.feub.net/2011/05/serveur-de-messagerie-simple-avec-postfix-et-dovecot/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=serveur-de-messagerie-simple-avec-postfix-et-dovecot</link>
		<comments>http://werk.feub.net/2011/05/serveur-de-messagerie-simple-avec-postfix-et-dovecot/#comments</comments>
		<pubDate>Fri, 13 May 2011 13:37:51 +0000</pubDate>
		<dc:creator>Fabien</dc:creator>
				<category><![CDATA[BSD]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[courrier]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[maildir]]></category>
		<category><![CDATA[mailserver]]></category>
		<category><![CDATA[mta]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[serveur]]></category>
		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://werk.feub.net/?p=796</guid>
		<description><![CDATA[Ce tutoriel aide à la mise en oeuvre d&#8217;un serveur de messagerie complet, par serveur simple, j’entends par là, pas de SSL, de MySQL et de fonctions avancées. Ces fonctions viendront par la suite dans de prochains articles. La solution proposée est à base de Postfix pour le MTA et Dovecot comme serveur IMAP. Il [...]]]></description>
			<content:encoded><![CDATA[<p>
<img src="http://werk.feub.net/medias/2011/05/Messagerie.png" alt="" title="" class="floatleft" />Ce tutoriel aide à la mise en oeuvre d&#8217;un serveur de messagerie complet, par serveur <em>simple</em>, j’entends par là, pas de <a href="http://fr.wikipedia.org/wiki/SSL">SSL</a>, de <a href="http://fr.wikipedia.org/wiki/Mysql">MySQL</a> et de fonctions <em>avancées</em>. Ces fonctions viendront par la suite dans de prochains articles. La solution proposée est à base de <a title="Postfix" href="http://www.postfix.org/">Postfix</a> pour le <a title="Wikipedia" href="http://fr.wikipedia.org/wiki/Mail_Transfer_Agent">MTA</a> et <a title="Dovecot" href="http://www.dovecot.org/">Dovecot</a> comme serveur <a title="Wikipedia" href="http://fr.wikipedia.org/wiki/IMAP">IMAP</a>.
</p>
<p>
Il gérera des boîtes aux lettres virtuelles – c’est-à-dire indépendantes des comptes <em>systèmes</em> – d’autant d’utilisateurs et de domaines que ce soit.
</p>
<p>
Pour la suite des opérations, la machine utilisée est sous <a title="fedora-fr.org" target="_blank" href="http://www.fedora-fr.org">Fedora</a>, le tutoriel pourra donc convenir aux utilisateurs de <a href="http://www.centos.org/">CentOS</a> et de <a href="http://www.redhat.com/rhel/">Red Hat</a>. On supposera qu&#8217;elle s’appelle <em>monhostname.local.mondomaine.net</em>. C&#8217;est parti ^.^
</p>
<h4>Postfix</h4>
<p>L&#8217;installation se fait naturellement avec <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 postfix</span></pre></div></div>

<p>
Afin de préparer le terrain, il faut créer l’arborescence qui accueillera les boîtes aux lettres virtuelles et l’utilisateur/groupe de celles-ci. Pour ce faire, ajouter un utilisateur <em>vmail</em> et un groupe du même nom ayant tout deux des uid et gid non réservés, par exemple 6000. Le home de cet utilisateur sera <em>/home/vmail</em>, c’est ici que les BAL seront construites :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># groupadd -g 6000 vmail</span>
<span style="color: #666666; font-style: italic;"># useradd -d /home/vmail -m -u 6000 -g 6000 -s /dev/null vmail</span></pre></div></div>

<p>
On change les droits et le propriétaire des répertoires pour plus de sécurité :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># chmod -R 750 /home/vmail/</span>
<span style="color: #666666; font-style: italic;"># chown -R vmail:vmail /home/vmail/</span></pre></div></div>

<p>
Les fichiers de configuration Postfix se situent sous <em>/etc/postfix</em> et c’est <em>main.conf</em> qui nous intéresse. Je vais juste copier-coller le mien ci-dessous, pour plus de renseignement sur ses paramètres, voir <a title="feub.net" target="_blank" href="http://werk.feub.net/2011/01/activer-postfix-sous-mac-os-x/">cet article</a>.
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">alias_database = <span style="color: #007800;">$alias_maps</span>
alias_maps = <span style="color: #7a0874; font-weight: bold;">hash</span>:<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>aliases
append_dot_mydomain = no
biff = no
broken_sasl_auth_clients = <span style="color: #c20cb9; font-weight: bold;">yes</span>
command_directory = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin
config_directory = <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix
daemon_directory = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>libexec<span style="color: #000000; font-weight: bold;">/</span>postfix
data_directory = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>postfix
debug_peer_level = <span style="color: #000000;">2</span>
delay_warning_time = 4h
html_directory = no
inet_interfaces = all
mail_owner = postfix
mailbox_transport = lmtp:unix:<span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>imap<span style="color: #000000; font-weight: bold;">/</span>socket<span style="color: #000000; font-weight: bold;">/</span>lmtp
mailbox_size_limit = <span style="color: #000000;">512000000</span>
mailq_path = <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>mailq.postfix
manpage_directory = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">man</span>
masquerade_domains = mondomaine.net
message_size_limit = <span style="color: #000000;">50000000</span>
mydestination = <span style="color: #007800;">$myhostname</span>, localhost.<span style="color: #007800;">$myhostname</span>, localhost
mydomain = mondomaine.net
myhostname = monhostname.local.mondomaine.net
mynetworks = 192.168.1.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span>, 127.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span>
myorigin = <span style="color: #007800;">$myhostname</span>
newaliases_path = <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>newaliases
queue_directory = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>spool<span style="color: #000000; font-weight: bold;">/</span>postfix
readme_directory = no
recipient_delimiter = +
relayhost = <span style="color: #7a0874; font-weight: bold;">&#91;</span>smtp.sfr.fr<span style="color: #7a0874; font-weight: bold;">&#93;</span>
sendmail_path = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">sendmail</span>
setgid_group = postdrop
smtp_generic_maps = <span style="color: #7a0874; font-weight: bold;">hash</span>:<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>generic
smtpd_banner = <span style="color: #007800;">$myhostname</span> ESMTP
smtpd_recipient_limit = <span style="color: #000000;">50</span>
unknown_local_recipient_reject_code = <span style="color: #000000;">550</span>
virtual_alias_maps = <span style="color: #7a0874; font-weight: bold;">hash</span>:<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>virtual
virtual_gid_maps = static:<span style="color: #000000;">6000</span>
virtual_mailbox_base = <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vmail
virtual_mailbox_domains = <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>domains
virtual_mailbox_limit = <span style="color: #000000;">512000000</span>
virtual_mailbox_maps = <span style="color: #7a0874; font-weight: bold;">hash</span>:<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>user_mailboxes_path
virtual_minimum_uid = <span style="color: #000000;">6000</span>
virtual_uid_maps = static:<span style="color: #000000;">6000</span></pre></div></div>

<p>
<span style="text-decoration: underline;">Astuce</span> : Si comme moi, le serveur est sur un domaine local (monhostname.local.mondomaine.net), quelques difficultés vont être rencontrées lors de l’envoi de message vers l’extérieur, la machine de relai [smtp.sfr.fr] va refuser d’acheminer les emails car le domaine n’est pas enregistré sur la toile : <code>Sender address rejected: Domain not found</code>. Pour remédier à cela, il faut substituer l’adresse de l’émetteur en ajoutant ceci dans <em>/etc/postfix/generic</em> :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">@</span>monhostname.local.mondomaine.net       <span style="color: #000000; font-weight: bold;">@</span>mondomaine.net</pre></div></div>

<p>On compile ce fichier avec <em>postmap</em> avant de relancer Postfix :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># postmap /etc/postfix/generic</span></pre></div></div>

<p>
Pour savoir où délivrer le courrier, le système va lire le nom des domaines virtuels gérés dans le fichier <em>domains</em> et les adresses emails ainsi que leur chemin seront dans <em>user_mailboxes_path</em>, tout deux toujours sous <em>/etc/postfix</em>. Il suffit d’ajouter des domaines séparés par des retours ligne, comme suit :
</p>

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

<p>
Et pour les boîtes aux lettres virtuelles :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">tutu<span style="color: #000000; font-weight: bold;">@</span>mondomaine.net mondomaine.net<span style="color: #000000; font-weight: bold;">/</span>tutu<span style="color: #000000; font-weight: bold;">/</span>
toto<span style="color: #000000; font-weight: bold;">@</span>monautredomaine.com monautredomaine.com<span style="color: #000000; font-weight: bold;">/</span>toto<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>
Noter le / (slash) de fin important pour indiquer qu&#8217;il s&#8217;agit de boîtes au format Maildir.
</p>
<p>
On ajoute un alias pour par exemple rediriger le courrier de <em>toto@monautredomaine.com</em> vers l’adresse <em>tutu@mondomaine.net</em> dans <em>user_aliases</em> :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">toto<span style="color: #000000; font-weight: bold;">@</span>monautredomaine.com tutu<span style="color: #000000; font-weight: bold;">@</span>mondomaine.net</pre></div></div>

<p>
Et pour fignoler, on redirige le courrier de root – qui arrive sous <em>/var/mail/root</em> – vers une adresse virtuelle pour que la lecture des courriers important du système soit facilité. Ceci ce fait dans le fichier <em>/etc/aliases</em> :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">root: tutu<span style="color: #000000; font-weight: bold;">@</span>mondomaine.net</pre></div></div>

<p>
Postfix ne lit pas ce genre de fichier tel quel, il faut comme pour le fichier <em>generic</em> le compiler pour créer le fichier de base de données grâce à la commande <em>postmap</em>, comme ceci :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">postmap <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>user_mailboxes_path
postmap <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>user_aliases</pre></div></div>

<p>Les alias locaux eux se compilent avec la commande :</p>

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

<p>Une fois les changements effectués, on recharge Postfix :</p>

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

<p>On peut désormais faire un petit essai d’envoi d’email :</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># &quot;Email test&quot; | mail -s &quot;Test email root&quot; root</span></pre></div></div>

<p>
Le message doit arriver dans <em>/home/vmail/mondomaine.net/tutu/new/</em>, l’arborescence étant créée automatiquement par Postfix dès réception de l’email.<br />
A noter qu’il est préférable d’avoir un champ MX mondomaine.net dans vos zones DNS pour que le courrier soit bien acheminé.
</p>
<h4>Dovecot</h4>
<p>
Comme le dit <a title="lairdutemps.org" href="http://ll.lairdutemps.org/linux/howto/postfix?s=postfix">le site</a> sur lequel je me suis inspiré, recevoir du courrier c’est bien, pouvoir le lire c’est mieux. Pour cela, il faut installer Dovecot que l&#8217;on utilisera en serveur IMAP.
</p>

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

<p>
Le fichier de configuration se situant sous <em>/etc/dovecot/dovecot.conf</em>, on l’édite comme suit :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># On veut des BAL IMAP</span>
protocols = imap
&nbsp;
<span style="color: #666666; font-style: italic;"># Chemin des les logs</span>
log_path = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>dovecot.log
info_log_path = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>dovecot-info.log
&nbsp;
<span style="color: #666666; font-style: italic;"># Je ne veux pas de SSL</span>
ssl_disable = <span style="color: #c20cb9; font-weight: bold;">yes</span>
disable_plaintext_auth = no
&nbsp;
<span style="color: #666666; font-style: italic;"># Les BAL seront au format Maildir</span>
mail_location = maildir:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vmail<span style="color: #000000; font-weight: bold;">/%</span>d<span style="color: #000000; font-weight: bold;">/%</span>n
&nbsp;
<span style="color: #666666; font-style: italic;"># Optimisations</span>
<span style="color: #007800;">dotlock_use_excl</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #007800;">maildir_copy_with_hardlinks</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Configuration de l'authentification</span>
auth_verbose = <span style="color: #c20cb9; font-weight: bold;">yes</span>
auth default <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    mechanisms = plain
    passdb passwd-file <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #666666; font-style: italic;"># Chemin vers les utilisateurs dovecot (les adresses email gérées)</span>
        args = <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span>
    <span style="color: #7a0874; font-weight: bold;">&#125;</span>
    userdb static <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        <span style="color: #666666; font-style: italic;"># Chemin vers les BAL</span>
        args = <span style="color: #007800;">uid</span>=vmail <span style="color: #007800;">gid</span>=vmail <span style="color: #007800;">home</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>vmail<span style="color: #000000; font-weight: bold;">/%</span>d<span style="color: #000000; font-weight: bold;">/%</span>n<span style="color: #000000; font-weight: bold;">/</span>
    <span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>
Maintenant il faut créer les utilisateurs (adresses emails) et les mots de passes associés pour accèder aux BAL dans le fichier <em>/etc/dovecot/passwd</em> :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;tutu@mondomaine.net:<span style="color: #780078;">`dovecotpw -p lemotdepasse`</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span></pre></div></div>

<p>On démarre Dovecot :</p>

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

<p>
Et voilà, c’est fini! Il ne reste plus qu’à le tester. On peut commencer par essayer d’accéder à une BAL en <a title="Wikipedia" href="http://fr.wikipedia.org/wiki/Telnet">telnet</a> sur le port 143 :
</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ telnet monhostname.mondomaine.net <span style="color: #000000;">143</span>
Trying 127.0.0.1...
Connected to monhostname.mondomaine.net.
Escape character is <span style="color: #ff0000;">'^]'</span>.
<span style="color: #000000; font-weight: bold;">*</span> OK Dovecot ready.
<span style="color: #000000;">1</span> <span style="color: #c20cb9; font-weight: bold;">login</span> tutu<span style="color: #000000; font-weight: bold;">@</span>mondomaine.net motdepasse
&nbsp;
<span style="color: #000000;">1</span> OK Logged in.
<span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">select</span> inbox
<span style="color: #000000; font-weight: bold;">*</span> FLAGS <span style="color: #7a0874; font-weight: bold;">&#40;</span>\Answered \Flagged \Deleted \Seen \Draft<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">*</span> OK <span style="color: #7a0874; font-weight: bold;">&#91;</span>PERMANENTFLAGS <span style="color: #7a0874; font-weight: bold;">&#40;</span>\Answered \Flagged \Deleted \Seen \Draft \<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> Flags permitted.
&nbsp;
<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">1</span> EXISTS
<span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000;">0</span> RECENT
<span style="color: #000000; font-weight: bold;">*</span> OK <span style="color: #7a0874; font-weight: bold;">&#91;</span>UIDVALIDITY <span style="color: #000000;">1217314075</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> UIDs valid
&nbsp;
<span style="color: #000000; font-weight: bold;">*</span> OK <span style="color: #7a0874; font-weight: bold;">&#91;</span>UIDNEXT <span style="color: #000000;">15</span><span style="color: #7a0874; font-weight: bold;">&#93;</span> Predicted next UID
<span style="color: #000000;">2</span> OK <span style="color: #7a0874; font-weight: bold;">&#91;</span>READ-WRITE<span style="color: #7a0874; font-weight: bold;">&#93;</span> Select completed.
&nbsp;
<span style="color: #000000;">3</span> list <span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000000; font-weight: bold;">*</span>
<span style="color: #000000; font-weight: bold;">*</span> LIST <span style="color: #7a0874; font-weight: bold;">&#40;</span>\HasNoChildren<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #ff0000;">&quot;Drafts&quot;</span>
<span style="color: #000000; font-weight: bold;">*</span> LIST <span style="color: #7a0874; font-weight: bold;">&#40;</span>\HasNoChildren<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #ff0000;">&quot;Sent&quot;</span>
<span style="color: #000000; font-weight: bold;">*</span> LIST <span style="color: #7a0874; font-weight: bold;">&#40;</span>\HasNoChildren<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #ff0000;">&quot;Trash&quot;</span>
<span style="color: #000000; font-weight: bold;">*</span> LIST <span style="color: #7a0874; font-weight: bold;">&#40;</span>\HasNoChildren<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #ff0000;">&quot;.&quot;</span> <span style="color: #ff0000;">&quot;INBOX&quot;</span>
&nbsp;
<span style="color: #000000;">3</span> OK List completed.</pre></div></div>

<p>
Si cela fonctionne, vous pouvez essayer avec un vrai client (Thunderbird, Mail.app, Claws Mail, Outlook). Sinon, il faut aller voir d&#8217;où vient le problème dans les logs sous <em>/var/log</em> et mieux vaut lire et relire les documentations (voir ci-dessous).
</p>
<hr />
<h4>En complément :</h4>
<ul>
<li>Première partie : Serveur de messagerie simple avec Postfix et Dovecot</li>
<li>Deuxième partie : <a href="http://werk.feub.net/2011/08/postfix-sasl-avec-dovecot/" title="Postfix SASL avec Dovecot"><strong>Postfix SASL avec Dovecot</strong></a></li>
<li>Troisième partie : <a href="http://werk.feub.net/2011/08/ajouter-le-support-tls-a-postfix/" title="Ajouter le support TLS à Postfix"><strong>Ajouter le support TLS à Postfix</strong></a></li>
<li><a href="http://www.postfix.org/" title="Postfix" target="_blank">http://www.postfix.org/</a></li>
<li><a href="http://www.dovecot.org/" title="Dovecot" target="_blank">http://www.dovecot.org/</a></li>
<li><a title="lairdutemps.org" href="http://ll.lairdutemps.org/linux/howto/postfix?s=postfix">lairdutemps.org</a></li>
</ul>
<hr />
<p>
Les bases de cet article à l&#8217;origine pour <a href="http://archlinux.fr/">Arch Linux</a> datent du 29 juillet 2008, c&#8217;est une sorte de re-publication un peu mise-à-jour pour Fedora et un transfert de Joomla vers WordPress.</p>
]]></content:encoded>
			<wfw:commentRss>http://werk.feub.net/2011/05/serveur-de-messagerie-simple-avec-postfix-et-dovecot/feed/</wfw:commentRss>
		<slash:comments>0</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>Pseudo-challenge du dimanche</title>
		<link>http://werk.feub.net/2008/08/pseudo-challenge-du-dimanche/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=pseudo-challenge-du-dimanche</link>
		<comments>http://werk.feub.net/2008/08/pseudo-challenge-du-dimanche/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 21:30:42 +0000</pubDate>
		<dc:creator>Fabien</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[serveur]]></category>

		<guid isPermaLink="false">http://werk.feub.net/?p=27</guid>
		<description><![CDATA[Refonte d'edoras, mon serveur sous Fedora]]></description>
			<content:encoded><![CDATA[<p>
Mon serveur edoras est fonctionnel, c&#8217;était mon petit challenge de la journée. Pas de crash, pas de changement de disque quelconque, aucun &#8230;. <em>problème</em> à proprement parler, juste une petite tentation geek pastorale ;} Hier soir, je réfléchissais à mon partitionnement &#8211; he oui, c&#8217;est la fête le weekend chez moi &#8211; et j&#8217;avais décidé de réduire ma partition root pour diverses raisons. Après avoir bataillé entre <a href="http://pwet.fr/man/linux/administration_systeme/resize2fs" title="Man">resize2fs</a>, <a href="http://fr.wikipedia.org/wiki/Fdisk" title="Wikipedia">fdisk</a> et <a href="http://www.sysresccd.org/" title="SystemRescueCD">SystemRescueCD</a>, j&#8217;ai rencontré quelques problèmes, non bloquant, mais qui ne me plaisaient pas. Avec un peu de recherche, j&#8217;aurais certainement résolu cela, mais je n&#8217;avais pas envie de chercher et je me suis dit que ce serait l&#8217;occasion de faire une ré-installation normale (en repartitionnant comme je le voulais) et ainsi de tester <em>pour de vrai</em> la restauration à partir de mes sauvegardes (plusieurs bases MySQL, serveur DHCP, Bind, serveur IMAP, Cacti, etc &#8230;). Faire des sauvegardes c&#8217;est toujours bien beau, on arrive toujours à quelques chose de joli et bien rangé traînant sur des disques ou des bandes, mais quid de la restauration? C&#8217;est toujours le point d&#8217;interrogation.
</p>
<p>
Il est passé 23h et j&#8217;ai mon système restauré dans son état initial. Du serveur FTP à rTorrent en passant par <a href="http://www.dovecot.org/" title="Dovecot">Dovecot</a> et <a href="http://www.cacti.net/" title="Cacti">Cacti</a>, j&#8217;en passe et des meilleurs, tout est reparti.<br />
Reste plus qu&#8217;à améliorer mes scripts de sauvegarde en ajoutant une historisation &#8230; C&#8217;est le prochain petit projet.</p>
]]></content:encoded>
			<wfw:commentRss>http://werk.feub.net/2008/08/pseudo-challenge-du-dimanche/feed/</wfw:commentRss>
		<slash:comments>0</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 360/394 objects using memcached

Served from: werk.feub.net @ 2012-02-09 00:38:13 -->
