<?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>johker&#039;s blog &#187; postfixadmin</title>
	<atom:link href="http://johker.ibutho.de/tag/postfixadmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://johker.ibutho.de</link>
	<description>stories about me, my life and my trips</description>
	<lastBuildDate>Sun, 18 Dec 2011 11:53:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>fetchmail Integration in postfixadmin</title>
		<link>http://johker.ibutho.de/2009/04/07/fetchmail-integration-in-postfixadmin/</link>
		<comments>http://johker.ibutho.de/2009/04/07/fetchmail-integration-in-postfixadmin/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 21:26:34 +0000</pubDate>
		<dc:creator>johker</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Tipps und Tricks]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[cronjob]]></category>
		<category><![CDATA[crontab]]></category>
		<category><![CDATA[fetchmail]]></category>
		<category><![CDATA[installation]]></category>
		<category><![CDATA[konfiguration]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[postfixadmin]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://johker.ibutho.de/?p=227</guid>
		<description><![CDATA[Viele Benutzer haben auch Mailboxen bei anderen Anbietern, z.B. bei gmx oder web.de. Damit diese Benutzer ihre E-Mails aggregieren können, wird fetchmail eingerichtet. fetchmail ist bereits in postfixadmin integriert, somit können fetchmail-Einträge über postfixadmin verwaltet werden (derzeit leider nur von &#8230; <a href="http://johker.ibutho.de/2009/04/07/fetchmail-integration-in-postfixadmin/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Viele Benutzer haben auch Mailboxen bei anderen Anbietern, z.B. bei gmx oder web.de. Damit diese Benutzer ihre E-Mails aggregieren können, wird <em>fetchmail</em> eingerichtet. <em>fetchmail</em> ist bereits in <em>postfixadmin</em> integriert, somit können <em>fetchmail</em>-Einträge über <em>postfixadmin</em> verwaltet werden (derzeit leider nur von Administratoren). Über das mitgelieferte <em>fetchmail.pl</em>-Skript werden die Daten aus der Datenbank ausgelesen, <em>fetchmail</em> aufgerufen, die Mails durch <em>amavisd-new</em> überprüft und an die Mailboxen der Benutzer ausgeliefert. Das <em>perl</em>-Skript wurde etwas angepasst, damit es mit <em>postgres</em> interagieren kann. Des Weiteren wurden die Dateinamen etwas angepasst.</p>
<p>Installation:</p>

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

<p>Nötige Verzeichnisse für das Skript anlegen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>fetchmail
<span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>fetchmail<span style="color: #000000; font-weight: bold;">/</span>fetchmail-all.lock</pre></div></div>

<p>Das Skript:</p>
<p><em>fetchmail.pl</em></p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/usr/bin/perl</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">use</span> DBI<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> MIME<span style="color: #339933;">::</span><span style="color: #006600;">Base64</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;"># use Data::Dumper;</span>
<span style="color: #000000; font-weight: bold;">use</span> File<span style="color: #339933;">::</span><span style="color: #006600;">Temp</span> <span style="color: #009966; font-style: italic;">qw/ mkstemp /</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">use</span> Sys<span style="color: #339933;">::</span><span style="color: #006600;">Syslog</span><span style="color: #339933;">;</span>
<span style="color: #666666; font-style: italic;"># require liblockfile-simple-perl</span>
<span style="color: #000000; font-weight: bold;">use</span> LockFile<span style="color: #339933;">::</span><span style="color: #006600;">Simple</span> <span style="color: #000066;">qw</span><span style="color: #009900;">&#40;</span>lock trylock unlock<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
openlog<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;fetchmail-all&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;pid&quot;</span><span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;mail&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">sub</span> log_and_die <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">my</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$message</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">@_</span><span style="color: #339933;">;</span>
  syslog<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;err&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000066;">die</span> <span style="color: #0000ff;">$message</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># read options and arguments</span>
&nbsp;
<span style="color: #0000ff;">$configfile</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;/etc/fetchmail/config&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #0000ff;">@ARGS1</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #000000; font-weight: bold;">ARGV</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$_</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span> <span style="color: #0000ff;">@ARGS1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/^-/</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/^--config$/</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #0000ff;">$configfile</span> <span style="color: #339933;">=</span> <span style="color: #000066;">shift</span> <span style="color: #0000ff;">@ARGS1</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># postgres settings</span>
<span style="color: #0000ff;">$database</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;postfix&quot;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$hostname</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;127.0.0.1&quot;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$user</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;postfix&quot;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$password</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;XXXXXX&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #0000ff;">$run_dir</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;/var/run/fetchmail&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># use specified config file</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span>e <span style="color: #0000ff;">$configfile</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">do</span> <span style="color: #0000ff;">$configfile</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">$dsn</span> <span style="color: #339933;">=</span> <span style="color: #ff0000;">&quot;DBI:Pg:database=$database;host=$hostname&quot;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$lock_file</span><span style="color: #339933;">=</span><span style="color: #0000ff;">$run_dir</span> <span style="color: #339933;">.</span> <span style="color: #ff0000;">&quot;/fetchmail-all.lock&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #0000ff;">$lockmgr</span> <span style="color: #339933;">=</span> LockFile<span style="color: #339933;">::</span><span style="color: #006600;">Simple</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">make</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">-</span>autoclean <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span>max <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #0000ff;">$lockmgr</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">lock</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$lock_file</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> log_and_die <span style="color: #ff0000;">&quot;can't lock ${lock_file}&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#postgres connect</span>
<span style="color: #0000ff;">$dbh</span> <span style="color: #339933;">=</span> DBI<span style="color: #339933;">-&gt;</span><span style="color: #006600;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$dsn</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$user</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$password</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> log_and_die <span style="color: #ff0000;">&quot;cannot connect the database&quot;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #0000ff;">$sql</span><span style="color: #339933;">=</span><span style="color: #cc0000; font-style: italic;">&lt;&lt;SQL;
SELECT id,mailbox,src_server,src_auth,src_user,src_password,src_folder,fetchall,keep,protocol,mda,extra_options,usessl 
FROM fetchmail
WHERE date_part('epoch',now())-date_part('epoch',date) &gt; poll_time*60
SQL</span>
&nbsp;
<span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">%config</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000066;">map</span><span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">my</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$id</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$mailbox</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$src_server</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$src_auth</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$src_user</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$src_password</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$src_folder</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$fetchall</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$keep</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$protocol</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$mda</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$extra_options</span><span style="color: #339933;">,</span><span style="color: #0000ff;">$usessl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">=@</span><span style="color: #0000ff;">$_</span><span style="color: #339933;">;</span>
&nbsp;
  syslog<span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;info&quot;</span><span style="color: #339933;">,</span><span style="color: #ff0000;">&quot;fetch ${src_user}@${src_server} for ${mailbox}&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #0000ff;">$cmd</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;user '${src_user}' there with password '&quot;</span><span style="color: #339933;">.</span>decode_base64<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$src_password</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #ff0000;">&quot;'&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #0000ff;">$cmd</span><span style="color: #339933;">.=</span><span style="color: #ff0000;">&quot; folder '${src_folder}'&quot;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$src_folder</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #0000ff;">$cmd</span><span style="color: #339933;">.=</span><span style="color: #ff0000;">&quot; mda &quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$mda</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$mda</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#       $cmd.=&quot; mda \&quot;/usr/local/libexec/dovecot/deliver -m ${mailbox}\&quot;&quot;;</span>
        <span style="color: #0000ff;">$cmd</span><span style="color: #339933;">.=</span><span style="color: #ff0000;">&quot; is '${mailbox}' here&quot;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #0000ff;">$cmd</span><span style="color: #339933;">.=</span><span style="color: #ff0000;">&quot; keep&quot;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$keep</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #0000ff;">$cmd</span><span style="color: #339933;">.=</span><span style="color: #ff0000;">&quot; fetchall&quot;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$fetchall</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #0000ff;">$cmd</span><span style="color: #339933;">.=</span><span style="color: #ff0000;">&quot; ssl&quot;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$usessl</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #0000ff;">$cmd</span><span style="color: #339933;">.=</span><span style="color: #ff0000;">&quot; &quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$extra_options</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$extra_options</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #0000ff;">$text</span><span style="color: #339933;">=</span><span style="color: #cc0000; font-style: italic;">&lt;&lt;TXT;
set postmaster &quot;postmaster&quot;
set nobouncemail
set no spambounce
set properties &quot;&quot;
set syslog
&nbsp;
poll ${src_server} with proto ${protocol}
        $cmd
&nbsp;
TXT</span>
&nbsp;
  <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$file_handler</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">$filename</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> mkstemp<span style="color: #009900;">&#40;</span> <span style="color: #ff0000;">&quot;/tmp/fetchmail-all-XXXXX&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">or</span> log_and_die <span style="color: #ff0000;">&quot;cannot open/create fetchmail temp file&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #000066;">print</span> <span style="color: #0000ff;">$file_handler</span> <span style="color: #0000ff;">$text</span><span style="color: #339933;">;</span>
  <span style="color: #000066;">close</span> <span style="color: #0000ff;">$file_handler</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #0000ff;">$ret</span><span style="color: #339933;">=</span><span style="color: #ff0000;">`/usr/bin/fetchmail -f $filename -i $run_dir/fetchmail.pid`</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000066;">unlink</span> <span style="color: #0000ff;">$filename</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #0000ff;">$sql</span><span style="color: #339933;">=</span><span style="color: #ff0000;">&quot;UPDATE fetchmail SET returned_text=&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$dbh</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">quote</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$ret</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #ff0000;">&quot;, date=now() WHERE id=&quot;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">$id</span><span style="color: #339933;">;</span>
  <span style="color: #0000ff;">$dbh</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">do</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">@</span><span style="color: #009900;">&#123;</span><span style="color: #0000ff;">$dbh</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">selectall_arrayref</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$sql</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #0000ff;">$lockmgr</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">unlock</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$lock_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
closelog<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Damit das Skript regelmäßig ausgeführt wird, legen wir einen Cronjob dafür an (als Benutzer <strong>root</strong>). In der hier gezeigten Konfiguration wird das Skript alle 5 Minuten ausgeführt.</p>
<p><em>crontab -e</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">*/</span><span style="color: #000000;">5</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #000000; font-weight: bold;">/</span>PFAD<span style="color: #000000; font-weight: bold;">/</span>ZU<span style="color: #000000; font-weight: bold;">/</span>fetchmail.pl <span style="color: #000000; font-weight: bold;">&amp;&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://johker.ibutho.de/2009/04/07/fetchmail-integration-in-postfixadmin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Der neue Server: Teil 7 roundcube</title>
		<link>http://johker.ibutho.de/2009/04/04/der-neue-server-teil-7-roundcube/</link>
		<comments>http://johker.ibutho.de/2009/04/04/der-neue-server-teil-7-roundcube/#comments</comments>
		<pubDate>Sat, 04 Apr 2009 10:29:57 +0000</pubDate>
		<dc:creator>johker</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[imapproxy]]></category>
		<category><![CDATA[installer]]></category>
		<category><![CDATA[konfiguration]]></category>
		<category><![CDATA[mailclient]]></category>
		<category><![CDATA[mua]]></category>
		<category><![CDATA[mutt]]></category>
		<category><![CDATA[postfixadmin]]></category>
		<category><![CDATA[postfixadmin bridge]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[rcpfa]]></category>
		<category><![CDATA[rcube]]></category>
		<category><![CDATA[roundcube]]></category>
		<category><![CDATA[sieve]]></category>
		<category><![CDATA[webmail]]></category>

		<guid isPermaLink="false">http://johker.ibutho.de/?p=199</guid>
		<description><![CDATA[Oft hat man nicht die Möglichkeit mit einen E-Mail Client &#8211; wie z.B. Evolution oder Thunderbird &#8211; arbeiten zu können, deshalb wird hier darauf eingegangen wie man einen Webmailer &#8211; in diesem Fall roundcube &#8211; inkl. postfixadmin-Integration und Sieve-Plugin installiert. &#8230; <a href="http://johker.ibutho.de/2009/04/04/der-neue-server-teil-7-roundcube/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Oft hat man nicht die Möglichkeit mit einen E-Mail Client &#8211; wie z.B. Evolution oder Thunderbird &#8211; arbeiten zu können, deshalb wird hier darauf eingegangen wie man einen Webmailer &#8211; in diesem Fall <em><a href="http://roundcube.net/" target="_blank">roundcube</a></em> &#8211; inkl. <em>postfixadmin</em>-Integration und Sieve-Plugin installiert.</p>
<h1>imapproxy</h1>
<p>Da http ein &#8220;stateless&#8221;-Protokoll ist, kann es &#8211; anders als IMAP-Clients &#8211; keine Verbindungen offen halten und stellt deshalb sehr viele unnötige &#8220;LOGIN&#8221;-Anfragen. Um dies zu verhindern wird ein imapproxy installiert. Dieser wird dem Webmailer vorgeschaltet und hält die Verbindungen geöffnet. Stellt der Webmailer nun eine Anfrage an den Proxy, sucht dieser die Verbindung raus und benutzt die bestehende Verbindung anstatt eine neue aufzubauen. Der Proxy hält die Verbindung nicht für eine unbestimmte Zeit offen, sondern schließt sie nachdem ein Timeout abgelaufen ist.</p>
<p>Installation:</p>

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

<p>Konfiguration:</p>

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

<p>Wir ändern nur die oben genannte Zeile, den Rest belassen wir wie er ist. Da der IMAP-Proxy auf dem gleichen System wie der Mailserver läuft, lassen wir nur lokale Verbindungen zu.<br />
Wenn nun ein Programm/Skript den IMAP-Proxy nutzen soll, gibt man Port 1143 an, anstatt Port 143.</p>
<h1>roundcube</h1>
<p>Für <em>roundcube</em> brauchen wir zunächst einen vHost. Im Weiteren wird davon ausgegangen, dass <em>roundcube</em> unter <em>https://webmail.domain.tld/</em> verfügbar ist.<br />
Zunächst muss die neueste <em>roundcube</em> Version von <a href="http://roundcube.net/" target="_blank">http://roundcube.net/</a> heruntergeladen und in den vHost entpackt werden, damit es über <em>https://webmail.domain.tld/</em> verfügbar ist.<br />
Nun legen wir eine Datenbank inkl. Benutzer für <em>roundcube</em> an und importieren das postgres-Schema:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">su</span> - postgres
psql template1
CREATE USER roundcube WITH PASSWORD <span style="color: #ff0000;">'password'</span>;
CREATE DATABASE roundcube WITH OWNER roundcube ENCODING <span style="color: #ff0000;">'UNICODE'</span>;
\c - roundcube
\i <span style="color: #000000; font-weight: bold;">/</span>PFAD<span style="color: #000000; font-weight: bold;">/</span>ZU<span style="color: #000000; font-weight: bold;">/</span>ROUNDCUBE<span style="color: #000000; font-weight: bold;">/</span>SQL<span style="color: #000000; font-weight: bold;">/</span>postgres.initial.sql
\q</pre></div></div>

<p>Nun rufen wir im Browser roundcube auf, hängen der URL aber noch &#8220;<em>/installer</em>&#8221; an und folgen danach den Anweisungen. Nachden wir die Konfigurationsdateien kopiert und am aufgeforderten Ort gespeichert haben, können wir <em>roundcube</em> über den Browser aufrufen und uns mit unserem IMAP-Benutzernamen und -passwort anmelden. <strong>Jedoch</strong> sollte man damit noch warten, bis <em>postfixadmin-bridge</em> installiert ist, denn dann wird automatisch der vollständige Name aus den <em>postfixadmin</em>-Tabellen übernommen.</p>
<h2>postfixadmin-bridge</h2>
<p>Zur Installation von <em><a href="http://nejc.skoberne.net/projects/rcpfa/" target="_blank">rcpfa</a></em> (= <em>postfixadmin-bridge</em>) wird <em>patch</em> benötigt:</p>

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

<p>Danach entpackt man <em>rcpfa</em> in den <em>roundcube</em> Ordner, wechselt in das neue Unterverzeichnis und führt folgenden Befehl aus:</p>

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

<p>Sollten während des Patch-Vorgangs Probleme auftreten, kann man sich die *.rej-Dateien anschauen und die Probleme ggf. händisch lösen. Nach der Installation muss noch die <em>roundcube</em>-Konfiguration angepasst werden (beim Patchen wurden neue Variablen in der Konfiguration hinzugefügt) und danach kann man im Einstellungs-Tab von <em>roundcube</em> Einstellungen aus <em>postfixadmin</em> ändern.</p>
<h2>sieve rules</h2>
<p>Das sieve-Plugin für roundcube kann man hier herunterladen: <a href="http://www.tehinterweb.co.uk/roundcube/#ptsieverules" target="_blank">http://www.tehinterweb.co.uk/roundcube/#ptsieverules</a> und anschließend mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">patch</span> <span style="color: #660033;">-ul</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>PFAD<span style="color: #000000; font-weight: bold;">/</span>ZU<span style="color: #000000; font-weight: bold;">/</span>ROUNDCUBE<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-p1</span> <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>PFAD<span style="color: #000000; font-weight: bold;">/</span>ZUM<span style="color: #000000; font-weight: bold;">/</span>PATCH</pre></div></div>

<p>installieren.<br />
Die parallele Installation von <em>rcpfa</em> und <em>sieve rules</em> ist problematisch, da der Patch-Vorgang sehr wahrscheinlich an einer Stelle fehlschlägt und man selbst Hand anlegen muss.<br />
Auch dieses Plugin hat Variablen zur <em>roundcube</em>-Konfiguration hinzugefügt, die angepasst werden müssen, bevor das Plugin benutzt werden kann.</p>
<h1>mutt</h1>
<p>Um auch über die Konsole auf E-Mails zugreifen kann, installieren wir zusätzlich noch <em>mutt</em>. Manche Leute fragen sich vielleicht, wozu man einen Konsolenmailer braucht, bzw. brauchen könnte. Ein interessanter Punkt ist, dass <em>mutt</em> einen weitaus größeren Funktionsumfang als ein Webmailer bietet und außerdem sieht es auch schick aus, wenn man seine Mails auf der Konsole liest.</p>
<p>Installation:</p>

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

<p>Eine einfache Konfiguration (&#8220;<em>~/.muttrc</em>&#8220;):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">folder</span>=<span style="color: #ff0000;">&quot;imap://localhost&quot;</span>
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">spoolfile</span>=<span style="color: #ff0000;">&quot;imap://localhost/INBOX&quot;</span>
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">imap_authenticators</span>=<span style="color: #ff0000;">&quot;LOGIN&quot;</span>
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">imap_user</span>=<span style="color: #ff0000;">&quot;username&quot;</span>
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">imap_pass</span>=<span style="color: #ff0000;">&quot;password&quot;</span>
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">move</span>=no
&nbsp;
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">editor</span>=<span style="color: #ff0000;">'vim -c &quot;set t_Co=8&quot; -c &quot;syntax on&quot; -c &quot;/^$&quot; -c &quot;set tw=72&quot; -c &quot;set number&quot;'</span>
<span style="color: #000000; font-weight: bold;">set</span> <span style="color: #007800;">header_cache</span>=~<span style="color: #000000; font-weight: bold;">/</span>.mutt_header</pre></div></div>

<p>Die <em>mutt</em>-Konfiguration ist sehr rudimentär und sollte zusätzlich noch an die eigenen Bedürfnisse angepasst werden, z.B. Sent-Ordner definieren, GPG-Schlüssel definieren, &#8230;</p>
<p>Quellen:</p>
<p>http://roundcube.net/</p>
<p>http://nejc.skoberne.net/projects/rcpfa/</p>
<p>http://www.tehinterweb.co.uk/roundcube/#ptsieverules</p>
]]></content:encoded>
			<wfw:commentRss>http://johker.ibutho.de/2009/04/04/der-neue-server-teil-7-roundcube/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Der neue Server: Teil 5 postfix</title>
		<link>http://johker.ibutho.de/2009/03/29/der-neue-server-teil-5-postfix/</link>
		<comments>http://johker.ibutho.de/2009/03/29/der-neue-server-teil-5-postfix/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 21:41:30 +0000</pubDate>
		<dc:creator>johker</dc:creator>
				<category><![CDATA[Howto]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[110]]></category>
		<category><![CDATA[143]]></category>
		<category><![CDATA[2000]]></category>
		<category><![CDATA[993]]></category>
		<category><![CDATA[995]]></category>
		<category><![CDATA[abuse.net]]></category>
		<category><![CDATA[anti-stasi]]></category>
		<category><![CDATA[configuration]]></category>
		<category><![CDATA[create role]]></category>
		<category><![CDATA[create user]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[deliver]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[dovecot postgres integration]]></category>
		<category><![CDATA[dovecot-deliver.log]]></category>
		<category><![CDATA[dovecot-imapd]]></category>
		<category><![CDATA[dovecot-pop3d]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[imaps]]></category>
		<category><![CDATA[lda]]></category>
		<category><![CDATA[mail server]]></category>
		<category><![CDATA[maildir]]></category>
		<category><![CDATA[main.cf]]></category>
		<category><![CDATA[managesieve]]></category>
		<category><![CDATA[master.cf]]></category>
		<category><![CDATA[mda]]></category>
		<category><![CDATA[microsoft sucks]]></category>
		<category><![CDATA[mta]]></category>
		<category><![CDATA[mx_access]]></category>
		<category><![CDATA[outlook]]></category>
		<category><![CDATA[pcre]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[pop3]]></category>
		<category><![CDATA[pop3s]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[postfixadmin]]></category>
		<category><![CDATA[postgres]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[quota]]></category>
		<category><![CDATA[recipient_checks]]></category>
		<category><![CDATA[relay_domains]]></category>
		<category><![CDATA[restrictions]]></category>
		<category><![CDATA[sasl]]></category>
		<category><![CDATA[sieve]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[smtps]]></category>
		<category><![CDATA[sql queries]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[test]]></category>
		<category><![CDATA[tls]]></category>
		<category><![CDATA[virtual]]></category>
		<category><![CDATA[virtual hosting]]></category>
		<category><![CDATA[virtual_alias_maps]]></category>
		<category><![CDATA[virtual_mailbox_domains]]></category>
		<category><![CDATA[virtual_mailbox_maps]]></category>
		<category><![CDATA[virtual_transport]]></category>
		<category><![CDATA[webinterface]]></category>
		<category><![CDATA[workarounds]]></category>

		<guid isPermaLink="false">http://johker.ibutho.de/?p=165</guid>
		<description><![CDATA[Hier wird erklärt wie man postfix mit postgreSQL-Backend installiert, dovecot inkl. sieve konfiguriert, sowie postfixadmin einrichtet, um postfix bequem über ein Webinterface verwalten zu können. Datenbank anlegen Als Erstes legen wir einen Datenbankbenutzer inkl. Datenbank für postfix an: su - &#8230; <a href="http://johker.ibutho.de/2009/03/29/der-neue-server-teil-5-postfix/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Hier wird erklärt wie man <em>postfix</em> mit postgreSQL-Backend installiert, <em>dovecot</em> inkl. <em>sieve</em> konfiguriert, sowie <em>postfixadmin</em> einrichtet, um <em>postfix</em> bequem über ein Webinterface verwalten zu können.</p>
<h1>Datenbank anlegen</h1>
<p>Als Erstes legen wir einen Datenbankbenutzer inkl. Datenbank für <em>postfix</em> an:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">su</span> - postgres
psql template1
CREATE USER postfix WITH PASSWORD <span style="color: #ff0000;">'password'</span>;
CREATE DATABASE postfix WITH OWNER postfix ENCODING <span style="color: #ff0000;">'UNICODE'</span>;
\q</pre></div></div>

<h1>Verzeichnis anlegen</h1>
<p>Später werden alle Mailboxen unter &#8220;<em>/var/vmail/DOMAIN/BENUTZERNAME/maildir/</em>&#8221; liegen, deshalb erstellen wir nun den Ordner &#8220;<em>/var/vmail</em>&#8221; und vergeben entsprechende Rechte. Die Einsortierung nach &#8220;<em>/var/vmail/DOMAIN/BENUTZERNAME/maildir/</em>&#8221; geschieht später über SQL-Queries automatisch.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">useradd <span style="color: #660033;">-r</span> <span style="color: #660033;">-u</span> <span style="color: #000000;">150</span> <span style="color: #660033;">-g</span> mail <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>vmail <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>nologin <span style="color: #660033;">-c</span> <span style="color: #ff0000;">'Virtual mailbox'</span> vmail
<span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>vmail
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">770</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>vmail<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> vmail:mail <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>vmail<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<h1>postfixadmin</h1>
<p><em>postfixadmin</em> installieren wir direkt aus deren <em>svn</em>-Repository, um mit der aktuellste Version zu arbeiten. Sollte es zu Problemen kommen, kann man über <a href="http://postfixadmin.sourceforge.net/" target="_blank">http://postfixadmin.sourceforge.net/</a> die neueste stabile Version herunterladen.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>www<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> https:<span style="color: #000000; font-weight: bold;">//</span>postfixadmin.svn.sourceforge.net<span style="color: #000000; font-weight: bold;">/</span>svnroot<span style="color: #000000; font-weight: bold;">/</span>postfixadmin<span style="color: #000000; font-weight: bold;">/</span>trunk postfixadmin-svn
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> postfixadmin-svn postfixadmin</pre></div></div>

<p>Danach passt man die Konfigurationsdatei &#8220;<em>/var/www/postfixadmin/config.inc.php</em>&#8221; an seine Wünsche und Anforderungen an. Nach Ausführen des &#8220;setup.php&#8221;-Skripts im Browser (und anschließendem Löschen/Umbenennen) ist <em>postfixadmin</em> einsatzbereit.</p>
<h1>postfix</h1>
<p><em>postfix</em> installieren:</p>

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

<p>Während der Installation von <em>postfix</em> wird man gefragt, wie man <em>postfix</em> konfigurieren will, dort wählt man &#8220;<strong>Internet Site</strong>&#8221; aus (wobei dies später irrelevant ist, da wir die Konfiguration komplett selbst schreiben).</p>
<h2>Datenbankverbindung konfigurieren</h2>
<p>Damit <em>postfix</em> mit den Accounts, die in <em>postfixadmin</em> angelegt werden zusammenarbeitet, müssen wir verschiedene SQL-Queries anlegen:</p>
<p><em>relay-domains.cf</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user            = postfix
password        = xxxxxxx
dbname          = postfix
hosts           = localhost
query = SELECT domain FROM domain WHERE domain = <span style="color: #ff0000;">'%s'</span> AND backupmx = <span style="color: #c20cb9; font-weight: bold;">true</span></pre></div></div>

<p><em>virtual-alias-maps.cf</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user             = postfix
password         = xxxxxxxx
dbname           = postfix
hosts            = localhost
query = SELECT goto FROM <span style="color: #7a0874; font-weight: bold;">alias</span> WHERE <span style="color: #007800;">address</span>=<span style="color: #ff0000;">'%s'</span> AND active = <span style="color: #c20cb9; font-weight: bold;">true</span></pre></div></div>

<p><em>virtual-domain-maps.cf</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user             = postfix
password         = xxxxxxxx
dbname           = postfix
hosts            = localhost
query = SELECT domain FROM domain WHERE <span style="color: #007800;">domain</span>=<span style="color: #ff0000;">'%s'</span> AND backupmx = <span style="color: #c20cb9; font-weight: bold;">false</span> AND active = <span style="color: #c20cb9; font-weight: bold;">true</span></pre></div></div>

<p><em>virtual-mailbox-limit-maps.cf</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user             = postfix
password         = xxxxxxxx
dbname           = postfix
hosts            = localhost
query = SELECT quota FROM mailbox WHERE username = <span style="color: #ff0000;">'%s'</span> AND active = <span style="color: #c20cb9; font-weight: bold;">true</span></pre></div></div>

<p><em>virtual-mailbox-maps.cf</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">user             = postfix
password         = xxxxxxxx
dbname           = postfix
hosts            = localhost
query = SELECT maildir <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #ff0000;">'maildir'</span> <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #ff0000;">'/'</span> FROM mailbox WHERE <span style="color: #007800;">username</span>=<span style="color: #ff0000;">'%s'</span> AND active = <span style="color: #c20cb9; font-weight: bold;">true</span></pre></div></div>

<h2>recipient checks</h2>
<p>Mit <em>recipient checks</em> kann man E-Mailadressen anhand von regulären Ausdrücken prüfen und dadurch Mails entweder annehmen oder ablehnen. Hier werden invalide E-Mailadressen, bzw. welche mit &#8220;seltsamer&#8221; Syntax abgewiesen und E-Mails an postmaster, hostmaster, webmaster und abuse immer angenommen.</p>
<p><em>/etc/postfix/recipient_checks.pcre</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>^\<span style="color: #000000; font-weight: bold;">@/</span>             <span style="color: #000000;">550</span> Invalid address format.
<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">!%</span>\<span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>.<span style="color: #000000; font-weight: bold;">*</span>\<span style="color: #000000; font-weight: bold;">@/</span>      <span style="color: #000000;">550</span> This server disallows weird address syntax.
<span style="color: #000000; font-weight: bold;">/</span>^postmaster\<span style="color: #000000; font-weight: bold;">@/</span>   OK
<span style="color: #000000; font-weight: bold;">/</span>^hostmaster\<span style="color: #000000; font-weight: bold;">@/</span>   OK
<span style="color: #000000; font-weight: bold;">/</span>^webmaster\<span style="color: #000000; font-weight: bold;">@/</span>    OK
<span style="color: #000000; font-weight: bold;">/</span>^abuse\<span style="color: #000000; font-weight: bold;">@/</span>        OK</pre></div></div>

<h2>mx access</h2>
<p>Über diese Datei werden E-Mails von Gegenstellen aus privaten IP-Blöcken, bzw. von Broadcast- und Multicast-Netzen von vorneherein abgewiesen, da diese im Internet prinzipiell nicht geroutet werden und es sich dabei mit extrem hoher Wahrscheinlichkeit um Spam handelt.</p>
<p><em>/etc/postfix/mx_access</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">0.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span>         REJECT Domain MX <span style="color: #000000; font-weight: bold;">in</span> broadcast network
10.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span>        REJECT Domain MX <span style="color: #000000; font-weight: bold;">in</span> RFC <span style="color: #000000;">1918</span> private network
127.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span>       REJECT Domain MX <span style="color: #000000; font-weight: bold;">in</span> loopback network
169.254.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">16</span>    REJECT Domain MX <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #c20cb9; font-weight: bold;">link</span> <span style="color: #7a0874; font-weight: bold;">local</span> network
172.16.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">12</span>     REJECT Domain MX <span style="color: #000000; font-weight: bold;">in</span> RFC <span style="color: #000000;">1918</span> private network
192.0.2.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span>      REJECT Domain MX <span style="color: #000000; font-weight: bold;">in</span> TEST-NET network
192.168.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">16</span>    REJECT Domain MX <span style="color: #000000; font-weight: bold;">in</span> RFC <span style="color: #000000;">1918</span> private network
224.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">4</span>       REJECT Domain MX <span style="color: #000000; font-weight: bold;">in</span> class D multicast network
240.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span>       REJECT Domain MX <span style="color: #000000; font-weight: bold;">in</span> class E reserved network
248.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">5</span>       REJECT Domain MX <span style="color: #000000; font-weight: bold;">in</span> reserved network</pre></div></div>

<p>Nun muss daraus noch eine <em>postfix-lookup table</em> erstellt werden:</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>mx_access</pre></div></div>

<h2>main.cf</h2>
<p>Nun müssen wir noch <em>postfix</em> konfigurieren und alle Teilkonfigurationen, die wir gerade erstellt haben zusammenfügen. Dies geschieht über die Datei &#8220;<em>/etc/postfix/main.cf</em>&#8220;:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># -------------------- GENERAL PART START --------------------</span>
allow_percent_hack = no
biff = no
disable_vrfy_command = <span style="color: #c20cb9; font-weight: bold;">yes</span>
&nbsp;
mydestination = <span style="color: #007800;">$myhostname</span>, <span style="color: #007800;">$mydomain</span>, localhost
mydomain = domain.tld
myhostname = mail.domain.tld
mynetworks_style = host
myorigin = <span style="color: #007800;">$mydomain</span>
&nbsp;
<span style="color: #666666; font-style: italic;">#home_mailbox = Maildir/</span>
<span style="color: #666666; font-style: italic;">#mailbox_size_limit = 2147483648</span>
<span style="color: #666666; font-style: italic;">#message_size_limit = 209715200</span>
local_transport = dovecot
masquerade_exceptions = root
recipient_delimiter = +
<span style="color: #666666; font-style: italic;"># -------------------- GENERAL PART END --------------------</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># -------------------- VIRTUAL PART START --------------------</span>
virtual_mailbox_base = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>vmail
relay_domains = proxy:pgsql:<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>pgsql<span style="color: #000000; font-weight: bold;">/</span>relay-domain-maps.cf
virtual_mailbox_maps = proxy:pgsql:<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>pgsql<span style="color: #000000; font-weight: bold;">/</span>virtual-mailbox-maps.cf
virtual_mailbox_domains = proxy:pgsql:<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>pgsql<span style="color: #000000; font-weight: bold;">/</span>virtual-domain-maps.cf
virtual_alias_maps = proxy:pgsql:<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>pgsql<span style="color: #000000; font-weight: bold;">/</span>virtual-alias-maps.cf
virtual_minimum_uid = <span style="color: #000000;">150</span>
virtual_uid_maps = static:<span style="color: #000000;">150</span>
virtual_gid_maps = static:<span style="color: #000000;">8</span>
virtual_transport = dovecot
dovecot_destination_recipient_limit = <span style="color: #000000;">1</span>
unknown_local_recipient_reject_code = <span style="color: #000000;">550</span>
<span style="color: #666666; font-style: italic;"># -------------------- VIRTUAL PART END --------------------</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># -------------------- RESTRICTIONS PART START --------------------</span>
smtpd_delay_reject = <span style="color: #c20cb9; font-weight: bold;">yes</span>
smtpd_helo_required = <span style="color: #c20cb9; font-weight: bold;">yes</span>
&nbsp;
smtpd_client_restrictions =
  permit_mynetworks,
  permit_sasl_authenticated,
  reject_unknown_reverse_client_hostname,
  permit
smtpd_data_restrictions =
  permit_mynetworks,
  permit_sasl_authenticated,
  reject_unauth_pipelining,
  permit
smtpd_helo_restrictions =
  permit_mynetworks,
  permit_sasl_authenticated,
  reject_invalid_helo_hostname,
  reject_non_fqdn_helo_hostname,
  permit
smtpd_recipient_restrictions =
  permit_mynetworks,
  permit_sasl_authenticated,
  reject_non_fqdn_recipient,
  reject_unknown_recipient_domain,
  check_recipient_mx_access cidr:<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>mx_access,
  reject_unauth_destination,
  check_recipient_access pcre:<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>recipient_checks.pcre,
<span style="color: #666666; font-style: italic;">###  check_policy_service inet:127.0.0.1:12525,</span>
  permit
smtpd_sender_restrictions =
  permit_mynetworks,
  permit_sasl_authenticated,
  reject_non_fqdn_sender,
  reject_unknown_sender_domain,
  permit
<span style="color: #666666; font-style: italic;"># -------------------- RESTRICTIONS PART END --------------------</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># -------------------- SASL PART START --------------------</span>
broken_sasl_auth_clients = <span style="color: #c20cb9; font-weight: bold;">yes</span>
smtpd_sasl_auth_enable = <span style="color: #c20cb9; font-weight: bold;">yes</span>
smtpd_sasl2_auth_enable = <span style="color: #c20cb9; font-weight: bold;">yes</span>
smtpd_sasl_local_domain = 
smtpd_sasl_type = dovecot
smtpd_sasl_path = private<span style="color: #000000; font-weight: bold;">/</span>auth
<span style="color: #666666; font-style: italic;"># -------------------- SASL PART END --------------------</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># -------------------- TLS PART START --------------------</span>
smtpd_use_tls = <span style="color: #c20cb9; font-weight: bold;">yes</span>
smtpd_tls_security_level = may
<span style="color: #666666; font-style: italic;">#smtpd_tls_auth_only = yes</span>
smtpd_tls_CAfile = <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>ssl<span style="color: #000000; font-weight: bold;">/</span>demoCA<span style="color: #000000; font-weight: bold;">/</span>cacert.pem
smtpd_tls_cert_file = <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>ssl<span style="color: #000000; font-weight: bold;">/</span>server-crt.pem
smtpd_tls_dh1024_param_file = <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>ssl<span style="color: #000000; font-weight: bold;">/</span>dh_1024.pem
smtpd_tls_dh512_param_file = <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>ssl<span style="color: #000000; font-weight: bold;">/</span>dh_512.pem
smtpd_tls_key_file = <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>ssl<span style="color: #000000; font-weight: bold;">/</span>server-key.pem
smtpd_tls_session_cache_database = btree:<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<span style="color: #000000; font-weight: bold;">/</span>smtpd_tls_session_cache
<span style="color: #666666; font-style: italic;"># -------------------- TLS PART END --------------------</span></pre></div></div>

<h2>master.cf</h2>
<p>Ans Ende der &#8220;<em>/etc/postfix/master.cf</em>&#8221; anhängen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Dovecot LDA</span>
dovecot unix - n n - - pipe
<span style="color: #007800;">flags</span>=DRhu <span style="color: #007800;">user</span>=vmail:mail <span style="color: #007800;">argv</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>deliver <span style="color: #660033;">-d</span> <span style="color: #800000;">${recipient}</span></pre></div></div>

<p>Will man auch <em>smtps</em> (Port 465) zulassen, so entfernt man die Raute-Zeichen vor den untenstehenden Zeilen, damit sie wie folgt aussehen (die Leerzeichen vor der zweiten Zeile sind essentiell):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">smtps     inet  n       -       -       -       -       smtpd
  <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_tls_wrappermode</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span></pre></div></div>

<p><em>smpts</em> kann nützlich sein, wenn Port 25 aus irgend einem Grund gesperrt sein sollte, denn es operiert auf Port 465, welcher seltener gesperrt ist (zumindest in Studentenwohnheimen und Universitäten), zusätzlich bietet es einen höheren Schutz als plaintext-smtp (doch einen geringeren als smtp+tls).</p>
<h1>dovecot</h1>
<p>Nun folgt die Konfiguration des dovecot E-Mail-Servers. Zunächst wird dovecot über aptitude:</p>

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

<p>Jetzt wird dovecot noch konfiguriert:</p>
<p><em>/etc/dovecot/dovecot.conf</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">## Dovecot configuration file</span>
&nbsp;
base_dir = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># imap imaps pop3 pop3s (use imaps and pop3s if configured for SSL)</span>
protocols = imaps imap pop3s pop3 managesieve
&nbsp;
<span style="color: #666666; font-style: italic;"># Uncomment the ssl_listen statements and comment out listen if using SSL</span>
protocol imap <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  listen = <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">143</span>
  ssl_listen = <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">993</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
protocol pop3 <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  listen = <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">110</span>
  ssl_listen = <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">995</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
protocol managesieve <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  listen = <span style="color: #000000; font-weight: bold;">*</span>:<span style="color: #000000;">2000</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
log_timestamp = “<span style="color: #000000; font-weight: bold;">%</span>Y-<span style="color: #000000; font-weight: bold;">%</span>m-<span style="color: #000000; font-weight: bold;">%</span>d <span style="color: #000000; font-weight: bold;">%</span>H:<span style="color: #000000; font-weight: bold;">%</span>M:<span style="color: #000000; font-weight: bold;">%</span>S ”
syslog_facility = mail
&nbsp;
<span style="color: #666666; font-style: italic;"># Where the mailboxes are located</span>
mail_location = maildir:<span style="color: #000000; font-weight: bold;">/</span>var<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>maildir
mail_access_groups = vmail
mail_debug = <span style="color: #c20cb9; font-weight: bold;">yes</span>
first_valid_uid = <span style="color: #000000;">150</span>
last_valid_uid = <span style="color: #000000;">150</span>
maildir_copy_with_hardlinks = <span style="color: #c20cb9; font-weight: bold;">yes</span>
&nbsp;
protocol imap <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  login_executable = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>imap-login
  mail_executable = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>imap
  imap_max_line_length = <span style="color: #000000;">65536</span>
  mail_plugins = quota imap_quota
  imap_client_workarounds = outlook-idle delay-newmail
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
protocol pop3 <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  login_executable = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>pop3-login
  mail_executable = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>pop3
  pop3_uidl_format = <span style="color: #000000; font-weight: bold;">%</span>08Xu<span style="color: #000000; font-weight: bold;">%</span>08Xv
  mail_plugins = quota
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
protocol lda <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  postmaster_address = postmaster<span style="color: #000000; font-weight: bold;">@</span>ibutho.de
  sendmail_path = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">sendmail</span>
  auth_socket_path = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>auth-master
  mail_plugins = quota cmusieve
  sieve_global_path = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>vmail<span style="color: #000000; font-weight: bold;">/</span>default.sieve
  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-deliver.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-deliver.log
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
protocol managesieve <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  sieve = <span style="color: #000000; font-weight: bold;">/</span>var<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>dovecot.sieve
  sieve_storage = <span style="color: #000000; font-weight: bold;">/</span>var<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>sieve
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
auth_verbose = no
auth_debug = <span style="color: #c20cb9; font-weight: bold;">yes</span>
<span style="color: #666666; font-style: italic;">#auth_debug_passwords = yes</span>
&nbsp;
auth default <span style="color: #7a0874; font-weight: bold;">&#123;</span>
 mechanisms = plain <span style="color: #c20cb9; font-weight: bold;">login</span>
&nbsp;
 passdb sql <span style="color: #7a0874; font-weight: bold;">&#123;</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>dovecot-sql.conf
 <span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
 userdb sql <span style="color: #7a0874; font-weight: bold;">&#123;</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>dovecot-sql.conf
 <span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
 userdb prefetch <span style="color: #7a0874; font-weight: bold;">&#123;</span>
 <span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
 user = nobody
&nbsp;
 socket listen <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  master <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    path = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>run<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>auth-master
    mode = 0660
    user = vmail
    group = mail
  <span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
  client <span style="color: #7a0874; font-weight: bold;">&#123;</span>
    path = <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<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>auth
    mode = 0660
    user = postfix
    group = postfix
  <span style="color: #7a0874; font-weight: bold;">&#125;</span>
 <span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
dict <span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
plugin <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  acl = vfile:<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>acls
  sieve = <span style="color: #000000; font-weight: bold;">/</span>var<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>dovecot.sieve
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Uncomment these if using SSL</span>
ssl_cert_file = <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>ibutho_server.pem
ssl_key_file = <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>ibutho_privatekey.pem
ssl_ca_file = <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>certs<span style="color: #000000; font-weight: bold;">/</span>root.pem
ssl_parameters_regenerate = <span style="color: #000000;">168</span>
verbose_ssl = no
<span style="color: #666666; font-style: italic;"># If you want client certificates, use these lines</span>
<span style="color: #666666; font-style: italic;"># ssl_verify_client_cert = yes</span>
<span style="color: #666666; font-style: italic;"># ssl_require_client_cert = yes</span>
<span style="color: #666666; font-style: italic;"># ssl_username_from_cert = yes</span></pre></div></div>

<p>Damit das logging nach &#8220;<em>/var/log/dovecot-deliver.log</em>&#8221; funktioniert, muss die Datei mit entsprechenden Rechten ausgestattet sein:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>dovecot-deliver.log
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">640</span> <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>dovecot-deliver.log
<span style="color: #c20cb9; font-weight: bold;">chown</span> vmail:mail <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-deliver.log</pre></div></div>

<p><em>/etc/dovecot/dovecot-sql.conf</em>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">driver = pgsql
connect = <span style="color: #007800;">host</span>=localhost <span style="color: #007800;">dbname</span>=postfix <span style="color: #007800;">user</span>=postfix <span style="color: #007800;">password</span>=xxxxxxxx
default_pass_scheme = MD5
&nbsp;
user_query = SELECT <span style="color: #ff0000;">'/var/vmail/'</span> <span style="color: #000000; font-weight: bold;">||</span> maildir AS home, <span style="color: #ff0000;">'maildir:/var/vmail/'</span> <span style="color: #000000; font-weight: bold;">||</span> maildir <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #ff0000;">'maildir'</span> AS mail, <span style="color: #000000;">150</span> AS uid, <span style="color: #000000;">8</span> AS gid, <span style="color: #ff0000;">'maildir:storage='</span> <span style="color: #000000; font-weight: bold;">||</span> quota AS quota FROM mailbox WHERE local_part = split_part<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'%n'</span>, <span style="color: #ff0000;">'+'</span>, <span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> AND domain = <span style="color: #ff0000;">'%d'</span>  AND active = <span style="color: #c20cb9; font-weight: bold;">true</span>
&nbsp;
password_query = SELECT username AS user, password, <span style="color: #ff0000;">'/var/vmail/'</span> <span style="color: #000000; font-weight: bold;">||</span> maildir AS userdb_home, <span style="color: #ff0000;">'maildir:/var/vmail/'</span> <span style="color: #000000; font-weight: bold;">||</span> maildir <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #ff0000;">'maildir'</span> AS userdb_mail, <span style="color: #000000;">150</span> <span style="color: #c20cb9; font-weight: bold;">as</span> userdb_uid, <span style="color: #000000;">8</span> <span style="color: #c20cb9; font-weight: bold;">as</span> userdb_gid FROM mailbox WHERE username = <span style="color: #ff0000;">'%u'</span> AND active = <span style="color: #c20cb9; font-weight: bold;">true</span></pre></div></div>

<h1>Testen der Konfiguration</h1>
<p>Zuerst kann man serverseitig mittels &#8220;<code>netstat -tulpen</code>&#8221; testen, ob der Server auf allen beabsichtigten Ports lauscht (110, 143, 993, 995, 2000). Danach kann man mittels &#8220;<code>telnet SERVER_IP 143</code>&#8220;, bzw. &#8220;<code>telnet SERVER_IP 110</code>&#8221; testen, ob man eine Verbindung bekommt. Ist dies der Fall, bietet es sich an auszuprobieren, ob man mit einem Mailprogramm auf das Postfach zugreifen kann (es muss natürlich eins in <em>postfixadmin</em> angelegt sein), bzw. ob man auch Mails empfangen und versenden kann.<br />
Ein weiterer wichtiger Test, den man durchführen sollte, ist, ob der Mailserver als &#8220;open relay&#8221; missbraucht werden kann (kurz und knapp heißt das, ob der Server möglicherweise eine &#8220;Spam-Schleuder&#8221; ist). Dies kann man u.a. hier testen: <a href="http://www.abuse.net/relay.html" target="_blank">http://www.abuse.net/relay.html</a>. Sollten alle Tests Erfolg haben, hat man einen funktionsfähigen Mailserver.</p>
<p>Quellen:<br />
postfixadmin/DOCUMENTS/POSTFIX_CONF.txt</p>
<p>http://blog.schalanda.name/archives/178-EUserv-vServer-Active-Installation-des-Mailsystems.html</p>
<p>http://codepoets.co.uk/postfixadmin-postgresql-courier-squirrelmail-debian-etch-howto-tutorial</p>
<p>http://wiki.rootforum.de/mailserver/postfix</p>
<p>http://wiki.rootforum.de/mailserver/postfix/postfix-admin</p>
<p>http://forum.rootforum.de/viewtopic.php?f=111&#038;t=46643</p>
<p>http://www.postfix.org/postconf.5.html</p>
<p>http://wiki.dovecot.org/MainConfig</p>
<p>http://wiki.dovecot.org/ManageSieve</p>
<p>http://wiki.dovecot.org/LDA/Sieve</p>
<p>http://wiki.dovecot.org/HowTo/DovecotLDAPostfixAdminMySQL</p>
]]></content:encoded>
			<wfw:commentRss>http://johker.ibutho.de/2009/03/29/der-neue-server-teil-5-postfix/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

