<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<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/"
	>

<channel>
	<title>dovecot &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://wordpress.com/tag/dovecot/</link>
	<description>Feed of posts on WordPress.com tagged "dovecot"</description>
	<pubDate>Tue, 07 Oct 2008 04:57:32 +0000</pubDate>

	<generator>http://wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Configuration de Postfix et Dovecot - partie 2]]></title>
<link>http://bperalta.wordpress.com/?p=77</link>
<pubDate>Sun, 21 Sep 2008 10:21:31 +0000</pubDate>
<dc:creator>Bertrand PERALTA</dc:creator>
<guid>http://bperalta.pt.wordpress.com/2008/09/21/configuration-de-postfix-et-dovecot-partie-2/</guid>
<description><![CDATA[Une fois que postfix est fonctionnel il faut penser à installer ce qu&#8217;il faut pour voir lire ]]></description>
<content:encoded><![CDATA[<p>Une fois que postfix est fonctionnel il faut penser à installer ce qu'il faut pour voir lire les mails qui sont reçus ;-)</p>
<p>Dovecot permet la gestion des boites au format Maildir, la récupération du courrier en pop3 et impa, SSL ou non et peut assurer le service d'authentification pour Postfix afin d'autoriser nos utilisateurs à envoyer des mails en utilisant notre serveur.</p>
<p><strong>Fichier dovecot.conf</strong></p>
<p>Voici donc les différetns paramètres modifiés par rapport à la configuration d'origine :</p>
<pre>disable_plaintext_auth = no</pre>
<p>Nécessaire pour l'uthentification de base. Toutes nos connexions avec Dovecot seront faites via SSL/TLS donc pas de soucis de lecture des mots de passe sur la ligne.</p>
<pre>ssl_disable = no</pre>
<p>SSL sera donc activé</p>
<pre>protocol imap {
ssl_cert_file = /var/keys/imap.mondomaine.fr_cert.pem
ssl_key_file = /var/keys/imap.mondomaine.fr_key.pem
ssl_key_password = &#60;Password de la clé&#62;
}
protocol pop3 {
ssl_cert_file = /var/keys/pop3.mondomaine.fr_cert.pem
ssl_key_file = /var/ssl/keys/pop3.mondomaine.fr_key.pem
ssl_key_password = &#60;Password de la clé&#62;
}</pre>
<p>SSL sera alors activé pour imap et pop3. La création des clés et certificats peuvent être faits en suivant les explications <a href="http://bertrand.peralta.fr/2008/09/10/creation-et-gestion-de-cles/" target="_self">ici</a>.</p>
<pre>mail_location = maildir:~/Maildir</pre>
<p>Même emplacement que défini dans Postfix (c'est mieux ;-)  )</p>
<pre>auth default {
  mechanisms = plain login
}</pre>
<p>Permet d'autauriser les authentification en PlainText</p>
<pre>passdb passwd-file {
  args = /etc/dovecot/dovecot.users
}
userdb passwd-file {
  args = /etc/dovecot/dovecot.users
}</pre>
<p>Indique l'emplacement du fichier listant les utilisateurs</p>
<pre>socket listen {
  client {
    path = /var/spool/postfix/private/auth
    mode = 0660
    user = postfix
    group = postfix
  }
}</pre>
<p>Indique à dovecot qui a le droit d'utiliser son authentification (cf paramètre smtpd_sasl_path de la conf postfix).</p>
<p><strong>Fichier dovecot.users</strong></p>
<p>Il reste maintenant à lister nos utilisateurs dans le fichier dovecot.users. Une ligne type à cette forme :</p>
<pre>&#60;userlogin&#62;:{&#60;encodagepwd&#62;}&#60;passwd&#62;:vmail:vmail::&#60;chemin de la boite&#62;::userdb_mail=maildir:~</pre>
<p>Par exemple,</p>
<pre>monlogin:{PLAIN}passwd:vmail:vmail::/home/vmail/monlogin::userdb_mail=maildir:~</pre>
<p>L'enregistrement dans ce fichier des mots de passe en mode PLAIN n'est pas recommandé d'un point de vue sécurité. Différents encodage peuvent être utilisé. Il suffit d'utiliser l'outil dovecotpw qui génère la chaine encodée à insérer dans le fichier de configuration.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Configuration de Postfix et Dovecot - partie 1]]></title>
<link>http://bperalta.wordpress.com/?p=62</link>
<pubDate>Sat, 20 Sep 2008 23:05:57 +0000</pubDate>
<dc:creator>Bertrand PERALTA</dc:creator>
<guid>http://bperalta.pt.wordpress.com/2008/09/21/configuration-de-postfix-et-dovecot-partie-1/</guid>
<description><![CDATA[Ce billet n&#8217;a pas pour vocation de remplacer la doc ou de couvrir les différents cas d&#8217;]]></description>
<content:encoded><![CDATA[<p>Ce billet n'a pas pour vocation de remplacer la doc ou de couvrir les différents cas d'utilisation qu'il est possible de rencontrer avec Postfix et Dovecot. Cela couvre une utilisation relativement simple permettant de mettre en place le minimum requis par un serveur smtp. L'installation est faite sur une OpenSuse 10.2 et n'utilise pas de base de données pour gérer les utilisateurs.</p>
<p>Voici dans un premier temps le paramétrage de Postfix. Le paramétrage de dovecot viendra dans un second temps...</p>
<p>Tout d'abord, spécifiquement pour la Suse, il faut demander à Yast de ne plus gérer lui-même Postfix.</p>
<p>Système / Editeur pour fichier /etc/sysconfig / Network / Mail / General / MAIL_CREATE_CONFIG = no</p>
<p>Voici ensuite les différents paramètres à renseigner dans le fichier /etc/postfix/main.cf</p>
<pre>myhostname = &#60;Nom du serveur&#62;</pre>
<p>par exemple : smtp.mondomaine.fr</p>
<pre>mydomain = &#60;domaine principal&#62;</pre>
<p>par exemple : mondomaine.fr</p>
<pre>mydestination = $myhostname, localhost.$mydomain, localhost, &#60;nomserveurinterne&#62;</pre>
<p>Dans mon cas, je veux pouvoir router certains mails via une adresse précise correspondant à un alias de smtp.mondomaine.fr. Par exemple, smtp.domaineinterne.com</p>
<pre>virtual_mailbox_domains = &#60;liste de domaines&#62;</pre>
<p>Par exemple, mondomaine.fr, seconddomaine.com, serveurmail.mondomaine.fr<br />
Dans mon cas, je renseigne cette liste en utilisant virtual_mailbox_domains et non pas virtual_alias_domains car j'utilise la possibilité de gérer des utilisateurs virtuels (qui ne sont pas des utilisateurs déclarés sur mon serveur linux).</p>
<pre>virtual_alias_maps = hash:/etc/postfix/virtual</pre>
<p>Le fichier virtual contient la liste de mes redirections vers d'autres emails ou vers des utilisateurs système</p>
<pre>virtual_mailbox_maps = hash:/etc/postfix/vmailbox</pre>
<p>Le fichier vmailbox contient la liste de mes redirections vers mes utilisateurs virtuels</p>
<pre>virtual_mailbox_base = /home/vmail</pre>
<p>Définit le répertoire contenant les boites des utilisateurs virtuels</p>
<pre>virtual_minimum_uid = 500
virtual_uid_maps = static:3000
virtual_gid_maps = static:3000</pre>
<p>Les boites mails virtuelles doivent appartenir à un compte et un groupe ayant l'id 3000 (par exemple vmail)</p>
<pre>smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_security_options = noanonymous</pre>
<p>Le smtp autorise l'accès sasl pour les utilisateurs non anonymes</p>
<pre>smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth</pre>
<p>Cet accès sasl est géré par dovecot</p>
<pre>smtpd_recipient_restrictions = permit_mynetworks, reject_non_fqdn_recipient, permit_sasl_authenticated, reject_unauth_destination</pre>
<p>On utilise les utilisateurs du réseau interne et les utilisateurs authentifiés</p>
<pre>mynetworks = 192.168.1.0/24</pre>
<p>Définition du réseau local interne</p>
<pre>home_mailbox = Maildir/</pre>
<p>Les boites sont gérés en format Maildir (un répertoire par boite et non pas un fichier). Le / est important...</p>
<p><strong>Exemple de fichier virtual</strong></p>
<pre>nom@mondomaine.fr      userlinux
autre@mondomaine.fr    autre@hotmail.f</pre>
<p><strong>Exemple de fichier vmailbox</strong></p>
<pre>user1@mondomaine.fr      user1/</pre>
<p>Cela signifie que les mails reçus par user1@mondomaine.fr seront stocké dans la boit user1 au format Maildir (grâce à la présence du / ) dans le répertoire user1 (qui sera lui-même situé sous /home/vmail).</p>
<p><strong>Important</strong> : Ces deux fichiers doivent être "recompilés" avec l'outil postmap après chaque modification afin de mettre à jour les .db respectifs.</p>
<p>Voilà, le postfix doit en principe être fonctionnel, et les règles d'anti-relaying en place si les domaines et noms de serveurs correctement renseignés. Il est important de bien tester cette partie sous peine de rapidement avoir un serveur qui croulera sous le trafic de spams :-/</p>
<p>Prochain épisode, le paramétrage de Dovecot permettant de relever le courrier mais également d'authentifier nos utilisateurs pour l'envoi des mails.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Complete GMail redundancy in 7 easy steps]]></title>
<link>http://padraigkitterick.wordpress.com/?p=45</link>
<pubDate>Sun, 24 Aug 2008 00:06:49 +0000</pubDate>
<dc:creator>Pádraig</dc:creator>
<guid>http://padraigkitterick.pt.wordpress.com/2008/08/24/backing-up-your-gmail-with-ubuntu/</guid>
<description><![CDATA[If there is anything that the recent GMail outages taught us, it&#8217;s that losing access to your ]]></description>
<content:encoded><![CDATA[<p>If there is anything that the recent <a title="Outage comment on official Gmail blog" href="http://gmailblog.blogspot.com/2008/08/we-feel-your-pain-and-were-sorry.html" target="_blank">GMail</a> <a title="El Reg weighs in on the outage" href="http://www.theregister.co.uk/2008/08/12/gmail_outage_outrage/" target="_blank">outages</a> taught us, it's that losing access to your email for a few hours should not mean that the <a title="Gmail Outage @ 43folders" href="http://www.43folders.com/2008/08/12/working-in-contexts" target="_blank">end of the world</a> has arrived. I think it also served as a reminder that if you rely 100% on <a title="Cloud computing @ wikipedia" href="http://en.wikipedia.org/wiki/Cloud_computing" target="_blank">the cloud</a> for access to your data, then be prepared to be disconnected from it every once in a while. Fortunately, it's quite easy to take advantage of free email services from the likes of Google while also making sure that should the worst happen, you can still access your data.</p>
<p><!--more--></p>
<p>With more and more communication, both professional and personal, being conducted through email, it's no wonder that people do get nervous when they suddenly lose control over several years worth of contacts and emails. This short article will show you how easy it is to back up your GMail automatically to a remote server which you can then access in the event that GMail goes down or you <a title="Denied access to a GMail account" href="http://www.chrisbrogan.com/when-google-owns-you/" target="_blank">lose access to your account</a>. We'll be using nothing but free open-source software. If you already have a net-connected machine with <a title="Ubuntu" href="http://www.ubuntu.com/" target="_blank">Ubuntu</a> installed then you're set to go. Otherwise, consider recycling an old pentium-or-better-cpu machine with a network card—the processing demands are relatively low and the most important resource is storage space for all the emails and attachments. Although these instructions are for Ubuntu, they should also work on Debian or any other Debian-based distro.</p>
<p>To set this up you obviously need a GMail account, although any email account which can be accessed using the <a title="POP @ wikipedia" href="http://en.wikipedia.org/wiki/Post_Office_Protocol" target="_blank">POP protocol</a> can be backed up using the same method. We'll be using the excellent <a title="Fetchmail" href="http://www.catb.org/~esr/fetchmail/" target="_blank">Fetchmail</a> to retrieve messages from the GMail account while leaving them untouched in your GMail inbox, <a title="Procmail" href="http://www.procmail.org/" target="_blank">Procmail</a> to deliver and filter them into a local <a title="Maildir @ wikipedia" href="http://en.wikipedia.org/wiki/Maildir" target="_blank">Maildir</a>-format mailbox, and <a title="Dovecot" href="http://www.dovecot.org/" target="_blank">Dovecot</a> to access the emails remotely, all on the latest release of <a title="Ubuntu" href="http://www.ubuntu.com/" target="_blank">Ubuntu</a>, <em>Hardy Heron (8.04 LTS)</em>.</p>
<p><strong>1. Setup GMail</strong></p>
<ul>
<li>Log in to your GMail account</li>
<li>Click 'Settings&#62;Imap/Pop' and enable POP access</li>
<li>You can chose whether to only download messages which arrive from now on or to download all existing messages. The latter is useful if you have already been using your GMail account for a while and would like to back all existing messages to a secure alternative location.</li>
</ul>
<p><strong>2. Install packages</strong></p>
<ul>
<li>Fire up a terminal window and run the following command:<code><br />
sudo apt-get install dovecot-imapd procmail fetchmail mutt</code></li>
<li>This should automatically download and install everything you need. The <em>mutt</em> package is optional and is a useful tool for checking if your IMAP server is working properly and that your emails are being downloaded (not to mention a nice command-line email client!).</li>
</ul>
<p><strong>3. Configure Fetchmail</strong></p>
<ul>
<li>We need to define our GMail accounts in fetchmail's configuration file. Open the file <strong>/etc/fetchmailrc</strong> for editing as root. The file won't exist yet so we'll have to create it.</li>
<li> Copy &#38; paste the following into the file:<code><br />
set daemon 60<br />
set syslog<br />
set postmaster "<strong>localuser</strong>"<br />
poll pop.gmail.com<br />
protocol pop3<br />
username "username@gmail.com" there with password "yourpassword" is <strong>localuser</strong> here<br />
keep ssl<br />
mda "/usr/bin/procmail -d <strong>localuser</strong>"</code></li>
<li>Change <span style="color:#000000;"><strong>localuser</strong></span> to your local username on the linux box and the email and password to match your gmail account. If you want, you can add as many other accounts as you want here. For each account, just copy the text starting from 'poll...' and change the login details.</li>
<li>The first line tells fetchmail to check for new emails every 60 seconds. Edit to match your preferred update frequency.</li>
<li>Edit <strong>/etc/default/fetchmail</strong> as root and change the line <code>START_DAEMON=no</code> to <code>START_DAEMON=yes</code></li>
</ul>
<p><strong>4. Configure Procmail (~/.procmailrc)</strong></p>
<ul>
<li>We're using procmail to deliver email from fetchmail to a mailbox in <a title="Maildir @ wikipedia" href="http://en.wikipedia.org/wiki/Maildir" target="_blank">Maildir</a> format. This is necessary due to the lack of Maildir support in Fetchmail, which supports the <a title="mbox format @ wikipedia" href="http://en.wikipedia.org/wiki/Mbox" target="_blank">mbox</a> format. The main difference between the formats is that Maildir stores each email in a single file, making it very efficient when you have a lot of emails. In contrast, mbox format stores all emails in a single file.</li>
<li>Create <strong>~/.procmailrc</strong> and put the following text in it:<code><br />
MAILDIR=$HOME/Mail/<br />
DEFAULT=$MAILDIR<br />
VERBOSE=on<br />
LOGFILE=$MAILDIR/procmail.log<br />
:0<br />
$MAILDIR</code></li>
<li>Set permissions on the file with: <code>chmod 640 ~/.procmailrc</code></li>
<li>This file simply tells procmail where to store the emails (in ~/Mail) and where to store it's logs. Procmail is capable of a lot more than this, and it supports a powerful filtering language. You can specify rules in your <strong>~/.procmailrc</strong> file to filter emails based on sender, subject, etc.</li>
</ul>
<p><strong>5. Configure Dovecot<br />
</strong></p>
<ul>
<li>We're almost there! We can retrieve emails from the GMail servers and deliver them locally. Now we need a way to access the email remotely. For this we're using Dovecot, and we need to tweak the configure a little.</li>
<li>As root, open up <strong>/etc/dovecot/dovecot.conf</strong> and update the following lines:<code><br />
protocols = imaps<br />
mail_location = maildir:~/Mail</code></li>
</ul>
<p><strong>6. Setup maildir</strong></p>
<ul>
<li>We need to create the local mailbox with:<code><br />
maildirmake.dovecot ~/Mail</code></li>
</ul>
<p><strong>7. Start services</strong></p>
<p>Okay, now everything is set up we need to start up the services:</p>
<p><code>sudo /etc/init.d/fetchmail start<br />
sudo /etc/init.d/dovecot start</code></p>
<p><strong>8. Enjoy!</strong></p>
<p>That's it! Run <code>tail -f /var/log/syslog</code> to check fetchmail is receiving messages and also check <strong>~/Mail/procmail.log</strong> to see that procmail is not throwing up any errors. The final thing you need to do is make sure you can access your email server remotely. Dovecot is running over SSL on port 993, so just configure your router to enable external access to that port. Then just configure Outlook , Thunderbird, etc. to access IMAP over SSL and you have full access to all your emails on your own server.</p>
<p><em>Note:</em> if you chose to setup GMail POP access to allow all existing messages to be downloaded and you have lots of messages in your account, it will take a few runs of fetchmail to collect them all. Leave things running overnight and check back in the morning!</p>
<p><strong>Optional step: Setup mutt</strong></p>
<ul>
<li>Create the file <strong>~/.muttrc</strong> and put the following in it:<code><br />
set mbox_type=Maildir<br />
set folder="~/Mail"<br />
set mask="!^\\.[^.]"<br />
set mbox="~/Mail"<br />
set record="+.Sent"<br />
set postponed="+.Drafts"<br />
set spoolfile="~/Mail"</code></li>
<li>Now just run <code>mutt</code> and read your email!</li>
</ul>
<p><strong>Related Links</strong></p>
<ul>
<li><a title="Set Up a Debian or Ubuntu Machine as a Maildrop" href="http://www.webmonkey.com/tutorial/Set_Up_a_Debian_or_Ubuntu_Machine_as_a_Maildrop" target="_blank">Set Up a Debian or Ubuntu Machine as a Maildrop </a></li>
<li><a title="Dovecot" href="http://www.dovecot.org/" target="_blank">Dovecot</a></li>
<li><a title="Fetchmail" href="http://www.catb.org/~esr/fetchmail/" target="_blank">Fetchmail</a></li>
<li><a title="Procmail" href="http://www.procmail.org/" target="_blank">Procmail</a></li>
</ul>
]]></content:encoded>
</item>
<item>
<title><![CDATA[FreeNAS as Digital Shoebox]]></title>
<link>http://syburgh.wordpress.com/?p=82</link>
<pubDate>Thu, 22 May 2008 02:02:19 +0000</pubDate>
<dc:creator>James</dc:creator>
<guid>http://syburgh.pt.wordpress.com/2008/05/22/freenas-as-digital-shoebox/</guid>
<description><![CDATA[FreeNAS is nearly what I want (for now). In addition to consolidating my files I want to run an IMAP]]></description>
<content:encoded><![CDATA[<p><a href="http://www.freenas.org">FreeNAS</a> is nearly what I want (for now). In addition to consolidating my files I want to run an IMAP server (<a href="http://www.dovecot.org/">dovecot</a>) for my decade of archived email on my wildly over-powered "storage appliance" (sporting GBs of underutilized RAM and storage).<!--more--> Combined with <a href="http://www.catb.org/~esr/fetchmail/">fetchmail</a> this would be great was to consolidate email for the long term (beyond <a href="http://www.gmail.com">Gmail</a>). The necessary software is already ported to FreeBSD, so maybe could be trivial. Maybe it could take months of overcoming unanticipated challenges. Maybe I'll do it myself.</p>
<p>If this thing was Linux based I could probably hack it together tonight. :(</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Mail with postfix and ldap]]></title>
<link>http://sahilahuja.wordpress.com/?p=27</link>
<pubDate>Sat, 03 May 2008 03:09:43 +0000</pubDate>
<dc:creator>Sahil Ahuja</dc:creator>
<guid>http://sahilahuja.pt.wordpress.com/2008/05/03/mail-with-postfix-and-ldap/</guid>
<description><![CDATA[Yes, it&#8217;s possible. I did it for the pragyan.org server.
The setup we used was :
/var/mail/vir]]></description>
<content:encoded><![CDATA[<p>Yes, it's possible. I did it for the <a href="http://pragyan.org">pragyan.org</a> server.</p>
<p>The setup we used was :</p>
<p>/var/mail/virtual/%u : the inboxes of different users,</p>
<p>/var/mail/virtual/PragyanMail/%u/%f : the different folders in mailboxes of different users.</p>
<p>It's much easily setup than one thinks initially.</p>
<p>HOW??  Here's how :</p>
<p style="padding-left:30px;"><em>But</em>, as with anything else, basics first<a href="http://en.wikipedia.org/wiki/SMTP"><acronym title="Simple Mail Transfer Protocol"></acronym></a></p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/SMTP"><acronym title="Simple Mail Transfer Protocol">SMTP</acronym></a> server : Simple Mail Transfer Protocol : The server which sends and receives mails. <strong>Postfix (or smtp)</strong>.</li>
</ul>
<ul>
<li><a href="http://en.wikipedia.org/wiki/IMAP"><acronym title="Internet Message Access Protocol">IMAP</acronym></a> server : Internet Message Access Protocol : The service which interacts with the <acronym title="Simple Mail Transfer Protocol">SMTP</acronym> server to access mail and send mail. <strong>Dovecot</strong></li>
<li>These come preinstalled in most linux distributions.</li>
</ul>
<p style="padding-left:30px;">Apart from these, other tricks that can be used by people to confuse simple minded, bread earning people like us are :</p>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Mail_transfer_agent">MTA</a> : Mail transfer agent : A <a title="Computer program" href="http://en.wikipedia.org/wiki/Computer_program">computer program</a> or <a title="Software agent" href="http://en.wikipedia.org/wiki/Software_agent">software agent</a> that transfers <a class="mw-redirect" title="Electronic mail" href="http://en.wikipedia.org/wiki/Electronic_mail">electronic mail</a> messages from one computer to another. (Eg: <a href="http://www.postfix.org/">Postfix</a>, <a href="http://www.sendmail.org/">Sendmail</a>)</li>
<li><a href="http://en.wikipedia.org/wiki/Mail_delivery_agent">MDA</a> : Mail delivery agent : A <strong>Mail Delivery Agent</strong> (<strong>MDA</strong>) is <a class="mw-redirect" title="Software" href="http://en.wikipedia.org/wiki/Software">software</a> that delivers <a title="E-mail" href="http://en.wikipedia.org/wiki/E-mail">e-mail</a> messages right after they've been accepted on a server, distributing them to recipients' individual <a title="Email Mailbox" href="http://en.wikipedia.org/wiki/Email_Mailbox">mailboxes</a>. (Eg: <a href="http://www.dovecot.org/">dovecot</a>)</li>
<li><a href="http://en.wikipedia.org/wiki/Mail_user_agent">MUA</a> : Mail user agent : An <strong>e-mail client</strong>, aka <strong>Mail User Agent</strong> (MUA), aka <strong>email reader</strong> is a frontend <a title="Computer program" href="http://en.wikipedia.org/wiki/Computer_program">computer program</a> used to manage <a class="mw-redirect" title="Email" href="http://en.wikipedia.org/wiki/Email">email</a>. (Eg: <a href="http://gmail.com">gmail</a>, <a href="http://gnome.org/projects/evolution/">evolution</a>, <a href="http://www.horde.org/">horde</a>, <a href="http://squirrelmail.org/">squirrelmail</a>, Outlook Express.)</li>
</ul>
<p>Now that thats out of the way, lets get our hands dirty.</p>
<p>But again, not so fast. As with anything in linux, when you set off to configure something, you end up knowing much more than you bargained for. ;)</p>
<h3><a id="aliases" name="aliases">Aliases</a></h3>
<p>Aliases are mappings between one source name and one or many destination name (in mail).<br />
Aliases can be found out from flat files in the form of mapping, from sql queries or from ldap (<strong>man ldap_table</strong>). The source itself can be in the destination.<br />
Link to alias files is given in /etc/postfix/main.cf at line</p>
<pre>alias_maps = hash:/etc/aliases, ldap:/etc/postfix/ldap-aliases.cf</pre>
<p>Type <strong>/usr/sbin/postmap -q core@pragyan.org ldap:/etc/postfix/ldap-aliases.cf</strong> to see its effects.</p>
<h3><a id="local_transport" name="local_transport">local_transport</a></h3>
<div class="level3">
<p>The <em>local_transport</em> parameter corresponds to the mail delivery agent used.</p>
<ol>
<li class="level1">
<div class="li">The default with postfix is <em>local</em>. The problem with local is that is requires local users and hence, a posixAccount schema to be an objectClass of every mail account. Rejected. Btw local also has to ability of mail forwarding to a user. i.e. if mailbox of <strong><em>user</em></strong> user1 is user1@gmail.com (user forwarding), then local will also forward to user1@gmail.com. By default, it assumes the uid of the user it is delivering mail to while delvering mail.</div>
</li>
<li class="level1">
<div class="li">Next is <em>virtual</em>. This is the one used. Virtual accepts users who are <em>system</em> users. But virtual (for security purposes) does not forward to hosts other than the localhost. So how do we forward to external hosts? virtual forwards in case the mails are aliases. So we simply put the gmail address as the entry of one of the aliases of the mail. If virtual MDA is used then whose uid does it use? (because the uid of the user himself doesn’t exist on the system). Another parameter value has to be used :</p>
<pre>  virtual_minimum_uid = 100 (security feature)
  virtual_uid_maps = static:700
  virtual_gid_maps = static:700</pre>
</div>
</li>
<li class="level1">
<div class="li">Other mail delivery agents : <em>procmail</em> doesn’t understand LDAP, and <em>maildrop</em> has too much overhead.</div>
</li>
</ol>
<h3><a id="group_expansion" name="group_expansion">Group expansion</a></h3>
<div class="level3">
<p>Excellent notes are available in /usr/share/doc/postfix-2.4.3/README_FILES/LDAP_README.</p>
<p>Any “map” parameter value, like alias_maps, can be either given a flat mapping file name, or a .cf file, with tells it what to do to get the mapping, in this format : <strong>protocol:filename</strong>. Eg.</p>
<pre>virtual_mailbox_maps = ldap:/etc/postfix/accountsmap.cf</pre>
</div>
</div>
<h3><a id="mail_boxes" name="mail_boxes">Mail boxes</a></h3>
<div class="level3">
<p><strong>mbox</strong> is a format for storing mails. It is the default format used in postfix and dovecot. This is a line from dovecot conf :</p>
<pre>mail_location = mbox:/var/spool/mail/virtual/PragyanMail/%u:INBOX=/var/spool/mail/virtual/%u</pre>
<p>The first part (mbox:<strong>/var/spool/mail/virtual/PragyanMail/</strong>%u:INBOX=/var/spool/mail/virtual/%u) refers to the user’s mail folder, which contains all his mail folders (Trash, drafts, sent mail.. ) (<em>the user’s mail folders are files in mbox format</em>)</p>
<p>The second part (mbox:/var/spool/mail/virtual/PragyanMail/%u:INBOX=<strong>/var/spool/mail/virtual/%u</strong>) refers to the one specific user folder (i.e. server file) which postfix writes to, that is his INBOX. (All other folders are written to and handled by the <acronym title="Internet Message Access Protocol">IMAP</acronym> client - dovecot.) Other variables which could have been used for specifying this are : %u - username, %n - user part in user@domain, same as %u if there’s no domain, %d - domain part in user@domain, %h - home directory etc.<br />
A virtual user can specify his mail folder to be anywhere. So, the following is a security config for postfix INBOX files :</p>
<pre>virtual_mailbox_base = /var/spool/mail/virtual</pre>
<p>Also</p>
<pre>chmod g+s /usr/bin/procmail</pre>
<p>for it to be able to create mail directories</p>
<h3><a id="maps_specified_in_postfix" name="maps_specified_in_postfix">Maps specified in postfix</a></h3>
<div class="level3">
<p>Maps are specified in /etc/postfix/main.cf. Important maps to be specified are :</p>
<ol>
<li class="level1">
<div class="li">User aliases <em><strong>virtual_alias_maps</strong></em>- mapping between group@domain.org and user1@pragyan.org, user2@pragyan.org, ...</div>
</li>
<li class="level1">
<div class="li">User mailboxes <em><strong>virtual_mailbox_maps</strong></em> - mapping between mailaddress (user1@pragyan.org) and mailbox location (/var/spool/mail/virtual/user1). A confirmation that the mail address corresponds to a real virtual user. For mail to be delivered, this entry needs to be there, which contains the mailbox address. This is but only a one to one mapping. (Ignores all following values)</div>
</li>
</ol>
<pre>local_recipient_maps = $virtual_mailbox_maps</pre>
<p>This line is required whenever the <strong>local_transport</strong> is changed to something else. (in this case to virtual)</p>
</div>
<div class="secedit">
<form action="https://delta.nitt.edu/doku/doku.php/delta/postfix" method="post">
<div class="no">
<h3><a id="schemas_the_real_working" name="schemas_the_real_working">Schemas (The Real Working):</a></h3>
<div class="level3">
<ul>
<li class="level1">
<div class="li">Ldap Entry <strong>evolutionPersonList</strong></p>
<pre>contact (multiple) : links to others ldap entries : uid=sahil,ou=P... , uid=cyber, ou=.. , ...
mail (multiple) : mails : sahilahuja@gmail.com, core@pragyan.org, ...
listName (single) : list name : coding</pre>
</div>
</li>
<li class="level1">
<div class="li">main.cf entry : virtual_alias_maps = ldap:/etc/postfix/ldap-aliases.cf . Contents of ldap-aliases.cf :</p>
<pre>server_host = 10.0.0.126
search_base = ou=Groups,ou=Pragyan,dc=delta,dc=nitt.edu
query_filter = (&#38;(objectClass=*)(listName=%u))
result_attribute = mail
special_result_attribute = contact
bind = yes
bind_dn = cn=dovecot,ou=Pragyan,dc=delta,dc=nitt.edu
bind_pw = ******</pre>
</div>
<ul>
<li class="level2">
<div class="li">The field matched is <strong>listName</strong>.</div>
</li>
<li class="level2">
<div class="li">The query runs recursively runs on field “contact”.</div>
</li>
<li class="level2">
<div class="li">All mails of form alias@pragyan.org again go through the same process</div>
</li>
</ul>
</li>
<li class="level1">
<div class="li">Ldap entry <strong>evolutionPerson</strong> . Important thing in it is the mapping between uid and mail. It’s a proof to postfix the user is a real virtual user.</div>
</li>
<li class="level1">
<div class="li">main.cf entry virtual_mailbox_maps = ldap:/etc/postfix/accountsmap.cf . Contents of accountsmap.cf :</p>
<pre>server_host = 10.0.0.126
search_base = ou=People,ou=Pragyan,dc=delta,dc=nitt.edu
query_filter = (&#38;(objectClass=*)(mail=%s))
result_attribute = uid
bind = yes
bind_dn = cn=dovecot,ou=Pragyan,dc=delta,dc=nitt.edu
[gallery]bind_pw = ******</pre>
</div>
</li>
<li class="level1">
<div class="li">The final main.cf entry that fits it all : virtual_mailbox_base = /var/spool/mail/virtual . A file with the name that is a result of the previous query (<strong>uid</strong>), gets created in this directory as the inbox of the user.</div>
</li>
</ul>
<p>Workflow is mailid → getaliases → Use alias result to get mail ids → deliver. That is, first alaises get processed, then accountsmap.</p>
</div>
</div>
<div class="no">Here are the files I used finally :</div>
<div class="no">
<ul>
<li class="level1">
<div class="li">Postfix : <span class="wikilink1">main.cf</span>, <span class="wikilink1">accountsmap.cf</span>, <span class="wikilink1">ldap-alias.conf</span></div>
</li>
<li class="level1">
<div class="li">Dovecot : <span class="wikilink1">dovecot.conf</span>, <span class="wikilink1">dovecot-ldap.conf</span></div>
</li>
<li class="level1">
<div class="li">Here is a compilation of the final content of these files : <a href="http://sahilahuja.wordpress.com/files/2008/05/mailconfiguration.pdf">mailconfiguration pdf</a>,<a href="http://sahilahuja.wordpress.com/files/2008/05/mailconfiguration.pdf"> </a><a href="http://sahilahuja.wordpress.com/files/2008/05/mailconfiguration.odt">mailconfiguration odt</a></div>
</li>
</ul>
</div>
<div class="no"><a href="http://wanderingbarque.com/howtos/mailserver/mailserver.html">Here</a> is the link of the guide I used as my own reference.</div>
</form>
</div>
</div>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Imapsync vs secure copy+mb2md SAS ]]></title>
<link>http://netcrash.wordpress.com/?p=84</link>
<pubDate>Wed, 30 Apr 2008 21:57:17 +0000</pubDate>
<dc:creator>Fernando André</dc:creator>
<guid>http://netcrash.pt.wordpress.com/2008/04/30/imapsync-vs-secure-copymb2md-sas/</guid>
<description><![CDATA[++++ Statistics ++++

Time                   : 50 sec Messages transfered : 995 Messages skipped : 0]]></description>
<content:encoded><![CDATA[<p>++++ Statistics ++++</p>
<div class="level3">
<p><strong>Time                   : 50 sec</strong> Messages transfered : 995 Messages skipped : 0 Total bytes transfered : 25959720 Total bytes skipped : 0 Total bytes error : 0 Detected 0 errors Please, rate imapsync at <a class="urlextern" title="http://freshmeat.net/projects/imapsync/" rel="nofollow" href="http://freshmeat.net/projects/imapsync/">http://freshmeat.net/projects/imapsync/</a></p>
<p>real    0m50.666s user    0m46.519s sys     0m3.476s</p>
<p><strong>28M     /home/ndref/</strong></p>
</div>
<div class="secedit">
<form action="/tvtelwiki/doku.php" method="post"> </form>
</div>
<h3><a id="teste_apos_ter_feito_um_pop" name="teste_apos_ter_feito_um_pop">Teste após ter feito um POP</a></h3>
<div class="level3">
<p>++++ Statistics ++++ Time : 3 sec Messages transfered : 0 Messages skipped : 943 Total bytes transfered : 0 Total bytes skipped : 25720752 Total bytes error : 0 Detected 0 errors Please, rate imapsync at <a class="urlextern" title="http://freshmeat.net/projects/imapsync/" rel="nofollow" href="http://freshmeat.net/projects/imapsync/">http://freshmeat.net/projects/imapsync/</a></p>
<p>real    0m3.377s user    0m3.140s sys     0m0.200s</p>
</div>
<div class="secedit">
<form action="/tvtelwiki/doku.php" method="post"> </form>
</div>
<h3><a id="eliminei_dados_de_uma_das_pastas" name="eliminei_dados_de_uma_das_pastas">Eliminei dados de uma das pastas</a></h3>
<div class="level3">
<p>antes :   du -s /home/ndref/ 28228   /home/ndref/</p>
<p>depois : du -s /home/ndref/ 28680   /home/ndref/</p>
<p>++++ Statistics ++++ Time : 44 sec Messages transfered : 39 Messages skipped : 943 Total bytes transfered : 346799 Total bytes skipped : 25720752 Total bytes error : 0 Detected 0 errors Please, rate imapsync at <a class="urlextern" title="http://freshmeat.net/projects/imapsync/" rel="nofollow" href="http://freshmeat.net/projects/imapsync/">http://freshmeat.net/projects/imapsync/</a></p>
<p>real    0m43.550s user    0m40.927s sys     0m2.536s</p>
</div>
<div class="secedit">
<form action="/tvtelwiki/doku.php" method="post"> </form>
</div>
<h2><a id="teste_usando_copy_com_scp_e_depois_o_mdb2maildir" name="teste_usando_copy_com_scp_e_depois_o_mdb2maildir">Teste usando copy com scp e depois o mdb2maildir</a></h2>
<div class="level2">
<p><strong>time scp root@</strong><strong>192.168.34.83</strong><strong>:/var/spool/mail/user2 .</strong> root@<strong>192.168.34.83</strong>’s password: joseol 100% 275MB 34.4MB/s 00:08</p>
<p><strong>real    0m10.490s</strong> user    0m3.840s sys     0m1.264s</p>
<p><strong>time ./mb2md user2 user2Maildir</strong> <strong>real    0m40.188s</strong> user    0m30.702s sys     0m7.488s</p>
<p><em>Resultou em vários erros durante a conversão de timestamps.</em></p>
<p><a class="urlextern" title="http://www.gerg.ca/hacks/mb2md/" rel="nofollow" href="http://www.gerg.ca/hacks/mb2md/">http://www.gerg.ca/hacks/mb2md/</a> works more or less ok in maildir, need to test the file contents.</p>
<p><a class="urlextern" title="http://batleth.sapienti-sat.org/projects/mb2md/" rel="nofollow" href="http://batleth.sapienti-sat.org/projects/mb2md/">http://batleth.sapienti-sat.org/projects/mb2md/</a></p>
<p><strong>time scp root@</strong><strong>192.168.34.83</strong><strong>:/var/spool/mail/teste61b .</strong> root@<strong>192.168.34.83</strong>’s password: tvtel47261b 100% 263MB 5.4MB/s 00:49</p>
<p><strong>real    0m56.528s</strong> user    0m3.644s sys     0m1.348s</p>
<p>time ./mb2md user1 teste61bMaildir <strong>real    0m20.478s</strong> user    0m17.633s sys     0m2.600s [18:06:06] mailer1:~/tmp#</p>
<p><strong>time scp root@192.168.34.83:/var/spool/mail/user1 .</strong> root@88.157.32.65’s password: tvtel105853b 100% 244MB 15.2MB/s 00:16</p>
<p><strong>real    0m22.852s</strong> user    0m3.520s sys     0m1.180s</p>
<p><strong>Após executar conversão com mb2maidir</strong> <strong>real    0m35.396s</strong> user    0m26.550s sys     0m6.644s</p>
</div>
<div class="secedit">
<form action="/tvtelwiki/doku.php" method="post"> </form>
</div>
<h2><a id="teste_hdparm" name="teste_hdparm">Teste hdparm</a></h2>
<div class="level2">
<p>/dev/sda:  Timing cached reads:   9662 <acronym title="Megabyte">MB</acronym> in  2.00 seconds = 4837.35 <acronym title="Megabyte">MB</acronym>/sec mailStorage1:/etc#</p>
</div>
<div class="level2"><strong>Hardware</strong></div>
<div class="level2">2 discos sas em raid 1 ;</div>
<div class="level2">4GB Ram</div>
<div class="level2">QuadCore Intel(R) Xeon(R) CPU           E5405  @ 2.00GHz</div>
<div class="level2"></div>
<div class="level2"><em>Resultado:</em></div>
<div class="level2">No final o mb2md com nfs mounted volume funcionou bem mas mesmo usando este modo demorou uma eternidade para migrar tudo.</div>
<div class="level2">ImapSync demora muito quando se pretendem fazer várias caixas de correio simultaneamente, sincronismo semanalmente para migração lenta é engraçado mas o sync com mais de 1000 caixas de correio com ~250 MB demora muito.</div>
<div class="level2"></div>
<div class="level2">O dovecot continua a surpreender-me com os vários mecanismos de controlo de conteúdo da INBOX .</div>
<div class="level2"></div>
<div class="level2">O que falhou na migração ?! Nada correu tudo bem, foi demorado mas correu bem. Após a cópia fez-se um redimensionamento das quotas para abranger a junção da antiga home+mailbox para a nova Home.</div>
<div class="level2">Em alguns casos resultou num tamanho exagerado, as home's só tinham mailbox do webmail foram migradas também com o script abaixo que foi melhorado pelo Russel Nelson.</div>
<div class="level2"></div>
<div class="level2">Script usado : <a href="http://qmail.europnews.de/convert-and-create">http://qmail.europnews.de/convert-and-create </a></div>
<div class="level2">este revelou vantagens no acesso às mailbox's do uw-imap , conversão dos dados do webmail.</div>
<div class="level2"></div>
<div class="level2">HdParm a um disco sas:</div>
<div class="level2">hdparm -T /dev/sda</p>
<p>/dev/sda:<br />
Timing cached reads:   8466 MB in  2.00 seconds = 4237.86 MB/sec</p>
</div>
<div class="level2"></div>
]]></content:encoded>
</item>
<item>
<title><![CDATA[dovecot]]></title>
<link>http://netcrash.wordpress.com/2008/04/01/dovecot/</link>
<pubDate>Tue, 01 Apr 2008 14:19:35 +0000</pubDate>
<dc:creator>Fernando André</dc:creator>
<guid>http://netcrash.pt.wordpress.com/2008/04/01/dovecot/</guid>
<description><![CDATA[Com tantos problemas porque é que não implementam uma solução directa no servidor ?!
]]></description>
<content:encoded><![CDATA[<p>Com tantos <a href="http://wiki.dovecot.org/Clients#head-129bcbfc238b5c34362b8216db87c05e7a34af85" title="problemas com clientes de email">problemas</a> porque é que não implementam uma solução directa no servidor ?!</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA["Attempted master login with no master passdbs"]]></title>
<link>http://binblog.wordpress.com/?p=44</link>
<pubDate>Sun, 10 Feb 2008 06:31:16 +0000</pubDate>
<dc:creator>martin</dc:creator>
<guid>http://binblog.pt.wordpress.com/2008/02/10/attempted-master-login-with-no-master-passdbs/</guid>
<description><![CDATA[If you get this under some conditions while using dovecot for SASL authentication from the Postfix M]]></description>
<content:encoded><![CDATA[<p>If you get this under some conditions while using <a href="http://www.dovecot.org">dovecot</a> for SASL authentication from the Postfix MTA, you're using an outdated pre-release version of dovecot, like e.g. 1.0.rc15. This specific version is still included not only in CentOS and RHEL 5 but also in Debian 4.0 (etch). The error is caused by a bug that was already <a href="http://www.mailinglistarchive.com/dovecot@dovecot.org/msg09688.html">fixed</a> in later pre-release versions.</p>
<p>I replaced the stock rpm from CentOS 5 with the current released <a href="http://www.atrpms.net/dist/el5/dovecot/">dovecot 1.0.10 rpm from atrpms.net</a>, which instantly fixed the problem. </p>
<p>Packages of dovecot 1.0.10 for Debian are <a href="http://packages.debian.org/search?lang=en&#38;suite=etch-backports&#38;searchon=names&#38;keywords=dovecot">available from backports.org</a>.</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[tpop3d-Migrationspfad]]></title>
<link>http://binblog.wordpress.com/?p=42</link>
<pubDate>Sat, 09 Feb 2008 19:22:20 +0000</pubDate>
<dc:creator>martin</dc:creator>
<guid>http://binblog.pt.wordpress.com/2008/02/09/tpop3d-migrationspfad/</guid>
<description><![CDATA[So leid es tut, daß der Autor von tpop3d sich vor einem Jahr das Leben genommen hat, so dringlich w]]></description>
<content:encoded><![CDATA[<p>So leid es tut, daß der Autor von <a href="http://www.ex-parrot.com/~chris/tpop3d/">tpop3d</a> sich vor einem Jahr <a href="http://www.ex-parrot.com/~chris/wwwitter/20070305-chris_lightfoot_1978-2007.html">das Leben genommen</a> hat, so dringlich war es dann doch, eine Software, die nicht mehr gewartet wird und für die auch kein Fork ansteht, weil ihre Zeit nebenbei auch ein wenig vorbei ist, durch eine andere Lösung zu ersetzen.</p>
<p>Gut, daß ich mich in diesen Tagen aus anderen Gründen mit <a href="http://www.dovecot.org/">dovecot</a> auseinandersetzen durfte. Da dovecot nicht nur die in meinen Perl-Authenticator für tpop3d verwendeten Prozentzeichen im Nutzernamen (<em>first.last%example.com</em>) in Klammeraffen übersetzen kann, sondern sogar eine Konfigurationsoption hat, um auf dem selben Maildir auch die selben UIDs wie tpop3d anzuzeigen...</p>
<blockquote><pre>auth_username_translation = %@
pop3_uidl_format = %Mf</pre>
</blockquote>
<p>...bestand die ganze Migration darin, das Script, das die <em>passwd</em>-Datei für tpop3d generierte, so anzupassen, daß Klammeraffen statt Prozentzeichen verwendet werden. Danach habe ich todesmutig direkt den POP3-Server für meine 100 User umgeswitcht. Die ersten Anwender, die erkennbar <em>leave-mail-on-server</em> aktiv haben, haben schon gepollt und <em>nicht</em> die alten Mails mitbekommen. Der UIDL-Hack hat also funktioniert.</p>
<p>Ciao, tpop3d mit Deinem voll mit Perl verscriptbaren Authentifizierungs-API. Ich habe Dir immerhin sechs Jahre lang die Treue gehalten. Und danke Chris (hoffentlich an einem Ort, der dir besser gefällt) dafür, daß Du mir immer geholfen hast, das Ding auch nochmal unter Solaris zu übersetzen. :-)</p>
<p>Wahrscheinlich bin ich der einzige Mensch weit und breit, der jetzt dovecot als reinen POP3-Server einsetzt. Geradezu reaktionär, wo doch IMAP der allerletzte Schrei ist. </p>
<p>So, und jetzt nichts wie weg vom Rechner und das Handy ausschalten. ;-)</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Mail Server with Virtual Users using Postfix + Postfix Admin + Dovecot + MySQL + CentOS 4.5 with RoundcubeMail]]></title>
<link>http://jangestre.wordpress.com/2007/11/27/mail-server-with-virtual-users-using-postfix-postfix-admin-dovecot-mysql-centos-45-with-roundcubemail/</link>
<pubDate>Tue, 27 Nov 2007 01:43:21 +0000</pubDate>
<dc:creator>jangestre</dc:creator>
<guid>http://jangestre.pt.wordpress.com/2007/11/27/mail-server-with-virtual-users-using-postfix-postfix-admin-dovecot-mysql-centos-45-with-roundcubemail/</guid>
<description><![CDATA[This installation was done using CentOS 4.5 since the it is mandatory on my part to use a RHEL clone]]></description>
<content:encoded><![CDATA[<p>This installation was done using CentOS 4.5 since the it is mandatory on my part to use a RHEL clone. You maybe wondering why not CentOS 5, the reason behind is that the source rpm for postfix that I got is not built for RHEL5 and I'll rather use FreeBSD or Debian if given the choice. :)</p>
<p>I've installed the default apache, mysql, postfix, dovecot and php-mysql from the installation CD's, then upgrade the packages using yum with --enablerepo=CentOSPlus.</p>
<p>Since the default MTA for CentOS is Sendmail, use system-switch-mail-nox from the command line to change the MTA from Sendmail to Postfix.</p>
<pre># system-switch-mail-nox</pre>
<p>Then make sure the services are started during bootup using chkconfig command:</p>
<pre># chkconfig mysqld on
# chkconfig httpd on
# chkconfig dovecot on
# chkconfig postfix on</pre>
<p>It is now time to upgrade the packages installed. This command will upgrade php from version to version 5 including the dependencies that includes mysql5</p>
<pre># yum --enablerepo=centosplus install php5</pre>
<p>Then upgrade apache: To update apache first use the base repo then upgrade using the centosplus repo. If you won't<br />
follow this sequence you'll end up with a broken httpd installation.</p>
<pre># yum update http* # yum upgrade --enablerepo=centosplus http*</pre>
<p>The default postfix rpm does not include mysql support, so to overcome this we must rebuild postfix using the source rpm.<br />
NOTE: The source rpm is specifically built for RHEL4 so that's why I used CentOS4.x series.</p>
<p>Download the postfix-2.4.x.src.rpm</p>
<pre># wget http://postfix.wl0.org/ftp/official/2.4/SRPMS/postfix-2.4.6-1.src.rpm</pre>
<p>Install postfix-2.4.x.src.rpm</p>
<pre># rpm -Uvh postfix-2.4.x.src.rpm</pre>
<p>Then edit postfix.spec, modify the version and add MySQL support (%define with_mysql_redhat 1) and build it.<br />
Note: Use mysql_redhat instead of mysql!</p>
<pre># vi /usr/src/redhat/SPECS/postfix.spec</pre>
<p>-----</p>
<pre>%define with_cdb          0
%define with_ldap         1
%define with_mysql        0
%define with_mysql_redhat 1
%define with_pcre         1
%define with_pgsql        0
%define with_sasl         1
%define with_spf          0
%define with_dovecot      1
%define with_tls          1
%define with_tlsfix       2
%define with_vda          0  

----- # rpmbuild -bb /usr/src/redhat/SPECS/postfix.spec</pre>
<p>Download dovecot 1.0.7 src.rpm, the version that comes with Centos4.5 doesn't have MySQL support</p>
<pre># wget http://dl.atrpms.net/all/dovecot-1.0.7-0_63.src.rpm</pre>
<p>Rebuild Dovecot:</p>
<p>First you need to create the /etc/rpm/macros.atrpms file to overcome the kernel limitation and insert the following in the file:</p>
<pre># vi /etc/rpm/macros.atrpms  %bcond_with()           %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%bcond_without()        %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
%with()                 %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
%without()              %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}</pre>
<p>Save and quit vi.</p>
<p>Edit /usr/src/redhat/SPECS/dovecot.spec and add support for MySQL.</p>
<p>For my build I need to install gettext-devel, go ahead and install using yum.</p>
<pre># yum install gettext-devel pcre-devel</pre>
<p>Then rebuild the rpm.</p>
<pre># rpmbuild --without inotify -bb /usr/src/redhat/SPECS/dovecot.spec</pre>
<p><strong>Create the virtualmail user and virtual users mail directory:</strong><br />
Note: It need not be in /home, it can also exist in /var</p>
<pre># useradd -r -u 150 -g mail -d /home/virtualmail -s /sbin/nologin -c "Virtual Mailbox" virtualmail</pre>
<p>The above command means that user virtualmail is a member of the "mail" group with default home at /home/virtualmail.</p>
<p>Then create the directory and change ownership:</p>
<pre># mkdir -p /home/virtualmail
# chmod 770 /home/virtualmail
# chown virtualmail:mail /home/virtualmail/</pre>
<p><strong>Self-signed server certificate:</strong></p>
<p>This will be used by postfix and dovecot.<br />
First create the directories, create the private key, and lastly create the certificate.</p>
<pre># mkdir -p /etc/postfix/ssl
# cd /etc/postfix/ssl
# openssl genrsa 1024 &#62; mail-key.pem
# chmod 400 mail-key.pem
# openssl req -new -x509 -nodes -sha1 -days 3650 -key mail-key.pem &#62; mail-cert.pem</pre>
<p><strong>Postfix Configuration Files:</strong></p>
<p>Manually create the following files under the /etc/postfix directory which will be used for the virtual settings:</p>
<p>/etc/postfix/mysql_virtual_alias_maps.cf :</p>
<pre>user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = alias
select_field = goto
where_field = address</pre>
<p>/etc/postfix/mysql_virtual_domains_maps.cf</p>
<pre>user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = domain
select_field = domain
where_field = domain
# The ff: is optional
additional_conditions = and backupmx = '0' and active = '1'</pre>
<p>/etc/postfix/mysql_virtual_mailbox_maps.cf</p>
<pre>user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = mailbox
select_field = maildir
where_field = username</pre>
<p>/etc/postfix/mysql_virtual_mailbox_limits_maps.cf</p>
<pre>user = postfix
password = postfix
hosts = localhost
dbname = postfix
table = mailbox
select_field = quota
where_field = username</pre>
<p>/etc/postfix/mysql_relay_domains_maps.cf:</p>
<pre>user            = postfix
password        = postfix
hosts           = localhost
dbname          = postfix
query           = SELECT domain FROM domain WHERE domain='%s' and backupmx = '1'</pre>
<p>Edit /etc/postfix/main.cf, my config looks like the following:</p>
<pre>myhostname = mail.myserver.ph
mydomain = myserver.ph
myorigin = $mydomain
inet_interfaces = all
mydestination = localhost
mynetworks = 192.168.234.0/24, 127.0.0.0/8
relay_domains = $mydestination
smtpd_recipient_restrictions =  permit_sasl_authenticated
				permit_mynetworks
				reject_unauth_destination
                                permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_exceptions_networks = $mynetworks
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = /var/run/dovecot/auth-client
smtpd_tls_cert_file = /etc/postfix/ssl/mail-cert.pem
smtpd_tls_key_file = /etc/postfix/ssl/mail-key.pem
smtpd_tls_session_cache_database = btree:/var/spool/postfix/smtpd_tls_session_cache
smtpd_tls_security_level = may
smtpd_tls_received_header = yes
smtpd_tls_loglevel = 1
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
# -------Virtual mailbox settings-----------
virtual_mailbox_domains = proxy:mysql:$config_directory/mysql_virtual_domains_maps.cf
virtual_mailbox_base = /home/virtualmail
virtual_mailbox_maps = proxy:mysql:$config_directory/mysql_virtual_mailbox_maps.cf
virtual_alias_maps = proxy:mysql:$config_directory/mysql_virtual_alias_maps.cf
virtual_minimum_uid = 150
virtual_uid_maps = static:150
virtual_gid_maps = static:12
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
# Additional for quota support
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = proxy:mysql:$config_directory/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please try again later
virtual_overquota_bounce = yes</pre>
<p>Edit master.cf and let dovecot handle local delivery:</p>
<pre># Dovecot LDA
 dovecot   unix  -       n       n       -       -       pipe
 flags=DRhu user=virtualmail:mail argv=/usr/libexec/dovecot/deliver -d ${recipient}</pre>
<p><strong>Dovecot Configuration:</strong></p>
<p>Create the dovecot user that will be used to access the postfix database:</p>
<pre>mysql&#62; grant SELECT ON postfix.*  to 'dovecot'@'localhost' IDENTIFIED by 'dovecot';</pre>
<p>Edit dovecot.conf, here is my configurations:</p>
<pre>## Dovecot configuration file
 base_dir = /var/run/dovecot/
 protocols = imap imaps pop3 pop3s
 listen = [::]
 log_timestamp = "%Y-%m-%d %H:%M:%S "
 syslog_facility = mail
 ssl_disable = no
 ssl_cert_file = /etc/postfix/ssl/mail-cert.pem
 ssl_key_file = /etc/postfix/ssl/mail-key.pem
 ssl_parameters_regenerate = 168
 verbose_ssl = no
 mail_location = maildir:/home/virtualmail/%d/%u
 mail_extra_groups = mail
 mail_debug = no
 first_valid_uid = 150
 last_valid_uid = 150
 maildir_copy_with_hardlinks = yes
 protocol imap {
 login_executable = /usr/libexec/dovecot/imap-login
 mail_executable = /usr/libexec/dovecot/imap.
 imap_max_line_length = 65536
 imap_client_workarounds = outlook-idle
 }
 protocol pop3 {
 # Login executable location.
 login_executable = /usr/libexec/dovecot/pop3-login
 mail_executable = /usr/libexec/dovecot/pop3
 pop3_uidl_format = %08Xu%08Xv
 pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
 }
 protocol lda {
 # Address to use when sending rejection mails.
 postmaster_address = postmaster@myserver.ph
 # Binary to use for sending mails.
 sendmail_path = /usr/lib/sendmail # UNIX socket path to master authentication server to find users.  auth_socket_path = /var/run/dovecot/auth-master
}
auth_verbose = no
auth_debug = no
auth_debug_passwords = no
auth default {
passdb sql {
# Path for SQL configuration file, see doc/dovecot-sql-example.conf
args = /etc/dovecot-sql.conf
}
# SQL database &#60;doc/wiki/AuthDatabase.SQL.txt&#62;
userdb sql {
# Path for SQL configuration file, see doc/dovecot-sql-example.conf
args = /etc/dovecot-sql.conf }
user = nobody
socket listen {
	master {
	path = /var/run/dovecot/auth-master
	mode = 0660
	user = virtualmail
	group = mail
	}
	client {
	path = /var/run/dovecot/auth-client
	mode = 0660
	user = postfix
	group = mail
	}
  }
}
dict {
}
plugin {
}</pre>
<p>----<br />
Edit /etc/dovecot-sql.conf:</p>
<pre>driver = mysql
 connect = host=localhost dbname=postfix user=dovecot password=dovecot
 default_pass_scheme = MD5
 # Get the mailbox
 user_query = SELECT '/home/virtualmail/%d/%n' as home, 'maildir:/home/virtualmail/%d/%n' as mail, 150 AS uid, 12 AS gid, concat('dirsize:storage=', quota) AS quota FROM mailbox WHERE username = '%u' AND active = '1'
 # Get the password
 password_query = SELECT username as user, password, '/home/virtualmail/%d/%n' as userdb_home, 'maildir:/home/virtualmail/%d/%n' as userdb_mail, 150 as userdb_uid, 12 as userdb_gid FROM mailbox WHERE username = '%u' AND active = '1'</pre>
<p><strong>Postfix Admin configuration:</strong></p>
<p>Download latest postfixadmin v2.2 from svn</p>
<pre># svn co https://postfixadmin.svn.sourceforge.net/svnroot/postfixadmin/trunk postfixadmin</pre>
<p>put postfixadmin in web root</p>
<pre># mkdir -p /var/www/html/postfixadmin</pre>
<p>Copy entire postfixadmin to --&#62; "/var/www/html/postfixadmin"</p>
<p>Edit DATABASE_MYSQL.TXT and provide password for user postfix and postfixadmin.<br />
If not, you will get a database access denied error!</p>
<pre># vi /var/www/html/postfixadmin/DATABASE_MYSQL.TXT FLUSH PRIVILEGES;
 GRANT USAGE ON postfix.* TO postfix@localhost IDENTIFIED BY 'postfix';
 GRANT SELECT, INSERT, DELETE, UPDATE ON postfix.* TO postfix@localhost;
 GRANT USAGE ON postfix.* TO postfixadmin@localhost IDENTIFIED BY 'postfixadmin';
 GRANT SELECT, INSERT, DELETE, UPDATE ON postfix.* TO postfixadmin@localhost;
 USE postfix;</pre>
<p>Save the changes made and exit vi.<br />
Load the postfixadmin database.</p>
<pre># mysql -u root -ppassword &#60; /var/www/html/postfixadmin/DATABASE_MYSQL.TXT</pre>
<p>Edit config.inc.php and set your default domain, to globally change the given default domain name, use the replace command:</p>
<pre># replace change-this-to-your.domain.tld yourdomain.com -- config.inc.php</pre>
<p>Set some variable in config.inc.php:</p>
<pre>//$CONF['configured'] = false; &#60;-- remember to comment out this line, enabled by default! // Postfix Admin Path
 // Set the location of your Postfix Admin installation here.
 // You must enter complete url (http://domain.tld/) and full path (/var/www/postfixadmin)
 $CONF['postfix_admin_url'] = 'http://192.168.159.131/postfixadmin/';
 $CONF['postfix_admin_path'] = '/var/www/html/postfixadmin';
 $CONF['database_type'] = 'mysqli';
 $CONF['database_host'] = 'localhost';
 $CONF['database_user'] = 'postfixadmin';
 $CONF['database_password'] = 'postfixadmin';
 $CONF['database_name'] = 'postfix';
 $CONF['database_prefix'] = '';</pre>
<p>Go to browser and type url http://ip.add.ress/postfixadmin and run setup from the menu and check for errors!</p>
<p>To be continued!</p>
]]></content:encoded>
</item>
<item>
<title><![CDATA[Dovecot in park of the city of Elche, Spain]]></title>
<link>http://ballesta.wordpress.com/2007/04/29/dovecot-in-park-of-the-city-of-elche-spain/</link>
<pubDate>Sun, 29 Apr 2007 06:43:26 +0000</pubDate>
<dc:creator>ballesta</dc:creator>
<guid>http://ballesta.pt.wordpress.com/2007/04/29/dovecot-in-park-of-the-city-of-elche-spain/</guid>
<description><![CDATA[
© Antonio Ballesteros, 2005.
www.ballesta.ru
]]></description>
<content:encoded><![CDATA[<p><a href="http://www.ballesta.ru/travel/2005/elche/elche_01.htm" target="_blank"><img src="http://www.ballesta.ru/travel/2005/elche/elche_01a.jpg" alt="Dovecot in park of the city of Elche, Spain" align="bottom" border="1" height="250" width="166" /></a><br />
© Antonio Ballesteros, 2005.<br />
<a href="http://www.ballesta.ru/" title="ballesta.ru" target="_blank">www.ballesta.ru</a></p>
]]></content:encoded>
</item>

</channel>
</rss>
