<?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>Abraxas &#187; OpenLDAP</title>
	<atom:link href="http://www.effinger.org/blog/tag/openldap/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.effinger.org/blog</link>
	<description>a personal knowledge base</description>
	<lastBuildDate>Mon, 23 Jan 2012 22:05:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>OpenLDAP für pam_ldap, nss_ldap unter Gentoo im Schnelldurchgang einrichten</title>
		<link>http://www.effinger.org/blog/2010/05/08/openldap-fur-pam_ldap-nss_ldap-unter-gentoo-im-schnelldurchgang-einrichten/</link>
		<comments>http://www.effinger.org/blog/2010/05/08/openldap-fur-pam_ldap-nss_ldap-unter-gentoo-im-schnelldurchgang-einrichten/#comments</comments>
		<pubDate>Sat, 08 May 2010 19:11:28 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[eGroupware]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[nss_ldap]]></category>
		<category><![CDATA[OpenLDAP]]></category>
		<category><![CDATA[pam_ldap]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=1013</guid>
		<description><![CDATA[<p>In diesem Artikel geht es darum, mit OpenLDAP die Basis für ein Benutzersystem unter Gentoo zu legen und die Linux-Authentifizierung mittels pam_ldap und nss_ldap an diese Basis anzubinden. Unter Gentoo ist die LDAP-Einrichtung zwar grundsätzlich ähnlich wie zu der Beschreibung in meinen anderen Blog-Artikeln (Das kleine OpenLDAP 1&#215;1, OpenLDAP im Mailserversetup unter Ubuntu) beschrieben hatte, [...]]]></description>
			<content:encoded><![CDATA[<p>In diesem Artikel geht es darum, mit OpenLDAP die Basis für ein Benutzersystem unter Gentoo zu legen und die Linux-Authentifizierung mittels <a href="http://www.padl.com/OSS/pam_ldap.html">pam_ldap</a> und <a href="http://www.padl.com/nss_ldap.html">nss_ldap</a> an diese Basis anzubinden. Unter Gentoo ist die LDAP-Einrichtung zwar grundsätzlich ähnlich wie zu der Beschreibung in meinen anderen Blog-Artikeln (<a href="http://www.effinger.org/blog/2008/12/14/das-kleine-openldap-1x1/">Das kleine OpenLDAP 1&#215;1</a>, <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-1-openldap/">OpenLDAP im Mailserversetup unter Ubuntu</a>) beschrieben hatte, allerdings gibt es an der ein oder anderen Stelle ein paar Unterschiede. Damit ich diese selbst nicht vergesse, wenn ich das nächste Mal OpenLDAP einrichte, dokumentiere ich meine Vorgehensweise. Sie orientiert sich vor allem an einem <a href="http://wiki.das-online.org/howtos/ldap/openldap-gentoo">Wikiartikel zu OpenLDAP</a> und der <a href="http://www.gentoo.org/doc/de/ldap-howto.xml">Gentoo-Dokumentation</a>.</p>
<h3>Installation von OpenLDAP</h3>
<p>Vor der Installation von OpenLDAP habe ich für meine Bedürfnisse die folgenden USE Flags in /etc/portage/package.use definiert</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">net-nds/openldap berkdb crypt perl ssl tcpd gnutls overlays samba syslog</pre></div></div>

<p>um anschließend die Installation zu starten mit einem</p>

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

<h3>Grundkonfiguration von OpenLDAP</h3>
<p>Zunächst erzeugen wir mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">slappasswd <span style="color: #660033;">-h</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>CRYPT<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>ein Passwort für die RootDN (später olcRootPW). Im Beispiel ergibt sich die Zeichenfolge {CRYPT}xVllx1Fyd0nd2 für &#8220;test&#8221; als Passwort. Nun editieren wir die Datei/etc/openldap/slapd.conf und ändern die Datenbankdefinitionen wie folgt ab</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#######################################################################</span>
<span style="color: #666666; font-style: italic;"># BDB database definition for dc=log</span>
<span style="color: #666666; font-style: italic;">#######################################################################</span>
&nbsp;
database        hdb
suffix          <span style="color: #ff0000;">&quot;dc=logs&quot;</span>
<span style="color: #666666; font-style: italic;">#</span>
checkpoint      <span style="color: #000000;">32</span>      <span style="color: #000000;">30</span>
rootdn          <span style="color: #ff0000;">&quot;cn=admin,dc=logs&quot;</span>
<span style="color: #666666; font-style: italic;"># Cleartext passwords, especially for the rootdn, should</span>
<span style="color: #666666; font-style: italic;"># be avoid.  See slappasswd(8) and slapd.conf(5) for details.</span>
<span style="color: #666666; font-style: italic;"># Use of strong authentication encouraged.</span>
rootpw          <span style="color: #7a0874; font-weight: bold;">&#123;</span>CRYPT<span style="color: #7a0874; font-weight: bold;">&#125;</span>xVllx1Fyd0nd2
<span style="color: #666666; font-style: italic;"># The database directory MUST exist prior to running slapd AND</span>
<span style="color: #666666; font-style: italic;"># should only be accessible by the slapd and slap tools.</span>
<span style="color: #666666; font-style: italic;"># Mode 700 recommended.</span>
directory       <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>openldap-data-logs
<span style="color: #666666; font-style: italic;"># Indices to maintain</span>
index   objectClass     eq
&nbsp;
<span style="color: #666666; font-style: italic;">#######################################################################</span>
<span style="color: #666666; font-style: italic;">## BDB database definition for dc=effinger,dc=org</span>
<span style="color: #666666; font-style: italic;">########################################################################</span>
<span style="color: #666666; font-style: italic;">#</span>
database        hdb
suffix          <span style="color: #ff0000;">&quot;dc=effinger,dc=org&quot;</span>
<span style="color: #666666; font-style: italic;">#</span>
checkpoint      <span style="color: #000000;">32</span>      <span style="color: #000000;">30</span>
rootdn          <span style="color: #ff0000;">&quot;cn=admin,dc=effinger,dc=org&quot;</span>
<span style="color: #666666; font-style: italic;"># Cleartext passwords, especially for the rootdn, should</span>
<span style="color: #666666; font-style: italic;"># be avoid.  See slappasswd(8) and slapd.conf(5) for details.</span>
<span style="color: #666666; font-style: italic;"># Use of strong authentication encouraged.</span>
rootpw          <span style="color: #7a0874; font-weight: bold;">&#123;</span>CRYPT<span style="color: #7a0874; font-weight: bold;">&#125;</span>xVllx1Fyd0nd2
<span style="color: #666666; font-style: italic;"># The database directory MUST exist prior to running slapd AND</span>
<span style="color: #666666; font-style: italic;"># should only be accessible by the slapd and slap tools.</span>
<span style="color: #666666; font-style: italic;"># Mode 700 recommended.</span>
directory       <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>openldap-data-effinger.org
<span style="color: #666666; font-style: italic;"># Indices to maintain</span>
index   objectClass     eq</pre></div></div>

<p>Passwörter und die Domain müssen natürlich angepasst werden. Der Kontext dc=log wird übrigens zur Protokollierung der Zugriffe erstellt. Im nächsten Schritt erzeugen wir die notwendigen Verzeichnisse und setzen deren Berechtigungen.</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>lib<span style="color: #000000; font-weight: bold;">/</span>openldap-data-logs <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <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>lib<span style="color: #000000; font-weight: bold;">/</span>openldap-data-effinger.org <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openldap<span style="color: #000000; font-weight: bold;">/</span>slapd.d
<span style="color: #c20cb9; font-weight: bold;">chown</span> ldap.ldap <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>openldap-data-logs <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> ldap.ldap <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>openldap-data-effinger.org<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> ldap.ldap <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openldap<span style="color: #000000; font-weight: bold;">/</span>slapd.d
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">700</span> <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>openldap-data-logs <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">700</span> <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>openldap-data-effinger.org <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">750</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openldap<span style="color: #000000; font-weight: bold;">/</span>slapd.d</pre></div></div>

<p>Nun erzeugen wir aus der bestehenden slapd.conf das neuere LDIF-basierte Konfigurationsschema in das Verzeichnis /etc/openldap/slapd.d mit dem Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><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>openldap<span style="color: #000000; font-weight: bold;">/</span>slapd <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openldap<span style="color: #000000; font-weight: bold;">/</span>slapd.conf <span style="color: #660033;">-F</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openldap<span style="color: #000000; font-weight: bold;">/</span>slapd.d</pre></div></div>

<p>Danach beenden wir slapd mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-s</span> <span style="color: #000000;">15</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">pidof</span> slapd<span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

<p>Nun müssen wir nur noch das Passwort für die Konfiguration festlegen. Dazu editieren wir /etc/openldap/slapd.d/cn\=config/olcDatabase\=\{0\}config.ldif und fügen die Zeile olcRootPW unterhalb von olcRootDN hinzu:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">olcRootDN: <span style="color: #007800;">cn</span>=config
olcRootPW: <span style="color: #7a0874; font-weight: bold;">&#123;</span>CRYPT<span style="color: #7a0874; font-weight: bold;">&#125;</span>xVllx1Fyd0nd2</pre></div></div>

<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px;">

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">slappasswd <span style="color: #660033;">-h</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>MD5</pre></div></div>

</div>
<p>Wir gehen jetzt nochmal auf Nummer sicher mit den Verzeichnis- und Dateiberechtigungen</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-Rfv</span> ldap.ldap <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openldap<span style="color: #000000; font-weight: bold;">/</span>slapd.d
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #660033;">-Rfv</span> <span style="color: #000000;">700</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openldap<span style="color: #000000; font-weight: bold;">/</span>slapd.d<span style="color: #000000; font-weight: bold;">/*</span>
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-Rfv</span> ldap.ldap <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>openldap-data-logs
<span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-Rfv</span> ldap.ldap <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>openldap-data-effinger.org</pre></div></div>

<p>und editieren wir die Datei /etc/openldap/ldap.conf, um dort die Parameter entsprechend anzupassen</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">BASE    dc=effinger,dc=org
TLS_CACERT /etc/ssl/certs/ca-certificates.crt
URI     ldapi://%2fvar%2frun%2fopenldap%2fslapd.sock</pre></div></div>

<p>Dann passen wir noch die Startparameter von OpenLDAP an in der Datei /etc/conf.d/slapd und deaktivieren hier zunächst SSL.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># conf.d file for openldap</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># To enable both the standard unciphered server and the ssl encrypted</span>
<span style="color: #666666; font-style: italic;"># one uncomment this line or set any other server starting options</span>
<span style="color: #666666; font-style: italic;"># you may desire.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># OPTS=&quot;-h 'ldaps:// ldap:// ldapi://%2fvar%2frun%2fopenldap%2fslapd.sock'&quot;</span>
<span style="color: #666666; font-style: italic;"># Uncomment the below to use the new slapd configuration for openldap 2.3</span>
<span style="color: #666666; font-style: italic;">#OPTS=&quot;-F /etc/openldap/slapd.d -h 'ldaps:// ldap:// ldapi://%2fvar%2frun%2fopenldap%2fslapd.sock'&quot;</span>
<span style="color: #007800;">OPTS</span>=<span style="color: #ff0000;">&quot;-F /etc/openldap/slapd.d -h 'ldap:// ldapi://%2fvar%2frun%2fopenldap%2fslapd.sock'&quot;</span></pre></div></div>

<p>Abschließend fügen wir den OpenLDAP slapd Daemon zu den Services hinzu, die beim Hochfahren des Systems automatisch gestartet werden, und starten ihn</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rc-update add slapd default
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>slapd start</pre></div></div>

<p>Bevor aber Daten eingegeben werden können, müssen wir die dazu  erforderlichen Schemas einbinden mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapadd <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openldap<span style="color: #000000; font-weight: bold;">/</span>schema<span style="color: #000000; font-weight: bold;">/</span>cosine.ldif
ldapadd <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openldap<span style="color: #000000; font-weight: bold;">/</span>schema<span style="color: #000000; font-weight: bold;">/</span>inetorgperson.ldif
ldapadd <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openldap<span style="color: #000000; font-weight: bold;">/</span>schema<span style="color: #000000; font-weight: bold;">/</span>rfc2307bis.ldif
ldapadd <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openldap<span style="color: #000000; font-weight: bold;">/</span>schema<span style="color: #000000; font-weight: bold;">/</span>samba.ldif</pre></div></div>

<p>Wegen eGroupware ist es wichtig, das rfc2307bis-Schema und nicht das  nis-Schema zu verwenden. Falls zuvor das nis-Schema verwendet wurde,  sollte man zur Migration der entsprechenden <a href="http://svn.egroupware.org/egroupware/tags/1.4-beta3/phpgwapi/doc/ldap/README">Anleitung  von eGroupware</a> folgen. Vor der Migration sollte man am Besten das  Konfigurationsschema und den <a href="http://www.linuxforen.de/forums/showthread.php?t=263822">Datenbankinhalt  mit slapcat sichern</a>, um nach der Umstellung die <a href="http://www.openldap.org/lists/openldap-software/200406/msg00723.html">Datenbank  zu löschen</a> und mit slapadd wiederherzustellen.</p>
<p>Falls noch keine rfc2307bis.ldif vorhanden ist, kann man sich diese Datei nach meiner <a href="http://www.effinger.org/blog/2009/02/08/ldif-dateien-zur-konfiguration-von-openldap-bequem-erzeugen/">Konvertierungsanleitung</a> aus  der entsprechenden Schema-Datei von eGroupware (phpgwapi/doc/ldap/rfc2307bis.schema) erzeugen oder aber von hier kopieren</p>

<div class="wp_syntax"><div class="code"><pre class="ldif" style="font-family:monospace;">dn: cn=rfc2307bis,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: rfc2307bis
olcAttributeTypes: ( 1.3.6.1.1.1.1.2 NAME 'gecos' DESC 'The GECOS field; the common name' EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.3 NAME 'homeDirectory' DESC 'The absolute path to the home directory' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.4 NAME 'loginShell' DESC 'The path to the login shell' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.5 NAME 'shadowLastChange' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.6 NAME 'shadowMin' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.7 NAME 'shadowMax' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.8 NAME 'shadowWarning' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.9 NAME 'shadowInactive' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.10 NAME 'shadowExpire' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.11 NAME 'shadowFlag' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.12 NAME 'memberUid' EQUALITY caseExactIA5Match SUBSTR caseExactIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
olcAttributeTypes: ( 1.3.6.1.1.1.1.13 NAME 'memberNisNetgroup' EQUALITY caseExactIA5Match SUBSTR caseExactIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
olcAttributeTypes: ( 1.3.6.1.1.1.1.14 NAME 'nisNetgroupTriple' DESC 'Netgroup triple' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
olcAttributeTypes: ( 1.3.6.1.1.1.1.15 NAME 'ipServicePort' DESC 'Service port number' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.16 NAME 'ipServiceProtocol' DESC 'Service protocol name' SUP name )
olcAttributeTypes: ( 1.3.6.1.1.1.1.17 NAME 'ipProtocolNumber' DESC 'IP protocol number' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.18 NAME 'oncRpcNumber' DESC 'ONC RPC number' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.19 NAME 'ipHostNumber' DESC 'IPv4 addresses as a dotted decimal omitting leading        zeros or IPv6 addresses as defined in RFC2373' SUP name )
olcAttributeTypes: ( 1.3.6.1.1.1.1.20 NAME 'ipNetworkNumber' DESC 'IP network as a dotted decimal, eg. 192.168,        omitting leading zeros' SUP name SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.21 NAME 'ipNetmaskNumber' DESC 'IP netmask as a dotted decimal, eg. 255.255.255.0,        omitting leading zeros' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.22 NAME 'macAddress' DESC 'MAC address in maximal, colon separated hex        notation, eg. 00:00:92:90:ee:e2' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
olcAttributeTypes: ( 1.3.6.1.1.1.1.23 NAME 'bootParameter' DESC 'rpc.bootparamd parameter' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
olcAttributeTypes: ( 1.3.6.1.1.1.1.24 NAME 'bootFile' DESC 'Boot image name' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
olcAttributeTypes: ( 1.3.6.1.1.1.1.26 NAME 'nisMapName' DESC 'Name of a A generic NIS map' SUP name )
olcAttributeTypes: ( 1.3.6.1.1.1.1.27 NAME 'nisMapEntry' DESC 'A generic NIS entry' EQUALITY caseExactIA5Match SUBSTR caseExactIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.28 NAME 'nisPublicKey' DESC 'NIS public key' EQUALITY octetStringMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.29 NAME 'nisSecretKey' DESC 'NIS secret key' EQUALITY octetStringMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.30 NAME 'nisDomain' DESC 'NIS domain' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
olcAttributeTypes: ( 1.3.6.1.1.1.1.31 NAME 'automountMapName' DESC 'automount Map Name' EQUALITY caseExactIA5Match SUBSTR caseExactIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.32 NAME 'automountKey' DESC 'Automount Key value' EQUALITY caseExactIA5Match SUBSTR caseExactIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.1.1.1.33 NAME 'automountInformation' DESC 'Automount information' EQUALITY caseExactIA5Match SUBSTR caseExactIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
olcObjectClasses: ( 1.3.6.1.1.1.2.0 NAME 'posixAccount' DESC 'Abstraction of an account with POSIX attributes' SUP top AUXILIARY MUST ( cn $ uid $ uidNumber $ gidNumber $ homeDirectory ) MAY ( userPassword $ loginShell $ gecos $ description ) )
olcObjectClasses: ( 1.3.6.1.1.1.2.1 NAME 'shadowAccount' DESC 'Additional attributes for shadow passwords' SUP top AUXILIARY MUST uid MAY ( userPassword $ description $ shadowLastChange $ shadowMin $ shadowMax $ shadowWarning $ shadowInactive $ shadowExpire $ shadowFlag ) )
olcObjectClasses: ( 1.3.6.1.1.1.2.2 NAME 'posixGroup' DESC 'Abstraction of a group of accounts' SUP top AUXILIARY MUST gidNumber MAY ( userPassword $ memberUid $ description ) )
olcObjectClasses: ( 1.3.6.1.1.1.2.3 NAME 'ipService' DESC 'Abstraction an Internet Protocol service.        Maps an IP port and protocol (such as tcp or udp)        to one or more names; the distinguished value of        the cn attribute denotes the services canonical        name' SUP top STRUCTURAL MUST ( cn $ ipServicePort $ ipServiceProtocol ) MAY description )
olcObjectClasses: ( 1.3.6.1.1.1.2.4 NAME 'ipProtocol' DESC 'Abstraction of an IP protocol. Maps a protocol number        to one or more names. The distinguished value of the cn        attribute denotes the protocols canonical name' SUP top STRUCTURAL MUST ( cn $ ipProtocolNumber ) MAY description )
olcObjectClasses: ( 1.3.6.1.1.1.2.5 NAME 'oncRpc' DESC 'Abstraction of an Open Network Computing (ONC)       [RFC1057] Remote Procedure Call (RPC) binding.       This class maps an ONC RPC number to a name.       The distinguished value of the cn attribute denotes       the RPC services canonical name' SUP top STRUCTURAL MUST ( cn $ oncRpcNumber ) MAY description )
olcObjectClasses: ( 1.3.6.1.1.1.2.6 NAME 'ipHost' DESC 'Abstraction of a host, an IP device. The distinguished        value of the cn attribute denotes the hosts canonical        name. Device SHOULD be used as a structural class' SUP top AUXILIARY MUST ( cn $ ipHostNumber ) MAY ( userPassword $ l $ description $ manager ) )
olcObjectClasses: ( 1.3.6.1.1.1.2.7 NAME 'ipNetwork' DESC 'Abstraction of a network. The distinguished value of        the cn attribute denotes the networks canonical name' SUP top STRUCTURAL MUST ipNetworkNumber MAY ( cn $ ipNetmaskNumber $ l $ description $ manager ) )
olcObjectClasses: ( 1.3.6.1.1.1.2.8 NAME 'nisNetgroup' DESC 'Abstraction of a netgroup. May refer to other netgroups' SUP top STRUCTURAL MUST cn MAY ( nisNetgroupTriple $ memberNisNetgroup $ description ) )
olcObjectClasses: ( 1.3.6.1.1.1.2.9 NAME 'nisMap' DESC 'A generic abstraction of a NIS map' SUP top STRUCTURAL MUST nisMapName MAY description )
olcObjectClasses: ( 1.3.6.1.1.1.2.10 NAME 'nisObject' DESC 'An entry in a NIS map' SUP top STRUCTURAL MUST ( cn $ nisMapEntry $ nisMapName ) MAY description )
olcObjectClasses: ( 1.3.6.1.1.1.2.11 NAME 'ieee802Device' DESC 'A device with a MAC address; device SHOULD be        used as a structural class' SUP top AUXILIARY MAY macAddress )
olcObjectClasses: ( 1.3.6.1.1.1.2.12 NAME 'bootableDevice' DESC 'A device with boot parameters; device SHOULD be        used as a structural class' SUP top AUXILIARY MAY ( bootFile $ bootParameter ) )
olcObjectClasses: ( 1.3.6.1.1.1.2.14 NAME 'nisKeyObject' DESC 'An object with a public and secret key' SUP top AUXILIARY MUST ( cn $ nisPublicKey $ nisSecretKey ) MAY ( uidNumber $ description ) )
olcObjectClasses: ( 1.3.6.1.1.1.2.15 NAME 'nisDomainObject' DESC 'Associates a NIS domain with a naming context' SUP top AUXILIARY MUST nisDomain )
olcObjectClasses: ( 1.3.6.1.1.1.2.16 NAME 'automountMap' SUP top STRUCTURAL MUST automountMapName MAY description )
olcObjectClasses: ( 1.3.6.1.1.1.2.17 NAME 'automount' DESC 'Automount information' SUP top STRUCTURAL MUST ( automountKey $ automountInformation ) MAY description )
olcObjectClasses: ( 1.3.6.1.4.1.5322.13.1.1 NAME 'namedObject' SUP top STRUCTURAL MAY cn )</pre></div></div>

<p>Entsprechendes gilt auch für die samba.ldif, die ich mir aus der /etc/openldap/schema/samba.schema erzeugt habe (diese Datei wird erzeugt, wenn man mit samba installiert). Hier ist ihr Inhalt aufgeführt:</p>

<div class="wp_syntax"><div class="code"><pre class="ldif" style="font-family:monospace;">dn: cn=samba,cn=schema,cn=config
objectClass: olcSchemaConfig
cn: samba
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.24 NAME 'sambaLMPassword' DESC 'LanManager Password' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.25 NAME 'sambaNTPassword' DESC 'MD4 hash of the unicode password' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.26 NAME 'sambaAcctFlags' DESC 'Account Flags' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{16} SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.27 NAME 'sambaPwdLastSet' DESC 'Timestamp of the last password update' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.28 NAME 'sambaPwdCanChange' DESC 'Timestamp of when the user is allowed to update the password' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.29 NAME 'sambaPwdMustChange' DESC 'Timestamp of when the password will expire' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.30 NAME 'sambaLogonTime' DESC 'Timestamp of last logon' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.31 NAME 'sambaLogoffTime' DESC 'Timestamp of last logoff' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.32 NAME 'sambaKickoffTime' DESC 'Timestamp of when the user will be logged off automatically' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.48 NAME 'sambaBadPasswordCount' DESC 'Bad password attempt count' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.49 NAME 'sambaBadPasswordTime' DESC 'Time of the last bad password attempt' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.55 NAME 'sambaLogonHours' DESC 'Logon Hours' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{42} SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.33 NAME 'sambaHomeDrive' DESC 'Driver letter of home directory mapping' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{4} SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.34 NAME 'sambaLogonScript' DESC 'Logon script path' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.35 NAME 'sambaProfilePath' DESC 'Roaming profile path' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.36 NAME 'sambaUserWorkstations' DESC 'List of user workstations the user is allowed to logon to' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{255} SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.37 NAME 'sambaHomePath' DESC 'Home directory UNC path' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.38 NAME 'sambaDomainName' DESC 'Windows NT domain to which the user belongs' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{128} )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.47 NAME 'sambaMungedDial' DESC 'Base64 encoded user parameter string' EQUALITY caseExactMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{1050} )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.54 NAME 'sambaPasswordHistory' DESC 'Concatenated MD5 hashes of the salted NT passwords used on this account' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{32} )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.20 NAME 'sambaSID' DESC 'Security ID' EQUALITY caseIgnoreIA5Match SUBSTR caseExactIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.23 NAME 'sambaPrimaryGroupSID' DESC 'Primary Group Security ID' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.51 NAME 'sambaSIDList' DESC 'Security ID List' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26{64} )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.19 NAME 'sambaGroupType' DESC 'NT Group Type' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.21 NAME 'sambaNextUserRid' DESC 'Next NT rid to give our for users' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.22 NAME 'sambaNextGroupRid' DESC 'Next NT rid to give out for groups' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.39 NAME 'sambaNextRid' DESC 'Next NT rid to give out for anything' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.40 NAME 'sambaAlgorithmicRidBase' DESC 'Base at which the samba RID generation algorithm should operate' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.41 NAME 'sambaShareName' DESC 'Share Name' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.42 NAME 'sambaOptionName' DESC 'Option Name' EQUALITY caseIgnoreMatch SUBSTR caseIgnoreSubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15{256} )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.43 NAME 'sambaBoolOption' DESC 'A boolean option' EQUALITY booleanMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.44 NAME 'sambaIntegerOption' DESC 'An integer option' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.45 NAME 'sambaStringOption' DESC 'A string option' EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.46 NAME 'sambaStringListOption' DESC 'A string list option' EQUALITY caseIgnoreMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.53 NAME 'sambaTrustFlags' DESC 'Trust Password Flags' EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.58 NAME 'sambaMinPwdLength' DESC 'Minimal password length (default: 5)' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.59 NAME 'sambaPwdHistoryLength' DESC 'Length of Password History Entries (default: 0 =&gt; off)' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.60 NAME 'sambaLogonToChgPwd' DESC 'Force Users to logon for password change (default: 0 =&gt; off, 2 =&gt; on)' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.61 NAME 'sambaMaxPwdAge' DESC 'Maximum password age, in seconds (default: -1 =&gt; never expire passwords)' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.62 NAME 'sambaMinPwdAge' DESC 'Minimum password age, in seconds (default: 0 =&gt; allow immediate password change)' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.63 NAME 'sambaLockoutDuration' DESC 'Lockout duration in minutes (default: 30, -1 =&gt; forever)' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.64 NAME 'sambaLockoutObservationWindow' DESC 'Reset time after lockout in minutes (default: 30)' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.65 NAME 'sambaLockoutThreshold' DESC 'Lockout users after bad logon attempts (default: 0 =&gt; off)' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.66 NAME 'sambaForceLogoff' DESC 'Disconnect Users outside logon hours (default: -1 =&gt; off, 0 =&gt; on)' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcAttributeTypes: ( 1.3.6.1.4.1.7165.2.1.67 NAME 'sambaRefuseMachinePwdChange' DESC 'Allow Machine Password changes (default: 0 =&gt; off)' EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE )
olcObjectClasses: ( 1.3.6.1.4.1.7165.2.2.6 NAME 'sambaSamAccount' DESC 'Samba 3.0 Auxilary SAM Account' SUP top AUXILIARY MUST ( uid $ sambaSID ) MAY ( cn $ sambaLMPassword $ sambaNTPassword $ sambaPwdLastSet $ sambaLogonTime $ sambaLogoffTime $ sambaKickoffTime $ sambaPwdCanChange $ sambaPwdMustChange $ sambaAcctFlags $ displayName $ sambaHomePath $ sambaHomeDrive $ sambaLogonScript $ sambaProfilePath $ description $ sambaUserWorkstations $ sambaPrimaryGroupSID $ sambaDomainName $ sambaMungedDial $ sambaBadPasswordCount $ sambaBadPasswordTime $ sambaPasswordHistory $ sambaLogonHours ) )
olcObjectClasses: ( 1.3.6.1.4.1.7165.2.2.4 NAME 'sambaGroupMapping' DESC 'Samba Group Mapping' SUP top AUXILIARY MUST ( gidNumber $ sambaSID $ sambaGroupType ) MAY ( displayName $ description $ sambaSIDList ) )
olcObjectClasses: ( 1.3.6.1.4.1.7165.2.2.14 NAME 'sambaTrustPassword' DESC 'Samba Trust Password' SUP top STRUCTURAL MUST ( sambaDomainName $ sambaNTPassword $ sambaTrustFlags ) MAY ( sambaSID $ sambaPwdLastSet ) )
olcObjectClasses: ( 1.3.6.1.4.1.7165.2.2.15 NAME 'sambaTrustedDomainPassword' DESC 'Samba Trusted Domain Password' SUP top STRUCTURAL MUST ( sambaDomainName $ sambaSID $ sambaNTPassword $ sambaPwdLastSet ) )
olcObjectClasses: ( 1.3.6.1.4.1.7165.2.2.5 NAME 'sambaDomain' DESC 'Samba Domain Information' SUP top STRUCTURAL MUST ( sambaDomainName $ sambaSID ) MAY ( sambaNextRid $ sambaNextGroupRid $ sambaNextUserRid $ sambaAlgorithmicRidBase $ sambaMinPwdLength $ sambaPwdHistoryLength $ sambaLogonToChgPwd $ sambaMaxPwdAge $ sambaMinPwdAge $ sambaLockoutDuration $ sambaLockoutObservationWindow $ sambaLockoutThreshold $ sambaForceLogoff $ sambaRefuseMachinePwdChange ) )
olcObjectClasses: ( 1.3.6.1.4.1.7165.2.2.7 NAME 'sambaUnixIdPool' DESC 'Pool for allocating UNIX uids/gids' SUP top AUXILIARY MUST ( uidNumber $ gidNumber ) )
olcObjectClasses: ( 1.3.6.1.4.1.7165.2.2.8 NAME 'sambaIdmapEntry' DESC 'Mapping from a SID to an ID' SUP top AUXILIARY MUST sambaSID MAY ( uidNumber $ gidNumber ) )
olcObjectClasses: ( 1.3.6.1.4.1.7165.2.2.9 NAME 'sambaSidEntry' DESC 'Structural Class for a SID' SUP top STRUCTURAL MUST sambaSID )
olcObjectClasses: ( 1.3.6.1.4.1.7165.2.2.10 NAME 'sambaConfig' DESC 'Samba Configuration Section' SUP top AUXILIARY MAY description )
olcObjectClasses: ( 1.3.6.1.4.1.7165.2.2.11 NAME 'sambaShare' DESC 'Samba Share Section' SUP top STRUCTURAL MUST sambaShareName MAY description )
olcObjectClasses: ( 1.3.6.1.4.1.7165.2.2.12 NAME 'sambaConfigOption' DESC 'Samba Configuration Option' SUP top STRUCTURAL MUST sambaOptionName MAY ( sambaBoolOption $ sambaIntegerOption $ sambaStringOption $ sambaStringListoption $ description ) )</pre></div></div>

<p>Der nächste Schritt kann übersprungen werden, falls man nicht meinem Mailserversetup folgen möchte: Wir fügen die in  meinem <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-1-openldap/">anderen  Artikel</a> aufgeführten Schemas  <span style="text-decoration: underline;">dyngroup.schema.ldif</span> und <span style="text-decoration: underline;">dovecot.schema.ldif</span> hinzu (siehe  dort).</p>
<p>Darüber hinaus erstellen wir den Eintrag für die Module, die geladen werden sollen und die Aktivierung der Module. Dazu erzeugen wir die Datei module_basis.ldif mit dem Inhalt</p>

<div class="wp_syntax"><div class="code"><pre class="ldif" style="font-family:monospace;">dn: cn=module,cn=config
objectclass: olcModuleList
cn: module
olcModulePath: /usr/lib/openldap/openldap</pre></div></div>

<p>und die Datei module_load.ldif mit dem Inhalt</p>

<div class="wp_syntax"><div class="code"><pre class="ldif" style="font-family:monospace;">dn: cn=module{0},cn=config
changetype: modify
add: olcModuleLoad
olcModuleLoad: dynlist.so
olcModuleLoad: accesslog.so</pre></div></div>

<p>Dann fügen wir den Inhalt cn=config hinzu mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapadd <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> module_basis.ldif
ldapmodify <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> module_load.ldif</pre></div></div>

<h3>Festlegen der Basisstruktur des LDAP-Verzeichnises und Eintrag bestehender Daten</h3>
<p>Nun können wir die Grundstruktur der Daten ergänzen. Dazu erzeugen wir wieder eine LDIF-Datei namens data.ldif mit dem Inhalt</p>

<div class="wp_syntax"><div class="code"><pre class="ldif" style="font-family:monospace;">dn: dc=effinger,dc=org
objectClass: dcObject
objectClass: organization
dc: effinger
o: effinger
&nbsp;
dn: o=default,dc=effinger,dc=org
objectClass: organization
objectClass: top
o: default
&nbsp;
dn: ou=accounts,o=default,dc=effinger,dc=org
objectClass: organizationalUnit
objectClass: top
ou: accounts
&nbsp;
dn: ou=groups,o=default,dc=effinger,dc=org
objectClass: organizationalUnit
objectClass: top
ou: groups
&nbsp;
dn: ou=machines,o=default,dc=effinger,dc=org
objectClass: organizationalUnit
objectClass: top
ou: machines
&nbsp;
dn: ou=contacts,o=default,dc=effinger,dc=org
objectClass: organizationalUnit
objectClass: top
ou: contacts</pre></div></div>

<p>und fügen Sie dem Verzeichnis durch den Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapadd <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=admin,dc=effinger,dc=org&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> data.ldif</pre></div></div>

<p>hinzu. Ganz wichtig ist übrigens, dass die <strong>Passwörter mit dem CRYPT-Algorithmus</strong> gehasht sind, denn ansonsten schlägt das Modul pam_unix fehl und man kann sich nicht einloggen. Also vorher bitte sicherstellen, dass die Passwörter mit dem Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">slappasswd <span style="color: #660033;">-h</span> <span style="color: #ff0000;">&quot;{CRYPT}&quot;</span></pre></div></div>

<p>erzeugt werden. Diese Information stammt aus dem <a href="http://www.brandonhutchinson.com/wiki/Pam_unix_vs._pam_ldap">Wiki-Artikel von Brandon Hutchinson</a>.</p>
<h3>Einrichten des Systems für die Authentifizierung mit LDAP</h3>
<p>Wir installieren pam_ldap und nss_ldap mit einem</p>

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

<p>Damit pam und nss LDAP zur Authentifizierung verwendet, müssen verschiedene Dateien angepasst werden. Die folgende Beschreibung orientiert sich dabei an der <a href="http://www.gentoo.org/doc/en/ldap-howto.xml#doc_chap3">Gentoo-Dokumentation</a>. Wir beginnen mit /etc/ldap.conf, die von pam_ldap und nss_ldap verwendet wird. Im Gegensatz dazu  lesen OpenLDAP und dessen Bibliotheken d/etc/openldap/ldap.conf aus, welche &#8211; falls wir das weiter oben nicht schon getan hätten &#8211; auch angepasst werden müsste. Bei mir sieht die Datei /etc/ldap.conf nun folgendermaßen aus:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">uri ldapi:<span style="color: #000000; font-weight: bold;">//%</span>2fvar<span style="color: #000000; font-weight: bold;">%</span>2frun<span style="color: #000000; font-weight: bold;">%</span>2fopenldap<span style="color: #000000; font-weight: bold;">%</span>2fslapd.sock
ldap_version <span style="color: #000000;">3</span>
scope one
pam_filter <span style="color: #007800;">objectclass</span>=posixAccount
pam_login_attribute uid
pam_member_attribute memberuid
pam_password exop
nss_base_passwd <span style="color: #007800;">ou</span>=accounts,<span style="color: #007800;">o</span>=default,<span style="color: #007800;">dc</span>=effinger,<span style="color: #007800;">dc</span>=org?one
nss_base_shadow <span style="color: #007800;">ou</span>=accounts,<span style="color: #007800;">o</span>=default,<span style="color: #007800;">dc</span>=effinger,<span style="color: #007800;">dc</span>=org?one
nss_base_group  <span style="color: #007800;">ou</span>=<span style="color: #c20cb9; font-weight: bold;">groups</span>,<span style="color: #007800;">o</span>=default,<span style="color: #007800;">dc</span>=effinger,<span style="color: #007800;">dc</span>=org?one
nss_base_hosts  <span style="color: #007800;">ou</span>=machines,<span style="color: #007800;">o</span>=default,<span style="color: #007800;">dc</span>=effinger,<span style="color: #007800;">dc</span>=org?one
nss_reconnect_tries <span style="color: #000000;">4</span>                   <span style="color: #666666; font-style: italic;"># number of times to double the sleep time</span>
nss_reconnect_sleeptime <span style="color: #000000;">1</span>               <span style="color: #666666; font-style: italic;"># initial sleep value</span>
nss_reconnect_maxsleeptime <span style="color: #000000;">16</span>   <span style="color: #666666; font-style: italic;"># max sleep value to cap at</span>
nss_reconnect_maxconntries <span style="color: #000000;">2</span>    <span style="color: #666666; font-style: italic;"># how many tries before sleeping</span></pre></div></div>

<p>Nun passen wir noch die Datei /etc/pam.d/system-auth an</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">auth            required        pam_env.so
auth            sufficient      pam_unix.so try_first_pass likeauth nullok
auth            sufficient      pam_ldap.so use_first_pass
auth            required        pam_deny.so
&nbsp;
account         sufficient      pam_ldap.so
account         required        pam_unix.so
&nbsp;
password        required        pam_cracklib.so difok=2 minlen=8 dcredit=2 ocredit=2 retry=3
password        sufficient      pam_unix.so try_first_pass use_authtok nullok sha512 shadow
password        sufficient      pam_ldap.so use_authtok use_first_pass
password        required        pam_deny.so
&nbsp;
session         required        pam_limits.so
session         required        pam_env.so
session         required        pam_unix.so
session         optional        pam_permit.so
session         optional        pam_ldap.so</pre></div></div>

<p>Ich musste hier alle Zeilen mit pam_ldap ergänzen. Bitte dabei unbedingt die gleiche Reihenfolge der Module beibehalten. Als letztes passen wir noch /etc/nsswitch.conf an (in den aufgeführten drei Zeilen hinten das Wort ldap ergänzen):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">passwd</span>:      compat ldap
shadow:      compat ldap
group:       compat ldap</pre></div></div>

<p>Damit sind wir fertig. Falls ein Benutzeraccount unter ou=accounts,o=default,dc=effinger,dc=org existiert, sollte er nach dem Aufruf von</p>

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

<p>aufgeführt werden. Für Benutzergruppen gibt es den analogen Befehl</p>

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

<p>Zum Schluss möchte ich noch anmerken, dass man LDAP damit auch als zentralen Server zur Benutzerauthentifizierung einsetzen kann. Dazu muss auf den Clients selbstverständlich die LDAP-URL vom obigen Beispiel angepasst werden, da sie hier ja auf einen lokalen Unix-Socket verweist.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2010/05/08/openldap-fur-pam_ldap-nss_ldap-unter-gentoo-im-schnelldurchgang-einrichten/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dovecot, Exim, OpenLDAP und getmail unter Ubuntu &#8211; (4) getmail</title>
		<link>http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-4-getmail/</link>
		<comments>http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-4-getmail/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 17:00:18 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[exim]]></category>
		<category><![CDATA[getmail]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[OpenLDAP]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=657</guid>
		<description><![CDATA[<p>Nachdem wir in den drei ersten Teilen zunächst OpenLDAP, Dovecot und Exim eingerichtet haben, geht es nun daran, getmail so einzurichten, dass Mails von einem externen Server via POP3 oder IMAP abgerufen werden und dann dem entsprechenden lokalen Benutzer zugestellt werden. Obwohl fast alles im Blog detailliert beschrieben ist, empfehle ich, die Konfigurationsdateien für das [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem wir in den drei ersten Teilen zunächst <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-1-openldap/">OpenLDAP</a>, <a href="http://www.effinger.org/blog/2009/03/22/dovecot-postfix-openldap-und-getmail-unter-ubuntu-2-dovecot/">Dovecot</a> und <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-3-exim/">Exim</a> eingerichtet haben, geht es nun daran, getmail so einzurichten, dass Mails von einem externen Server via POP3 oder IMAP abgerufen werden und dann dem entsprechenden lokalen Benutzer zugestellt werden. Obwohl fast alles im Blog detailliert beschrieben ist, empfehle ich, die <a href="http://www.effinger.org/blog/wp-content/uploads/2009/03/configfiles-mailsystem.tgz">Konfigurationsdateien für das Mailsystem herunterzuladen</a>.</p>
<h2>Installation</h2>
<p>Wir installieren getmail und das benötigte python-Modul durch den Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> getmail4 python-ldap</pre></div></div>

<h2>Konfiguration zum Mailabruf von externen Servern</h2>
<p>Der Benutzer secmail wird für uns alle Mails abholen und an den jeweiligen Nutzer zustellen. Für diesen Zweck habe ich das Python-Skript getmail-ldap.py geschrieben. Es liest zunächst die Login-Daten aller externen Mail-Accounts aus dem LDAP-Verzeichnis und erzeugt für jeden Mailaccount eine entsprechende Konfigurationsdatei zur Verwendung mit getmail. Anschließend ruft es getmail auf und benachrichtigt im Falle einer Fehlermeldung den Administrator per E-Mail. Die folgenden Schritte führen wir unter dem Benutzer secmail durch, damit die Dateien mit der entsprechenden Berechtigung erzeugt werden. Dazu rufen wir sudo auf:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-u</span> secmail <span style="color: #660033;">-s</span></pre></div></div>

<p>Den folgenden Inhalt</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/python</span>
<span style="color: #808080; font-style: italic;"># File: getmail-ldap.py</span>
<span style="color: #ff7700;font-weight:bold;">try</span>:
	<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">errno</span>
	<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">string</span>
	<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">logging</span>
	<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">logging</span>.<span style="color: black;">handlers</span>
	<span style="color: #ff7700;font-weight:bold;">import</span> ldap
	<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">ConfigParser</span>
	<span style="color: #ff7700;font-weight:bold;">import</span> ldif
	<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">threading</span>
	<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">StringIO</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">StringIO</span>
	<span style="color: #ff7700;font-weight:bold;">from</span> ldap.<span style="color: black;">cidict</span> <span style="color: #ff7700;font-weight:bold;">import</span> cidict
	<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span> <span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
	<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">subprocess</span> <span style="color: #ff7700;font-weight:bold;">import</span> Popen,PIPE
<span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">ImportError</span>:
	<span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;&quot;&quot;Cannot find all required libraries please install them and try again&quot;&quot;&quot;</span>
	<span style="color: #ff7700;font-weight:bold;">raise</span> <span style="color: #008000;">SystemExit</span>
&nbsp;
config_file_location = <span style="color: #483d8b;">'/home/secmail/getmail-ldap.cfg'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> pid_exists<span style="color: black;">&#40;</span>pid<span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;Is there a process with PID pid?&quot;&quot;&quot;</span>
    <span style="color: #ff7700;font-weight:bold;">if</span> pid <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">0</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">False</span>
&nbsp;
    exist = <span style="color: #008000;">False</span>
    <span style="color: #ff7700;font-weight:bold;">try</span>:
        <span style="color: #dc143c;">os</span>.<span style="color: black;">kill</span><span style="color: black;">&#40;</span>pid, <span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
        exist = <span style="color: #ff4500;">1</span>
    <span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">OSError</span>, x:
        <span style="color: #ff7700;font-weight:bold;">if</span> x.<span style="color: #dc143c;">errno</span> <span style="color: #66cc66;">!</span>= <span style="color: #dc143c;">errno</span>.<span style="color: black;">ESRCH</span>:
            <span style="color: #ff7700;font-weight:bold;">raise</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">return</span> exist
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> get_search_results<span style="color: black;">&#40;</span>results<span style="color: black;">&#41;</span>:
    <span style="color: #483d8b;">&quot;&quot;&quot;Given a set of results, return a list of LDAPSearchResult
    objects.
    &quot;&quot;&quot;</span>
    res = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">type</span><span style="color: black;">&#40;</span>results<span style="color: black;">&#41;</span> == <span style="color: #008000;">tuple</span> <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>results<span style="color: black;">&#41;</span> == <span style="color: #ff4500;">2</span> :
        <span style="color: black;">&#40;</span><span style="color: #dc143c;">code</span>, arr<span style="color: black;">&#41;</span> = results
    <span style="color: #ff7700;font-weight:bold;">elif</span> <span style="color: #008000;">type</span><span style="color: black;">&#40;</span>results<span style="color: black;">&#41;</span> == <span style="color: #008000;">list</span>:
        arr = results
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>results<span style="color: black;">&#41;</span> == <span style="color: #ff4500;">0</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> res
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">for</span> item <span style="color: #ff7700;font-weight:bold;">in</span> arr:
        res.<span style="color: black;">append</span><span style="color: black;">&#40;</span> LDAPSearchResult<span style="color: black;">&#40;</span>item<span style="color: black;">&#41;</span> <span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">return</span> res
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> LDAPSearchResult:
    <span style="color: #483d8b;">&quot;&quot;&quot;A class to model LDAP results.
    &quot;&quot;&quot;</span>
&nbsp;
    dn = <span style="color: #483d8b;">''</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, entry_tuple<span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;&quot;Create a new LDAPSearchResult object.&quot;&quot;&quot;</span>
        <span style="color: black;">&#40;</span>dn, attrs<span style="color: black;">&#41;</span> = entry_tuple
        <span style="color: #ff7700;font-weight:bold;">if</span> dn:
            <span style="color: #008000;">self</span>.<span style="color: black;">dn</span> = dn
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            <span style="color: #ff7700;font-weight:bold;">return</span>
&nbsp;
        <span style="color: #008000;">self</span>.<span style="color: black;">attrs</span> = cidict<span style="color: black;">&#40;</span>attrs<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> get_attributes<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;&quot;Get a dictionary of all attributes.
        get_attributes()-&gt;{'name1':['value1','value2',...],
				'name2: [value1...]}
        &quot;&quot;&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">attrs</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> set_attributes<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, attr_dict<span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;&quot;Set the list of attributes for this record.
&nbsp;
        The format of the dictionary should be string key, list of
        string alues. e.g. {'cn': ['M Butcher','Matt Butcher']}
&nbsp;
        set_attributes(attr_dictionary)
        &quot;&quot;&quot;</span>
&nbsp;
        <span style="color: #008000;">self</span>.<span style="color: black;">attrs</span> = cidict<span style="color: black;">&#40;</span>attr_dict<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> has_attribute<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, attr_name<span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;&quot;Returns true if there is an attribute by this name in the
        record.
&nbsp;
        has_attribute(string attr_name)-&gt;boolean
        &quot;&quot;&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">attrs</span>.<span style="color: black;">has_key</span><span style="color: black;">&#40;</span> attr_name <span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> get_attr_values<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, key<span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;&quot;Get a list of attribute values.
        get_attr_values(string key)-&gt;['value1','value2']
        &quot;&quot;&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">attrs</span><span style="color: black;">&#91;</span>key<span style="color: black;">&#93;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> get_attr_names<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;&quot;Get a list of attribute names.
        get_attr_names()-&gt;['name1','name2',...]
        &quot;&quot;&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">attrs</span>.<span style="color: black;">keys</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> get_dn<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;&quot;Get the DN string for the record.
        get_dn()-&gt;string dn
        &quot;&quot;&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">self</span>.<span style="color: black;">dn</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> pretty_print<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;&quot;Create a nice string representation of this object.
&nbsp;
        pretty_print()-&gt;string
        &quot;&quot;&quot;</span>
        <span style="color: #008000;">str</span> = <span style="color: #483d8b;">&quot;DN: &quot;</span> + <span style="color: #008000;">self</span>.<span style="color: black;">dn</span> + <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">for</span> a, v_list <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">self</span>.<span style="color: black;">attrs</span>.<span style="color: black;">iteritems</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
            <span style="color: #008000;">str</span> = <span style="color: #008000;">str</span> + <span style="color: #483d8b;">&quot;Name: &quot;</span> + a + <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
            <span style="color: #ff7700;font-weight:bold;">for</span> v <span style="color: #ff7700;font-weight:bold;">in</span> v_list:
                <span style="color: #008000;">str</span> = <span style="color: #008000;">str</span> + <span style="color: #483d8b;">&quot;  Value: &quot;</span> + v + <span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span>
        <span style="color: #008000;">str</span> = <span style="color: #008000;">str</span> + <span style="color: #483d8b;">&quot;========&quot;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">str</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> to_ldif<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #483d8b;">&quot;&quot;&quot;Get an LDIF representation of this record.
&nbsp;
        to_ldif()-&gt;string
        &quot;&quot;&quot;</span>
        out = <span style="color: #dc143c;">StringIO</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        ldif_out = ldif.<span style="color: black;">LDIFWriter</span><span style="color: black;">&#40;</span>out<span style="color: black;">&#41;</span>
        ldif_out.<span style="color: black;">unparse</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">dn</span>, <span style="color: #008000;">self</span>.<span style="color: black;">attrs</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> out.<span style="color: black;">getvalue</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> RetrieveMails<span style="color: black;">&#40;</span><span style="color: #dc143c;">threading</span>.<span style="color: black;">Thread</span><span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, getmail_binary, config_filename, config_data_dir<span style="color: black;">&#41;</span>:
		<span style="color: #dc143c;">threading</span>.<span style="color: black;">Thread</span>.<span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>
		<span style="color: #008000;">self</span>.<span style="color: black;">getmail_binary</span>, <span style="color: #008000;">self</span>.<span style="color: black;">config_filename</span>, <span style="color: #008000;">self</span>.<span style="color: black;">config_data_dir</span> = \
			getmail_binary, config_filename, config_data_dir
	<span style="color: #ff7700;font-weight:bold;">def</span> run<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">try</span>:
			command = <span style="color: black;">&#91;</span><span style="color: #008000;">self</span>.<span style="color: black;">getmail_binary</span>, \
				<span style="color: #808080; font-style: italic;">#'--quiet', \</span>
				<span style="color: #483d8b;">'--rcfile='</span> + <span style="color: #008000;">self</span>.<span style="color: black;">config_filename</span>, \
				<span style="color: #483d8b;">'--getmaildir='</span> + <span style="color: #008000;">self</span>.<span style="color: black;">config_data_dir</span><span style="color: black;">&#93;</span>
			<span style="color: #008000;">self</span>.<span style="color: black;">pid_filename</span> = <span style="color: #008000;">self</span>.<span style="color: black;">config_filename</span> + <span style="color: #483d8b;">'.pid'</span>
			<span style="color: #808080; font-style: italic;"># Check for a pidfile to see if the daemon already runs</span>
			<span style="color: #ff7700;font-weight:bold;">try</span>:
				pid_file = <span style="color: #008000;">file</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">pid_filename</span>,<span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>
				pid_number = pid = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>pid_file.<span style="color: black;">read</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
				pid_file.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
			<span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">IOError</span>:
				pid = <span style="color: #008000;">None</span>
			<span style="color: #808080; font-style: italic;"># Check whether process is really running</span>
			<span style="color: #ff7700;font-weight:bold;">if</span> pid:
				pid = pid_exists<span style="color: black;">&#40;</span>pid<span style="color: black;">&#41;</span>
			<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> pid:
				getmail_process = Popen<span style="color: black;">&#40;</span>command, shell=<span style="color: #008000;">False</span>,stdout=PIPE,stderr=PIPE<span style="color: black;">&#41;</span>
				<span style="color: #ff7700;font-weight:bold;">try</span>:
					<span style="color: #008000;">file</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">pid_filename</span>,<span style="color: #483d8b;">'w+'</span><span style="color: black;">&#41;</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;%s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #66cc66;">%</span> getmail_process.<span style="color: black;">pid</span><span style="color: black;">&#41;</span>
					getmail_process.<span style="color: black;">wait</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
				<span style="color: #ff7700;font-weight:bold;">finally</span>:
					<span style="color: #dc143c;">os</span>.<span style="color: black;">remove</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">pid_filename</span><span style="color: black;">&#41;</span>
					<span style="color: #808080; font-style: italic;"># Zur Sicherheit die erstellte Konfigurationsdatei loeschen (Login-Daten!)</span>
					<span style="color: #dc143c;">os</span>.<span style="color: black;">remove</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">config_filename</span><span style="color: black;">&#41;</span>
				stderr_output=<span style="color: #dc143c;">string</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>getmail_process.<span style="color: black;">stderr</span>.<span style="color: black;">readlines</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
				<span style="color: #ff7700;font-weight:bold;">if</span> getmail_process.<span style="color: black;">returncode</span> <span style="color: #66cc66;">&lt;&gt;</span> <span style="color: #ff4500;">0</span> <span style="color: #ff7700;font-weight:bold;">or</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>stderr_output.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">&gt;</span><span style="color: #ff4500;">0</span> :
					<span style="color: #ff7700;font-weight:bold;">raise</span> <span style="color: #008000;">Exception</span>, <span style="color: #483d8b;">&quot;Getmail command failed for &quot;</span> + <span style="color: #483d8b;">&quot; &quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>command<span style="color: black;">&#41;</span> \
						+<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>StdErr: <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> + <span style="color: #dc143c;">string</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>stderr_output.<span style="color: black;">strip</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> \
						+<span style="color: #483d8b;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>StdOut: <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> + <span style="color: #dc143c;">string</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>getmail_process.<span style="color: black;">stdout</span>.<span style="color: black;">readlines</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
			<span style="color: #ff7700;font-weight:bold;">else</span>:
				log_object.<span style="color: black;">info</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Command &quot;</span> + <span style="color: #483d8b;">&quot; &quot;</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>command<span style="color: black;">&#41;</span> +\
					<span style="color: #483d8b;">&quot; not executed, existing pid &quot;</span> + <span style="color: #008000;">str</span><span style="color: black;">&#40;</span>pid_number<span style="color: black;">&#41;</span> + <span style="color: #483d8b;">&quot; found&quot;</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">except</span>:
			log_object.<span style="color: black;">exception</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;An error occured!&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> RetrieveAccount:
	account_name = <span style="color: #008000;">None</span>
	account_type = <span style="color: #008000;">None</span>
	login = <span style="color: #008000;">None</span>
	password = <span style="color: #008000;">None</span>
	server = <span style="color: #008000;">None</span>
	<span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, account_name=<span style="color: #008000;">None</span>, account_type=<span style="color: #008000;">None</span>, server=<span style="color: #008000;">None</span>, login=<span style="color: #008000;">None</span>, password=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span>:
		<span style="color: #008000;">self</span>.<span style="color: black;">account_name</span>, <span style="color: #008000;">self</span>.<span style="color: black;">account_type</span>, <span style="color: #008000;">self</span>.<span style="color: black;">login</span>, <span style="color: #008000;">self</span>.<span style="color: black;">password</span>, <span style="color: #008000;">self</span>.<span style="color: black;">server</span> = \
			account_name, account_type, login, password, server
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> GetmailConfigFile<span style="color: black;">&#40;</span><span style="color: #dc143c;">ConfigParser</span>.<span style="color: black;">SafeConfigParser</span><span style="color: black;">&#41;</span>:
	output_filename = <span style="color: #008000;">None</span>
	<span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, defaults, default_config_filename=<span style="color: #008000;">None</span>, output_filename=<span style="color: #008000;">None</span><span style="color: black;">&#41;</span>:
		<span style="color: #dc143c;">ConfigParser</span>.<span style="color: black;">SafeConfigParser</span>.<span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, defaults<span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> default_config_filename <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">None</span>:
			<span style="color: #008000;">self</span>.<span style="color: black;">read</span><span style="color: black;">&#40;</span>default_config_filename<span style="color: black;">&#41;</span>
		<span style="color: #008000;">self</span>.<span style="color: black;">output_filename</span> = output_filename
	<span style="color: #ff7700;font-weight:bold;">def</span> set_pop3_account<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, newRetrieveAccount<span style="color: black;">&#41;</span>:
		<span style="color: #008000;">self</span>.<span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'retriever'</span>,<span style="color: #483d8b;">'server'</span>,newRetrieveAccount.<span style="color: black;">server</span><span style="color: black;">&#41;</span>
		<span style="color: #008000;">self</span>.<span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'retriever'</span>,<span style="color: #483d8b;">'type'</span>,newRetrieveAccount.<span style="color: black;">account_type</span><span style="color: black;">&#41;</span>
		<span style="color: #008000;">self</span>.<span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'retriever'</span>,<span style="color: #483d8b;">'username'</span>,newRetrieveAccount.<span style="color: black;">login</span><span style="color: black;">&#41;</span>
		<span style="color: #008000;">self</span>.<span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'retriever'</span>,<span style="color: #483d8b;">'password'</span>,newRetrieveAccount.<span style="color: black;">password</span><span style="color: black;">&#41;</span>
		<span style="color: #008000;">self</span>.<span style="color: #008000;">set</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'destination'</span>,<span style="color: #483d8b;">'arguments'</span>,<span style="color: #483d8b;">'(&quot;'</span>+newRetrieveAccount.<span style="color: black;">account_name</span>+<span style="color: #483d8b;">'&quot;,)'</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">def</span> write<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">self</span>.<span style="color: black;">output_filename</span> <span style="color: #ff7700;font-weight:bold;">is</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">None</span>:
			<span style="color: #483d8b;">&quot;&quot;&quot;try:
				output_file = open(self.output_filename, 'wb')
			except:
				raise Exception, &quot;Unable to open &quot; + <span style="color: #000099; font-weight: bold;">\</span>
					self.output_filename + &quot;for writing&quot;
			finally:
				output_file.close()
			&quot;&quot;&quot;</span>
			<span style="color: #dc143c;">os</span>.<span style="color: black;">umask</span><span style="color: black;">&#40;</span>0077<span style="color: black;">&#41;</span>
			output_file = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>.<span style="color: black;">output_filename</span>, <span style="color: #483d8b;">'wb'</span><span style="color: black;">&#41;</span>
			<span style="color: #dc143c;">ConfigParser</span>.<span style="color: black;">SafeConfigParser</span>.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, output_file<span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">else</span>:
			<span style="color: #ff7700;font-weight:bold;">raise</span> <span style="color: #008000;">Exception</span>, <span style="color: #483d8b;">&quot;No output file for configuration defined&quot;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Konfigurationsdatei lesen</span>
config_object = <span style="color: #dc143c;">ConfigParser</span>.<span style="color: black;">SafeConfigParser</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
config_object.<span style="color: black;">read</span><span style="color: black;">&#40;</span>config_file_location<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Set-up Logging</span>
log_object = <span style="color: #dc143c;">logging</span>.<span style="color: black;">getLogger</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;getmail-ldap&quot;</span><span style="color: black;">&#41;</span>
log_object.<span style="color: black;">setLevel</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">logging</span>.<span style="color: black;">DEBUG</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># This handler writes everything to a log file.</span>
log_file_handler = <span style="color: #dc143c;">logging</span>.<span style="color: black;">FileHandler</span><span style="color: black;">&#40;</span>config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Logging'</span>,<span style="color: #483d8b;">'LogFile'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
log_file_formatter = <span style="color: #dc143c;">logging</span>.<span style="color: black;">Formatter</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;%(levelname)s %(asctime)s %(funcName)s %(lineno)d %(message)s&quot;</span><span style="color: black;">&#41;</span>
log_file_handler.<span style="color: black;">setFormatter</span><span style="color: black;">&#40;</span>log_file_formatter<span style="color: black;">&#41;</span>
log_file_handler.<span style="color: black;">setLevel</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">logging</span>.<span style="color: black;">DEBUG</span><span style="color: black;">&#41;</span>
log_object.<span style="color: black;">addHandler</span><span style="color: black;">&#40;</span>log_file_handler<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># This handler emails anything that is an error or worse.</span>
log_smtp_handler = <span style="color: #dc143c;">logging</span>.<span style="color: black;">handlers</span>.<span style="color: black;">SMTPHandler</span><span style="color: black;">&#40;</span>\
	config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Logging'</span>,<span style="color: #483d8b;">'MailServer'</span><span style="color: black;">&#41;</span>,\
	config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Logging'</span>,<span style="color: #483d8b;">'MailFrom'</span><span style="color: black;">&#41;</span>,\
	config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Logging'</span>,<span style="color: #483d8b;">'MailTo'</span><span style="color: black;">&#41;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">','</span><span style="color: black;">&#41;</span>,\
	config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Logging'</span>,<span style="color: #483d8b;">'MailSubject'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
log_smtp_handler.<span style="color: black;">setLevel</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">logging</span>.<span style="color: black;">ERROR</span><span style="color: black;">&#41;</span>
log_smtp_handler.<span style="color: black;">setFormatter</span><span style="color: black;">&#40;</span>log_file_formatter<span style="color: black;">&#41;</span>
log_object.<span style="color: black;">addHandler</span><span style="color: black;">&#40;</span>log_smtp_handler<span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> main_call<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
&nbsp;
	<span style="color: #808080; font-style: italic;">## first you must open a connection to the LDAP server</span>
	ldap_object = ldap.<span style="color: #008000;">open</span><span style="color: black;">&#40;</span>config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'LDAP'</span>,<span style="color: #483d8b;">'LDAPServer'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	ldap_object.<span style="color: black;">simple_bind_s</span><span style="color: black;">&#40;</span>\
		config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'LDAP'</span>,<span style="color: #483d8b;">'BindDN'</span><span style="color: black;">&#41;</span>,\
		config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'LDAP'</span>,<span style="color: #483d8b;">'BindPassword'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
	<span style="color: #808080; font-style: italic;"># searching doesn't require a bind in LDAP V3.</span>
	<span style="color: #808080; font-style: italic;"># If you're using LDAP v2, set the next line appropriately</span>
	<span style="color: #808080; font-style: italic;"># and do a bind as shown in the above example.</span>
	<span style="color: #808080; font-style: italic;"># you can also set this to ldap.VERSION2 if you're using a v2 directory</span>
	<span style="color: #808080; font-style: italic;"># you should  set the next option to ldap.VERSION2 if you're using a v2 directory</span>
	ldap_object.<span style="color: black;">protocol_version</span> = ldap.<span style="color: black;">VERSION3</span>	
&nbsp;
	<span style="color: #808080; font-style: italic;">## The next lines will also need to be changed to support your search requirements and directory</span>
	<span style="color: #808080; font-style: italic;">## retrieve all attributes - again adjust to your needs - see documentation for more options</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">if</span> config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'LDAP'</span>,<span style="color: #483d8b;">'SearchScope'</span><span style="color: black;">&#41;</span>.<span style="color: black;">upper</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> == <span style="color: #483d8b;">&quot;SUB&quot;</span>:
            search_scope = ldap.<span style="color: black;">SCOPE_SUBTREE</span>
        <span style="color: #ff7700;font-weight:bold;">elif</span> config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'LDAP'</span>,<span style="color: #483d8b;">'SearchScope'</span><span style="color: black;">&#41;</span>.<span style="color: black;">upper</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span> == <span style="color: #483d8b;">&quot;ONE&quot;</span>:
            search_scope = ldap.<span style="color: black;">SCOPE_ONELEVEL</span>
        <span style="color: #ff7700;font-weight:bold;">else</span>:
            search_scope = ldap.<span style="color: black;">SCOPE_BASE</span>
&nbsp;
	ldap_result_id = ldap_object.<span style="color: black;">search</span><span style="color: black;">&#40;</span> \
		config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'LDAP'</span>,<span style="color: #483d8b;">'SearchDN'</span><span style="color: black;">&#41;</span>, \
		search_scope,
		config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'LDAP'</span>,<span style="color: #483d8b;">'SearchFilter'</span><span style="color: black;">&#41;</span>, \
		<span style="color: #008000;">None</span><span style="color: black;">&#41;</span>
&nbsp;
	ldap_results = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
&nbsp;
	<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #ff4500;">1</span>:
		result_type, result_data = ldap_object.<span style="color: black;">result</span><span style="color: black;">&#40;</span>ldap_result_id, <span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: black;">&#40;</span>result_data == <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>:
			<span style="color: #ff7700;font-weight:bold;">break</span>
		<span style="color: #ff7700;font-weight:bold;">else</span>:
			<span style="color: #808080; font-style: italic;">## here you don't have to append to a list</span>
			<span style="color: #808080; font-style: italic;">## you could do whatever you want with the individual entry</span>
			<span style="color: #808080; font-style: italic;">## The appending to list is just for illustration.</span>
			<span style="color: #ff7700;font-weight:bold;">if</span> result_type == ldap.<span style="color: black;">RES_SEARCH_ENTRY</span>:
				ldap_results += get_search_results<span style="color: black;">&#40;</span>result_data<span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> ldap_result <span style="color: #ff7700;font-weight:bold;">in</span> ldap_results:
		account = RetrieveAccount<span style="color: black;">&#40;</span> \
			<span style="color: #808080; font-style: italic;"># Account Name \</span>
			ldap_result.<span style="color: black;">get_attr_values</span><span style="color: black;">&#40;</span>\
				config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'LDAP'</span>,<span style="color: #483d8b;">'RelevantAttributes'</span><span style="color: black;">&#41;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">','</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> ,\
			<span style="color: #808080; font-style: italic;"># Account Type \</span>
			ldap_result.<span style="color: black;">get_attr_values</span><span style="color: black;">&#40;</span>\
				config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'LDAP'</span>,<span style="color: #483d8b;">'RelevantAttributes'</span><span style="color: black;">&#41;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">','</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>,\
			<span style="color: #808080; font-style: italic;"># Server \</span>
			ldap_result.<span style="color: black;">get_attr_values</span><span style="color: black;">&#40;</span>\
				config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'LDAP'</span>,<span style="color: #483d8b;">'RelevantAttributes'</span><span style="color: black;">&#41;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">','</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">2</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>,\
			<span style="color: #808080; font-style: italic;"># Login \</span>
			ldap_result.<span style="color: black;">get_attr_values</span><span style="color: black;">&#40;</span>\
				config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'LDAP'</span>,<span style="color: #483d8b;">'RelevantAttributes'</span><span style="color: black;">&#41;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">','</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">3</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>,\
			<span style="color: #808080; font-style: italic;"># Password \</span>
			ldap_result.<span style="color: black;">get_attr_values</span><span style="color: black;">&#40;</span>\
				config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'LDAP'</span>,<span style="color: #483d8b;">'RelevantAttributes'</span><span style="color: black;">&#41;</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">','</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">4</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>\
		<span style="color: black;">&#41;</span>
		config_output_filename = <span style="color: #dc143c;">os</span>.<span style="color: black;">path</span>.<span style="color: black;">join</span><span style="color: black;">&#40;</span>\
			config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Main'</span>,<span style="color: #483d8b;">'ConfigFileOutputDir'</span><span style="color: black;">&#41;</span>, \
			<span style="color: #483d8b;">&quot;getmail_&quot;</span> + \
			account.<span style="color: black;">account_name</span> + \
			<span style="color: #483d8b;">&quot;.cfg&quot;</span><span style="color: black;">&#41;</span>
		config_file = GetmailConfigFile<span style="color: black;">&#40;</span><span style="color: #008000;">None</span>, \
			config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Main'</span>,<span style="color: #483d8b;">'DefaultGetmailConfigFile'</span><span style="color: black;">&#41;</span>, config_output_filename<span style="color: black;">&#41;</span>
		config_file.<span style="color: black;">set_pop3_account</span><span style="color: black;">&#40;</span>account<span style="color: black;">&#41;</span>
		log_object.<span style="color: black;">info</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Writing Account Configuration for &quot;</span> + account.<span style="color: black;">account_name</span> + \
				<span style="color: #483d8b;">&quot; to file &quot;</span> + config_output_filename<span style="color: black;">&#41;</span>
		config_file.<span style="color: black;">write</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		RetrieveMails<span style="color: black;">&#40;</span>\
			config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Main'</span>,<span style="color: #483d8b;">'GetmailBinary'</span><span style="color: black;">&#41;</span>, \
			config_output_filename, \
			config_object.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Main'</span>,<span style="color: #483d8b;">'GetmailDir'</span><span style="color: black;">&#41;</span>\
		<span style="color: black;">&#41;</span>.<span style="color: black;">start</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
		<span style="color: #808080; font-style: italic;">#print config_output_filename</span>
		<span style="color: #808080; font-style: italic;">#print &quot;Name &quot; + account.account_name</span>
		<span style="color: #808080; font-style: italic;">#print &quot;Type &quot; + account.account_type</span>
		<span style="color: #808080; font-style: italic;">#print &quot;Server &quot; + account.server</span>
		<span style="color: #808080; font-style: italic;">#print &quot;Login &quot; + account.login</span>
		<span style="color: #808080; font-style: italic;">#print &quot;Password &quot; + account.password</span>
		<span style="color: #808080; font-style: italic;">#print &quot;-----------------&quot;</span>
		<span style="color: #808080; font-style: italic;">#print ldap_result.pretty_print()</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">if</span> __name__ == <span style="color: #483d8b;">&quot;__main__&quot;</span>:
	<span style="color: #ff7700;font-weight:bold;">try</span>:
		main_call<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
	<span style="color: #ff7700;font-weight:bold;">except</span>:
		log_object.<span style="color: black;">exception</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;An error occured!&quot;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>speichern wir als /home/secmail/getmail-ldap.py und machen die Datei durch ein</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">750</span> getmail-ldap.py</pre></div></div>

<p>ausführbar. Das Skript besitzt eine Konfigurationsdatei unter /home/secmail/getmail-ldap.cfg mit dem Inhalt</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>Main<span style="">&#93;</span></span>
# Path to getmail
<span style="color: #000099;">GetmailBinary</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">/usr/bin/getmail</span>
# Directory that should be used as a storage by getmail
<span style="color: #000099;">GetmailDir</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">/home/secmail/getmail_data</span>
# Read default values for getmail from this file
<span style="color: #000099;">DefaultGetmailConfigFile</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">/home/secmail/getmailrc_template.cfg</span>
# Save the final configuration files which include the LDAP details to this directory
<span style="color: #000099;">ConfigFileOutputDir</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">/home/secmail/getmail_config</span>
&nbsp;
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>Logging<span style="">&#93;</span></span>
# Write messages to the following log file
<span style="color: #000099;">LogFile</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">/var/log/getmail-ldap.log</span>
# If a severe error occures a mail goes to the admin
# SMTP-Server to use for sending this error notification
<span style="color: #000099;">MailServer</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">localhost</span>
# Mail address of the sender of this error notification
<span style="color: #000099;">MailFrom</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">secmail@myserver</span>
# Recipients of this error notification
# separate multiple recipients by comma
<span style="color: #000099;">MailTo</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">root@myserver</span>
# Subject of the error notification
<span style="color: #000099;">MailSubject</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">Getmail-LDAP Error</span>
&nbsp;
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>LDAP<span style="">&#93;</span></span>
# Read LDAP information from this server
<span style="color: #000099;">LDAPServer</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">myserver</span>
# Authenticate with the following DN
<span style="color: #000099;">BindDN</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">uid=secmail, ou=users, o=effinger</span>
# Authenticate with the following password
<span style="color: #000099;">BindPassword</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">mysecmailpassword</span>
# Restrict search of external mail accounts to this DN
<span style="color: #000099;">SearchDN</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">ou=users, o=effinger</span>
# Scope of search for external mail accounts
# Possible values include SUB, ONE and BASE
<span style="color: #000099;">SearchScope</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">SUB</span>
# Identify external mail accounts with the following filter
<span style="color: #000099;">SearchFilter</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"><span style="">&#40;</span>&amp;<span style="">&#40;</span>dcSubMailAddress<span style="color: #000066; font-weight:bold;">=</span>*<span style="">&#41;</span><span style="">&#40;</span>objectClass<span style="color: #000066; font-weight:bold;">=</span>dcExternalMailAccount<span style="">&#41;</span><span style="">&#40;</span>dcAccountStatus<span style="color: #000066; font-weight:bold;">=</span>active<span style="">&#41;</span><span style="">&#40;</span>dcRetrieveType<span style="color: #000066; font-weight:bold;">=</span>*<span style="">&#41;</span><span style="">&#40;</span>dcRetrieveLogin<span style="color: #000066; font-weight:bold;">=</span>*<span style="">&#41;</span><span style="">&#40;</span>dcRetrievePassword<span style="color: #000066; font-weight:bold;">=</span>*<span style="">&#41;</span><span style="">&#41;</span></span>
# List of LDAP-Attributes used to determine the following variables
# 	<span style="">1</span>. Name for resulting getmail configuration file <span style="">&#40;</span>must be unique<span style="">&#41;</span>
#	<span style="">2</span>. Type for mail collection e.g. BrokenUIDLPOP3Retriever
#	<span style="">3</span>. Mail server to collect mails from
#	<span style="">4</span>. Login for mail server
# 	<span style="">5</span>. Password for mail server
# separate by comma
<span style="color: #000099;">RelevantAttributes</span><span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;">dcSubMailAddress,dcRetrieveType,dcRetrieveServer,dcRetrieveLogin,dcRetrievePassword</span></pre></div></div>

<p>Die Konfigurationsoptionen habe ich durch Kommentare dokumentiert. In jedem Fall muss in dieser Datei im Abschnitt [LDAP] der LDAPServer von myserver auf den jeweiligen DNS-Eintrag des OpenLDAP-Servers angepasst werden. Auch die Zeile mit BindPassword müssen wir ändern, so dass sie das  secmail Passwort enthält. Da diese Datei mit dem Passwort sensible Informationen enthält, die es einem Angreifer erlauben würden, aus dem LDAP-Verzeichnis alle Login-Informationen der externen Mail-Accounts zu lesen, setzen wir die Berechtigung für die Datei so, dass nur secmail darauf zugreifen kann:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">640</span> getmail-ldap.cfg</pre></div></div>

<p>Anschließend erzeugen wir die referenzierte Datei /home/secmail/getmailrc_template.cfg mit dem Inhalt</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>retriever<span style="">&#93;</span></span>
<span style="color: #000099;">type</span> <span style="color: #000066; font-weight:bold;">=</span>
<span style="color: #000099;">server</span> <span style="color: #000066; font-weight:bold;">=</span>
<span style="color: #000099;">username</span> <span style="color: #000066; font-weight:bold;">=</span>
<span style="color: #000099;">password</span> <span style="color: #000066; font-weight:bold;">=</span> 
&nbsp;
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>destination<span style="">&#93;</span></span>
<span style="color: #000099;">type</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> MDA_external</span>
<span style="color: #000099;">path</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> /usr/sbin/exim4</span>
<span style="color: #000099;">arguments</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> <span style="">&#40;</span></span><span style="color: #933;">&quot;user@mailhost.tld&quot;</span>,<span style="">&#41;</span>
&nbsp;
<span style="color: #000066; font-weight:bold;"><span style="">&#91;</span>options<span style="">&#93;</span></span>
# for testing do not delete mails
#delete <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> false</span>
<span style="color: #000099;">delete</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> true</span>
<span style="color: #000099;">message_log</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> /var/log/getmail.log</span>
<span style="color: #000099;">read_all</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> true</span>
# do not manipulate the header
<span style="color: #000099;">delivered_to</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> false</span>
<span style="color: #000099;">received</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> false</span></pre></div></div>

<p>Die einzelnen Konfigurationsoptionen werden in der <a href="http://pyropus.ca/software/getmail/configuration.html#rcfile">Dokumentation von getmail</a> detailliert erläutert. Wichtig ist hier zu wissen, dass das Python-Skript diese Datei als Vorlage nimmt und dann in der Sektion [retriever] die Werte für type, server, username und password aus dem LDAP-Verzeichnis einträgt. In der Sektion [destination] wird der Wert arguments so abgeändert, dass die Mail an den lokalen Benutzer geht. Das <a href="http://archives.devshed.com/forums/networking-100/getmail-and-exim4t-64730.html">Zusammenspiel von getmail und exim</a> wird in einem Forumsbeitrag näher erläutert.<br />
<strong>Empfehlung:</strong> Zu Beginn ist es sicherlich sinnvoll, im Abschnitt [options] den Wert von delete auf false zu setzen. So werden die Mails vom externen Server zwar heruntergeladen, aber nicht gelöscht. Wenn alles einwandfrei funktioniert, kann man hier den Wert wieder auf true setzen.<br />
Auch hier setzen wir die Berechtigungen für die Datei entsprechend:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">640</span> getmailrc_template.cfg</pre></div></div>

<p>Nun erzeugen wir noch ein Verzeichnis, welches getmail benötigt und eines zum Ablegen der finalen Konfigurationsdateien mit den Berechtigungen, so dass nur secmail darauf zugreifen kann.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-m</span> <span style="color: #000000;">750</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>secmail<span style="color: #000000; font-weight: bold;">/</span>getmail_data <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>secmail<span style="color: #000000; font-weight: bold;">/</span>getmail_config</pre></div></div>

<p>Dann erzeugen wir die Logdateien im Verzeichnis /var/log und setzen die Berechtigung so, dass auch secmail in diese Dateien schreiben kann.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <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>getmail<span style="color: #7a0874; font-weight: bold;">&#123;</span>-ldap,<span style="color: #7a0874; font-weight: bold;">&#125;</span>.log
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> root.secmail <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>getmail<span style="color: #7a0874; font-weight: bold;">&#123;</span>-ldap,<span style="color: #7a0874; font-weight: bold;">&#125;</span>.log
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">660</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>getmail<span style="color: #7a0874; font-weight: bold;">&#123;</span>-ldap,<span style="color: #7a0874; font-weight: bold;">&#125;</span>.log</pre></div></div>

<h2>Testen des Mailabrufs</h2>
<p>Mit dem Aufruf des Pythonskripts durch ein</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-u</span> secmail <span style="color: #660033;">-s</span>
<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>secmail<span style="color: #000000; font-weight: bold;">/</span>getmail-ldap.py</pre></div></div>

<p>und das anschließende Inspizieren der Log-Dateien /var/log/getmail-ldap.log und /var/log/getmail.log können wir testen, ob die Mails heruntergeladen werden. Ob die Zustellung an den lokalen Benutzer geklappt hat, sieht man an neuen Dateien im jeweiligen maildir (hier: /home/paul/mail/paulpanzer@gmx.de/maildir/INBOX/new) bzw. durch Abruf der Mails mit einem Client z.B. per IMAP.</p>
<h2>Regelmäßiges Zustellen externer Mails</h2>
<p>Damit die Mails regelmäßig von dem externen Server abgerufen werden, richten wir einen Cron-Job ein, der alle fünf Minuten prüft, ob neue Mails vorhanden sind. Dazu führen wir als secmail User</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">crontab <span style="color: #660033;">-e</span></pre></div></div>

<p>aus und tragen dort die Zeile</p>

<div class="wp_syntax"><div class="code"><pre class="cron" style="font-family:monospace;">*/5 * * * * /home/secmail/getmail-ldap.py</pre></div></div>

<p>ein. Bei Adam Kane kann man nachlesen, <a href="http://www.foogazi.com/2006/12/07/understand-cron-jobs-in-5-minutes/">was ein Cron-Job ist</a>.</p>
<h2>Feintuning &#8211; Logdateien mit Logrotate verwalten</h2>
<p>Nachdem nun alles soweit eingerichtet ist, kümmern wir uns noch darum, dass die Logdateien ordentlich aufgeräumt werden. Wir erzeugen deshalb im Verzeichnis /etc/logrotate.d/ die Datei dovecot mit dem Inhalt</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Logrotate Konfiguration für dovecot</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.log <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        daily
        missingok
        rotate <span style="color: #000000;">14</span>
        compress
        delaycompress
        notifempty
        create <span style="color: #000000;">600</span> root root
<span style="color: #7a0874; font-weight: bold;">&#125;</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: #7a0874; font-weight: bold;">&#123;</span>
        daily
        missingok
        rotate <span style="color: #000000;">14</span>
        compress
        delaycompress
        notifempty
        create <span style="color: #000000;">600</span> root secmail
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>und ebenso die Datei getmail mit diesem Inhalt</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Logrotate Konfiguration für getmail und getmail-ldap</span>
<span style="color: #666666; font-style: italic;"># siehe /home/secmail/getmail-ldap.py</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>getmail.log <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        daily
        missingok
        rotate <span style="color: #000000;">14</span>
        compress
        delaycompress
        notifempty
        create <span style="color: #000000;">660</span> root secmail
<span style="color: #7a0874; font-weight: bold;">&#125;</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>getmail-ldap.log <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        daily
        missingok
        rotate <span style="color: #000000;">14</span>
        compress
        delaycompress
        notifempty
        create <span style="color: #000000;">660</span> root secmail
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Wir korrigieren außerdem noch einen kleinen Bug im exim-Paket, indem wir die Zeile</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">        create <span style="color: #000000;">640</span> Debian-exim adm</pre></div></div>

<p>in den beiden Dateien exim-base und exim-paniclog im selben Verzeichnis durch folgende Zeile ersetzen</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">        create <span style="color: #000000;">640</span> Debian-exim root</pre></div></div>

<p><strong><a href="http://www.openldap.org/lists/openldap-software/200111/msg00307.html">Tip zum Logging des OpenLDAP-Servers von der OpenLDAP-Mailingliste</a>:</strong> Standardmäßig wird alles in die syslog geschrieben. Wenn man der Übersichtlichkeit halber eine eigene Logdatei für OpenLDAP haben möchte, muss man OpenLDAP mitteilen, dass es beim Loggen einen eigenen Selektor (hier:local4) verwenden soll. Dazu muss die Datei /etc/default/slapd die folgende Zeile enthalten:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">SLAPD_OPTIONS</span>=<span style="color: #ff0000;">&quot;-l local4&quot;</span></pre></div></div>

<p>Nun konfigurieren wir syslog so, dass es alle Informationen mit diesem Selektor in eine eigene Datei schreibt. Bei Verwendung von sysklogd ergänzen wir in der Datei /etc/syslog.conf folgende Zeile</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Log openldap to separate file</span>
local4.<span style="color: #000000; font-weight: bold;">*</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>slapd.log</pre></div></div>

<p>Bei Verwendung von rsyslog erzeugen wir die Datei /etc/rsyslog.d/40-slapd.conf mit folgendem Inhalt</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Log openldap to separate file</span>
local4.<span style="color: #000000; font-weight: bold;">*</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>slapd.log
<span style="color: #000000; font-weight: bold;">&amp;</span> ~</pre></div></div>

<p>Außerdem legen wir eine entsprechende Datei namens /etc/logrotate.d/slapd mit dem folgenden Inhalt an.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><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>slapd.log <span style="color: #7a0874; font-weight: bold;">&#123;</span>
        daily
        missingok
        rotate <span style="color: #000000;">14</span>
        compress
        delaycompress
        notifempty
        create <span style="color: #000000;">660</span> root openldap
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Damit die Änderungen Wirkung zeigen, müssen wir anfangs eine Logdatei erzeugen und anschließend Syslog und OpenLDAP neu starten bzw. die Konfiguration neu laden.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <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>slapd.log
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> root.openldap <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>slapd.log
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">660</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>slapd.log
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>sysklogd reload
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>slapd restart</pre></div></div>

<h2>Links zum getmail-ldap Python-Skript</h2>
<p>Bei der Erstellung des Python-Skripts waren einige Webseiten sehr hilfreich, die deshalb hier aufgeführt werden, obowhl sie für die Einrichtung des Mailservers ohne Bedeutung sind.</p>
<ul>
<li><a href="http://www.network-theory.co.uk/python/intro/">Einführung in Python &#8211; An Introduction to Python</a></li>
<li><a href="http://www.diveintopython.org/toc/index.html">Eine weitere Einführung &#8211; Dive into Python</a></li>
<li><a href="http://www.python.org/dev/peps/pep-0008/">Guter Stil bei der Python-Programmierung &#8211; Style Guide for Python Code</a></li>
<li><a href="http://docs.python.org/library/logging.html">Offizielle Dokumentation zum Logging-Modul von Python</a></li>
<li><a href="http://code.activestate.com/recipes/466332/">Beispielcode, welcher das Logging-Modul verwendet</a></li>
<li><a href="http://python-ldap.sourceforge.net/doc/html/ldap.html">Offizielle Dokumenation zum LDAP-Modul von Python</a></li>
<li><a href="http://www.grotan.com/ldap/python-ldap-samples.html">Beispiel zur Verwendung des LDAP-Moduls von Python</a></li>
<li><a href="http://www.packtpub.com/article/python-ldap-applications-ldap-opearations">Die LDAP-Helper Klasse, welche das Verarbeiten von LDAP-Resultaten wesentlich vereinfacht</a></li>
<li><a href="http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/1/">Grundlagen von Threading in Python</a></li>
<li><a href="http://docs.python.org/library/subprocess.html">Offizielle Dokumentation zum Subprozess-Modul von Python</a></li>
<li><a href="http://blog.doughellmann.com/2007/07/pymotw-subprocess.html">Beispielcode zur Verwendung von Unterprozessen in Doug Hellmanns Blog</a></li>
<li><a href="http://www.gossamer-threads.com/lists/python/python/724330">Verwendung von Unterprozessen ohne den Parameter Shell=True</a></li>
</ul>
<h2>Weitere Konfigurationsschritte</h2>
<p>Die Schritte zur Einrichtung der im <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-1-openldap/">ersten Teil</a> angesprochenen Komponenten Roundcube als Webmaildienst, LDAP zur Verwaltung von Addressen und Spamassassin zum Filtern von Spam-Mails sowie eine Anleitung zum Einrichten eins Mail-Clients werden aufgrund von Zeitmangel leider erst in einigen Wochen verfügbar sein.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-4-getmail/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Dovecot, Exim, OpenLDAP und getmail unter Ubuntu &#8211; (3) Exim</title>
		<link>http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-3-exim/</link>
		<comments>http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-3-exim/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 16:57:48 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[exim]]></category>
		<category><![CDATA[getmail]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[OpenLDAP]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=508</guid>
		<description><![CDATA[<p>Nach der Einrichtung von OpenLDAP im ersten Teil, der Anpassung und Konfiguration von dovecot im zweiten Teil befasst sich der dritte Teil mit der Konfiguration von Exim. Obwohl fast alles im Blog detailliert beschrieben ist, empfehle ich, die Konfigurationsdateien für das Mailsystem herunterzuladen.</p> Installation von Exim <p>Da wir bei exim die LDAP-Unterstützung benötigen, müssen wir [...]]]></description>
			<content:encoded><![CDATA[<p>Nach der <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-1-openldap/">Einrichtung von OpenLDAP im ersten Teil</a>, der <a href="http://www.effinger.org/blog/2009/03/22/dovecot-postfix-openldap-und-getmail-unter-ubuntu-2-dovecot/">Anpassung und Konfiguration von dovecot im zweiten Teil</a> befasst sich der dritte Teil mit der Konfiguration von Exim. Obwohl fast alles im Blog detailliert beschrieben ist, empfehle ich, die <a href="http://www.effinger.org/blog/wp-content/uploads/2009/03/configfiles-mailsystem.tgz">Konfigurationsdateien für das Mailsystem herunterzuladen</a>.</p>
<h2>Installation von Exim</h2>
<p>Da wir bei exim die LDAP-Unterstützung benötigen, müssen wir die entsprechende Exim-Version mit einem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> exim4-daemon-heavy</pre></div></div>

<p>installieren. Dabei wird notwendigerweise auch postfix entfernt, das von Ubuntu standardmäßig als Message Transfer Agent (MTA) eingesetzt wird.</p>
<h2>Konfiguration von Exim</h2>
<p>Damit exim auf die SSL-Zertifikate zur Verschlüsselung der SMTP-Verbindungen zugreifen kann, müssen wir den exim-Benutzer zur Gruppe ssl-cert hinzufügen</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> adduser Debian-exim ssl-cert</pre></div></div>

<p>Zur Konfiguration von exim kann man unter Ubuntu/Debian ein spezielles Konfigurationspaket namens exim4-config verwenden. Dieses erzeugt aus einzelnen Dateien im Verzeichnis /etc/exim4/conf.d eine finale Konfigurationsdatei (<a href="http://pkg-exim4.alioth.debian.org/README/README.Debian.html">nähere Informationen zu exim4-config auf der Debian-Seite</a>). Ich empfehle, dieses Konfigurationspaket zu verwenden und die Grundkonfiguration mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> dpkg-reconfigure exim4-config</pre></div></div>

<p>zu starten. Im anschließenden Konfigurationsdialog wählen wir <em>Nur lokale Mailzustellung; keine Netzwerkverbindung</em>. Dann geben wir den korrekten DNS-Namen des Servers an, den wir auch schon bei der Erzeugung der Schlüsselzertifikate verwendet haben (hier im Beispiel <em>myserver</em>). Der nächste Punkt ist eigentlich selbsterklärend, wenn der SMTP-Server über alle Interfaces erreichbar sein soll, das Feld leer lassen, ansonsten die gewünschte IP-Addresse eintragen. Der nächste Schritt fordert uns auf, mögliche weitere Domains für den lokalen Mailempfang anzugeben (im Zweifelsfall leer lassen). Der Punkt, ob DNS-Anfragen minimiert werden sollen, beantworten wir mit <em>Nein</em>. Als Speicherformat für lokale Mails wählen wir <em>mbox</em> (wird aber später modifiziert). Die Einstellungen sollen in <em>kleine Dateien</em> aufgeteilt werden. Nun machen wir uns an die Anpassung. Wir editieren die Datei /etc/exim4/update-exim4.conf.conf und ändern die letzte Zeile mit dem Eintrag</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">dc_localdelivery</span>=<span style="color: #ff0000;">'mail_spool'</span></pre></div></div>

<p>in</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">dc_localdelivery</span>=<span style="color: #ff0000;">'dovecot_delivery'</span></pre></div></div>

<p>ab. Im nächsten Schritt löschen wir den Inhalt des Verzeichnisses /etc/exim4/conf.d und kopieren die Dateien aus dem <a href="http://www.effinger.org/blog/wp-content/uploads/2009/03/configfiles-mailsystem.tgz">Konfigurationspaket</a> dorthin mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>exim4<span style="color: #000000; font-weight: bold;">/</span>conf.d
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-R</span> <span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/</span>to<span style="color: #000000; font-weight: bold;">/</span>configfiles<span style="color: #000000; font-weight: bold;">/</span>exim<span style="color: #000000; font-weight: bold;">/</span>conf.d <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>exim4</pre></div></div>

<p>In der Datei /etc/exim4/conf.d/main/00_local_macros passen wir folgende Zeilen an:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldap_default_servers = myserver
MAIN_TLS_CERTIFICATE = <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>myserver.crt
MAIN_TLS_PRIVATEKEY = <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>myserver.key</pre></div></div>

<p>Wir ersetzen hier myserver jeweils durch den DNS-Namen des Servers. Nun erzeugen wir die finale Konfigurationsdatei für exim und starten exim anschließend neu mit dem Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> update-exim4.conf <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>exim4 restart</pre></div></div>

<p>Das Programm erzeugt so eine finale Konfigurationsdatei, die unter /var/lib/exim4/config.autogenerated abgelegt wird. Für diejenigen, die das Debiankonfigurationssystem nicht nutzen können/wollen, ist hier deren Inhalt aufgeführt:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#########</span>
<span style="color: #666666; font-style: italic;"># WARNING WARNING WARNING</span>
<span style="color: #666666; font-style: italic;"># WARNING WARNING WARNING</span>
<span style="color: #666666; font-style: italic;"># WARNING WARNING WARNING</span>
<span style="color: #666666; font-style: italic;"># WARNING WARNING WARNING</span>
<span style="color: #666666; font-style: italic;"># WARNING WARNING WARNING</span>
<span style="color: #666666; font-style: italic;"># This file is generated dynamically from the files in</span>
<span style="color: #666666; font-style: italic;"># the conf.d/ directory, or from exim4.conf.template respectively.</span>
<span style="color: #666666; font-style: italic;"># Additional information is read from update-exim4.conf.conf</span>
<span style="color: #666666; font-style: italic;"># This version of the file was created from the directory /etc/exim4</span>
<span style="color: #666666; font-style: italic;"># Any changes you make here will be lost.</span>
<span style="color: #666666; font-style: italic;"># See /usr/share/doc/exim4-base/README.Debian.gz and update-exim4.conf(8)</span>
<span style="color: #666666; font-style: italic;"># for instructions of customization.</span>
<span style="color: #666666; font-style: italic;"># WARNING WARNING WARNING</span>
<span style="color: #666666; font-style: italic;"># WARNING WARNING WARNING</span>
<span style="color: #666666; font-style: italic;"># WARNING WARNING WARNING</span>
<span style="color: #666666; font-style: italic;"># WARNING WARNING WARNING</span>
<span style="color: #666666; font-style: italic;"># WARNING WARNING WARNING</span>
<span style="color: #666666; font-style: italic;">#########</span>
&nbsp;
FIRST_USER_ACCOUNT_UID = <span style="color: #000000;">1000</span>
&nbsp;
acl_not_smtp_start = acl_check_not_smtp
&nbsp;
ldap_default_servers = myserver
&nbsp;
LDAP_BASE = <span style="color: #007800;">ou</span>=<span style="color: #c20cb9; font-weight: bold;">users</span>,<span style="color: #007800;">o</span>=effinger
&nbsp;
<span style="color: #007800;">SEC_MAIL_USER</span>=secmail
IS_SENDER_SECMAIL = eq<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$originator_uid</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${extract{2}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>:<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${lookup{SEC_MAIL_USER}</span>lsearch<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$value</span><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><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
received_header_text = <span style="color: #800000;">${if !IS_SENDER_SECMAIL {Received: ${if def:sender_rcvhost {from $sender_rcvhost\n\t}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if def:sender_ident {from ${quote_local_part:$sender_ident}</span> <span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #800000;">${if def:sender_helo_name {(helo=$sender_helo_name)\n\t}</span><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>by <span style="color: #007800;">$primary_hostname</span> <span style="color: #800000;">${if def:received_protocol {with $received_protocol}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #800000;">${if def:tls_cipher {($tls_cipher)\n\t}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>Exim <span style="color: #007800;">$version_number</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>\n\t<span style="color: #800000;">${if def:sender_address {(envelope-from &lt;$sender_address&gt;)\n\t}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #c20cb9; font-weight: bold;">id</span> <span style="color: #007800;">$message_exim_id</span><span style="color: #800000;">${if def:received_for {\n\tfor $received_for}</span><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;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
LOCAL_DELIVERY_SECMAIL = dovecot_delivery_secmail
&nbsp;
MAIN_TLS_ENABLE = <span style="color: #c20cb9; font-weight: bold;">yes</span>
MAIN_TLS_CERTIFICATE = <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>myserver.crt
MAIN_TLS_PRIVATEKEY = <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>myserver.key
MAIN_TLS_VERIFY_CERTIFICATES = <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>ca.crt
&nbsp;
SENDER_EXTRACT_UID = <span style="color: #800000;">${sg{${lc:$sender_address}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
	<span style="color: #7a0874; font-weight: bold;">&#123;</span>\N^<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>a-zA-Z0-<span style="color: #000000;">9</span>_.-<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>a-zA-Z0-<span style="color: #000000;">9</span>_.-<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>a-zA-Z0-<span style="color: #000000;">9</span>_.-<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span>$\N<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\<span style="color: #007800;">$1</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
SENDER_EXTRACT_REAL_MAIL = <span style="color: #800000;">${sg{${lc:$sender_address}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
	<span style="color: #7a0874; font-weight: bold;">&#123;</span>\N^<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>a-zA-Z0-<span style="color: #000000;">9</span>_.-<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>a-zA-Z0-<span style="color: #000000;">9</span>_.-<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>a-zA-Z0-<span style="color: #000000;">9</span>_.-<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span>$\N<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\<span style="color: #007800;">$2</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
IS_SENDER_REMOTE = $<span style="color: #7a0874; font-weight: bold;">&#123;</span>lookup ldap \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span>ldap:<span style="color: #000000; font-weight: bold;">///</span><span style="color: #007800;">uid</span>=<span style="color: #800000;">${quote_ldap_dn:SENDER_EXTRACT_UID}</span>,LDAP_BASE??sub?<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSubMailAddress</span>=<span style="color: #800000;">${quote_ldap:SENDER_EXTRACT_REAL_MAIL}</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcAccountStatus</span>=active<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>fail<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
IS_LOCAL_PART_VALID = $<span style="color: #7a0874; font-weight: bold;">&#123;</span>lookup ldap \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span>ldap:<span style="color: #000000; font-weight: bold;">///</span><span style="color: #007800;">uid</span>=<span style="color: #800000;">${quote_ldap_dn:${lc:$local_part}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>,LDAP_BASE??base?<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">objectClass</span>=dcMailUser<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
GET_UID_FOR_RCPT = $<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">tr</span> \
	<span style="color: #7a0874; font-weight: bold;">&#123;</span>$<span style="color: #7a0874; font-weight: bold;">&#123;</span>lookup ldapm \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span>ldap:<span style="color: #000000; font-weight: bold;">///</span>LDAP_BASE??sub?<span style="color: #800000;">${if match_domain{$domain}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>+local_domains<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">mail</span>=<span style="color: #800000;">${quote_ldap:$local_part}</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSubMailAddress</span>=<span style="color: #800000;">${quote_ldap:$local_part@$domain}</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcAccountStatus</span>=active<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><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> \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${sg{${lc:$value}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\N<span style="color: #7a0874; font-weight: bold;">&#40;</span>?m<span style="color: #7a0874; font-weight: bold;">&#41;</span>^.<span style="color: #000000; font-weight: bold;">*</span><span style="color: #007800;">uid</span>=<span style="color: #ff0000;">&quot;(.*?)&quot;</span>.<span style="color: #000000; font-weight: bold;">*</span>$\N<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\<span style="color: #007800;">$1</span><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> \
	<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;">&#123;</span>\n<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>,<span style="color: #7a0874; font-weight: bold;">&#125;</span> \
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
GET_ALIAS_FOR_RCPT = $<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">tr</span> \
	<span style="color: #7a0874; font-weight: bold;">&#123;</span>$<span style="color: #7a0874; font-weight: bold;">&#123;</span>lookup ldapm \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span>ldap:<span style="color: #000000; font-weight: bold;">///</span>LDAP_BASE?mail,dcSubMailAddress?sub?<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcMailAlias</span>=<span style="color: #800000;">${quote_ldap:$local_part${if match_domain{$domain}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>+local_domains<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$domain</span><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><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcMailAlternateAddress</span>=<span style="color: #800000;">${quote_ldap:$local_part@$domain}</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcAccountStatus</span>=active<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${sg{${lc:$value}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\N<span style="color: #7a0874; font-weight: bold;">&#40;</span>?m<span style="color: #7a0874; font-weight: bold;">&#41;</span>^.<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>mail<span style="color: #000000; font-weight: bold;">|</span>dcsubmailaddress<span style="color: #7a0874; font-weight: bold;">&#41;</span>=<span style="color: #ff0000;">&quot;(.*?)&quot;</span>.<span style="color: #000000; font-weight: bold;">*</span>$\N<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\<span style="color: #007800;">$2</span><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> \
	<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;">&#123;</span>\n<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>,<span style="color: #7a0874; font-weight: bold;">&#125;</span> \
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
GET_ALIAS_FOR_AUTH = $<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">tr</span> \
	<span style="color: #7a0874; font-weight: bold;">&#123;</span>$<span style="color: #7a0874; font-weight: bold;">&#123;</span>lookup ldapm \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span>ldap:<span style="color: #000000; font-weight: bold;">///</span>LDAP_BASE?dcMailAlias,dcMailAlternateAddress?sub?<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">|</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">mail</span>=<span style="color: #800000;">${quote_ldap:AUTH_SERVER_MAIL}</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSubMailAddress</span>=<span style="color: #800000;">${quote_ldap:AUTH_SERVER_MAIL}</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcAccountStatus</span>=active<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${sg{${lc:$value}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\N<span style="color: #7a0874; font-weight: bold;">&#40;</span>?m<span style="color: #7a0874; font-weight: bold;">&#41;</span>^.<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>dcmailalias<span style="color: #000000; font-weight: bold;">|</span>dcmailalternateaddress<span style="color: #7a0874; font-weight: bold;">&#41;</span>=<span style="color: #ff0000;">&quot;(.*?)&quot;</span>.<span style="color: #000000; font-weight: bold;">*</span>$\N<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\<span style="color: #007800;">$2</span><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> \
	<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;">&#123;</span>\n<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>,<span style="color: #7a0874; font-weight: bold;">&#125;</span> \
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
GET_COMPLETE_MAIL_FOR_LOCAL_PART_UID = $<span style="color: #7a0874; font-weight: bold;">&#123;</span>lookup ldap \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span>ldap:<span style="color: #000000; font-weight: bold;">///</span><span style="color: #007800;">uid</span>=<span style="color: #800000;">${quote_ldap_dn:${lc:$local_part}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>,LDAP_BASE?mail?base?<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">objectClass</span>=dcMailUser<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${local_part}</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #800000;">${value}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
GET_LOCAL_MAIL = <span style="color: #800000;">${if match_domain{$parent_domain}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>+local_domains<span style="color: #7a0874; font-weight: bold;">&#125;</span> \
	<span style="color: #7a0874; font-weight: bold;">&#123;</span>GET_COMPLETE_MAIL_FOR_LOCAL_PART_UID<span style="color: #7a0874; font-weight: bold;">&#125;</span> \
	<span style="color: #7a0874; font-weight: bold;">&#123;</span>$<span style="color: #7a0874; font-weight: bold;">&#123;</span>lookup ldap \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span>ldap:<span style="color: #000000; font-weight: bold;">///</span><span style="color: #007800;">uid</span>=<span style="color: #800000;">${quote_ldap_dn:${lc:$local_part}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>,LDAP_BASE?dcSubMailAddress?sub?<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSubMailAddress</span>=<span style="color: #800000;">${quote_ldap:$parent_local_part@$parent_domain}</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcAccountStatus</span>=active<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$local_part</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$parent_local_part</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #007800;">$parent_domain</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span>GET_COMPLETE_MAIL_FOR_LOCAL_PART_UID<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> \
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
IS_AUTH_REMOTE = $<span style="color: #7a0874; font-weight: bold;">&#123;</span>lookup ldap <span style="color: #7a0874; font-weight: bold;">&#123;</span> \
	<span style="color: #007800;">user</span>=<span style="color: #ff0000;">&quot;uid=<span style="color: #007800;">${quote_ldap_dn:AUTH_SERVER_UID}</span>,LDAP_BASE&quot;</span> \
    	<span style="color: #007800;">pass</span>=<span style="color: #800000;">${quote:AUTH_SERVER_PASSWORD}</span> \
	ldap:<span style="color: #000000; font-weight: bold;">///</span>LDAP_BASE??sub?<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSubMailAddress</span>=<span style="color: #800000;">${quote_ldap:AUTH_SERVER_MAIL}</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcAccountStatus</span>=active<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSMTPServer</span>=<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSMTPLogin</span>=<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSMTPPassword</span>=<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
	<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>fail<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
AUTH_REMOTE_SERVER = $<span style="color: #7a0874; font-weight: bold;">&#123;</span>lookup ldap <span style="color: #7a0874; font-weight: bold;">&#123;</span> \
	<span style="color: #007800;">user</span>=<span style="color: #ff0000;">&quot;uid=<span style="color: #007800;">${quote_ldap_dn:AUTH_SERVER_UID}</span>,LDAP_BASE&quot;</span> \
    	<span style="color: #007800;">pass</span>=<span style="color: #800000;">${quote:AUTH_SERVER_PASSWORD}</span> \
	ldap:<span style="color: #000000; font-weight: bold;">///</span>LDAP_BASE?dcSMTPServer?sub?<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSubMailAddress</span>=<span style="color: #800000;">${quote_ldap:AUTH_SERVER_MAIL}</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcAccountStatus</span>=active<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSMTPServer</span>=<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSMTPLogin</span>=<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSMTPPassword</span>=<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
	<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$value</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
AUTH_REMOTE_LOGIN = $<span style="color: #7a0874; font-weight: bold;">&#123;</span>lookup ldap <span style="color: #7a0874; font-weight: bold;">&#123;</span>\
	<span style="color: #007800;">user</span>=<span style="color: #ff0000;">&quot;uid=<span style="color: #007800;">${quote_ldap_dn:AUTH_SERVER_UID}</span>,LDAP_BASE&quot;</span> \
    	<span style="color: #007800;">pass</span>=<span style="color: #800000;">${quote:AUTH_SERVER_PASSWORD}</span> \
	ldap:<span style="color: #000000; font-weight: bold;">///</span>LDAP_BASE?dcSMTPLogin?sub?<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSubMailAddress</span>=<span style="color: #800000;">${quote_ldap:AUTH_SERVER_MAIL}</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcAccountStatus</span>=active<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSMTPServer</span>=<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSMTPLogin</span>=<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSMTPPassword</span>=<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
	<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$value</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
AUTH_REMOTE_PASSWORD = $<span style="color: #7a0874; font-weight: bold;">&#123;</span>lookup ldap <span style="color: #7a0874; font-weight: bold;">&#123;</span>\
	<span style="color: #007800;">user</span>=<span style="color: #ff0000;">&quot;uid=<span style="color: #007800;">${quote_ldap_dn:AUTH_SERVER_UID}</span>,LDAP_BASE&quot;</span> \
    	<span style="color: #007800;">pass</span>=<span style="color: #800000;">${quote:AUTH_SERVER_PASSWORD}</span> \
	ldap:<span style="color: #000000; font-weight: bold;">///</span>LDAP_BASE?dcSMTPPassword?sub?<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSubMailAddress</span>=<span style="color: #800000;">${quote_ldap:AUTH_SERVER_MAIL}</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcAccountStatus</span>=active<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSMTPServer</span>=<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSMTPLogin</span>=<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">dcSMTPPassword</span>=<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
	<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$value</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
AUTH_SERVER_PLAIN_AUTH = $<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">if</span> ldapauth \
    <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">user</span>=<span style="color: #ff0000;">&quot;uid=<span style="color: #007800;">${quote_ldap_dn:${sg{${lc:$auth2}</span>} <span style="color: #000099; font-weight: bold;">\
</span> 	{<span style="color: #000099; font-weight: bold;">\N</span>^([a-zA-Z0-9_.-]+)@([a-zA-Z0-9_@.-]+)$<span style="color: #000099; font-weight: bold;">\N</span>}{<span style="color: #000099; font-weight: bold;">\$</span>1}}},LDAP_BASE&quot;</span> \
    <span style="color: #007800;">pass</span>=<span style="color: #800000;">${quote:$auth3}</span> \
    ldap:<span style="color: #000000; font-weight: bold;">///</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
AUTH_SERVER_LOGIN_AUTH = $<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">if</span> ldapauth \
    <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">user</span>=<span style="color: #ff0000;">&quot;uid=<span style="color: #007800;">${quote_ldap_dn:${sg{${lc:$auth1}</span>} <span style="color: #000099; font-weight: bold;">\
</span> 	{<span style="color: #000099; font-weight: bold;">\N</span>^([a-zA-Z0-9_.-]+)@([a-zA-Z0-9_@.-]+)$<span style="color: #000099; font-weight: bold;">\N</span>}{<span style="color: #000099; font-weight: bold;">\$</span>1}}},LDAP_BASE&quot;</span> \
    <span style="color: #007800;">pass</span>=<span style="color: #800000;">${quote:$auth2}</span> \
    ldap:<span style="color: #000000; font-weight: bold;">///</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
AUTH_SERVER_MAIL = <span style="color: #800000;">${sg{${lc:${extract{1}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$authenticated_id</span><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><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\N^<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>a-zA-Z0-<span style="color: #000000;">9</span>_.-<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>a-zA-Z0-<span style="color: #000000;">9</span>_<span style="color: #000000; font-weight: bold;">@</span>.-<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span>$\N<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\<span style="color: #007800;">$2</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
AUTH_SERVER_UID = <span style="color: #800000;">${sg{${lc:${extract{1}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$authenticated_id</span><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><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\N^<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>a-zA-Z0-<span style="color: #000000;">9</span>_.-<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>a-zA-Z0-<span style="color: #000000;">9</span>_<span style="color: #000000; font-weight: bold;">@</span>.-<span style="color: #7a0874; font-weight: bold;">&#93;</span>+<span style="color: #7a0874; font-weight: bold;">&#41;</span>$\N<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\<span style="color: #007800;">$1</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
AUTH_SERVER_PASSWORD = <span style="color: #800000;">${extract{2}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$authenticated_id</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
IS_SENDER_BAD = <span style="color: #800000;">${if match {AUTH_SERVER_MAIL}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>\N^<span style="color: #7a0874; font-weight: bold;">&#91;</span>a-zA-Z0-<span style="color: #000000;">9</span>_.-<span style="color: #7a0874; font-weight: bold;">&#93;</span>+$\N<span style="color: #7a0874; font-weight: bold;">&#125;</span> \
	<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if match {${lc:AUTH_SERVER_MAIL}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${lc:$sender_address_local_part}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span> \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if match {${lc:$sender_address_local_part}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
			<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${lc:${tr{GET_ALIAS_FOR_AUTH}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>,<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>::<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><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
			<span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><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>\
	<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;">&#123;</span><span style="color: #800000;">${if match_address {${lc:AUTH_SERVER_MAIL}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${lc:$sender_address}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span> \
		<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if match_address {${lc:$sender_address}</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
			<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${lc:${tr{GET_ALIAS_FOR_AUTH}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>,<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>::<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><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
			<span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
			<span style="color: #7a0874; font-weight: bold;">&#123;</span>$<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">if</span> and<span style="color: #7a0874; font-weight: bold;">&#123;</span> \
					<span style="color: #7a0874; font-weight: bold;">&#123;</span>match_domain<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$sender_address_domain</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>+local_domains<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;">&#123;</span>match_local_part<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$sender_address_local_part</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>SEC_MAIL_USER<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;">&#123;</span>match_ip<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$sender_host_address</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span><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>\
				<span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
				<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><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>\
		<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><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
exim_path = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span>exim4
&nbsp;
.ifndef CONFDIR
CONFDIR = <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>exim4
.endif
&nbsp;
UPEX4CmacrosUPEX4C = <span style="color: #000000;">1</span>
<span style="color: #666666; font-style: italic;">##############################################</span>
<span style="color: #666666; font-style: italic;"># the following macro definitions were created</span>
<span style="color: #666666; font-style: italic;"># dynamically by /usr/sbin/update-exim4.conf</span>
.ifndef MAIN_PACKAGE_VERSION
<span style="color: #007800;">MAIN_PACKAGE_VERSION</span>=<span style="color: #000000;">4.69</span>-5ubuntu2
.endif
.ifndef MAIN_LOCAL_DOMAINS
<span style="color: #007800;">MAIN_LOCAL_DOMAINS</span>=<span style="color: #000000; font-weight: bold;">@</span>:localhost
.endif
.ifndef MAIN_RELAY_TO_DOMAINS
<span style="color: #007800;">MAIN_RELAY_TO_DOMAINS</span>=empty
.endif
.ifndef ETC_MAILNAME
<span style="color: #007800;">ETC_MAILNAME</span>=myserver
.endif
.ifndef LOCAL_DELIVERY
<span style="color: #007800;">LOCAL_DELIVERY</span>=dovecot_delivery
.endif
.ifndef MAIN_RELAY_NETS
<span style="color: #007800;">MAIN_RELAY_NETS</span>=: 127.0.0.1 : ::::<span style="color: #000000;">1</span>
.endif
.ifndef DCreadhost
<span style="color: #007800;">DCreadhost</span>=empty
.endif
.ifndef DCsmarthost
<span style="color: #007800;">DCsmarthost</span>=empty
.endif
.ifndef DC_eximconfig_configtype
<span style="color: #007800;">DC_eximconfig_configtype</span>=<span style="color: #7a0874; font-weight: bold;">local</span>
.endif
.ifndef DCconfig_local
<span style="color: #007800;">DCconfig_local</span>=<span style="color: #000000;">1</span>
.endif
<span style="color: #666666; font-style: italic;">##############################################</span>
&nbsp;
domainlist local_domains = MAIN_LOCAL_DOMAINS
&nbsp;
domainlist relay_to_domains = MAIN_RELAY_TO_DOMAINS
&nbsp;
hostlist relay_from_hosts = MAIN_RELAY_NETS
&nbsp;
.ifndef MAIN_PRIMARY_HOSTNAME_AS_QUALIFY_DOMAIN
.ifndef MAIN_QUALIFY_DOMAIN
qualify_domain = ETC_MAILNAME
.else
qualify_domain = MAIN_QUALIFY_DOMAIN
.endif
.endif
&nbsp;
.ifdef MAIN_LOCAL_INTERFACES
local_interfaces = MAIN_LOCAL_INTERFACES
.endif
&nbsp;
.ifndef LOCAL_DELIVERY
<span style="color: #007800;">LOCAL_DELIVERY</span>=mail_spool
.endif
&nbsp;
gecos_pattern = ^<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>^,:<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
gecos_name = <span style="color: #007800;">$1</span>
&nbsp;
.ifndef CHECK_RCPT_LOCAL_LOCALPARTS
CHECK_RCPT_LOCAL_LOCALPARTS = ^<span style="color: #7a0874; font-weight: bold;">&#91;</span>.<span style="color: #7a0874; font-weight: bold;">&#93;</span> : ^.<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: #666666; font-style: italic;">#&amp;?]</span>
.endif
&nbsp;
.ifndef CHECK_RCPT_REMOTE_LOCALPARTS
CHECK_RCPT_REMOTE_LOCALPARTS = ^<span style="color: #7a0874; font-weight: bold;">&#91;</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: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">@%!`</span><span style="color: #666666; font-style: italic;">#&amp;?] : ^.*/\\.\\./</span>
.endif
&nbsp;
.ifndef MAIN_LOG_SELECTOR
MAIN_LOG_SELECTOR = +tls_peerdn
.endif
&nbsp;
.ifndef MAIN_ACL_CHECK_MAIL
MAIN_ACL_CHECK_MAIL = acl_check_mail
.endif
acl_smtp_mail = MAIN_ACL_CHECK_MAIL
&nbsp;
.ifndef MAIN_ACL_CHECK_RCPT
MAIN_ACL_CHECK_RCPT = acl_check_rcpt
.endif
acl_smtp_rcpt = MAIN_ACL_CHECK_RCPT
&nbsp;
.ifndef MAIN_ACL_CHECK_DATA
MAIN_ACL_CHECK_DATA = acl_check_data
.endif
acl_smtp_data = MAIN_ACL_CHECK_DATA
&nbsp;
.ifdef MESSAGE_SIZE_LIMIT
message_size_limit = MESSAGE_SIZE_LIMIT
.endif
&nbsp;
.ifdef MAIN_ALLOW_DOMAIN_LITERALS
allow_domain_literals
.endif
&nbsp;
.ifndef DC_minimaldns
.ifndef MAIN_HOST_LOOKUP
MAIN_HOST_LOOKUP = <span style="color: #000000; font-weight: bold;">*</span>
.endif
host_lookup = MAIN_HOST_LOOKUP
.endif
&nbsp;
.ifdef MAIN_HARDCODE_PRIMARY_HOSTNAME
primary_hostname = MAIN_HARDCODE_PRIMARY_HOSTNAME
.endif
&nbsp;
.ifdef MAIN_SMTP_ACCEPT_MAX_NOMAIL_HOSTS
smtp_accept_max_nonmail_hosts = MAIN_SMTP_ACCEPT_MAX_NOMAIL_HOSTS
.endif
&nbsp;
.ifndef MAIN_FORCE_SENDER
local_from_check = <span style="color: #c20cb9; font-weight: bold;">false</span>
local_sender_retain = <span style="color: #c20cb9; font-weight: bold;">true</span>
untrusted_set_sender = <span style="color: #000000; font-weight: bold;">*</span>
.endif
&nbsp;
.ifndef MAIN_IGNORE_BOUNCE_ERRORS_AFTER
MAIN_IGNORE_BOUNCE_ERRORS_AFTER = 2d
.endif
ignore_bounce_errors_after = MAIN_IGNORE_BOUNCE_ERRORS_AFTER
&nbsp;
.ifndef MAIN_TIMEOUT_FROZEN_AFTER
MAIN_TIMEOUT_FROZEN_AFTER = 7d
.endif
timeout_frozen_after = MAIN_TIMEOUT_FROZEN_AFTER
&nbsp;
.ifndef MAIN_FREEZE_TELL
MAIN_FREEZE_TELL = postmaster
.endif
freeze_tell = MAIN_FREEZE_TELL
&nbsp;
.ifndef SPOOLDIR
SPOOLDIR = <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>exim4
.endif
spool_directory = SPOOLDIR
&nbsp;
.ifndef MAIN_TRUSTED_USERS
MAIN_TRUSTED_USERS = uucp
.endif
trusted_users = MAIN_TRUSTED_USERS
.ifdef MAIN_TRUSTED_GROUPS
trusted_groups = MAIN_TRUSTED_GROUPS
.endif
&nbsp;
.ifdef MAIN_TLS_ENABLE
.ifndef MAIN_TLS_ADVERTISE_HOSTS
MAIN_TLS_ADVERTISE_HOSTS = <span style="color: #000000; font-weight: bold;">*</span>
.endif
tls_advertise_hosts = MAIN_TLS_ADVERTISE_HOSTS
&nbsp;
.ifdef MAIN_TLS_CERTKEY
tls_certificate = MAIN_TLS_CERTKEY
.else
.ifndef MAIN_TLS_CERTIFICATE
MAIN_TLS_CERTIFICATE = CONFDIR<span style="color: #000000; font-weight: bold;">/</span>exim.crt
.endif
tls_certificate = MAIN_TLS_CERTIFICATE
&nbsp;
.ifndef MAIN_TLS_PRIVATEKEY
MAIN_TLS_PRIVATEKEY = CONFDIR<span style="color: #000000; font-weight: bold;">/</span>exim.key
.endif
tls_privatekey = MAIN_TLS_PRIVATEKEY
.endif
&nbsp;
.ifndef MAIN_TLS_VERIFY_CERTIFICATES
MAIN_TLS_VERIFY_CERTIFICATES = <span style="color: #800000;">${if exists{/etc/ssl/certs/ca-certificates.crt}</span>\
                                    <span style="color: #7a0874; font-weight: bold;">&#123;</span><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>ca-certificates.crt<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
				    <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
.endif
tls_verify_certificates = MAIN_TLS_VERIFY_CERTIFICATES
&nbsp;
.ifdef MAIN_TLS_VERIFY_HOSTS
tls_verify_hosts = MAIN_TLS_VERIFY_HOSTS
.endif
&nbsp;
.ifndef MAIN_TLS_TRY_VERIFY_HOSTS
MAIN_TLS_TRY_VERIFY_HOSTS = <span style="color: #000000; font-weight: bold;">*</span>
.endif
tls_try_verify_hosts = MAIN_TLS_TRY_VERIFY_HOSTS
&nbsp;
.endif
&nbsp;
.ifdef MAIN_LOG_SELECTOR
log_selector = MAIN_LOG_SELECTOR
.endif
&nbsp;
begin acl
&nbsp;
acl_check_not_smtp:
  accept
	<span style="color: #007800;">condition</span>=<span style="color: #800000;">${if IS_SENDER_SECMAIL {yes}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
	<span style="color: #007800;">control</span>=suppress_local_fixups
&nbsp;
  accept
&nbsp;
acl_local_deny_exceptions:
  accept
    hosts = <span style="color: #800000;">${if exists{CONFDIR/host_local_deny_exceptions}</span>\
                 <span style="color: #7a0874; font-weight: bold;">&#123;</span>CONFDIR<span style="color: #000000; font-weight: bold;">/</span>host_local_deny_exceptions<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
                 <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
  accept
    senders = <span style="color: #800000;">${if exists{CONFDIR/sender_local_deny_exceptions}</span>\
                   <span style="color: #7a0874; font-weight: bold;">&#123;</span>CONFDIR<span style="color: #000000; font-weight: bold;">/</span>sender_local_deny_exceptions<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
                   <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
  accept
    hosts = <span style="color: #800000;">${if exists{CONFDIR/local_host_whitelist}</span>\
                 <span style="color: #7a0874; font-weight: bold;">&#123;</span>CONFDIR<span style="color: #000000; font-weight: bold;">/</span>local_host_whitelist<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
                 <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
  accept
    senders = <span style="color: #800000;">${if exists{CONFDIR/local_sender_whitelist}</span>\
                   <span style="color: #7a0874; font-weight: bold;">&#123;</span>CONFDIR<span style="color: #000000; font-weight: bold;">/</span>local_sender_whitelist<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
                   <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
  .ifdef LOCAL_DENY_EXCEPTIONS_LOCAL_ACL_FILE
  .include LOCAL_DENY_EXCEPTIONS_LOCAL_ACL_FILE
  .endif
&nbsp;
  .ifdef WHITELIST_LOCAL_DENY_LOCAL_ACL_FILE
  .include WHITELIST_LOCAL_DENY_LOCAL_ACL_FILE
  .endif
&nbsp;
acl_check_mail:
  .ifdef CHECK_MAIL_HELO_ISSUED
  deny
    message = no HELO given before MAIL <span style="color: #7a0874; font-weight: bold;">command</span>
    condition = <span style="color: #800000;">${if def:sender_helo_name {no}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
  .endif
&nbsp;
  deny
    message = bad sender
    log_message = bad sender <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">auth_id</span>=AUTH_SERVER_MAIL mismatches <span style="color: #007800;">sender</span>=<span style="color: #007800;">$sender_address</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    condition = IS_SENDER_BAD
  accept
&nbsp;
acl_check_rcpt:
&nbsp;
  .ifdef CHECK_RCPT_LOCAL_LOCALPARTS
  deny
    domains = +local_domains
    local_parts = CHECK_RCPT_LOCAL_LOCALPARTS
    message = restricted characters <span style="color: #000000; font-weight: bold;">in</span> address
  .endif
&nbsp;
  .ifdef CHECK_RCPT_REMOTE_LOCALPARTS
  deny
    domains = <span style="color: #000000; font-weight: bold;">!</span>+local_domains
    local_parts = CHECK_RCPT_REMOTE_LOCALPARTS
    message = restricted characters <span style="color: #000000; font-weight: bold;">in</span> address
  .endif
&nbsp;
  accept
    .ifndef CHECK_RCPT_POSTMASTER
    local_parts = postmaster
    .else
    local_parts = CHECK_RCPT_POSTMASTER
    .endif
    domains = +local_domains : +relay_to_domains
&nbsp;
  .ifdef CHECK_RCPT_VERIFY_SENDER
  deny
    message = Sender verification failed
    <span style="color: #000000; font-weight: bold;">!</span>acl = acl_local_deny_exceptions
    <span style="color: #000000; font-weight: bold;">!</span>verify = sender
  .endif
&nbsp;
  deny
    <span style="color: #000000; font-weight: bold;">!</span>acl = acl_local_deny_exceptions
    senders = <span style="color: #800000;">${if exists{CONFDIR/local_sender_callout}</span>\
                         <span style="color: #7a0874; font-weight: bold;">&#123;</span>CONFDIR<span style="color: #000000; font-weight: bold;">/</span>local_sender_callout<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
                   <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">!</span>verify = sender<span style="color: #000000; font-weight: bold;">/</span>callout
&nbsp;
  require
    verify = recipient
&nbsp;
  accept
    authenticated = <span style="color: #000000; font-weight: bold;">*</span>
    condition = IS_SENDER_REMOTE
&nbsp;
  require
    message = relay not permitted
    domains = +local_domains : +relay_to_domains
&nbsp;
  deny
    <span style="color: #000000; font-weight: bold;">!</span>acl = acl_local_deny_exceptions
    recipients = <span style="color: #800000;">${if exists{CONFDIR/local_rcpt_callout}</span>\
                            <span style="color: #7a0874; font-weight: bold;">&#123;</span>CONFDIR<span style="color: #000000; font-weight: bold;">/</span>local_rcpt_callout<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
                      <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">!</span>verify = recipient<span style="color: #000000; font-weight: bold;">/</span>callout
&nbsp;
  deny
    message = sender envelope address <span style="color: #007800;">$sender_address</span> is locally blacklisted here. If you think this is wrong, get <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #c20cb9; font-weight: bold;">touch</span> with postmaster
    <span style="color: #000000; font-weight: bold;">!</span>acl = acl_local_deny_exceptions
    senders = <span style="color: #800000;">${if exists{CONFDIR/local_sender_blacklist}</span>\
                   <span style="color: #7a0874; font-weight: bold;">&#123;</span>CONFDIR<span style="color: #000000; font-weight: bold;">/</span>local_sender_blacklist<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
                   <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
  deny
    message = sender IP address <span style="color: #007800;">$sender_host_address</span> is locally blacklisted here. If you think this is wrong, get <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #c20cb9; font-weight: bold;">touch</span> with postmaster
    <span style="color: #000000; font-weight: bold;">!</span>acl = acl_local_deny_exceptions
    hosts = <span style="color: #800000;">${if exists{CONFDIR/local_host_blacklist}</span>\
                 <span style="color: #7a0874; font-weight: bold;">&#123;</span>CONFDIR<span style="color: #000000; font-weight: bold;">/</span>local_host_blacklist<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
                 <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
  .ifdef CHECK_RCPT_REVERSE_DNS
  warn
    message = X-Host-Lookup-Failed: Reverse DNS lookup failed <span style="color: #000000; font-weight: bold;">for</span> <span style="color: #007800;">$sender_host_address</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #800000;">${if eq{$host_lookup_failed}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>failed<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>deferred<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;">&#41;</span>
     condition = <span style="color: #800000;">${if and{{def:sender_host_address}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">!</span>def:sender_host_name<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;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
  .endif
&nbsp;
  .ifdef CHECK_RCPT_SPF
  deny
    message = <span style="color: #7a0874; font-weight: bold;">&#91;</span>SPF<span style="color: #7a0874; font-weight: bold;">&#93;</span> <span style="color: #007800;">$sender_host_address</span> is not allowed to send mail from <span style="color: #800000;">${if def:sender_address_domain {$sender_address_domain}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$sender_helo_name</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>.  \
              Please see http:<span style="color: #000000; font-weight: bold;">//</span>www.openspf.org<span style="color: #000000; font-weight: bold;">/</span>Why?<span style="color: #007800;">scope</span>=<span style="color: #800000;">${if def:sender_address_domain {mfrom}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>helo<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>;<span style="color: #007800;">identity</span>=<span style="color: #800000;">${if def:sender_address_domain {$sender_address}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$sender_helo_name</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>;<span style="color: #007800;">ip</span>=<span style="color: #007800;">$sender_host_address</span>
    log_message = SPF check failed.
    <span style="color: #000000; font-weight: bold;">!</span>acl = acl_local_deny_exceptions
    condition = <span style="color: #800000;">${run{/usr/bin/spfquery --ip \&quot;$sender_host_address\&quot; --mail-from \&quot;$sender_address\&quot; --helo \&quot;$sender_helo_name\&quot;}</span>\
                     <span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if eq {$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>no<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><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
  defer
    message = Temporary DNS error <span style="color: #000000; font-weight: bold;">while</span> checking SPF record.  Try again later.
    condition = <span style="color: #800000;">${if eq {$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">5</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
  warn
    message = Received-SPF: <span style="color: #800000;">${if eq {$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>pass<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if eq {$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>softfail<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
                                 <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if eq {$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>neutral<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if eq {$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>unknown<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if eq {$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">6</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>none<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>error<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><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><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><span style="color: #7a0874; font-weight: bold;">&#125;</span>
    condition = <span style="color: #800000;">${if &lt;={$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">6</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
  warn
    log_message = Unexpected error <span style="color: #000000; font-weight: bold;">in</span> SPF check.
    condition = <span style="color: #800000;">${if &gt;{$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">6</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
  warn
    message = X-SPF-Guess: <span style="color: #800000;">${run{/usr/bin/spfquery --ip \&quot;$sender_host_address\&quot; --mail-from \&quot;$sender_address\&quot; \ --helo \&quot;$sender_helo_name\&quot; --guess true}</span>\
                                <span style="color: #7a0874; font-weight: bold;">&#123;</span>pass<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if eq {$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>softfail<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if eq {$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>neutral<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if eq {$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>unknown<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
                                <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if eq {$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">6</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>none<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>error<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><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><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><span style="color: #7a0874; font-weight: bold;">&#125;</span>
    condition = <span style="color: #800000;">${if &lt;={$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">6</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
  defer
    message = Temporary DNS error <span style="color: #000000; font-weight: bold;">while</span> checking SPF record.  Try again later.
    condition = <span style="color: #800000;">${if eq {$runrc}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">5</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #c20cb9; font-weight: bold;">yes</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
  .endif
&nbsp;
  .ifdef CHECK_RCPT_IP_DNSBLS
  warn
    message = X-Warning: <span style="color: #007800;">$sender_host_address</span> is listed at <span style="color: #007800;">$dnslist_domain</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$dnslist_value</span>: <span style="color: #007800;">$dnslist_text</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    log_message = <span style="color: #007800;">$sender_host_address</span> is listed at <span style="color: #007800;">$dnslist_domain</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$dnslist_value</span>: <span style="color: #007800;">$dnslist_text</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    dnslists = CHECK_RCPT_IP_DNSBLS
  .endif
&nbsp;
  .ifdef CHECK_RCPT_DOMAIN_DNSBLS
  warn
    message = X-Warning: <span style="color: #007800;">$sender_address_domain</span> is listed at <span style="color: #007800;">$dnslist_domain</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$dnslist_value</span>: <span style="color: #007800;">$dnslist_text</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    log_message = <span style="color: #007800;">$sender_address_domain</span> is listed at <span style="color: #007800;">$dnslist_domain</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">$dnslist_value</span>: <span style="color: #007800;">$dnslist_text</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
    <span style="color: #000000; font-weight: bold;">!</span>senders = <span style="color: #800000;">${if exists{CONFDIR/local_domain_dnsbl_whitelist}</span>\
                    <span style="color: #7a0874; font-weight: bold;">&#123;</span>CONFDIR<span style="color: #000000; font-weight: bold;">/</span>local_domain_dnsbl_whitelist<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
                    <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
    dnslists = CHECK_RCPT_DOMAIN_DNSBLS
  .endif
&nbsp;
  .ifdef CHECK_RCPT_LOCAL_ACL_FILE
  .include CHECK_RCPT_LOCAL_ACL_FILE
  .endif
&nbsp;
  accept
    domains = +relay_to_domains
    endpass
    verify = recipient
&nbsp;
  accept
&nbsp;
acl_check_data:
&nbsp;
  .ifdef CHECK_DATA_VERIFY_HEADER_SYNTAX
  deny
    message = Message headers fail syntax check
    <span style="color: #000000; font-weight: bold;">!</span>acl = acl_local_deny_exceptions
    <span style="color: #000000; font-weight: bold;">!</span>verify = header_syntax
  .endif
&nbsp;
  .ifdef CHECK_DATA_VERIFY_HEADER_SENDER
  deny
    message = No verifiable sender address <span style="color: #000000; font-weight: bold;">in</span> message headers
    <span style="color: #000000; font-weight: bold;">!</span>acl = acl_local_deny_exceptions
    <span style="color: #000000; font-weight: bold;">!</span>verify = header_sender
  .endif
&nbsp;
  .ifdef CHECK_DATA_LOCAL_ACL_FILE
  .include CHECK_DATA_LOCAL_ACL_FILE
  .endif
&nbsp;
  accept
&nbsp;
begin routers
&nbsp;
.ifdef MAIN_ALLOW_DOMAIN_LITERALS
domain_literal:
  debug_print = <span style="color: #ff0000;">&quot;R: domain_literal for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = ipliteral
  domains = <span style="color: #000000; font-weight: bold;">!</span> +local_domains
  transport = remote_smtp
.endif
&nbsp;
hubbed_hosts:
  debug_print = <span style="color: #ff0000;">&quot;R: hubbed_hosts for <span style="color: #007800;">$domain</span>&quot;</span>
  driver = manualroute
  domains = <span style="color: #ff0000;">&quot;<span style="color: #007800;">${if exists{CONFDIR/hubbed_hosts}</span><span style="color: #000099; font-weight: bold;">\
</span>                   {partial-lsearch;CONFDIR/hubbed_hosts}<span style="color: #000099; font-weight: bold;">\
</span>              fail}&quot;</span>
  same_domain_copy_routing = <span style="color: #c20cb9; font-weight: bold;">yes</span>
  route_data = <span style="color: #800000;">${lookup{$domain}</span>partial-lsearch<span style="color: #7a0874; font-weight: bold;">&#123;</span>CONFDIR<span style="color: #000000; font-weight: bold;">/</span>hubbed_hosts<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
  transport = remote_smtp
&nbsp;
system_aliases:
  debug_print = <span style="color: #ff0000;">&quot;R: system_aliases for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = redirect
  domains = +local_domains
  allow_fail
  allow_defer
  data = <span style="color: #800000;">${lookup{$local_part}</span>lsearch<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>aliases<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
  .ifdef SYSTEM_ALIASES_USER
  user = SYSTEM_ALIASES_USER
  .endif
  .ifdef SYSTEM_ALIASES_GROUP
  group = SYSTEM_ALIASES_GROUP
  .endif
  .ifdef SYSTEM_ALIASES_FILE_TRANSPORT
  file_transport = SYSTEM_ALIASES_FILE_TRANSPORT
  .endif
  .ifdef SYSTEM_ALIASES_PIPE_TRANSPORT
  pipe_transport = SYSTEM_ALIASES_PIPE_TRANSPORT
  .endif
  .ifdef SYSTEM_ALIASES_DIRECTORY_TRANSPORT
  directory_transport = SYSTEM_ALIASES_DIRECTORY_TRANSPORT
  .endif
&nbsp;
.ifndef FIRST_USER_ACCOUNT_UID
FIRST_USER_ACCOUNT_UID = <span style="color: #000000;">0</span>
.endif
&nbsp;
.ifndef DEFAULT_SYSTEM_ACCOUNT_ALIAS
DEFAULT_SYSTEM_ACCOUNT_ALIAS = :fail: no mail to system accounts
.endif
&nbsp;
COND_SYSTEM_USER_AND_REMOTE_SUBMITTER = <span style="color: #ff0000;">&quot;<span style="color: #000099; font-weight: bold;">\
</span>               <span style="color: #007800;">${if and{{! match_ip{$sender_host_address}</span>{:@[]}}<span style="color: #000099; font-weight: bold;">\
</span>                        {&lt;{<span style="color: #007800;">$local_user_uid</span>}{FIRST_USER_ACCOUNT_UID}}}<span style="color: #000099; font-weight: bold;">\
</span>                    {1}{0}<span style="color: #000099; font-weight: bold;">\
</span>		}&quot;</span>
&nbsp;
lowuid_aliases:
  debug_print = <span style="color: #ff0000;">&quot;R: lowuid_aliases for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span> (UID <span style="color: #007800;">$local_user_uid</span>)&quot;</span>
  check_local_user
  driver = redirect
  allow_fail
  domains = +local_domains
  condition = COND_SYSTEM_USER_AND_REMOTE_SUBMITTER
  data = <span style="color: #800000;">${if exists{/etc/exim4/lowuid-aliases}</span>\
              <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${lookup{$local_part}</span>lsearch<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>exim4<span style="color: #000000; font-weight: bold;">/</span>lowuid-aliases<span style="color: #7a0874; font-weight: bold;">&#125;</span>\
              <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$value</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>DEFAULT_SYSTEM_ACCOUNT_ALIAS<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><span style="color: #7a0874; font-weight: bold;">&#123;</span>DEFAULT_SYSTEM_ACCOUNT_ALIAS<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
local_user_secmail:
  debug_print = <span style="color: #ff0000;">&quot;R: local_user_secmail for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = accept
  domains = +local_domains
  local_parts = <span style="color: #000000; font-weight: bold;">!</span> root
  condition = <span style="color: #800000;">${if IS_SENDER_SECMAIL {IS_LOCAL_PART_VALID}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>no<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
  transport = LOCAL_DELIVERY_SECMAIL
&nbsp;
local_user:
  debug_print = <span style="color: #ff0000;">&quot;R: local_user for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = accept
  domains = +local_domains
  local_parts = <span style="color: #000000; font-weight: bold;">!</span> root
  condition = IS_LOCAL_PART_VALID
  transport = LOCAL_DELIVERY
  cannot_route_message = Unknown user
&nbsp;
ldap_uid_aliases:
  debug_print = <span style="color: #ff0000;">&quot;R: ldap_uid_alias for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = redirect
  data = GET_UID_FOR_RCPT
  check_ancestor
&nbsp;
ldap_aliases:
  debug_print = <span style="color: #ff0000;">&quot;R: ldap_alias for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = redirect
  data = GET_ALIAS_FOR_RCPT
  check_ancestor
&nbsp;
.ifdef DCconfig_satellite
hub_user:
  debug_print = <span style="color: #ff0000;">&quot;R: hub_user for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = redirect
  domains = +local_domains
  data = <span style="color: #800000;">${local_part}</span><span style="color: #000000; font-weight: bold;">@</span>DCreadhost
  check_local_user
&nbsp;
hub_user_smarthost:
  debug_print = <span style="color: #ff0000;">&quot;R: hub_user_smarthost for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = manualroute
  domains = DCreadhost
  transport = remote_smtp_smarthost
  route_list = <span style="color: #000000; font-weight: bold;">*</span> DCsmarthost byname
  host_find_failed = defer
  same_domain_copy_routing = <span style="color: #c20cb9; font-weight: bold;">yes</span>
  check_local_user
.endif
&nbsp;
smarthost_auto:
   condition = IS_AUTH_REMOTE
   driver = manualroute
   domains = <span style="color: #000000; font-weight: bold;">!</span> +local_domains
   route_data = AUTH_REMOTE_SERVER
   transport = remote_smtp_smarthost_auto
&nbsp;
mail4root:
  debug_print = <span style="color: #ff0000;">&quot;R: mail4root for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = redirect
  domains = +local_domains
  data = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>mail<span style="color: #000000; font-weight: bold;">/</span>mail
  file_transport = address_file
  local_parts = root
  user = mail
  group = mail
&nbsp;
begin transports
&nbsp;
.ifdef HIDE_MAILNAME
<span style="color: #007800;">REMOTE_SMTP_HEADERS_REWRITE</span>=<span style="color: #000000; font-weight: bold;">*@</span>+local_domains <span style="color: #007800;">$1</span><span style="color: #000000; font-weight: bold;">@</span>DCreadhost frs : <span style="color: #000000; font-weight: bold;">*@</span>ETC_MAILNAME <span style="color: #007800;">$1</span><span style="color: #000000; font-weight: bold;">@</span>DCreadhost frs
<span style="color: #007800;">REMOTE_SMTP_RETURN_PATH</span>=<span style="color: #800000;">${if match_domain{$sender_address_domain}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>+local_domains<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${sender_address_local_part}</span><span style="color: #000000; font-weight: bold;">@</span>DCreadhost<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${if match_domain{$sender_address_domain}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>ETC_MAILNAME<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #800000;">${sender_address_local_part}</span><span style="color: #000000; font-weight: bold;">@</span>DCreadhost<span style="color: #7a0874; font-weight: bold;">&#125;</span>fail<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>
.endif
&nbsp;
.ifdef REMOTE_SMTP_HELO_FROM_DNS
<span style="color: #007800;">REMOTE_SMTP_HELO_DATA</span>=<span style="color: #800000;">${lookup dnsdb {ptr=$sending_ip_address}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$value</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$primary_hostname</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
.endif
&nbsp;
address_file:
  debug_print = <span style="color: #ff0000;">&quot;T: address_file for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = appendfile
  delivery_date_add
  envelope_to_add
  return_path_add
&nbsp;
address_pipe:
  debug_print = <span style="color: #ff0000;">&quot;T: address_pipe for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = pipe
  return_fail_output
&nbsp;
address_reply:
  debug_print = <span style="color: #ff0000;">&quot;T: autoreply for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = autoreply
&nbsp;
dovecot_delivery:
  debug_print = <span style="color: #ff0000;">&quot;T: dovecot_delivery_pipe for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span> translates to GET_LOCAL_MAIL&quot;</span>
  driver = pipe
  <span style="color: #7a0874; font-weight: bold;">command</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: #ff0000;">&quot;GET_LOCAL_MAIL&quot;</span>
  message_prefix =
  message_suffix =
  delivery_date_add
  envelope_to_add
  return_path_add
  log_output
  user = secmail
  group = secmail
&nbsp;
dovecot_delivery_secmail:
  debug_print = <span style="color: #ff0000;">&quot;T: dovecot_delivery_pipe_secmail for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span> translates to GET_LOCAL_MAIL&quot;</span>
  driver = pipe
  <span style="color: #7a0874; font-weight: bold;">command</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: #ff0000;">&quot;GET_LOCAL_MAIL&quot;</span>
  message_prefix =
  message_suffix =
  delivery_date_add = <span style="color: #c20cb9; font-weight: bold;">false</span>
  envelope_to_add = <span style="color: #c20cb9; font-weight: bold;">false</span>
  return_path_add = <span style="color: #c20cb9; font-weight: bold;">false</span>
  log_output
  user = secmail
  group = secmail
&nbsp;
mail_spool:
  debug_print = <span style="color: #ff0000;">&quot;T: appendfile for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = appendfile
  <span style="color: #c20cb9; font-weight: bold;">file</span> = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>mail<span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$local_part</span>
  delivery_date_add
  envelope_to_add
  return_path_add
  group = mail
  mode = 0660
  mode_fail_narrower = <span style="color: #c20cb9; font-weight: bold;">false</span>
&nbsp;
maildir_home:
  debug_print = <span style="color: #ff0000;">&quot;T: maildir_home for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = appendfile
  .ifdef MAILDIR_HOME_MAILDIR_LOCATION
  directory = MAILDIR_HOME_MAILDIR_LOCATION
  .else
  directory = <span style="color: #007800;">$home</span><span style="color: #000000; font-weight: bold;">/</span>Maildir
  .endif
  .ifdef MAILDIR_HOME_CREATE_DIRECTORY
  create_directory
  .endif
  .ifdef MAILDIR_HOME_CREATE_FILE
  create_file = MAILDIR_HOME_CREATE_FILE
  .endif
  delivery_date_add
  envelope_to_add
  return_path_add
  maildir_format
  .ifdef MAILDIR_HOME_DIRECTORY_MODE
  directory_mode = MAILDIR_HOME_DIRECTORY_MODE
  .else
  directory_mode = 0700
  .endif
  .ifdef MAILDIR_HOME_MODE
  mode = MAILDIR_HOME_MODE
  .else
  mode = 0600
  .endif
  mode_fail_narrower = <span style="color: #c20cb9; font-weight: bold;">false</span>
&nbsp;
maildrop_pipe:
  debug_print = <span style="color: #ff0000;">&quot;T: maildrop_pipe for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = pipe
  path = <span style="color: #ff0000;">&quot;/bin:/usr/bin:/usr/local/bin&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">command</span> = <span style="color: #ff0000;">&quot;/usr/bin/maildrop&quot;</span>
  return_path_add
  delivery_date_add
  envelope_to_add
&nbsp;
procmail_pipe:
  debug_print = <span style="color: #ff0000;">&quot;T: procmail_pipe for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = pipe
  path = <span style="color: #ff0000;">&quot;/bin:/usr/bin:/usr/local/bin&quot;</span>
  <span style="color: #7a0874; font-weight: bold;">command</span> = <span style="color: #ff0000;">&quot;/usr/bin/procmail&quot;</span>
  return_path_add
  delivery_date_add
  envelope_to_add
&nbsp;
remote_smtp:
  debug_print = <span style="color: #ff0000;">&quot;T: remote_smtp for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = smtp
.ifdef REMOTE_SMTP_HOSTS_AVOID_TLS
  hosts_avoid_tls = REMOTE_SMTP_HOSTS_AVOID_TLS
.endif
.ifdef REMOTE_SMTP_HEADERS_REWRITE
  headers_rewrite = REMOTE_SMTP_HEADERS_REWRITE
.endif
.ifdef REMOTE_SMTP_RETURN_PATH
  return_path = REMOTE_SMTP_RETURN_PATH
.endif
.ifdef REMOTE_SMTP_HELO_FROM_DNS
  <span style="color: #007800;">helo_data</span>=REMOTE_SMTP_HELO_DATA
.endif
&nbsp;
remote_smtp_smarthost:
  debug_print = <span style="color: #ff0000;">&quot;T: remote_smtp_smarthost for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = smtp
  hosts_try_auth = <span style="color: #000000; font-weight: bold;">&lt;</span>; <span style="color: #800000;">${if exists{CONFDIR/passwd.client}</span> \
        <span style="color: #7a0874; font-weight: bold;">&#123;</span>\
        <span style="color: #800000;">${lookup{$host}</span>nwildlsearch<span style="color: #7a0874; font-weight: bold;">&#123;</span>CONFDIR<span style="color: #000000; font-weight: bold;">/</span>passwd.client<span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #007800;">$host_address</span><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>\
        <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> \
      <span style="color: #7a0874; font-weight: bold;">&#125;</span>
.ifdef REMOTE_SMTP_SMARTHOST_HOSTS_AVOID_TLS
  hosts_avoid_tls = REMOTE_SMTP_SMARTHOST_HOSTS_AVOID_TLS
.endif
.ifdef REMOTE_SMTP_HEADERS_REWRITE
  headers_rewrite = REMOTE_SMTP_HEADERS_REWRITE
.endif
.ifdef REMOTE_SMTP_RETURN_PATH
  return_path = REMOTE_SMTP_RETURN_PATH
.endif
.ifdef REMOTE_SMTP_HELO_FROM_DNS
  <span style="color: #007800;">helo_data</span>=REMOTE_SMTP_HELO_DATA
.endif
&nbsp;
remote_smtp_smarthost_auto:
  debug_print = <span style="color: #ff0000;">&quot;T: remote_smtp_smarthost_auto for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span> from user AUTH_SERVER_MAIL&quot;</span>
  driver = smtp
  hosts_require_auth = AUTH_REMOTE_SERVER
&nbsp;
address_directory:
  debug_print = <span style="color: #ff0000;">&quot;T: address_directory for <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = appendfile
  delivery_date_add
  envelope_to_add
  return_path_add
  check_string = <span style="color: #ff0000;">&quot;&quot;</span>
  escape_string = <span style="color: #ff0000;">&quot;&quot;</span>
  maildir_format
&nbsp;
begin retry
&nbsp;
<span style="color: #000000; font-weight: bold;">*</span>                      <span style="color: #000000; font-weight: bold;">*</span>           F,2h,15m; G,16h,1h,<span style="color: #000000;">1.5</span>; F,4d,6h
&nbsp;
begin rewrite
&nbsp;
.ifndef NO_EAA_REWRITE_REWRITE
<span style="color: #000000; font-weight: bold;">*@</span>+local_domains <span style="color: #ff0000;">&quot;<span style="color: #007800;">${lookup{${local_part}</span>}lsearch{/etc/email-addresses}<span style="color: #000099; font-weight: bold;">\
</span>                   {<span style="color: #007800;">$value</span>}fail}&quot;</span> Ffrs
<span style="color: #000000; font-weight: bold;">*@</span>ETC_MAILNAME <span style="color: #ff0000;">&quot;<span style="color: #007800;">${lookup{${local_part}</span>}lsearch{/etc/email-addresses}<span style="color: #000099; font-weight: bold;">\
</span>                   {<span style="color: #007800;">$value</span>}fail}&quot;</span> Ffrs
.endif
&nbsp;
begin authenticators
&nbsp;
plain_ldapauth_server:
  driver = plaintext
  public_name = PLAIN
  .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
    server_advertise_condition = <span style="color: #800000;">${if eq{$tls_cipher}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
  .endif
  server_condition = AUTH_SERVER_PLAIN_AUTH
  server_set_id = <span style="color: #007800;">$auth2</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$auth3</span>
  server_prompts = :
&nbsp;
login_ldapauth_server:
  driver = plaintext
  public_name = LOGIN
  server_prompts = Username:: : Password::
  .ifndef AUTH_SERVER_ALLOW_NOTLS_PASSWORDS
    server_advertise_condition = <span style="color: #800000;">${if eq{$tls_cipher}</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#125;</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>
  .endif
  server_condition = AUTH_SERVER_LOGIN_AUTH
  server_set_id = <span style="color: #007800;">$auth1</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #007800;">$auth2</span>
&nbsp;
cram_md5_client:
     driver = cram_md5
     public_name = CRAM-MD5
     client_name = AUTH_REMOTE_LOGIN
     client_secret = AUTH_REMOTE_PASSWORD
&nbsp;
plain_client:
      driver = plaintext
      public_name = PLAIN
      client_send = <span style="color: #000000; font-weight: bold;">&lt;|</span>^AUTH_REMOTE_LOGIN^AUTH_REMOTE_PASSWORD
&nbsp;
login_client:
      driver = plaintext
      public_name = LOGIN
      client_send = <span style="color: #000000; font-weight: bold;">&lt;|</span> <span style="color: #000000; font-weight: bold;">|</span> AUTH_REMOTE_LOGIN <span style="color: #000000; font-weight: bold;">|</span> AUTH_REMOTE_PASSWORD</pre></div></div>

<p>Die Konfigurationsdatei ist auf den ersten Blick sehr umfangreich, allerdings gibt es eine <a href="http://www.exim.org/exim-html-current/doc/html/spec_html/">exzellente Dokumentation von Exim</a>. Dort sind insbesondere die Abschnitte zu <a href="http://www.exim.org/exim-html-current/doc/html/spec_html/ch09.html">Lookups</a> (wegen LDAP) und <a href="http://www.exim.org/exim-html-current/doc/html/spec_html/ch11.html">String Expansions</a> interessant. Allgemeine <a href="http://koivi.com/exim4-config/">Konfigurationshinweise für Exim unter Debian/Ubuntu</a> hat Justin Koivisto zusammengestellt. Den <a href="http://www.wogri.at/Exim.248.0.html?&amp;L=1">Beitrag von Wolfgang Hennerbichler zur Einrichtung der TLS-Verschlüsselung der SMTP-Verbindung</a> zusammen mit der <a href="http://pkg-exim4.alioth.debian.org/README/README.Debian.html#TLS">Dokumentation von exim4-config zu diesem Thema</a> empfand ich ebenfalls hilfreich wie auch den <a href="http://www.exim-users.org/forums/showthread.php?t=44484&amp;page=1&amp;pp=15">Forumsthread, der die Verwendung von $authenticated_id und die Anpassung des received_header_text dokumentiert</a>. Die Mailingliste von exim enthält einen sehr guten Beitrag, mit ausführlicher Beispielkonfiguration, wie <a href="http://www.mail-archive.com/exim-users@exim.org/msg29852.html">E-Mails via Authentifizierung über externe Mailserver verschickt</a> werden können. <a href="http://www.tgunkel.de/docs/exim_smarthosts.de">Wie man mehrere Smarthosts mit Exim verwendt</a>, beschreibt auch Thorsten Gunkel.<br />
Nun testen wir die Exim-Konfiguration, ob auch alles wie gewünscht funktioniert.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">exim <span style="color: #660033;">-bt</span> paul<span style="color: #000000; font-weight: bold;">@</span>myserver</pre></div></div>

<p>sollte folgendes ausgeben</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">R: system_aliases for paul@myserver
R: local_user_secmail for paul@myserver
R: local_user for paul@myserver
paul@myserver
  router = local_user, transport = dovecot_delivery</pre></div></div>

<p>analog sollte ein</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">exim <span style="color: #660033;">-bt</span> paulpanzer<span style="color: #000000; font-weight: bold;">@</span>gmx.de</pre></div></div>

<p>zu folgendem Resultat führen</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">R: ldap_uid_alias for paulpanzer@gmx.de
R: system_aliases for paul@myserver
R: local_user_secmail for paul@myserver
R: local_user for paul@myserver
paul@myserver
    &lt;-- paulpanzer@gmx.de
  router = local_user, transport = dovecot_delivery</pre></div></div>

<p>Im nächsten Schritt können wir auch eine SMTP-Session testen. Dazu erzeugen wir mit dem Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-ne</span> <span style="color: #ff0000;">'\0paul@paulpanzer@gmx.de\0test'</span> <span style="color: #000000; font-weight: bold;">|</span> base64</pre></div></div>

<p>eine Zeichenfolge zur Authentifizierung, wobei paul für den Benutzer steht, paulpanzer@gmx.de für die externe Mailaddresse und test für das Passwort von paul (es besteht keine Verbindung zu den Passwörtern von paulpanzer@gmx.de). Ich erhalte hier AHBhdWxAcGF1bHBhbnplckBnbXguZGUAdGVzdA==. Wir starten mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl s_client <span style="color: #660033;">-starttls</span> smtp <span style="color: #660033;">-crlf</span> <span style="color: #660033;">-connect</span> myserver:<span style="color: #000000;">25</span></pre></div></div>

<p>eine verschlüsselte SMTP-Session und verschicken eine Testmail an paul@myserver, indem wir folgende Befehle eingeben (alle Zeilen, die nicht mit einer Zahl beginnen)</p>

<div class="wp_syntax"><div class="code"><pre class="xorg_conf" style="font-family:monospace;"><span style="color: #cc66cc;">250</span> HELP
ehlo client
<span style="color: #cc66cc;">250</span>-myserver Hello myserver <span class="br0">&#91;</span>127.0.1.1<span class="br0">&#93;</span>
<span style="color: #cc66cc;">250</span>-SIZE <span style="color: #cc66cc;">52428800</span>
<span style="color: #cc66cc;">250</span>-PIPELINING
<span style="color: #cc66cc;">250</span>-AUTH PLAIN LOGIN
<span style="color: #cc66cc;">250</span> HELP
AUTH PLAIN AHBhdWxAcGF1bHBhbnplckBnbXguZGUAdGVzdA==
<span style="color: #cc66cc;">235</span> Authentication succeeded
mail from: paulpanzer@gmx.de
<span style="color: #cc66cc;">250</span> OK
rcpt to: paul@myserver
<span style="color: #cc66cc;">250</span> Accepted
data
<span style="color: #cc66cc;">354</span> Enter message, ending with <span style="color: #0000ff;">&quot;.&quot;</span> on a line by itself
From: Paul Panzer &lt;paulpanzer@gmx.de&gt;
To: Paul &lt;paul@myserver&gt;
Subject: Testing SMTP
This is a test body.
.
<span style="color: #cc66cc;">250</span> OK id=1Ll9N3-0001hf-6J
quit
<span style="color: #cc66cc;">221</span> myserver closing connection
closed</pre></div></div>

<p>Wer im Detail nachlesen möchte, was die einzelnen Befehle bewirken, dem sei die <a href="http://qmail.jms1.net/test-auth.shtml">Anleitung zum Testen von SMTP per Telnet von John M. Simpson</a> empfohlen. Als Resultat des Tests sollten wir im Verzeichnis /home/paul/mail/paul/maildir/INBOX/new/ eine Datei haben, die in etwa folgenden Inhalt hat</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Return-path: &lt;paulpanzer@gmx.de&gt;
Envelope-to: paul@myserver
Delivery-date: Sat, 21 Mar 2009 23:18:09 +0100
Received: from myserver ([127.0.1.1] helo=la)
	by myserver with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
	(Exim 4.69)
	(envelope-from &lt;paulpanzer@gmx.de&gt;)
	id 1Ll9Vy-0001jC-N8
	for paul@myserver; Sat, 21 Mar 2009 23:18:09 +0100
From: Paul Panzer &lt;paulpanzer@gmx.de&gt;
To: Paul &lt;paul@myserver&gt;
Subject: Testing SMTP 
&nbsp;
This is a test body.</pre></div></div>

<h2>Fehlerquellen in der Konfiguration finden</h2>
<p>Falls exim nicht das gewünschte Resultat liefert oder bei der Auslieferung an eine bestimmte Addresse ein Fehler auftritt, hilft es, Exim im Debug-Modus zu starten. Beispielsweise kann man eine derartige Batch-SMTP-Session über folgenden Befehl starten</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> exim4 <span style="color: #660033;">-C</span> <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>exim4<span style="color: #000000; font-weight: bold;">/</span>config.autogenerated <span style="color: #660033;">-v</span> -d+all <span style="color: #660033;">-bs</span></pre></div></div>

<p>Um zu testen, wie Exim intern die Mailaddressen routet, können wir mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> exim <span style="color: #660033;">-v</span> -d-all+lookup <span style="color: #660033;">-bt</span> paulpanzer<span style="color: #000000; font-weight: bold;">@</span>gmx.de</pre></div></div>

<p>alle zugehörigen lookups von exim verfolgen. Durch das &#8220;-all+lookup&#8221; werden nur Informationen ausgeben, die mit lookups zu tun haben.</p>
<h2>Umgang mit Exim</h2>
<p>Exim besitzt eine Vielzahl an Kommandozeilenoptionen. Sich in der man-page zurechtzufinden ist daher nicht einfach, allerdings habe ich eine <a href="http://forums.spry.com/showthread.php?t=1373">sehr gute Zusammenstellung einzelner Exim-Befehle</a> gefunden. Ein Befehl fehlt dabei jedoch. Mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> exim <span style="color: #660033;">-qff</span></pre></div></div>

<p>kann man das erneute Auslierfern von &#8220;frozen messages&#8221;, also als unzustellbar marktierten Mails, erzwingen.</p>
<p>Der vierte Teil der Konfiguration beschäftigt sich mit der <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-4-getmail/">Einrichtung von getmail zum Abruf externer Mails via POP3/IMAP</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-3-exim/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dovecot, Exim, OpenLDAP und getmail unter Ubuntu &#8211; (2) Dovecot</title>
		<link>http://www.effinger.org/blog/2009/03/22/dovecot-postfix-openldap-und-getmail-unter-ubuntu-2-dovecot/</link>
		<comments>http://www.effinger.org/blog/2009/03/22/dovecot-postfix-openldap-und-getmail-unter-ubuntu-2-dovecot/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 16:56:36 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[exim]]></category>
		<category><![CDATA[getmail]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[OpenLDAP]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=458</guid>
		<description><![CDATA[<p>Nachdem die Grundvorraussetzungen im ersten Teil geschaffen wurden, wenden wir uns in diesem Teil der Anpassung, Installation und Konfiguration von dovecot zu. Obwohl fast alles im Blog detailliert beschrieben ist, empfehle ich, die Konfigurationsdateien für das Mailsystem herunterzuladen.</p> Installation von Dovecot <p>Nach einem</p> sudo apt-get install dovecot-common dovecot-imapd dovecot-pop3d <p>sind die notwendigen Dovecot-Pakete installiert.</p> Anpassung [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem die Grundvorraussetzungen im <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-1-openldap/">ersten Teil</a> geschaffen wurden, wenden wir uns in diesem Teil der Anpassung, Installation und Konfiguration von <a href="http://www.dovecot.org/">dovecot</a> zu. Obwohl fast alles im Blog detailliert beschrieben ist, empfehle ich, die <a href="http://www.effinger.org/blog/wp-content/uploads/2009/03/configfiles-mailsystem.tgz">Konfigurationsdateien für das Mailsystem herunterzuladen</a>.</p>
<h2>Installation von Dovecot</h2>
<p>Nach einem</p>

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

<p>sind die notwendigen Dovecot-Pakete installiert.</p>
<h2>Anpassung der Installation</h2>
<p>Dovecot verwendet zur Zustellung von Mails den Dovecot Local Delivery Agent (LDA). Damit dieser die Mails in allen Verzeichnissen der Benutzer ablegen kann, benötigt er root-Rechte, die wir über das Setuid-Bit vergeben. Zum Mailversand setzen wir jedoch exim als  Message Transfer Agent (MTA) ein, so dass Mails nie direkt via Dovecot-LDA, sondern immer indirekt über exim zugestellt werden. Da deshalb nur exim den Dovecot LDA aufrufen muss, wäre es sicherheitstechnisch bedenklich, könnte jeder Benutzer den Dovecot LDA mit Setuid-Bit aufrufen (eine Sicherheitslücke im Dovecot LDA würde dann sofort das gesamte System kompromittieren). Deshalb richten wir einen speziellen Benutzer namens secmail ein, der diese Rechte besitzt und dessen sich exim dann bedienen soll.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> adduser <span style="color: #660033;">--system</span> <span style="color: #660033;">--group</span> <span style="color: #660033;">--disabled-login</span> <span style="color: #660033;">--shell</span> <span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">false</span> <span style="color: #660033;">--home</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>secmail secmail</pre></div></div>

<p>Anschließend müssen wir für unsere Konfiguration das setuid-Bit für Dovecots LDA setzen,  damit dieser zur Zustellung jeweils auf die jeweilige Benutzer-ID wechseln kann. Durch den Aufruf von dpkg-statoverride werden die Berechtigungen auch bei Paketaktualisierungen beibehalten, obwohl der Einsatz auch einige <a href="http://www.netfort.gr.jp/~dancer/diary/200511.html.en#2005-Nov-13-09:40:15">Nachteile</a> mit sich bringt.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> dpkg-statoverride <span style="color: #660033;">--update</span> <span style="color: #660033;">--add</span> root secmail <span style="color: #000000;">4710</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</pre></div></div>

<h2>Konfiguration von dovecot</h2>
<p>Zunächst kopieren wir die im <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-1-openldap/">ersten Teil der Anleitung</a> erzeugten Dateien des Client-Zertifikats für dovecot in das Konfigurationsverzeichnis und passen die Berechtigungen an.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <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>easy-rsa<span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/</span>dovecot-client.key <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>easy-rsa<span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/</span>dovecot-client.crt <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>dovecot
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> root.dovecot <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-client.<span style="color: #7a0874; font-weight: bold;">&#123;</span>key,crt<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">640</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>dovecot-client.key</pre></div></div>

<p>Die <a href="http://wiki.dovecot.org/MainConfig">Konfiguration von dovecot</a> ist im Vergleich zu anderen Mailservern wie qmail, courier-imap oder cyrus einfach und gut dokumentiert. Meine um Kommentare und Leerzeilen verkürzte Version sieht so aus:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">protocols = imap imaps managesieve
log_path = <span style="color: #000000; font-weight: bold;">/</span>var<span style="color: #000000; font-weight: bold;">/</span>log<span style="color: #000000; font-weight: bold;">/</span>dovecot.log
log_timestamp = <span style="color: #ff0000;">&quot;%Y-%m-%d %H:%M:%S &quot;</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>myserver.crt
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>myserver.key
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>ca.crt
ssl_verify_client_cert = <span style="color: #c20cb9; font-weight: bold;">yes</span>
login_user = dovecot
login_greeting = Ready.
mail_privileged_group =
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
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
protocol pop3 <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  pop3_uidl_format = <span style="color: #000000; font-weight: bold;">%</span>08Xu<span style="color: #000000; font-weight: bold;">%</span>08Xv
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
protocol managesieve <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>managesieve-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>managesieve
  <span style="color: #007800;">sieve</span>=~<span style="color: #000000; font-weight: bold;">/</span>.dovecot.sieve
  <span style="color: #007800;">sieve_storage</span>=~<span style="color: #000000; font-weight: bold;">/</span>sieve
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
protocol lda <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  postmaster_address = paul<span style="color: #000000; font-weight: bold;">@</span>myserver
  mail_plugins = cmusieve
  mail_plugin_dir = <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>modules<span style="color: #000000; font-weight: bold;">/</span>lda
  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
  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
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
auth_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>dovecot-auth
auth_username_chars = abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890.-_<span style="color: #000000; font-weight: bold;">@</span>
auth default <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  mechanisms = plain
  passdb ldap <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-ldap-passdb.conf
  <span style="color: #7a0874; font-weight: bold;">&#125;</span>
  userdb ldap <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-ldap-userdb.conf
  <span style="color: #7a0874; font-weight: bold;">&#125;</span>
  user = root
  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
      group = secmail
    <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>
dict <span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
plugin <span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Eine entsprechende Datei kann man einfach durch ein</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>dovecot<span style="color: #000000; font-weight: bold;">/</span>dovecot.conf <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">egrep</span> <span style="color: #660033;">-v</span> <span style="color: #ff0000;">'(^\t* *#|^\t* *$)'</span></pre></div></div>

<p>erzeugen. Hier ist der Inhalt der referenzierten Dateien dovecot-ldap-passdb.conf und dovecot-ldap-userdb.conf.</p>
<p>dovecot-ldap-passdb.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">hosts</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> myserver</span>
<span style="color: #000099;">tls</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> yes</span>
<span style="color: #000099;">tls_ca_cert_file</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> /etc/ssl/certs/ca.crt</span>
<span style="color: #000099;">tls_cert_file</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> /etc/dovecot/dovecot-client.crt</span>
<span style="color: #000099;">tls_key_file</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> /etc/dovecot/dovecot-client.key</span>
<span style="color: #000099;">tls_require_cert</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> demand</span>
<span style="color: #000099;">auth_bind</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> yes</span>
<span style="color: #000099;">auth_bind_userdn</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> uid=%Ln,ou=users,o=effinger</span>
<span style="color: #000099;">ldap_version</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 3</span>
<span style="color: #000099;">base</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> uid=%Ln,ou=users,o=effinger</span></pre></div></div>

<p>dovecot-ldap-userdb.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">hosts</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> myserver</span>
<span style="color: #000099;">tls</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> yes</span>
<span style="color: #000099;">tls_ca_cert_file</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> /etc/ssl/certs/ca.crt</span>
<span style="color: #000099;">tls_cert_file</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> /etc/dovecot/dovecot-client.crt</span>
<span style="color: #000099;">tls_key_file</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> /etc/dovecot/dovecot-client.key</span>
<span style="color: #000099;">tls_require_cert</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> demand</span>
<span style="color: #000099;">ldap_version</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 3</span>
<span style="color: #000099;">base</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> uid=%Ln,ou=users,o=effinger</span>
<span style="color: #000099;">scope</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> subtree</span>
<span style="color: #000099;">user_attrs</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> dcMailMessageStore=home=%$/%Ld,uidNumber=uid,gidNumber=gid,=mail=maildir:~/maildir:INBOX=~/maildir/INBOX</span>
<span style="color: #000099;">user_filter</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> <span style="">&#40;</span>|<span style="">&#40;</span>mail<span style="color: #000066; font-weight:bold;">=</span>%d<span style="">&#41;</span><span style="">&#40;</span>&amp;<span style="">&#40;</span>dcSubMailAddress<span style="color: #000066; font-weight:bold;">=</span>%d<span style="">&#41;</span><span style="">&#40;</span>dcAccountStatus<span style="color: #000066; font-weight:bold;">=</span>active<span style="">&#41;</span><span style="">&#41;</span><span style="">&#41;</span></span></pre></div></div>

<p>Nach einem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>dovecot restart</pre></div></div>

<p>sollte man den Login testen. Dazu kann man die <a href="http://aplawrence.com/SCOFAQ/FAQ_scotec4testimap.html">Anleitung zum Testen von IMAP mit telnet von A. P. Lawrence</a> verwenden. Das sieht dann beispielsweise so aus:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">$ telnet localhost <span style="color: #000000;">143</span>
Trying 127.0.0.1...
Connected to localhost.
Escape character is <span style="color: #ff0000;">'^]'</span>.
<span style="color: #000000; font-weight: bold;">*</span> OK Ready.
as1 <span style="color: #c20cb9; font-weight: bold;">login</span> paul<span style="color: #000000; font-weight: bold;">@</span>paul mypassword
as1 OK Logged in.
as2 <span style="color: #7a0874; font-weight: bold;">logout</span>
<span style="color: #000000; font-weight: bold;">*</span> BYE Logging out
as2 OK Logout completed.
Connection closed by foreign host.</pre></div></div>

<p>Wichtig ist dabei, beide E-Mail-Addressen zu überprüfen (lokal und extern). Im Beispiel hier muss man also die logins paul@paul sowie paul@paulpanzer@gmx.de testen.</p>
<p>Zum Schluss möchte ich noch auf einige Seiten hinweisen, die bei der Konfiguration von dovecot hilfreich für mich waren</p>
<ul>
<li><a href="http://wiki.dovecot.org/">Offizielle Docevot-Dokumentation</a></li>
<li><a href="http://www.njae.me.uk/Dovecot_server_setup">Beispielhaftes Server-Setup mit virtuellen Benutzern</a></li>
<li><a href="http://wanderingbarque.com/howtos/mailserver/mailserver.html">Secure Virtual Mailserver Howto</a></li>
</ul>
<p>In <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-3-exim/">Teil 3</a> befassen wir uns mit der Einrichtung von Exim als MTA (Message Transfer Agent).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2009/03/22/dovecot-postfix-openldap-und-getmail-unter-ubuntu-2-dovecot/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dovecot, Exim, OpenLDAP und getmail unter Ubuntu &#8211; (1) OpenLDAP</title>
		<link>http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-1-openldap/</link>
		<comments>http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-1-openldap/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 16:55:33 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[exim]]></category>
		<category><![CDATA[getmail]]></category>
		<category><![CDATA[LDAP]]></category>
		<category><![CDATA[OpenLDAP]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=248</guid>
		<description><![CDATA[<p>In diesem Blog-Eintrag geht es um die Einrichtung eines Mailservers, der dovecot, Exim, OpenLDAP und getmail verwendet. Folgendes wird mit der Konfiguration erreicht:</p> Mails können von Benutzern, die in OpenLDAP eingetragen sind per IMAP abgerufen und per SMTP versendet werden (auch mit TLS-Verschlüsselung). Benutzer können Mails von externen POP3/IMAP-Accounts direkt in ihr IMAP Postfach legen [...]]]></description>
			<content:encoded><![CDATA[<p>In diesem Blog-Eintrag geht es um die Einrichtung eines Mailservers, der <a href="http://www.dovecot.org/">dovecot</a>, <a href="http://www.exim.org/">Exim</a>, <a href="http://www.openldap.org/">OpenLDAP</a> und <a href="http://pyropus.ca/software/getmail/">getmail</a> verwendet. Folgendes wird mit der Konfiguration erreicht:</p>
<ul>
<li>Mails können von  Benutzern, die in OpenLDAP eingetragen sind per IMAP abgerufen und per SMTP versendet werden (auch mit TLS-Verschlüsselung).</li>
<li>Benutzer können Mails von externen POP3/IMAP-Accounts direkt in ihr IMAP Postfach legen lassen</li>
<li>Benutzer können Mails mit einer externen Absenderaddresse via lokalem Mailserver verschicken, der sie über den entsprechenden externen Mailserver verschickt</li>
</ul>
<p>Am Beispiel sollte es klarer werden. Paul ist mit der Userid paul in OpenLDAP eingetragen und hat auf dem lokalen Rechner mit der Domain myserver die Mailaddresse paul@myserver. Paul kann per IMAP Mails abrufen (Login: paul@paul Server: myserver) und ebenfalls per SMTP Mails verschicken. Außerdem hat Paul eine weitere E-Mailadresse aus der Zeit als er sich noch keine eigene Domain leisten konnte. Diese lautet paulpanzer@gmx.de. Paul möchte seine E-Mails zukünftig auf seinem lokalen Server speichern und nicht mehr bei GMX. Er bzw. der Administrator trägt dazu die POP3-Zugangsdaten von GMX in OpenLDAP ein. Danach werden alle E-Mails automatisch heruntergeladen und Paul kann über den Login paul@paulpanzer@gmx.de auf dem Server myserver seine GMX-Mails per IMAP abrufen. Trägt Paul bzw. der Administrator auch die SMTP-Daten für die E-Mailaddresse paulpanzer@gmx.de in OpenLDAP ein, so kann Paul außerdem Mails indirekt via GMX- Mailserver verschicken, indem er als SMTP-Login paul@paulpanzer@gmx.de auf seinem lokalen Server wählt. So sieht das fertige Schema mit der verwendeten Software aus:</p>
<p><a href="http://www.effinger.org/blog/wp-content/uploads/2009/03/general_scheme.png"><img class="aligncenter size-medium wp-image-709" title="General Software Setup - Dovecot, Exim &amp; Co." src="http://www.effinger.org/blog/wp-content/uploads/2009/03/general_scheme-300x212.png" alt="General Software Setup - Dovecot, Exim &amp; Co." width="300" height="212" /></a>Der Zugriff per Webinterface auf Mails und der Abruf der Mails vom externen Server bzw. das Empfangen von Mails ist hier dargestellt:</p>
<p><a href="http://www.effinger.org/blog/wp-content/uploads/2009/03/general_scheme_2.png"><img class="aligncenter size-medium wp-image-707" title="General software setup - Getmail, Roundcube &amp; Co." src="http://www.effinger.org/blog/wp-content/uploads/2009/03/general_scheme_2-300x212.png" alt="General software setup - Getmail, Roundcube &amp; Co." width="300" height="212" /></a></p>
<h2>Einrichtung</h2>
<p>Bevor man überhaupt daran denkt, ein E-Mail-Serversystem aufzusetzen, müssen zwei Bedingungen erfüllt sein. Die erste betrifft eine genaue Systemzeit, der zweite den Hostnamen. Obwohl fast alles im Blog detailliert beschrieben ist, empfehle ich, die <a href="http://www.effinger.org/blog/wp-content/uploads/2009/03/configfiles-mailsystem.tgz">Konfigurationsdateien für das Mailsystem herunterzuladen</a>.</p>
<h2>Genaue Systemzeit mit Ubuntu</h2>
<p>Leider installiert Ubuntu standardmäßig das Paket ntpdate. Durch dieses Paket wird jedes Mal, wenn man mit dem Internet verbunden ist (genauer gesagt beim ifup), die Zeit mit einem NTP-Server im Internet abgeglichen und ggfs. die Systemzeit entsprechend geändert. An sich ja keine schlechte Sache, aber <a href="http://wiki.dovecot.org/TimeMovedBackwards">dovecot reagiert auf Zeitänderungen sehr verstimmt</a> und quittiert den Dienst. Deshalb setze ich stets ntpd ein. Dies ist ein NTP-Server, der systematisch die Differenz zwischen Systemzeitgeber und dem Internetserver beobachtet und so systematisches zu schell bzw. zu langsam gehen des Systemzeitgebers korrigieren kann. Man erhält damit eine genauere Systemzeit und damit auch ein stabiles dovecot. Deshalb installiere ich ntpd und entferne ntpdate:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> autoremove <span style="color: #660033;">--purge</span> ntpdate <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ntp</pre></div></div>

<p>Um für den Ausfall des Ubuntu NTP-Servers gewappnet zu sein, habe ich die Server-Einträge in /etc/ntp.conf noch um Server aus dem <a href="http://www.pool.ntp.org/use.html">öffentlichen NTP-Pool</a> ergänzt:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># You do need to talk to an NTP server or two (or three).</span>
server <span style="color: #000000;">0</span>.pool.ntp.org
server <span style="color: #000000;">1</span>.pool.ntp.org
server <span style="color: #000000;">2</span>.pool.ntp.org
server ntp.ubuntu.com</pre></div></div>

<p>Nach einem Speichern der Konfigurationsdatei und einem Neustart des NTP-Servers mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>ntp restart</pre></div></div>

<p>haben wir den ersten Punkt erledigt. Christoph Langner beschreibt die <a href="http://christoph-langner.de/de/2008/12/die-uhrzeit-eines-rechners-uber-das-internet-stellen/">Installation von ntpd</a> noch etwas ausführlicher.</p>
<h2>Hostname für den Mailserver</h2>
<p>Der zweite wichtige Punkt ist der Hostname. Der fully qualified domain name (FQDN) des Rechners muss bekannt sein. Nachprüfen lässt sich das über</p>

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

<p>Bekommt man keine Ausgabe wie host.domain.de, dann muss man die /etc/hosts anpassen, so dass die Reihenfolge der Servernamen stimmt:</p>

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

<p>Bitte unbedingt beachten, dass das beispielhaft aufgeführte myserver <em>kein</em> FQDN ist. Ein FQDN besteht immer auch aus einer Top-Level-Domain.</p>
<h2>Erzeugen von SSL-Zertifikaten</h2>
<p>Damit wir mit imaps, dem durch Verschlüsselung abgesicherten IMAP, auf unseren Server zugreifen können, und auch den SMTP- und LDAP-Zugriff verschlüsseln können, benötigen wir entsprechende SSL-Zertifikate. Am einfachsten lassen sich solche Zertifikate mit easy-rsa aus dem Paktet openvpn erzeugen. Übrigens gibt es gibt es dazu gute Anleitungen von <a href="http://knecht.homelinux.net/phpBB2/viewtopic.php?f=12&amp;t=449">linux.neoberserker.de</a> oder im <a href="http://wiki.openvpn.eu/index.php/Erzeugen_einer_PKI_mit_EasyRSA">OpenVPN-Wiki</a>. Das Paket openvpn müssen wir jedoch nicht installieren. Es genügt, wenn wir mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> openvpn <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #7a0874; font-weight: bold;">cd</span> openvpn <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #7a0874; font-weight: bold;">source</span> openvpn</pre></div></div>

<p>den Quelltext herunterladen. Wir führen alle folgenden Befehle zur Zertifikatserstellung als root aus (wichtig, damit später nicht jeder Benutzer die geheimen Dateien lesen kann). Zunächst kopieren wir das entsprechende Unterverzeichnis in /etc/ssl und löschen anschließend die nicht mehr benötigten Verzeichnisse mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-s</span>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-R</span> openvpn-<span style="color: #000000;">2.1</span>~rc11<span style="color: #000000; font-weight: bold;">/</span>easy-rsa<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2.0</span> <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>easy-rsa
<span style="color: #7a0874; font-weight: bold;">cd</span> .. <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-rf</span> openvpn
<span style="color: #7a0874; font-weight: bold;">cd</span> <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>easy-rsa</pre></div></div>

<p>Nun editieren wir die Datei <em>vars</em> und passen Sie entsprechend an. Bei mir habe ich folgende Zeilen am Ende angepasst:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">KEY_COUNTRY</span>=<span style="color: #ff0000;">&quot;DE&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">KEY_PROVINCE</span>=<span style="color: #ff0000;">&quot;RP&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">KEY_CITY</span>=<span style="color: #ff0000;">&quot;Ludwigshafen&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">KEY_ORG</span>=<span style="color: #ff0000;">&quot;Effinger&quot;</span>
<span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">KEY_EMAIL</span>=<span style="color: #ff0000;">&quot;nospam@effinger.org&quot;</span></pre></div></div>

<p>Anschließend führen wir folgende Schritte durch, um die CA-Dateien zur Ausstellung eigener Zertifikate zu erzeugen. Beim Schritt ./build-ca kann man alle Punkte mit Enter bestätigen bis auf <em>common name</em>. Hier sollte man einen einfachen Namen, z.B. MyCA, angeben (am Besten nur Buchstaben und Zahlen verwenden &#8211; keine Leerzeichen oder sonstige Sonderzeichen).</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">. .<span style="color: #000000; font-weight: bold;">/</span>vars
.<span style="color: #000000; font-weight: bold;">/</span>clean-all
.<span style="color: #000000; font-weight: bold;">/</span>build-ca
.<span style="color: #000000; font-weight: bold;">/</span>build-dh</pre></div></div>

<p>Im nächsten Schritt erstellen wir für unseren Mailserver ein Server-Schlüsselpaar mit dem Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>build-key-server myserver</pre></div></div>

<p>myserver sollte dabei durch den DNS-Eintrag des Servers ersetzt werden (Thunderbird fragt ansonsten jedes Mal sicherheitshalber nach, ob das Zertifikat akzeptiert werden soll, weil der Zertifikatsname nicht mit dem Hostnamen übereinstimmt). Auch hier bestätigen wir wieder alles mit Enter bis auf den Punkt <em>Sign the certificate?</em> Hier antworten wir mit ja (<em>y</em>) und bestätigen die darauf erfolgende Rückfrage ebenfalls mit <em>y</em>. Ein Client-Zertifikat kann man mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>build-key myclient</pre></div></div>

<p>analog erzeugen. Dieses benötigt man jedoch nur, wenn man ausschließlich Clients mit gültigem Zertifikat auf den Mailserver zugreifen lassen möchte. Bei dovecot ist das der Fall, wenn der Parameter <em>ssl_require_client_cert=yes</em> gesetzt ist. Da dovecot sich mit dem LDAP-Server verbindet, können wir dazu ebenfalls ein Client-Zertifikat verwenden. Wir erzeugen es mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>build-key dovecot-client</pre></div></div>

<p>Im Unterverzeichnis keys sind nun einige Dateien, die wir noch in das richtige Verzeichnis kopieren müssen. Wichtig ist, dass niemand unbefugt auf die <a href="http://wiki.openvpn.eu/index.php/Erzeugen_einer_PKI_mit_EasyRSA#Schl.C3.BCssel.C3.BCbersicht">geheimzuhaltenden Dateien</a> zugreifen kann, die allesamt mit der Erweiterung .key enden. Am Besten ist es, vor dem Kopieren die Berechtigungen zu prüfen. Die öffentlichen Zertifikate werden in das Verzeichnis /etc/ssl/certs und die geheimen Zertifikate in /etc/ssl/private kopiert mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> <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>easy-rsa<span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/</span>myserver.crt <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>easy-rsa<span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/</span>ca.crt <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>
<span style="color: #c20cb9; font-weight: bold;">cp</span> <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>easy-rsa<span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/</span>myserver.key <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>
<span style="color: #c20cb9; font-weight: bold;">chown</span> root.ssl-cert <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>myserver.key
<span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">640</span> <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>myserver.key</pre></div></div>

<p>Die letzten beiden Zeilen dienen dazu, Exim, Dovecot und LDAP den Zugriff auf die geheime Key-Datei zu gewähren. Die entsprechendenBenutzer müssen dazu in der Gruppe ssl-cert sein (Anleitung erfolgt bei der Installation des jeweiligen Programms). Falls man später doch noch OpenVPN nutzen möchte, kann man den Diffie-Hellman Parameter ebenfalls kopieren</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> <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>easy-rsa<span style="color: #000000; font-weight: bold;">/</span>keys<span style="color: #000000; font-weight: bold;">/</span>dh1024.pem <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></pre></div></div>

<p>Die Client-Zertifikate muss man nun natürlich dem E-Mail-Programm bekannt machen. Bei Thunderbird fügt man über <em>Extras&gt;Einstellungen&gt;Erweitert&gt;Zertifikate&gt;Zertifikate&gt;Zertifizierungsstellen&gt;Importieren</em> die Datei ca.crt hinzu, wechselt anschließend auf den Reiter <em>Ihre Zertifikate, </em>um dort dann die Dateien <em>myclient.p12</em> importieren. Letzere Datei erzeugt man durch ein</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">openssl pkcs12 <span style="color: #660033;">-export</span> <span style="color: #660033;">-name</span> <span style="color: #ff0000;">&quot;myclient&quot;</span> <span style="color: #660033;">-in</span> myclient.crt <span style="color: #660033;">-inkey</span> myclient.key <span style="color: #660033;">-out</span> myclient.p12</pre></div></div>

<h2>OpenLDAP installieren</h2>
<p>Als nächstes installieren wir OpenLDAP und die ldap-utils nach meinem <a href="http://www.effinger.org/blog/2008/12/14/das-kleine-openldap-1x1/">OpenLDAP 1&#215;1</a>. Hier die Schritte in Kurzform (falls Schritte unklar sind &#8211; im <a href="http://www.effinger.org/blog/2008/12/14/das-kleine-openldap-1x1/">OpenLDAP 1&#215;1</a> ist alles sehr ausführlich erklärt):</p>
<ol>
<li>Alle folgenden Befehle als root ausführen mit einem

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

<p>oder</p>

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

</li>
<li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> slapd ldap-utils</pre></div></div>

<p>Unbedingt das Administrator-Passwort bei der Einrichtung merken.</li>
<li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>slapd stop</pre></div></div>

</li>
<li>Die automatisch bei der Einrichtung erzeugte Datenbank löschen (Vorsicht, wenn OpenLDAP bereits im Einsatz ist! Dieser Befehl kann die aktive Datenbank löschen)</li>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ldap<span style="color: #000000; font-weight: bold;">/</span>slapd.d<span style="color: #000000; font-weight: bold;">/</span>cn\=config<span style="color: #000000; font-weight: bold;">/</span>olcDatabase\=\<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">1</span>\<span style="color: #7a0874; font-weight: bold;">&#125;</span>hdb.ldif <span style="color: #000000; font-weight: bold;">&amp;&amp;</span> <span style="color: #c20cb9; font-weight: bold;">rm</span> <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>ldap<span style="color: #000000; font-weight: bold;">/*</span></pre></div></div>

<li>Die folgende Datei database.ldif passen:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Database settings</span>
dn: <span style="color: #007800;">olcDatabase</span>=hdb,<span style="color: #007800;">cn</span>=config
objectClass: olcDatabaseConfig
objectClass: olcHdbConfig
olcDatabase: hdb
<span style="color: #666666; font-style: italic;"># The base of your directory</span>
olcSuffix: <span style="color: #007800;">o</span>=effinger
<span style="color: #666666; font-style: italic;"># rootdn directive for specifying a superuser on the database. This is needed</span>
<span style="color: #666666; font-style: italic;"># for syncrepl.</span>
olcRootDN: <span style="color: #007800;">cn</span>=admin,<span style="color: #007800;">o</span>=effinger
<span style="color: #666666; font-style: italic;"># Superuser Password for the database</span>
<span style="color: #666666; font-style: italic;"># {SSHA}pEvotN6PmSjx0JV/mZl5BWeSVOKR1Ejt equals &quot;test&quot;</span>
<span style="color: #666666; font-style: italic;"># CHANGE this for your installation!!!</span>
olcRootPW: <span style="color: #7a0874; font-weight: bold;">&#123;</span>SSHA<span style="color: #7a0874; font-weight: bold;">&#125;</span>pEvotN6PmSjx0JV<span style="color: #000000; font-weight: bold;">/</span>mZl5BWeSVOKR1Ejt
<span style="color: #666666; font-style: italic;"># Where the database file are physically stored</span>
olcDbDirectory: <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>ldap
<span style="color: #666666; font-style: italic;"># The dbconfig settings are used to generate a DB_CONFIG file the first</span>
<span style="color: #666666; font-style: italic;"># time slapd starts.  They do NOT override existing an existing DB_CONFIG</span>
<span style="color: #666666; font-style: italic;"># file.  You should therefore change these settings in DB_CONFIG directly</span>
<span style="color: #666666; font-style: italic;"># or remove DB_CONFIG and restart slapd for changes to take effect.</span>
<span style="color: #666666; font-style: italic;"># For the Debian package we use 2MB as default but be sure to update this</span>
<span style="color: #666666; font-style: italic;"># value if you have plenty of RAM</span>
&nbsp;
olcDbConfig: set_cachesize <span style="color: #000000;">0</span> <span style="color: #000000;">2097152</span> <span style="color: #000000;">0</span>
<span style="color: #666666; font-style: italic;"># Sven Hartge reported that he had to set this value incredibly high</span>
<span style="color: #666666; font-style: italic;"># to get slapd running at all. See http://bugs.debian.org/303057 for more</span>
<span style="color: #666666; font-style: italic;"># information.</span>
<span style="color: #666666; font-style: italic;"># Number of objects that can be locked at the same time.</span>
olcDbConfig: set_lk_max_objects <span style="color: #000000;">1500</span>
<span style="color: #666666; font-style: italic;"># Number of locks (both requested and granted)</span>
olcDbConfig: set_lk_max_locks <span style="color: #000000;">1500</span>
<span style="color: #666666; font-style: italic;"># Number of lockers</span>
olcDbConfig: set_lk_max_lockers <span style="color: #000000;">1500</span>
<span style="color: #666666; font-style: italic;"># Indexing options</span>
olcDbIndex: objectClass eq
<span style="color: #666666; font-style: italic;"># Save the time that the entry gets modified</span>
olcLastMod: TRUE
<span style="color: #666666; font-style: italic;"># Checkpoint the BerkeleyDB database periodically in case of system</span>
<span style="color: #666666; font-style: italic;"># failure and to speed slapd shutdown.</span>
olcDbCheckpoint: <span style="color: #000000;">512</span> <span style="color: #000000;">30</span>
<span style="color: #666666; font-style: italic;"># The userPassword by default can be changed</span>
<span style="color: #666666; font-style: italic;"># by the entry owning it if they are authenticated.</span>
<span style="color: #666666; font-style: italic;"># Others should not be able to see it, except the</span>
<span style="color: #666666; font-style: italic;"># admin entry below</span>
<span style="color: #666666; font-style: italic;"># These access lines apply to database #1 only</span>
olcAccess: to <span style="color: #007800;">attrs</span>=userPassword,shadowLastChange by <span style="color: #007800;">dn</span>=<span style="color: #ff0000;">&quot;cn=admin,o=effinger&quot;</span> <span style="color: #c20cb9; font-weight: bold;">write</span> by anonymous auth by self <span style="color: #c20cb9; font-weight: bold;">write</span> by <span style="color: #000000; font-weight: bold;">*</span> none
<span style="color: #666666; font-style: italic;"># Ensure read access to the base for things like</span>
<span style="color: #666666; font-style: italic;"># supportedSASLMechanisms.  Without this you may</span>
<span style="color: #666666; font-style: italic;"># have problems with SASL not knowing what</span>
<span style="color: #666666; font-style: italic;"># mechanisms are available and the like.</span>
<span style="color: #666666; font-style: italic;"># Note that this is covered by the 'access to *'</span>
<span style="color: #666666; font-style: italic;"># ACL below too but if you change that as people</span>
<span style="color: #666666; font-style: italic;"># are wont to do you'll still need this if you</span>
<span style="color: #666666; font-style: italic;"># want SASL (and possible other things) to work</span>
<span style="color: #666666; font-style: italic;"># happily.</span>
olcAccess: to dn.base=<span style="color: #ff0000;">&quot;&quot;</span> by <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #c20cb9; font-weight: bold;">read</span>
<span style="color: #666666; font-style: italic;"># The admin dn has full write access, everyone else</span>
<span style="color: #666666; font-style: italic;"># can read everything.</span>
olcAccess: to <span style="color: #000000; font-weight: bold;">*</span> by <span style="color: #007800;">dn</span>=<span style="color: #ff0000;">&quot;cn=admin,o=effinger&quot;</span> <span style="color: #c20cb9; font-weight: bold;">write</span> by <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #c20cb9; font-weight: bold;">read</span>
<span style="color: #666666; font-style: italic;"># For Netscape Roaming support, each user gets a roaming</span>
<span style="color: #666666; font-style: italic;"># profile for which they have write access to</span>
<span style="color: #666666; font-style: italic;">#olcAccess: to dn=&quot;.*,ou=Roaming,o=morsnet&quot; by dn=&quot;cn=admin,o=effinger&quot; write by dnattr=owner write</span></pre></div></div>

<p><strong>Bitte unbedingt das Passwort (olcRootPW) ändern.</strong><br />
Falls gewünscht auch die RootDN (hier &#8220;o=effinger&#8221;) anpassen. Dadurch müssen einige der folgenden Befehle/Dateien angepasst werden.</li>
<li>Eine neue Datenbank mit Hilfe der database.ldif erzeugen (Administratorpasswort aus Schritt 2 wird benötigt)

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>slapd start
ldapadd <span style="color: #660033;">-f</span> database.ldif <span style="color: #660033;">-x</span> <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=admin,cn=config&quot;</span> <span style="color: #660033;">-W</span></pre></div></div>

</li>
</ol>
<p>Jetzt haben wir eine saubere Datenbank mit der RootDN &#8220;o=effinger&#8221; und dem entsprechenden Administrator &#8220;cn=admin,o=effinger&#8221;, die wir nun weiter konfigurieren können. Bevor wir damit loslegen, muss man sich jedoch Gedanken machen, wie die Daten in OpenLDAP strukturiert werden sollen. Ich habe mich für folgendes Setup entschieden:</p>
<ul>
<li>Benutzer werden im Kontext ou=users,o=effinger gespeichert also z.B. uid=paul,ou=users,o=effinger. Hier wird auch die lokale Mail-Addresse paul abgelegt. Die Domainendung (@myserver) wird hier weggelassen, da teilweise die Domain nicht angegeben ist bzw. oft anders addressiert ist, z.B. paul@localhost</li>
<li>Externe Mail-Accounts des Benutzers werden jeweils unter dem zugehörigen Benutzereintrag gespeichert, also z.B. dcSubMailAddress=paulpanzer@gmx.de,uid=paul,ou=users,o=effinger, zusammen mit den Angaben zu Logins für SMTP und den Mailabruf, z.B. mit POP3.</li>
<li>Da dovecot jedoch nicht ganz flexibel mit LDAP umgehen kann, müssen wir Parameter wie uid, Angaben zum Speicherort der Mails, die unter uid=paul,ou=users,o=effinger verfügbar sind auch unter dcSubMailAddress=paulpanzer@gmx.de,uid=paul,ou=users,o=effinger verfügbar machen. Das geht mit dem <a href="http://www.openldap.org/faq/data/cache/1209.html">DynList/DynGroup Overlay</a> von OpenLDAP. Eine Alternative wäre das <a href="http://linux.die.net/man/5/slapo-rwm">slapo-rwm Overlay</a> gewesen, das allerdings in der aktuellen Ubuntu-Version noch einen <a href="http://www.mail-archive.com/openldap-software@openldap.org/msg14716.html">Bug</a> aufweist und deshalb außen vor bleibt.</li>
</ul>
<p>Nach den konzeptionellen Überlegungen machen wir uns nun an die Arbeit. Wir konfigurieren das DynList-Overlay, wobei mir eine <a href="http://wiki.das-online.org/howtos/ldap/openldap-gentoo#dynlist">Anleitung für Gentoo</a> und die <a href="http://islandlinux.org/howto/installing-secure-ldap-openldap-ssl-ubuntu-using-self-signed-certificate">kurze Einführung für Ubuntu</a> sehr geholfen haben und ergänzen OpenLDAP mit einem von mir <a href="http://www.effinger.org/blog/2009/01/11/eigenes-ldap-schema-erstellen/">erstellten Schema (dovecot.schema.ldif)</a>.</p>
<ol>
<li>Folgenden Inhalt unter dem Namen dyngroup.schema.ldif abspeichern:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dn: <span style="color: #007800;">cn</span>=dyngroup,<span style="color: #007800;">cn</span>=schema,<span style="color: #007800;">cn</span>=config
objectClass: olcSchemaConfig
cn: dyngroup
olcObjectIdentifier: NetscapeRoot 2.16.840.1.113730
olcObjectIdentifier: NetscapeLDAP NetscapeRoot:<span style="color: #000000;">3</span>
olcObjectIdentifier: NetscapeLDAPattributeType NetscapeLDAP:<span style="color: #000000;">1</span>
olcObjectIdentifier: NetscapeLDAPobjectClass NetscapeLDAP:<span style="color: #000000;">2</span>
olcObjectIdentifier: OpenLDAPExp11 1.3.6.1.4.1.4203.666.11
olcObjectIdentifier: DynGroupBase OpenLDAPExp11:<span style="color: #000000;">8</span>
olcObjectIdentifier: DynGroupAttr DynGroupBase:<span style="color: #000000;">1</span>
olcObjectIdentifier: DynGroupOC DynGroupBase:<span style="color: #000000;">2</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> NetscapeLDAPattributeType:<span style="color: #000000;">198</span> NAME <span style="color: #ff0000;">'memberURL'</span> DESC <span style="color: #ff0000;">'Identifies an URL associated with each member of a group. Any type of labeled URL can be used.'</span> SUP labeledURI <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> DynGroupAttr:<span style="color: #000000;">1</span> NAME <span style="color: #ff0000;">'dgIdentity'</span> DESC <span style="color: #ff0000;">'Identity to use when processing the memberURL'</span> SUP distinguishedName SINGLE-VALUE <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> DynGroupAttr:<span style="color: #000000;">2</span> NAME <span style="color: #ff0000;">'dgAuthz'</span> DESC <span style="color: #ff0000;">'Optional authorization rules that determine who is allowed to assume the dgIdentity'</span> EQUALITY authzMatch SYNTAX 1.3.6.1.4.1.4203.666.2.7 X-ORDERED <span style="color: #ff0000;">'VALUES'</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcObjectClasses: <span style="color: #7a0874; font-weight: bold;">&#40;</span> NetscapeLDAPobjectClass:<span style="color: #000000;">33</span> NAME <span style="color: #ff0000;">'groupOfURLs'</span> SUP top STRUCTURAL MUST cn MAY <span style="color: #7a0874; font-weight: bold;">&#40;</span> memberURL $ businessCategory $ description $ o $ ou $ owner $ seeAlso <span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcObjectClasses: <span style="color: #7a0874; font-weight: bold;">&#40;</span> DynGroupOC:<span style="color: #000000;">1</span> NAME <span style="color: #ff0000;">'dgIdentityAux'</span> SUP top AUXILIARY MAY <span style="color: #7a0874; font-weight: bold;">&#40;</span> dgIdentity $ dgAuthz <span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>und mit einem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapadd <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=admin,cn=config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> dyngroup.schema.ldif</pre></div></div>

<p>hinzufügen (Administrator-Passwort wird benötigt).</li>
<li>Als nächstes folgenden Inhalt unter dem Namen dovecot.schema.ldif abspeichern

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dn: <span style="color: #007800;">cn</span>=dovecot,<span style="color: #007800;">cn</span>=schema,<span style="color: #007800;">cn</span>=config
objectClass: olcSchemaConfig
cn: dovecot
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.1.1.1 NAME <span style="color: #ff0000;">'dcMailMessageStore'</span> DESC <span style="color: #ff0000;">'Path to the maildir/mbox on the mail system'</span> EQUALITY caseExactIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">256</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> SINGLE-VALUE <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.1.1.2 NAME <span style="color: #ff0000;">'dcMailAlias'</span> DESC <span style="color: #ff0000;">'Secondary (alias) mailaddresses for a user'</span> EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">256</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.2.1.1 NAME <span style="color: #ff0000;">'dcSubMailAddress'</span> DESC <span style="color: #ff0000;">'A users secondary e-mail address for which mail from on another Mailserver has to be fetched'</span> EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">256</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.2.1.2 NAME <span style="color: #ff0000;">'dcAccountStatus'</span> DESC <span style="color: #ff0000;">'The status of a user account: active, noaccess, disabled, deleted'</span> EQUALITY caseIgnoreIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.2.1.3 NAME <span style="color: #ff0000;">'dcSMTPServer'</span> DESC <span style="color: #ff0000;">'Outgoing mails should be delivered to this Mailserver via SMTP.'</span> EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">256</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> SINGLE-VALUE <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.2.1.4 NAME <span style="color: #ff0000;">'dcSMTPLogin'</span> DESC <span style="color: #ff0000;">'Login credential to send Mail with the SMTP server'</span> EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.2.1.5 NAME <span style="color: #ff0000;">'dcSMTPPassword'</span> DESC <span style="color: #ff0000;">'A separate text that stores the SMTP account password in clear text'</span> EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.2.1.6 NAME <span style="color: #ff0000;">'dcRetrieveType'</span> DESC <span style="color: #ff0000;">'Tells getmail what mail account to retrieve mail from, and how to access that account, e.g. SimplePOP3Retriever and BrokenUIDLPOP3SSLRetriever'</span> EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">256</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> SINGLE-VALUE <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.2.1.7 NAME <span style="color: #ff0000;">'dcRetrieveServer'</span> DESC <span style="color: #ff0000;">'Incoming mails have to be downloaded from this server'</span> EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">256</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> SINGLE-VALUE <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.2.1.8 NAME <span style="color: #ff0000;">'dcRetrieveLogin'</span> DESC <span style="color: #ff0000;">'Login credential to receive Mail from the server'</span> EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.2.1.9 NAME <span style="color: #ff0000;">'dcRetrievePassword'</span> DESC <span style="color: #ff0000;">'Password for mail retrieval in clear text'</span> EQUALITY caseExactIA5Match SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 SINGLE-VALUE <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.2.1.10 NAME <span style="color: #ff0000;">'dcMailQuota'</span> DESC <span style="color: #ff0000;">'The size of space the user can have until further messages get bounced.'</span> EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.2.1.11 NAME <span style="color: #ff0000;">'dcMailSizeMax'</span> DESC <span style="color: #ff0000;">'The maximum size of a single messages the user accepts.'</span> EQUALITY integerMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 SINGLE-VALUE <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.2.1.12 NAME <span style="color: #ff0000;">'dcMailAlternateAddress'</span> DESC <span style="color: #ff0000;">'Secondary (alias) mailaddresses for an external Mail Account'</span> EQUALITY caseIgnoreIA5Match SUBSTR caseIgnoreIA5SubstringsMatch SYNTAX 1.3.6.1.4.1.1466.115.121.1.26<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">256</span><span style="color: #7a0874; font-weight: bold;">&#125;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcAttributeTypes: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.3.1.1 NAME <span style="color: #ff0000;">'dcPosixOwnerURL'</span> DESC <span style="color: #ff0000;">'Identifies an URL associated with the posixOwner of the entry. Any type of labeled URL can be used.'</span> SUP labeledURI <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcObjectClasses: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.1.2.1 NAME <span style="color: #ff0000;">'dcMailUser'</span> DESC <span style="color: #ff0000;">'Dovecot-LDAP User'</span> SUP top AUXILIARY MUST dcMailMessageStore MAY dcMailAlias <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcObjectClasses: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.2.2.1 NAME <span style="color: #ff0000;">'dcExternalMailAccount'</span> DESC <span style="color: #ff0000;">'Dovecot-LDAP external mail account'</span> SUP top STRUCTURAL MUST <span style="color: #7a0874; font-weight: bold;">&#40;</span> dcSubMailAddress $ dcAccountStatus <span style="color: #7a0874; font-weight: bold;">&#41;</span> MAY <span style="color: #7a0874; font-weight: bold;">&#40;</span> dcSMTPServer $ dcSMTPLogin $ dcSMTPPassword $ dcRetrieveType $ dcRetrieveServer $ dcRetrieveLogin $ dcRetrievePassword $ dcMailQuota $ dcMailSizeMax $ dcMailAlternateAddress <span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span>
olcObjectClasses: <span style="color: #7a0874; font-weight: bold;">&#40;</span> 1.3.6.1.4.1.32589.1.3.2.1 NAME <span style="color: #ff0000;">'dcPosixSubAccount'</span> DESC <span style="color: #ff0000;">'LDAP-URL for retrieving the respective posixAccount of an entry'</span> SUP top AUXILIARY MAY dcPosixOwnerURL <span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>und ebenfalls in die Konfiguration übernehmen mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapadd <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=admin,cn=config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> dovecot.schema.ldif</pre></div></div>

</li>
<li>Jetzt aktivieren wir das DynList-Modul und speichern dazu Folgendes als dynlist_moduleLoad.ldif

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dn: <span style="color: #007800;">cn</span>=module<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>,<span style="color: #007800;">cn</span>=config
changetype: modify
add: olcModuleLoad
olcModuleLoad: dynlist.so</pre></div></div>

<p>um es anschließend zur OpenLDAP-Konfiguration hinzuzufügen mit einem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapmodify <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=admin,cn=config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> dynlist_moduleLoad.ldif</pre></div></div>

</li>
<li>Dem <a href="http://www.openldap.org/doc/admin24/overlays.html#Dynamic%20Lists">Dynlist-Overlay</a> müssen wir außerdem mitteilen, dass das Attribut dcPosixOwnerURL jeweils auf den zugehörigen Benutzer verweist. Das machen wir, indem wir den folgenden Inhalt als dynlist_activateOnSuffix.ldif abspeichern

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dn: <span style="color: #007800;">olcOverlay</span>=dynlist,<span style="color: #007800;">olcDatabase</span>=<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>hdb,<span style="color: #007800;">cn</span>=config
objectClass: olcOverlayConfig
objectClass: olcDynamicList
olcDLattrSet: dcPosixSubAccount dcPosixOwnerURL
olcOverlay: dynlist</pre></div></div>

<p>und dann</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapadd <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=admin,cn=config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> dynlist_activateOnSuffix.ldif</pre></div></div>

<p>ausführen.</li>
<li>Nun müssen wir einen Grundeintrag in LDAP vornehmen, bevor wir starten können. Außerdem benötigen wir einen Benutzer secmail, um Mails von externen Servern in festen Intervallen abzurufen und in das jeweilige lokale IMAP-Postfach abzulegen. Daher legen wir mit der folgenden LDIF-Datei database-content.ldif zunächst den Grundeintrag und den Benutzer secmail an (Passwort wieder unbedingt mit slappasswd anpassen) an

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># effinger</span>
dn: <span style="color: #007800;">o</span>=effinger
objectclass: organization
objectclass: top
o: effinger
&nbsp;
<span style="color: #666666; font-style: italic;"># users, effinger</span>
dn: <span style="color: #007800;">ou</span>=<span style="color: #c20cb9; font-weight: bold;">users</span>,<span style="color: #007800;">o</span>=effinger
objectClass: organizationalUnit
objectClass: top
ou: <span style="color: #c20cb9; font-weight: bold;">users</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># secmail, users, effinger</span>
dn: <span style="color: #007800;">uid</span>=secmail,<span style="color: #007800;">ou</span>=<span style="color: #c20cb9; font-weight: bold;">users</span>,<span style="color: #007800;">o</span>=effinger
objectClass: posixAccount
objectClass: account
objectClass: top
cn: secmail
gidNumber: <span style="color: #000000;">134</span>
homeDirectory: <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>secmail
uid: secmail
uidNumber: <span style="color: #000000;">121</span>
<span style="color: #666666; font-style: italic;"># This password equals test</span>
userPassword: <span style="color: #7a0874; font-weight: bold;">&#123;</span>SSHA<span style="color: #7a0874; font-weight: bold;">&#125;</span>R+pQv9aIQINrPYdgljEJ0B7jzCp2cCzz</pre></div></div>

<p>und fügen sie mit einem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapadd <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=admin,o=effinger&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> database-content.ldif</pre></div></div>

<p>zum LDAP-Verzeichnis hinzu (Achtung Passwort verwenden, das für database.ldif erzeugt wurde)</li>
<li>SSL/TLS aktivieren, dazu folgenden Inhalt als ssl-tls_init.ldif abspeichern

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dn: <span style="color: #007800;">cn</span>=config
changetype: modify
add: olcTLSCACertificateFile
olcTLSCACertificateFile: <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>ca.crt
&nbsp;
dn: <span style="color: #007800;">cn</span>=config
changetype: modify
add: olcTLSCertificateFile
olcTLSCertificateFile: <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>myserver.crt
&nbsp;
dn: <span style="color: #007800;">cn</span>=config
changetype: modify
add: olcTLSCertificateKeyFile
olcTLSCertificateKeyFile: <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>myserver.key</pre></div></div>

<p>und folgende Befehle ausführen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapmodify <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=admin,cn=config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> ssl-tls_init.ldif
<span style="color: #c20cb9; font-weight: bold;">sudo</span> adduser openldap ssl-cert</pre></div></div>

<p>Ein Neustart ist ebenfalls erforderlich, da ich die Erfahrung gemacht habe, dass ohne einen Neustart der Zugriff über TLS nicht funktioniert.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>slapd restart</pre></div></div>

</li>
<li>Im nächsten Schritt der LDAP-Konfiguration richten wir Zugriffsrechte ein. Generell soll auf die Login-Daten bei externen Mailservern nur der jeweilige Benutzer selbst und der LDAP-Administrator lesend und schreibend zugreifen können, während der secmail Benutzer nur Leserechte benötigt. Diese Zugriffsrechte werden in der Datei add_acl.ldif mit dem Inhalt

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dn: <span style="color: #007800;">olcDatabase</span>=<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>hdb,<span style="color: #007800;">cn</span>=config
changetype: modify
add: olcAccess
<span style="color: #666666; font-style: italic;"># The information to send and receive mails from remote servers</span>
<span style="color: #666666; font-style: italic;"># can only be modified by the user itself and the admin</span>
<span style="color: #666666; font-style: italic;"># the secmail user which will retrieve mails must have read access</span>
olcAccess: <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>to dn.regex=<span style="color: #ff0000;">&quot;.*uid=([^,]+),ou=users,o=effinger&quot;</span> <span style="color: #007800;">attrs</span>=dcRetrieveType,dcRetrieveLogin,dcRetrievePassword,dcRetrieveServer,dcSMTPLogin,dcSMTPPassword,dcSMTPServer by <span style="color: #007800;">dn</span>=<span style="color: #ff0000;">&quot;cn=admin,o=effinger&quot;</span> <span style="color: #c20cb9; font-weight: bold;">write</span> by dn.exact,<span style="color: #007800;">expand</span>=<span style="color: #ff0000;">&quot;uid=$1,ou=users,o=effinger&quot;</span> <span style="color: #c20cb9; font-weight: bold;">write</span> by <span style="color: #007800;">dn</span>=<span style="color: #ff0000;">&quot;uid=secmail,ou=users,o=effinger&quot;</span> <span style="color: #c20cb9; font-weight: bold;">read</span> by <span style="color: #000000; font-weight: bold;">*</span> none
<span style="color: #666666; font-style: italic;"># Users shall have write access to their attributes</span>
<span style="color: #666666; font-style: italic;"># admin shall have write access as well</span>
<span style="color: #666666; font-style: italic;"># all other users have only read access</span>
olcAccess: <span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>to dn.regex=<span style="color: #ff0000;">&quot;.*uid=([^,]+),ou=users,o=effinger&quot;</span> <span style="color: #007800;">attrs</span>=dcMailAlternateAddress by <span style="color: #007800;">dn</span>=<span style="color: #ff0000;">&quot;cn=admin,o=effinger&quot;</span> <span style="color: #c20cb9; font-weight: bold;">write</span> by dn.exact,<span style="color: #007800;">expand</span>=<span style="color: #ff0000;">&quot;uid=$1,ou=users,o=effinger&quot;</span> <span style="color: #c20cb9; font-weight: bold;">write</span> by <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #c20cb9; font-weight: bold;">read</span></pre></div></div>

<p>durch den Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapmodify <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=admin,cn=config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> add_acl.ldif</pre></div></div>

<p>zum LDAP-Verzeichnis hinzugefügt.</li>
<li>Im letzten Schritt indizieren wir wichtige Felder für die Suche im LDAP-Verzeichnis. Das schont Ressourcen und sorgt außerdem dafür,  dass die dezenten Hinweise von OpenLDAP in der Syslog, dass einzelne Attribute indiziert werden sollten, verschwinden. <a href="http://www.zytrax.com/books/ldap/apa/indeces.html">Was die einzelnen Indexoptionen bedeuten</a> ist auf zytrax.com erklärt. Wir legen die Datei add_attribute_indices.ldif mit dem Inhalt

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dn: <span style="color: #007800;">olcDatabase</span>=<span style="color: #7a0874; font-weight: bold;">&#123;</span><span style="color: #000000;">1</span><span style="color: #7a0874; font-weight: bold;">&#125;</span>hdb,<span style="color: #007800;">cn</span>=config
changetype: modify
add: olcDbIndex
olcDbIndex: cn pres,eq,sub
olcDbIndex: sn pres,eq,sub
olcDbIndex: uid pres,eq
olcDbIndex: mail pres,eq,sub
olcDbIndex: dcMailAlias pres,eq
olcDbIndex: givenName pres,eq,sub
olcDbIndex: dcSubMailAddress pres,eq
olcDbIndex: dcMailAlternateAddress pres,eq
olcDbIndex: dcAccountStatus pres,eq</pre></div></div>

<p>an und fügen sie mit dem Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapmodify <span style="color: #660033;">-D</span> <span style="color: #ff0000;">&quot;cn=admin,cn=config&quot;</span> <span style="color: #660033;">-x</span> <span style="color: #660033;">-W</span> <span style="color: #660033;">-f</span> add_attribute_indices.ldif</pre></div></div>

<p>dem Verzeichnis hinzu.</li>
</ol>
<h2>Zugriff auf OpenLDAP-Server absichern</h2>
<p>Durch die Anpassung der Datei ldap.conf können wir festlegen, an welchen LDAP-Server Anfragen standardmäßig gerichtet werden sollen und unter welchen Bedingungen eine Verbindung mit diesem akzeptiert wird. Wir möchten die Konfiguration so anpassen, dass der OpenLDAP-Server ein gültiges Zertifikat vorweisen muss und standardmäßig der gerade eingerichtete LDAP-Server befragt wird. Standardmäßig werden die Anfragen zwar sowieso an den lokalen Rechner gerichtet, aber die Angabe des DNS-Namens ist notwendig, da sonst die Gültigkeitsprüfung für das Serverzertifikat fehlschlagt. In der Datei /etc/ldap/ldap.conf tragen wir folgende Zeilen ein (myserver durch den DNS-Namen ersetzen):</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">URI             ldap:<span style="color: #000000; font-weight: bold;">//</span>myserver
TLS_CACERT      <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>ca.crt
TLS_REQCERT     demand</pre></div></div>

<p>Ein anschließender Test mit dem Befehl</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapsearch <span style="color: #660033;">-x</span> <span style="color: #660033;">-b</span> <span style="color: #ff0000;">&quot;o=effinger&quot;</span> <span style="color: #660033;">-ZZ</span></pre></div></div>

<p>sollte Einträge des LDAP-Servers zurückgeben. Eigentlich wäre es auch das Beste, wenn der LDAP-Server nur TLS-verschlüsselte Verbindungen akzeptieren würde. Das kann man über <a href="http://markmail.org/message/edzras2hn2mlgim3#query:openldap%20allow%20%22tls%20only%22+page:1+mid:jgjmdhdiewzftlyw+state:results">ACL mit den Security Strength Factors (SSF)</a> einstellen, allerdings unterstützt Exim bislang keine TLS-verschlüsselten LDAP-Verbindungen, so dass wir hierauf verzichten.</p>
<h2>LDAP-Einträge hinzufügen</h2>
<p>Jetzt können wir Einträge in OpenLDAP anlegen. Sehr komfortabel kann man dazu <a href="http://www.jxplorer.org/">JXplorer</a> verwenden (zur Installation siehe Abschnitt <a href="http://www.effinger.org/blog/2008/12/14/das-kleine-openldap-1x1/">Die nächsten Schritt mit LDAP im OpenLDAP 1&#215;1</a>). Wir starten JXplorer und wählen im Menü <em>Datei&gt;Verbinden</em>. Dort tragen wir folgendes ein (localhost bzw. myserver anpassen):<br />
<a href="http://www.effinger.org/blog/wp-content/uploads/2009/01/connection.png"><img class="aligncenter size-medium wp-image-420" title="Connection Dialog from JXplorer" src="http://www.effinger.org/blog/wp-content/uploads/2009/01/connection-300x226.png" alt="Connection Dialog from JXplorer" width="300" height="226" /></a></p>
<p>Die Daten noch mal im Überblick:</p>
<ul>
<li><em>Host</em>: myserver <em>Port</em>:389 (myserver anpassen)</li>
<li><em>Base DN</em>: o=effinger (ggfs. anpassen)</li>
<li><em>Benutzer DN</em>: cn=admin,o=effinger (ggfs. anpassen)</li>
<li><em>Kennwort</em>: Das Passwort, das wir für die Datei database.ldif gewählt haben (s.o.).</li>
</ul>
<p>Nach der erfolgreichen Verbindungsherstellung sehen wir die LDAP-Hierarchie und erweitern den Baum unter o=effinger, so dass wir folgendes sehen:<br />
<a href="http://www.effinger.org/blog/wp-content/uploads/2009/01/ldap_tree.png"><img class="aligncenter size-full wp-image-425" title="LDAP Hierarchie nach dem Hinzufügen von users" src="http://www.effinger.org/blog/wp-content/uploads/2009/01/ldap_tree.png" alt="LDAP Hierarchie nach dem Hinzufügen von users" width="112" height="52" /></a></p>
<p>Im nächsten Schritt fügen wir unseren ersten Benutzer Paul hinzu. Dazu Rechtsklick auf <em>users</em> im LDAP-Baum und <em>Neu</em> auswählen. Im nachfolgenden Dialog ändern wir die <em>RDN</em> auf uid=paul und fügen die Klassen top, person, organizationalPerson, inetOrgPerson, posixAccount und dcMailUser hinzu.<br />
<a href="http://www.effinger.org/blog/wp-content/uploads/2009/01/add_user.png"><img class="aligncenter size-medium wp-image-426" title="Adding a user to the LDAP directory with JXplorer" src="http://www.effinger.org/blog/wp-content/uploads/2009/01/add_user-300x225.png" alt="Adding a user to the LDAP directory with JXplorer" width="300" height="225" /></a></p>
<p>Nun sehen wir im nächsten Dialog einige fett gedruckte Attribute &#8211; diese sind Pflichtattribute und müssen daher ausgefüllt werden.<br />
<a href="http://www.effinger.org/blog/wp-content/uploads/2009/03/add_user_attributes.png"></a><a href="http://www.effinger.org/blog/wp-content/uploads/2009/03/add_user_attributes.png"><img class="aligncenter size-medium wp-image-609" title="Adding necessary user attributes with JXplorer" src="http://www.effinger.org/blog/wp-content/uploads/2009/03/add_user_attributes-279x300.png" alt="Adding necessary user attributes with JXplorer" width="279" height="300" /></a></p>
<ul>
<li><strong>cn</strong> steht für common name und ist einfach eine Bezeichnung für den Eintrag, am einfachsten ist es, man wählt hier Vornamen und Nachnamen des Benutzers</li>
<li><strong>dcMailMessageStore </strong>gibt  das Grundverzeichnis an, in welchem die E-Mails abgelegt werden sollen. Wir werden Dovecot später so konfigurieren, dass wir dieses Verzeichnis (z.B. /home/paul/mail) um die E-Mail-Addresse ergänzen, so dass man z.B. /home/paul/mail/paul/ erhält. Letzeres wird in Dovecot das Home-Verzeichnis sein, in dem u.a. die .dovecot.sieve gespeichert wird. Die Mails werden später als Maildir im Unterverzeichnis maildir abgelegt, also /home/paul/mail/paul/maildir</li>
<li><strong>gidNumber</strong> gibt die GruppenID des Benutzers Paul an. Paul sollte bereits als Benutzer auf dem Rechner angelegt sein, so dass man über ein

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

<p>die gid herausfinden kann.</li>
<li><strong>homeDirectory</strong> das Heimverzeichnis des Benutzers Paul. Den korrekten Wert kann man herausfinden durch ein

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">passwd</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> paul <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> -d: <span style="color: #660033;">-f6</span></pre></div></div>

</li>
<li><strong>sn</strong> steht für surname, also den Nachnamen des Benutzers</li>
<li><strong>givenName</strong> steht für den Vornamen des Benutzers, ist allerdings ein optionales Attribut</li>
<li><strong>uidNumber</strong> die BenutzerID von Paul. Der korrekte Wert ist analog zur gidNumber herauszufinden &#8211; statt gid dann den Wert von uid  verwenden.</li>
<li><strong>userPassword</strong> Damit Paul sich einloggen kann, legen wir ein Passwort für ihn fest. Das Passwort sollte <em>keinen Slash</em> &#8220;/&#8221; enthalten, da in der Exim-Konfiguration dieses Zeichen zur Trennung einer zusammengesetzten Zeichenfolge aus Login und Passwort verwendet wird.</li>
<li><strong>mail</strong> Dieses Attribut steht für die lokale E-Mail-Addresse von Paul. Die lokale E-Mail-Addresse wird dabei ohne die Domain angegeben. In diesem Fall genügt also der Eintrag &#8220;paul&#8221; für die Addresse paul@myserver</li>
</ul>
<p>Danach klicken wir auf den Button <em>Abschicken</em> und Paul ist als Benutzer in LDAP verfügbar.</p>
<p>Jetzt richten wir noch den externen MailAccount von Paul ein, damit er auch seine Mails von GMX abrufen bzw. über GMX schicken kann. Dazu erweitern wir die Ansicht der LDAP-Hierarchie, so dass wir mit einem Rechtsklick auf paul erneut den Eintrag <em>Neu</em> wählen können.<br />
<a href="http://www.effinger.org/blog/wp-content/uploads/2009/01/ldap_tree2.png"><img class="aligncenter size-full wp-image-429" title="LDAP tree after adding paul as a user" src="http://www.effinger.org/blog/wp-content/uploads/2009/01/ldap_tree2.png" alt="LDAP tree after adding paul as a user" width="112" height="70" /></a><br />
Im erscheinenden Dialogfeld wählen wir die <em>Klassen</em> dcExternalMailAccount und dcPosixSubAccount aus. <em>RDN</em> setzen wir auf dcSubMailAddress=paulpanzer@gmx.de. Folgende Attribute können bzw. müssen wir eintragen:</p>
<ul>
<li><strong>dcSubMailAddress</strong> steht für die Mail-Addresse des externen Accounts. Lokale Mails an diese Addresse werden ohne den Umweg über den externen Mailprovider zugestellt.</li>
<li><strong>dcAccountStatus</strong> kann die Werte active, noaccess, disabled und deleted annehmen. Wir wählen active.</li>
<li><strong>dcMailQuota</strong> ist ein Attribut, das  wir nicht verwenden werden, allerdings könnte man hier zukünftig eine Größenbeschränkung für die paulpanzer@gmx.de-Mailbox  einrichten.</li>
<li><strong>dcMailSizeMax</strong> verwenden wir ebenfalls nicht, allerdings könnte man hier zukünftig eine Beschränkung der Größe der zu versendenden E-Mails festlegen.</li>
<li><strong>dcRetrieveType</strong> gibt den Protokoll/Typ an, mit dem die Mails abgerufen werden sollen. Beispielhafte Werte sind SimplePOP3Retriever, BrokenUIDLPOP3Retriever oder SimpleIMAPSSLRetriever. Eine detaillierte Auflistung findet sich in der <a href="http://pyropus.ca/software/getmail/configuration.html#conf-retriever">Dokumentation von getmail</a>.</li>
<li><strong>dcRetrieveLogin</strong> der Benutzername für den Mailabruf, bei GMX üblicherweise die E-Mail-Addresse</li>
<li><strong>dcRetrievePassword</strong> das zugehörige Passwort, um Mails abzurufen.</li>
<li><strong>dcRetrieveServer</strong> der Name/IP des Servers für das Abrufen von Mails. Bei GMX mit POP3 ist es pop.gmx.net.</li>
<li><strong>dcSMTPLogin</strong> der Benutzername für den SMTP-Server, bei GMX üblicherweise die E-Mail-Addresse.</li>
<li><strong>dcSMTPPassword</strong> das zugehörige Passwort, um Mails zu versenden.</li>
<li><strong>dcSMTPServer</strong> der Name/IP des SMTP-Servers. Bei GMX ist es mail.gmx.net.</li>
<li><strong>dcMailAlternateAddress</strong> steht für eventuelle Alias-Addressen der bei dcSubMailAddress angegebenen E-Mail-Addresse.  Besitzt Paul Panzer also für die Addresse paulpanzer@gmx.de noch den Alias p.panzer@gmx.de kann er die Mail hier eintragen und Mails über den lokalen Server werden direkt ohne Umwege über GMX zugestellt.</li>
<li><strong>dcPosixOwnerURL</strong> dient dazu, dass dovecot wichtige Parameter, wie uid, uidNumber,gidNumber und dcMailMessageStore vom übergeordneten Benutzereintrag von Paul bekommt. Hier tragen wir folgende <a href="http://java.sun.com/products/jndi/tutorial/ldap/misc/url.html">LDAP-URL</a> ein:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldap:<span style="color: #000000; font-weight: bold;">///</span><span style="color: #007800;">uid</span>=paul,<span style="color: #007800;">ou</span>=<span style="color: #c20cb9; font-weight: bold;">users</span>,<span style="color: #007800;">o</span>=effinger?uid,uidNumber,gidNumber,dcMailMessageStore?base?<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000; font-weight: bold;">&amp;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">objectClass</span>=posixAccount<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #007800;">objectClass</span>=dcMailUser<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

</li>
</ul>
<p>Und so sieht das bei mir aus:<br />
<a href="http://www.effinger.org/blog/wp-content/uploads/2009/03/external_mail_account.png"><img class="aligncenter size-medium wp-image-608" title="Adding an external mail account to the LDAP directory" src="http://www.effinger.org/blog/wp-content/uploads/2009/03/external_mail_account-300x294.png" alt="Adding an external mail account to the LDAP directory" width="300" height="294" /></a><br />
Nun wieder auf <em>Abschicken</em> klicken und der Eintrag sollte vorhanden sein. Wichtig ist, jetzt nochmal zu prüfen, ob auch das Dynlist-Overlay funktioniert. Das machen wir mit einem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldapsearch <span style="color: #660033;">-b</span> <span style="color: #ff0000;">&quot;dcSubMailAddress=paulpanzer@gmx.de,uid=paul,ou=users,o=effinger&quot;</span> <span style="color: #660033;">-x</span></pre></div></div>

<p>Dieser Befehl sollte unter anderem die Zeilen mit den Attributen uid, uidNumber,gidNumber und dcMailMessageStore augeben:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dcMailMessageStore: <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>paul
gidNumber: <span style="color: #000000;">1000</span>
uidNumber: <span style="color: #000000;">1000</span>
uid: paul</pre></div></div>

<h2>Testen und Mitschneiden von Anfragen an OpenLDAP</h2>
<p>Zum Testen und Debuggen ist es oft hilfreich, zu überprüfen, welche LDAP Anfragen an den OpenLDAP-Server gestellt wurden. Dazu kann man unter cn=config (mit cn=admin,cn=config einloggen) den Parameter <em>olcLogLevel</em> von <em>none</em> auf einen numerischen Wert ändern. <em>256</em> hat sich für mich als gut bewährt, bei Terrence Miao findet man aber eine <a href="http://terrencemiao.com/Webmail/msg00461.html">detaillierte Auflistung der einzelnen Loglevels</a>. Die LDAP-Anfragen werden dann in die syslog geschrieben.</p>
<p>Da der Artikel nun schon ziemlich lang ist, folgt die <a href="http://www.effinger.org/blog/2009/03/22/dovecot-postfix-openldap-und-getmail-unter-ubuntu-2-dovecot/">Konfiguration von dovecot in einem zweiten Teil</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-1-openldap/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss>

