<?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</title>
	<atom:link href="http://www.effinger.org/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.effinger.org/blog</link>
	<description>a personal knowledge base</description>
	<lastBuildDate>Sun, 06 Jun 2010 17:41:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mit strace prüfen, was ein Programm so treibt</title>
		<link>http://www.effinger.org/blog/2010/05/08/mit-strace-prufen-was-ein-programm-so-treibt/</link>
		<comments>http://www.effinger.org/blog/2010/05/08/mit-strace-prufen-was-ein-programm-so-treibt/#comments</comments>
		<pubDate>Sat, 08 May 2010 20:19:13 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[strace]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=986</guid>
		<description><![CDATA[<p>Manchmal kommt man mit Fehlermeldungen von Programmen einfach nicht weiter. Bevor man jedoch im Trial- und Errorverfahren Konfigurationsparameter ausprobiert, um dem Fehler auf die Spur zu kommen oder gleich ein alternatives Programm wählt, kann man strace bemühen. Dieses kleine Programm erlaubt es Systemaufrufe eines Programmes zu protokollieren.</p>
Die wichtigsten Parameter von strace

-o filename schreibt die Ausgabe [...]]]></description>
			<content:encoded><![CDATA[<p>Manchmal kommt man mit Fehlermeldungen von Programmen einfach nicht weiter. Bevor man jedoch im Trial- und Errorverfahren Konfigurationsparameter ausprobiert, um dem Fehler auf die Spur zu kommen oder gleich ein alternatives Programm wählt, kann man strace bemühen. Dieses kleine Programm erlaubt es Systemaufrufe eines Programmes zu protokollieren.</p>
<h3>Die wichtigsten Parameter von strace</h3>
<ul>
<li><em>-o filename</em> schreibt die Ausgabe in die Datei <em>filename</em></li>
<li><em>-f</em> mit diesem Parameter protokolliert das Programm auch forks (d.h. neue Prozesse, die durch das zu protokollierende Programm gestartet werden)</li>
<li><em>-tt</em> mit diesem Parameter wird vor jedem Aufruf zunächst die Zeit protokolliert (auf Basis von Mikrosekunden)</li>
<li><em>-e</em> schränkt die Events ein, die strace protokolliert (siehe Beispiele weiter unten)</li>
<li><em>-p PID</em> strace protokolliert die Systemaufrufe des Prozesses mit der Prozess-ID <em>PID</em></li>
</ul>
<p>Ein beispielhafter Aufruf sieht dann so aus</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">strace</span> <span style="color: #660033;">-o</span> logfile.log <span style="color: #660033;">-f</span> .<span style="color: #000000; font-weight: bold;">/</span>mycommand <span style="color: #660033;">-mycommandparameter</span></pre></div></div>

<p>Im Folgenden sind einige nützliche Beispiele für spezielle Programmaufrufe aufgeführt.</p>
<h3>Auf welche Dateien greift ein Programm zu?</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">strace</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">trace</span>=open <span style="color: #660033;">-o</span> logfile.log .<span style="color: #000000; font-weight: bold;">/</span>mycommand <span style="color: #660033;">-mycommandparameter</span></pre></div></div>

<p>Das habe ich mir von <a href="http://www.netadmintools.com/art353.html">NetAdminTools</a> abgeschaut.</p>
<h3>Welche Programme startet/pausiert/beendet das Programm?</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">strace</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">trace</span>=process <span style="color: #660033;">-o</span> logfile.log .<span style="color: #000000; font-weight: bold;">/</span>mycommand <span style="color: #660033;">-mycommandparameter</span></pre></div></div>

<h3>Wie protokolliere ich die Systemaufrufe eine Programms, das schon gestartet ist?</h3>
<p>Hierfür gibt es den Parameter <em>-p</em> von strace, mit dem man die entsprechende Prozess-ID des Programms an strace übergibt. Um diese ID herauszufinden bemüht man zunächst ps, welches mit dem folgenden Befehl die IDs aller laufenden Prozesse mit dem Namen mycommand auflistet.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ps</span> aux <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> mycommand <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> <span style="color: #660033;">-v</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> mycommand</pre></div></div>

<p>Wer es kürzer haben möchte, sollte sich meine <a href="http://www.effinger.org/blog/2008/11/20/arbeitserleichterung-durch-bashrc-und-bash_aliases/">bashrc</a> anschauen, in der eine Funktion pg definiert ist, die mit dem Aufruf</p>

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

<p>dasselbe Resultat erzielt. Angenommen die Ausgabe in der Spalte PID lautet 123, dann würde man strace folgendermaßen aufrufen.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">strace</span> <span style="color: #660033;">-o</span> logfile.log <span style="color: #660033;">-p</span> <span style="color: #000000;">123</span></pre></div></div>

<p>Falls es mit Sicherhheit nur ein Programm namens mycommand läuft, geht das auch schneller mit einem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">strace</span> <span style="color: #660033;">-o</span> logfile.log <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">pidof</span> mycommand<span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;</span>strong<span style="color: #000000; font-weight: bold;">&gt;&lt;</span>strong<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #c20cb9; font-weight: bold;">strace</span> <span style="color: #660033;">-e</span> <span style="color: #007800;">trace</span>=open<span style="color: #000000; font-weight: bold;">&lt;/</span>strong<span style="color: #000000; font-weight: bold;">&gt;&lt;/</span>strong<span style="color: #000000; font-weight: bold;">&gt;</span></pre></div></div>

</div>
<h3>Wie versteht man die Ausgabe von strace?</h3>
<p>Am Beispiel der folgenden Ausgabe wollen wir mal grob nachvollziehen, was ein Programm gerade macht</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">execve<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">&quot;/bin/cat&quot;</span>, <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">&quot;cat&quot;</span>, <span style="color: #ff0000;">&quot;/var/log/messages&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>, <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000;">37</span> vars <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> = <span style="color: #000000;">0</span></pre></div></div>

<p>Was macht der Befehl execve? Dazu rufen wir mit</p>

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

<p>die entsprechende Hilfedatei auf und erfahren dort, dass das Programm cat mit dem Parameter /var/log/messages gestartet wird.</p>
<p>Welche Tips und Kniffe fallen euch noch im Zusammenhang mit strace ein?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2010/05/08/mit-strace-prufen-was-ein-programm-so-treibt/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<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;"><span style="color: #c20cb9; font-weight: bold;">dc</span></span>=effinger,<span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">dc</span></span>=org?one
nss_base_shadow <span style="color: #007800;">ou</span>=accounts,<span style="color: #007800;">o</span>=default,<span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">dc</span></span>=effinger,<span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">dc</span></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;"><span style="color: #c20cb9; font-weight: bold;">dc</span></span>=effinger,<span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">dc</span></span>=org?one
nss_base_hosts  <span style="color: #007800;">ou</span>=machines,<span style="color: #007800;">o</span>=default,<span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">dc</span></span>=effinger,<span style="color: #007800;"><span style="color: #c20cb9; font-weight: bold;">dc</span></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
&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        required        pam_unix.so try_first_pass use_authtok nullok sha512 shadow
password        sufficient      pam_ldap.so use_authtok use_first_pass
&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>0</slash:comments>
		</item>
		<item>
		<title>Erfahrungen mit Gentoo auf Linux-VServer</title>
		<link>http://www.effinger.org/blog/2010/03/15/erfahrungen-mit-gentoo-auf-linux-vserver/</link>
		<comments>http://www.effinger.org/blog/2010/03/15/erfahrungen-mit-gentoo-auf-linux-vserver/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 20:33:30 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Gentoo]]></category>
		<category><![CDATA[Linux-VServer]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=1001</guid>
		<description><![CDATA[<p>Nachdem ich mittlerweile bei dem attraktiven Angebot von netcup zugegriffen habe, bin ich stolzer Besitzer eines Linux-VServers. Schon länger spiele ich mit dem Gedanken, mal eine andere Distributionslinie als Debian/Ubuntu &#38; Co auszuprobieren und nun bin ich untreu geworden. Auf meinem VServer läuft Gentoo. Leider war Gentoo nicht als vorinstalliertes Image verfügbar (@netcup:  hier besteht [...]]]></description>
			<content:encoded><![CDATA[<p>Nachdem ich mittlerweile bei dem <a href="http://www.netcup.de/vserver/">attraktiven Angebot</a> von <a href="http://www.hostblog.eu/">netcup</a> zugegriffen habe, bin ich stolzer Besitzer eines Linux-VServers. Schon länger spiele ich mit dem Gedanken, mal eine andere Distributionslinie als Debian/Ubuntu &amp; Co auszuprobieren und nun bin ich untreu geworden. Auf meinem VServer läuft <a href="http://www.gentoo.de/">Gentoo</a>. Leider war Gentoo nicht als vorinstalliertes Image verfügbar (@netcup:  hier besteht noch Verbesserungspotential), aber dank der <a href="http://mark.ossdl.de/2010/02/gentoo-on-a-linux-vserver-partition-with-wrong-initstyle/">Anleitung von Mark</a> habe ich die Installation auch so geschafft (siehe auch <a href="http://mark.ossdl.de/2010/02/gentoo-on-a-linux-vserver-partition-with-wrong-initstyle/comment-page-1/#comment-8525">mein Kommentar</a> dort). Soweit lief alles einwandfrei!</p>
<h3>Neustarten des Linux-VServers mit Gentoo</h3>
<p>Ein kleines Problem hatte ich mit dem Neustart des Systems. Ein einfaches</p>

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

<p>half da nicht weiter, denn es trat die folgende Fehlermeldung auf</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">init: timeout opening/writing control channel /dev/initctl</pre></div></div>

<p>mit der Folge, dass das System nicht neu startete. Der Hintergrund dieser Fehlermeldung ist, dass unter Linux-VServer kein reguläres init-System läuft &#8211; eine <a href="http://www.mail-archive.com/vserver@list.linux-vserver.org/msg09755.html">detailliertere Beschreibung findet sich in der Mailingliste</a>. Aus diesem Grund ist für einen Neustart ein</p>

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

<p>erforderlich, wie es auch <a href="http://thenthdoctor.blogspot.com/2007/03/timeout-openingwriting-control-channel.html">Nathan Hawks erklärt</a>.</p>
<h3>Festlegen des Domainnamens auf dem Gentoo-System</h3>
<p>Ich habe mich etwas abgemüht, den Domainnamen des Systems festzulegen. Die Ausgabe von</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>ergab stets</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">hostname: Unbekannter Rechner</pre></div></div>

<p>Auch die Änderung der Datei /etc/hosts von</p>

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

<p>auf</p>

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

<p>führte nicht zum gewünschten Erfolg. Ebenso wirkungslos blieb die Änderung von dns_domain_lo in der Datei /etc/conf.d/net. Erst als ich die IP-Adresse von eth0 und den Hostnamen auch noch in /etc/hosts nach dem Schema</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">xx.xx.xx.xx       myserver.mydomain.tld</pre></div></div>

<p>eingetragen hatte, funktionierte es. Darauf kam ich aber erst durch einen <a href="http://forum.soft32.com/linux/gentoo-Domainname-ftopict333490.html">Forumsbeitrag</a> mit dem gleichen Problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2010/03/15/erfahrungen-mit-gentoo-auf-linux-vserver/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Dovecot, Exim, OpenLDAP und getmail unter Ubuntu – (5) DSpam</title>
		<link>http://www.effinger.org/blog/2010/02/20/dovecot-exim-openldap-und-getmail-unter-ubuntu-%e2%80%93-5-dspam/</link>
		<comments>http://www.effinger.org/blog/2010/02/20/dovecot-exim-openldap-und-getmail-unter-ubuntu-%e2%80%93-5-dspam/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 20:20:28 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[dovecot-antispam]]></category>
		<category><![CDATA[DSPAM]]></category>
		<category><![CDATA[exim]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Sieve]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=914</guid>
		<description><![CDATA[<p>Es ist nun schon eine ganze Weile her seit ich zum letzten Mal über mein Mailserversetup geschrieben habe. In den letzten vier Blogartikeln wurde das Zusammenspiel der Grundkomponenten mit Dovecot, Exim, OpenLDAP und getmail konfiguriert. Jetzt geht es ans Feintuning &#8211; das Einrichten eines Spamfilters mit dspam und dovecot-antispam.</p>
Weshalb dspam?
<p>Warum dspam wird vielleicht manch einer [...]]]></description>
			<content:encoded><![CDATA[<p>Es ist nun schon eine ganze Weile her seit ich zum letzten Mal über mein Mailserversetup geschrieben habe. In den letzten vier Blogartikeln wurde das Zusammenspiel der Grundkomponenten mit <a href="http://www.effinger.org/blog/2009/03/22/dovecot-postfix-openldap-und-getmail-unter-ubuntu-2-dovecot/">Dovecot</a>, <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-3-exim/">Exim</a>, <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-1-openldap/">OpenLDAP</a> und <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-4-getmail/">getmail</a> konfiguriert. Jetzt geht es ans Feintuning &#8211; das Einrichten eines Spamfilters mit <a href="http://dspam.sourceforge.net/">dspam</a> und <a href="http://johannes.sipsolutions.net/Projects/dovecot-antispam">dovecot-antispam</a>.</p>
<h2>Weshalb dspam?</h2>
<p>Warum dspam wird vielleicht manch einer fragen und nicht das weitverbreitetere spamassassin? Ich habe mich für dspam entschieden, weil es anders als Spamassassin <span style="text-decoration: underline;">nicht</span> regelbasiert ist. Spamassassin legt bestimmte Regeln fest, nach denen Punkte vergeben werden und kombiniert dies mit lernenden Elementen (je nach Konfiguration). Regelbasiertes Filtern von Nachrichten hat einen Vorteil: Man hat einen sofort <span style="text-decoration: underline;">einigermaßen</span> brauchbaren Spamfiltern. Einigermaßen sage ich deswegen, weil natürlich statische Filter so allgemein sein müssen, dass sie für den eigenen spezifischen Spamschutz nicht maßgeschneidert sein können. Man wird damit, wenn man die Regeln auch noch ein bischen für sich anpasst weit kommen, allerdings sind dem Grenzen gesetzt. Mit dspam setze ich auf einen Spamfilter, der rein auf adaptives Lernen setzt und dabei <a href="http://dspam.irontec.com/faq.shtml#1.16">modernste Algorithmen</a> einsetzt. Das hat zwar den Nachteil, dass es eine Lernphase braucht und deshalb anfangs einen relativ hohen Anteil von Spam/Ham nicht richtig klassifiziert, mit der Zeit jedoch erhält man einen auf die persönlichen Bedürfnisse maßgeschneiderten Spamfilter. Diese Argumentation findet sich übrigens auch in der <a href="http://dspam.irontec.com/faq.shtml#1.7">DSPAM FAQ</a>. Ob das jetzt tatsächlich so ist, wird sich bei mir im Praxistest zeigen. Ich werde berichten..</p>
<h2>Das Spamfilter-Setup im Überblick</h2>
<p>In diesem Abschnitt möchte ich einen Überblick darüber geben, wie sich dspam in die Grundkonfiguration einfügt. Zunächst wird jede Nachricht, die exim zustellt, vor der Übergabe an den dovecot local delivery agent (LDA) von dspam analysiert und das Ergebnis im Mailheader festgehalten. Per Sieve-Filterregel kann man dann die Spammails in den Spamordner verschieben lassen. Wenn eine Mail falsch klassifiziert ist, kann man sie &#8211; falls es sich richtigerweise um Spam handelt &#8211; an spam@myserver oder andernfalls an ham@myserver schicken. Auf Dauer wäre das jedoch sehr aufwendig. Deswegen gibt es dovecot-antispam, ein Plugin für dovecot, welches beim Verschieben von Nachrichten in den Spamordner diese an spam@myserver schickt bzw. beim Verschieben von Nachrichten aus dem Spamordner in normale Ordner (nicht den Papierkorb) diese an ham@myserver schickt. DSpam kann die nutzerspezifischen Daten auf verschiedene Weisen speichern. In diesem Howto wird MySQL als Backend für dspam genutzt.</p>
<h2>Installation und Kompilieren benötigter Pakete</h2>
<p>So, beginnen wir mit einer kleinen Korrektur unserer Exim-Installation, die später bei der Prüfung von Paketabhängigkeiten wichtig wird. Wir installieren nämlich das Paket exim, welches auf eines der verschiedenen exim-Pakete verweist (wir haben <a href="http://www.effinger.org/blog/2009/03/22/dovecot-exim-openldap-und-getmail-unter-ubuntu-3-exim/">im dritten Teil des Howtos</a> den exim4-daemon-heavy installiert). Zusätzlich benötigen wir noch MySQL, das Dovecot-Antispam Plugin und dbconfig-common zur Einrichtung eines MySQL-Benutzers. Bei der Installation wird übrigens nach dem MySQL-Root-Passwort gefragt, bitte dieses unbedingt merken, denn wir benötigen es später noch.</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 dovecot-antispam mysql-server dbconfig-common</pre></div></div>

<p>Im nächsten Schritt installieren wir dspam. Ich habe mich allerdings dafür entschieden, nicht die in den Repositories erhältliche Version 3.6.8 zu verwenden, sondern selbst die Pakete für die Version 3.9.0 RC2 zu erstellen. Dabei bin ich analog zu der <a href="https://juxtaposition.axley.net/2007/11/postfix-dspam-3-1.html">Beschreibung von Jason Axley</a> vorgegangen</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> build-essential
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> build-dep dspam</pre></div></div>

<p>Glücklicherweise gibt es einen aktiven Debian-Nutzer, der quasi alles (Sourcen+Patches) in einem Repository öffentlich zur Verfügung stellt unter <a href="http://packages.kirya.net/debian/pool/main/d/dspam/">http://packages.kirya.net/debian/pool/main/d/dspam/</a> (übrigens gibt es auch eine <a href="http://www.kirya.net/articles/setting-up-dspam-as-a-filter-for-postfix-on-debian-etch/">Anleitung auf kirya.net</a>). Von dort laden wir nun die Quelldateien und Patches herunter, entpacken sie und wechseln in das Unterverzeichnis dspam</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>packages.kirya.net<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span>pool<span style="color: #000000; font-weight: bold;">/</span>main<span style="color: #000000; font-weight: bold;">/</span>d<span style="color: #000000; font-weight: bold;">/</span>dspam<span style="color: #000000; font-weight: bold;">/</span>dspam_3.9.0~rc2+git20091231.orig.tar.gz
<span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>packages.kirya.net<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span>pool<span style="color: #000000; font-weight: bold;">/</span>main<span style="color: #000000; font-weight: bold;">/</span>d<span style="color: #000000; font-weight: bold;">/</span>dspam<span style="color: #000000; font-weight: bold;">/</span>dspam_3.9.0~rc2+git20091231-1.debian.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf dspam_3.9.0~rc2+git20091231.orig.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf dspam_3.9.0~rc2+git20091231-1.debian.tar.gz <span style="color: #660033;">-C</span> dspam
<span style="color: #7a0874; font-weight: bold;">cd</span> dspam</pre></div></div>

<p>Dann editieren wir die Datei debian/control, um die Paketabhängigkeiten so zu verändern, dass auch exim als Delivery Agent akzeptiert wird. Wir ergänzen deshalb in der depends-Zeile exim. Aus</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Package: dspam
Architecture: any
Depends: ${misc:Depends}, procmail | maildrop | courier-maildrop | sensible-mda, lsb-base (&gt;= 3.0-6), ${shlibs:Depends}</pre></div></div>

<p>wird dann</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Package: dspam
Architecture: any
Depends: ${misc:Depends}, exim4 | procmail | maildrop | courier-maildrop | sensible-mda, lsb-base (&gt;= 3.0-6), ${shlibs:Depends}</pre></div></div>

<p>Nun können wir die Binärpakete erstellen und installieren mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">fakeroot debian<span style="color: #000000; font-weight: bold;">/</span>rules binary
<span style="color: #7a0874; font-weight: bold;">cd</span> ..
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">dpkg</span> <span style="color: #660033;">-i</span> dspam_3.9.0~rc2+git20091231-<span style="color: #000000;">1</span>_i386.deb libdspam7_3.9.0~rc2+git20091231-<span style="color: #000000;">1</span>_i386.deb libdspam7-drv-mysql_3.9.0~rc2+git20091231-<span style="color: #000000;">1</span>_i386.deb dspam-doc_3.9.0~rc2+git20091231-<span style="color: #000000;">1</span>_all.deb</pre></div></div>

<p>Dabei werden wir gefragt, ob die Datenbankkonfiguration jetzt oder manuell (später) erfolgen soll. Wir wählen die erste Option. Nun wird nach dem MySQL-Passwort von oben gefragt, das wir eingeben. Das Passwort für dspam können wir automatisch festlegen lassen.</p>
<h2>Konfigurationsdateien</h2>
<p>Ich habe mir die Mühe gemacht und die im Vergleich zur Standardkonfiguration, die in den Teilen (1) bis (4) beschrieben wurde, angepassten Dateien in einem <a href="http://www.effinger.org/blog/wp-content/uploads/2010/02/modified-configfiles-mailsystem-with-spam.tar.gz">Archiv</a> zusammenzupacken. Dieses Archiv ist damit <em>kein</em> Ersatz für das <a href="http://www.effinger.org/blog/wp-content/uploads/2009/03/configfiles-mailsystem.tgz">dort aufgeführte Paket der Konfigurationsdateien</a>, sondern vielmehr eine Ergänzung. Wichtige Anmerkung: Die Konfigurationsdateien können immer nur Ausgangspunkt für die eigene Konfiguration sein u.a. auch deshalb, weil die Berechtigungen für diese Dateien angepasst werden müssen!</p>
<h2>Konfiguration von dspam</h2>
<p>Jetzt machen wir uns ans Eingemachte, der Konfiguration von dspam, welches leider keine sehr ausführliche Dokumentation bietet. Es gibt jedoch eine <a href="http://www.mail-archive.com/dspam-user@lists.sourceforge.net/msg00840.html">kurze Quick-and-Dirty Anleitung von der dspam-user Mailingliste</a> und in der Readme unter /usr/share/doc/dspam/README.gz sind auch einige Informationen zu finden. Außerdem fand ich die Kommentare in einer <a href="http://www.scribd.com/doc/8019538/Dspam-Pop3-Proxy-Clamav">weiteren Anleitung</a> sehr hilfreich. Wir passen zunächst das MySQL-Datenbankschema an. Ich bevorzuge nämlich das geschwindigkeitsoptimierte Datenbankschema gegenüber dem speicherplatzoptimierten, welches standardmäßig installiert wird. Deshalb habe ich mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-u</span> root <span style="color: #660033;">-p</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;drop database dspam; create database dspam; GRANT SELECT, INSERT, UPDATE, DELETE ON dspam.* to dspam@localhost identified by '<span style="color: #007800;">$(sudo cat /etc/dspam/dspam.d/mysql.conf | grep MySQLPass | cut -f3)</span>';&quot;</span></pre></div></div>

<p>erstmal das komplette dspam -Schema gelöscht und neu erzeugt. Dazu wird natürlich wieder das MySQL root Passwort von oben benötigt. Anschließend installieren wir mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-u</span> dspam -p$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <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>dspam<span style="color: #000000; font-weight: bold;">/</span>dspam.d<span style="color: #000000; font-weight: bold;">/</span>mysql.conf <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> MySQLPass <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> -f3<span style="color: #7a0874; font-weight: bold;">&#41;</span> dspam <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>libdspam7-drv-mysql<span style="color: #000000; font-weight: bold;">/</span>sql<span style="color: #000000; font-weight: bold;">/</span>mysql_objects-speed.sql</pre></div></div>

<p>das geschwindigkeitsoptimierte Datenbankschema. Wer alternativ doch das speicherplatzoptimierte Schema verwenden will, installiert es mit einem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-u</span> dspam -p$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <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>dspam<span style="color: #000000; font-weight: bold;">/</span>dspam.d<span style="color: #000000; font-weight: bold;">/</span>mysql.conf <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> MySQLPass <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> -f3<span style="color: #7a0874; font-weight: bold;">&#41;</span> dspam <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>libdspam7-drv-mysql<span style="color: #000000; font-weight: bold;">/</span>sql<span style="color: #000000; font-weight: bold;">/</span>mysql_objects-space.sql</pre></div></div>

<p>Nun schaffen wir die Voraussetzungen dafür, dass virtuelle Benutzer verwendet werden können. Ich habe mich dafür entschieden, dass Datenbankschema so einzurichten, dass nicht existierende Benutzer automatisch angelegt werden.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-u</span> dspam -p$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <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>dspam<span style="color: #000000; font-weight: bold;">/</span>dspam.d<span style="color: #000000; font-weight: bold;">/</span>mysql.conf <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> MySQLPass <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> -f3<span style="color: #7a0874; font-weight: bold;">&#41;</span> dspam <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>libdspam7-drv-mysql<span style="color: #000000; font-weight: bold;">/</span>sql<span style="color: #000000; font-weight: bold;">/</span>virtual_users.sql</pre></div></div>

<p>Wer alternativ die Benutzer manuell anlegen will, führt stattdessen</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysql <span style="color: #660033;">-u</span> dspam -p$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">sudo</span> <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>dspam<span style="color: #000000; font-weight: bold;">/</span>dspam.d<span style="color: #000000; font-weight: bold;">/</span>mysql.conf <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> MySQLPass <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> -f3<span style="color: #7a0874; font-weight: bold;">&#41;</span> dspam <span style="color: #000000; font-weight: bold;">&lt;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>doc<span style="color: #000000; font-weight: bold;">/</span>libdspam7-drv-mysql<span style="color: #000000; font-weight: bold;">/</span>sql<span style="color: #000000; font-weight: bold;">/</span>virtual_user_aliases.sql</pre></div></div>

<p>aus. Jetzt passen wir die Datei /etc/dspam/dspam.d/mysql.conf so an, dass wir virtuelle Benutzer nutzen und die Verbindung von dspam zu MySQL über einen Unix-Socket hergestellt wird (Passwort &#8211; hier donotchange &#8211; unbedingt so lassen, wie es voreingestellt ist). Mit der Option MySQLUIDInSignature legen wir fest, dass in der DSPAM-Signatur der Benutzer gespeichert wird, für den die Spam-Klassifizierung durchgeführt wurde, so dass zwei serverweite Mail-Adressen (hier ham@ und spam@) ausreichen, um die Mail umzuklassifizieren.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">MySQLServer             /var/run/mysqld/mysqld.sock
MySQLUser               dspam
MySQLPass               donotchange
MySQLDb         dspam
MySQLReconnect          true
MySQLVirtualTable               dspam_virtual_uids
MySQLVirtualUIDField            uid
MySQLVirtualUsernameField       username
MySQLUIDInSignature     on</pre></div></div>

<p>Auch die Datei /etc/dspam/dspam.conf muss angepasst werden. Wir legen secmail, der Benutzer, unter dem der Dovecot LDA Mails zustellt und mit dem später dspam von exim aufgerufen wird, als vertrauenswürdigen Benutzer fest und schließen außerdem die Konfigurationsdateien im Verzeichnis /etc/dspam/dspam.d mitein. Zudem soll die dspam-Signatur nur im Header sein, was mit der Preference  signatureLocation eingestellt wird. Die <a href="http://dspamwiki.expass.de/Preferences_Attributes">Bedeutung der einzelnen Preference-Optionen</a> wird im dspam-Wiki erklärt. Der Standardpfad für dspam.pid muss aufgrund von Berechtigungsproblemen korrigiert werden. Wir ergänzen bzw. ändern deshalb folgende Zeilen</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Trust user secmail</span>
Trust secmail
&nbsp;
<span style="color: #666666; font-style: italic;"># Changed to only have MessageIDs in the header</span>
Preference <span style="color: #ff0000;">&quot;signatureLocation=headers&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Change dspam.pid location to</span>
ServerPID               <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>dspam<span style="color: #000000; font-weight: bold;">/</span>dspam.pid
&nbsp;
<span style="color: #666666; font-style: italic;"># dspam only has to work together with the dspam client in our configuration</span>
ServerMode dspam
&nbsp;
<span style="color: #666666; font-style: italic;"># Authetication password required for dspam client</span>
<span style="color: #666666; font-style: italic;"># change secret to something else!!</span>
ServerPass.Relay1      <span style="color: #ff0000;">&quot;secret&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Use local unix socket to minimize overhead</span>
ServerDomainSocketPath <span style="color: #ff0000;">&quot;/tmp/dspam.sock&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Parameters used by dspam client to connect  to the server</span>
<span style="color: #666666; font-style: italic;"># change secret to the password you have chosen above..</span>
ClientHost     <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>dspam.sock
ClientIdent    <span style="color: #ff0000;">&quot;secret@Relay1&quot;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Include config files from /etc/dspam/dspam.d</span>
Include <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>dspam<span style="color: #000000; font-weight: bold;">/</span>dspam.d<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>Als nächstes editieren wir /etc/default/dspam und setzen die Variable START auf YES, damit dspam im Daemon-Mode beim Hochfahren des Systems gestartet wird.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Variables for dspam.</span>
<span style="color: #666666; font-style: italic;">#</span>
<span style="color: #666666; font-style: italic;"># Do start dspam.</span>
<span style="color: #007800;">START</span>=<span style="color: #c20cb9; font-weight: bold;">yes</span></pre></div></div>

<p>Das Startskript für dspam wird angepasst, da dspam nicht automatisch in den Hintergrund geht. Deshalb editieren wir /etc/init.d/dspam und ergänzen die Option &#8211;background. Aus</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">        start-stop-daemon <span style="color: #660033;">--start</span> <span style="color: #660033;">--quiet</span> <span style="color: #660033;">--pidfile</span> <span style="color: #007800;">$PIDFILE</span> <span style="color: #660033;">--chuid</span> <span style="color: #007800;">$USER</span> <span style="color: #660033;">--exec</span> <span style="color: #007800;">$DAEMON</span> <span style="color: #660033;">--</span> <span style="color: #007800;">$DAEMON_ARGS</span> \
        <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">2</span></pre></div></div>

<p>wird somit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">        start-stop-daemon <span style="color: #660033;">--start</span> <span style="color: #660033;">--quiet</span> <span style="color: #660033;">--pidfile</span> <span style="color: #007800;">$PIDFILE</span> <span style="color: #660033;">--chuid</span> <span style="color: #007800;">$USER</span> <span style="color: #660033;">--exec</span> <span style="color: #007800;">$DAEMON</span> <span style="color: #660033;">--background</span> <span style="color: #660033;">--</span> <span style="color: #007800;">$DAEMON_ARGS</span> \
        <span style="color: #000000; font-weight: bold;">||</span> <span style="color: #7a0874; font-weight: bold;">return</span> <span style="color: #000000;">2</span></pre></div></div>

<p>Jetzt fügen wir noch den Benutzer secmail zur Gruppe dspam hinzu, damit es beim Aufruf von exim, der unter dem Nutzer secmail erfolgt, keine Berechtigungsprobleme gibt.</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 secmail dspam</pre></div></div>

<p>Nun können wir dspam im Daemon-Modus testen, indem wir es via</p>

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

<p>aufrufen, um es via Strg-C nach einer Minute beenden. Ob es Probleme gibt, sollte man anhand der Logdateien im Verzeichnis /var/log/dspam und der Syslog verfolgen. Wenn das soweit geklappt hat, starten wir dspam dauerhaft 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> service dspam start</pre></div></div>

<p>Nun prüfen wir das Zusammenspiel von Client und Server und legen gleichzeitig einen Benutzer namens globaluser an. Diesen Benutzer benötigen wir, da dspam beim Reklassifizieren einer Mail die Angabe eines Parameters &#8211;user mit gültigem User verlangt, selbst wenn es eigentlich anhand der dspam-Signatur auf den Benutzer schließen könnte, für den die Mail klassifiziert wurde. <a href="http://www.dovecot.org/list/dovecot/2006-April/012626.html">Ryan Kolak beschreibt dieses Problem ausführlicher</a>, das schon <a href="http://old.nabble.com/antispam---Unable-to-determine-the-destination-user-td20211120.html">häufiger diskutiert</a> wurde und bei dem es sich meiner Meinung nach um einen Bug handelt (Fehlermeldung:  Unable to determine the destination user). Wenn wir den 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> Subject:<span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-u</span> secmail dspam <span style="color: #660033;">--client</span> <span style="color: #660033;">--debug</span> <span style="color: #660033;">--mode</span>=notrain <span style="color: #660033;">--user</span> globaluser <span style="color: #660033;">--deliver</span>=spam,innocent <span style="color: #660033;">--stdout</span></pre></div></div>

<p>ausführen und anschließend die dspam-Statistik 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> dspam_stats</pre></div></div>

<p>abrufen, sollten wir folgendes Ergebnis erhalten</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">globaluser        TP:     <span style="color: #000000;">0</span> TN:     <span style="color: #000000;">1</span> FP:     <span style="color: #000000;">0</span> FN:     <span style="color: #000000;">0</span> SC:     <span style="color: #000000;">0</span> NC:     <span style="color: #000000;">0</span></pre></div></div>

<p>Falls Fehler aufgetreten sind, werden diese in den obigen Logdateien bzw.der Syslog festgehalten. Die Konfiguration von dspam ist nun abgeschlossen. Einen kleinen <a href="http://www.mail-archive.com/dspam-users@lists.nuclearelephant.com/msg00156.html">Tip zu dspam von der dspam-user Mailingliste</a>, möchte ich aber noch loswerden. Mit</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">strings</span> $<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">which</span> dspam<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> build</pre></div></div>

<p>lässt sich feststellen, welche Parameter beim Kompilieren von dspam verwendet wurden. Das kann hilfreich sein, denn bei dspam werden viele Optionen schon beim Kompilieren festgelegt.</p>
<h2>Anpassung der exim-Konfiguration</h2>
<p>Jetzt machen wir uns daran, Exim zu konfigurieren. Hier habe ich mich an der <a href="http://www.rm-f.de/cms/?q=node/80">Anleitung von Robert Fendt</a> und einer <a href="http://www.directadmin.com/forum/showpost.php?p=22430&amp;postcount=2">Dokumentation in einem Forum</a> orientiert. Zunächst fügen wir zu den bestehen Transporten an die lokalen Mailboxen zwei Zeilen hinzu. Der transport_filter leitet die Nachrichten durch den Spamfilter während die headers_remove Zeile dazu führt, dass in der Nachricht vorhandene DSpam-Header entfernt werden, so dass diese Header tatsächlich nur von dspam stammen können. Wir editieren also die beiden Dateien /etc/exim4/conf.d/transport/30_exim4-config_dovecot_delivery_pipe und /etc/exim4/conf.d/transport/30_exim4-config_dovecot_delivery_pipe_secmail und ergänzen die beiden erwähnten Zeilen:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">  driver = pipe
  transport_filter = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>dspam <span style="color: #660033;">--deliver</span>=innocent,spam <span style="color: #660033;">--user</span> <span style="color: #ff0000;">&quot;GET_LOCAL_MAIL&quot;</span> <span style="color: #660033;">--stdout</span>
  headers_remove = X-DSPAM-Result:X-DSPAM-Processed:X-DSPAM-Confidence:X-DSPAM-Probability:X-DSPAM-Signature
  <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></pre></div></div>

<p>Jetzt müssen wir noch die beiden Mail-Adressen spam@myserver und ham@myserver einrichten. Natürlich sollen nur vom Server selbst oder von authentifizierten Benutzern E-Mails an diese Adressen geschickt werden dürfen. In der Datei /etc/exim4/conf.d/main/00_local_macros ergänzen wir deshalb Macros für eine Hostliste und diese beiden E-Mail-Adressen</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># @[] list of all local IPs</span>
<span style="color: #666666; font-style: italic;"># If exim is used localy in batch mode (exim4 -bs) then &quot;$host&quot; is empty, the &quot;: :&quot; adds the empty string.</span>
hostlist own_hosts = <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> : :
&nbsp;
<span style="color: #666666; font-style: italic;"># address for reclassifying/learning false positive spam mails</span>
MAIL_ADDRESS_HAM = ham
&nbsp;
<span style="color: #666666; font-style: italic;"># address for reclassifying/learning undetected spam</span>
MAIL_ADDRESS_SPAM = spam</pre></div></div>

<p>Nun verweigern wir allen nicht authentifizierten Usern von entfernten Hosts das Senden von Mails durch Ergänzung der folgenden Zeilen in der Datei /etc/exim4/conf.d/acl/30_exim4-config_check_rcpt (bitte unbedingt nach der Stelle mit accept authenticated=*)</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Accept if the message arrived over an authenticated connection, from</span>
<span style="color: #666666; font-style: italic;"># any host. Again, these messages are usually from MUAs, so recipient</span>
<span style="color: #666666; font-style: italic;"># verification is omitted, and submission mode is set. And again, we do this</span>
<span style="color: #666666; font-style: italic;"># check before any black list tests.</span>
accept
  authenticated = <span style="color: #000000; font-weight: bold;">*</span>
  <span style="color: #666666; font-style: italic;"># Nur unter der Bedingung, dass der Absender ein valider, entfernter User in LDAP</span>
  <span style="color: #666666; font-style: italic;"># ist Empfänger bedingungslos akzeptieren</span>
  condition = IS_SENDER_REMOTE
  <span style="color: #666666; font-style: italic;">#control = submission/sender_retain</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Deny all unauthenticated remote hosts to send mail to</span>
<span style="color: #666666; font-style: italic;"># spam or ham email addresses</span>
deny
  hosts = <span style="color: #000000; font-weight: bold;">!</span>+own_hosts
  local_parts = MAIL_ADDRESS_HAM : MAIL_ADDRESS_SPAM</pre></div></div>

<p>Jetzt brauchen wir nur noch einen Router und einen Transporter für das Lernen von Spam bzw. Ham. Den Router erzeugen wir durch die Datei /etc/exim4/conf.d/router/410_exim4-config_spam_classification 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;">################################################</span>
<span style="color: #666666; font-style: italic;">### router/410_exim4-config_spam_classification</span>
<span style="color: #666666; font-style: italic;">################################################</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># This router matches the local spam and ham mailboxes</span>
<span style="color: #666666; font-style: italic;"># which are used to train the spam filter with false</span>
<span style="color: #666666; font-style: italic;"># spam positives or unrecognized spam.</span>
&nbsp;
router_spam_training:
  debug_print = <span style="color: #ff0000;">&quot;R: spam training issued by mail from <span style="color: #007800;">$sender_address</span>@<span style="color: #007800;">$sender_address_domain</span> to <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&quot;</span>
  driver = accept
  domains = +local_domains
  local_parts = MAIL_ADDRESS_HAM : MAIL_ADDRESS_SPAM
  transport = transport_spam_training
&nbsp;
<span style="color: #666666; font-style: italic;">################################################</span>
<span style="color: #666666; font-style: italic;">### router/410_exim4-config_spam_classification</span>
<span style="color: #666666; font-style: italic;">################################################</span></pre></div></div>

<p>Den Transporter erstellen wir analog durch die Datei /etc/exim4/conf.d/transport/30_exim4-config_transport_spam_training 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;">#####################################################</span>
<span style="color: #666666; font-style: italic;">### transport/30_exim4-config_transport_spam_training</span>
<span style="color: #666666; font-style: italic;">#####################################################</span>
&nbsp;
transport_spam_training:
  debug_print = <span style="color: #ff0000;">&quot;T: spam training issued by mail from <span style="color: #007800;">$sender_address</span>@<span style="color: #007800;">$sender_address_domain</span> to <span style="color: #007800;">$local_part</span>@<span style="color: #007800;">$domain</span>&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>bin<span style="color: #000000; font-weight: bold;">/</span>dspam <span style="color: #ff0000;">&quot;<span style="color: #007800;">${if eq{$local_part}</span>{MAIL_ADDRESS_HAM} {--class=innocent}{--class=spam}}&quot;</span> <span style="color: #660033;">--source</span>=error <span style="color: #660033;">--delivery</span>=stdout <span style="color: #660033;">--user</span> globaluser
  message_prefix =
  message_suffix =
  <span style="color: #666666; font-style: italic;"># Do not add additional Headers</span>
  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;
<span style="color: #666666; font-style: italic;">#####################################################</span>
<span style="color: #666666; font-style: italic;">### transport/30_exim4-config_transport_spam_training</span>
<span style="color: #666666; font-style: italic;">#####################################################</span></pre></div></div>

<p>Was mich lange aufgehalten hat, waren die String-Expansions in der command Angabe. Hier kommt es darauf an, die Anführungszeichen zu setzen, wie es sowohl in der <a href="http://wiki.exim.org/FAQ/General_Debugging/Q0025">FAQ</a> als auch in der <a href="http://exim.org/exim-html-4.71/doc/html/spec_html/ch29.html#SECThowcommandrun">Dokumentation von command</a> und unter anderem auch bei der von <a href="http://www.exim.org/exim-html-4.71/doc/html/spec_html/ch24.html#id603010">transport_filter</a> erwähnt wird. Der Grund, warum hier für dspam nicht der Parameter &#8211;stdout, sondern &#8211;delivery=stdout gewählt wurde, liegt darin, dass ansonsten teilweise die Fehlermeldung &#8220;Client exited with error -5&#8243; auftaucht. <a href="http://marc.info/?l=dspam-users&amp;m=120836028609994&amp;w=2">Dieser Hinweis zur Fehlerbehebung stammt übrigens von der dspam-users Mailinglist</a>. Abschließend wird die Konfigurationsdatei erzeugt und Exim neu gestartet 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> 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>Nun kann man 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> Subject:<span style="color: #7a0874; font-weight: bold;">test</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #660033;">-u</span> secmail dspam <span style="color: #660033;">--client</span> <span style="color: #660033;">--debug</span> <span style="color: #660033;">--mode</span>=notrain <span style="color: #660033;">--user</span> globaluser <span style="color: #660033;">--deliver</span>=spam,innocent <span style="color: #660033;">--stdout</span> <span style="color: #000000; font-weight: bold;">|</span> mail <span style="color: #660033;">-s</span> <span style="color: #ff0000;">&quot;Reclassify&quot;</span> spam</pre></div></div>

<p>testen, ob die Konfiguration funktioniert. Ein erneutes</p>

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

<p>sollte dann dieses Ergebnis</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">globaluser        TP:     <span style="color: #000000;">0</span> TN:     <span style="color: #000000;">1</span> FP:     <span style="color: #000000;">0</span> FN:     <span style="color: #000000;">1</span> SC:     <span style="color: #000000;">0</span> NC:     <span style="color: #000000;">0</span></pre></div></div>

<p>ausgeben.</p>
<h2>Einrichtung des dovecot-antispam Plugins</h2>
<p>Im nächsten Schritt konfigurieren wir das dovecot-antispam plugin. Bei diesem Plugin wird <span style="text-decoration: underline;">beim Kompilieren</span> festgelegt, welches Backend (dspam-exec, mailtrain oder crm114-exec) verwendet werden soll. Wenn man die Paket-Version von Debian/Ubuntu verwendet, ist man deshalb automatisch auf das mailtrain-Backend festgelegt. Dies kann man zwar erst der <a href="http://packages.ubuntu.com/lucid/utils/dovecot-antispam">Beschreibung des Pakets in Lucid Lynx</a> lesen, trifft aber auch auf vorherige Versionen zu. Passen wir also jetzt die Konfigurationsdatei unter /etc/dovecot/dovecot.conf an. Wir aktivieren das antispam-Plugin im Imap-Abschnitt folgendermaßen</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">protocol imap <span style="color: #7a0874; font-weight: bold;">&#123;</span>
  mail_plugins = antispam
  <span style="color: #666666; font-style: italic;"># mail_plugin_dir = /usr/lib/dovecot/modules/imap</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>anschließend ergänzen wir den plugin-Abschnitt um die Konfigurationsparameter für dovecot-antispam. Dabei sind unter Umständen die Ordnerbezeichnungen für den Papierkorb und Spam anzupassen.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">plugin <span style="color: #7a0874; font-weight: bold;">&#123;</span>
 <span style="color: #666666; font-style: italic;">##################</span>
 <span style="color: #666666; font-style: italic;"># DSPAM</span>
 <span style="color: #666666; font-style: italic;"># GENERIC OPTIONS</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># mail signature (used with any backend requiring a signature)</span>
 antispam_signature = X-DSPAM-Signature
&nbsp;
 <span style="color: #666666; font-style: italic;"># action to take on mails without signature</span>
 <span style="color: #666666; font-style: italic;"># (used with any backend requiring a signature)</span>
 <span style="color: #666666; font-style: italic;"># (we recommend only setting this to 'move' after verifying that the</span>
 <span style="color: #666666; font-style: italic;"># whole setup is working)</span>
 <span style="color: #666666; font-style: italic;"># antispam_signature_missing = move # move silently without training</span>
 antispam_signature_missing = move
&nbsp;
 <span style="color: #666666; font-style: italic;"># semicolon-separated list of Trash folders (default unset i.e. none)</span>
 <span style="color: #666666; font-style: italic;"># antispam_trash =</span>
 antispam_trash = trash;Trash;Deleted Items
&nbsp;
 <span style="color: #666666; font-style: italic;"># semicolon-separated list of spam folders</span>
 antispam_spam = SPAM;Spam;spam
&nbsp;
 <span style="color: #666666; font-style: italic;"># semicolon-separated list of unsure folders (default unset i.e. none)</span>
 <span style="color: #666666; font-style: italic;"># antispam_unsure =</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># Whether to allow APPENDing to SPAM folders or not. Must be set to</span>
 <span style="color: #666666; font-style: italic;"># &quot;yes&quot; (case insensitive) to be activated. Before activating, please</span>
 <span style="color: #666666; font-style: italic;"># read the discussion below.</span>
 <span style="color: #666666; font-style: italic;"># antispam_allow_append_to_spam = no</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">###########################</span>
 <span style="color: #666666; font-style: italic;"># BACKEND SPECIFIC OPTIONS</span>
 <span style="color: #666666; font-style: italic;"># please note: the backend has to be specified at compile time</span>
 <span style="color: #666666; font-style: italic;"># the backend used in the Debian/Ubuntu standard package is mailtrain</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">#===================</span>
 <span style="color: #666666; font-style: italic;"># dspam-exec plugin</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># dspam binary</span>
 antispam_dspam_binary = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>dspam
&nbsp;
 <span style="color: #666666; font-style: italic;"># semicolon-separated list of extra arguments to dspam</span>
 <span style="color: #666666; font-style: italic;"># (default unset i.e. none)</span>
 <span style="color: #666666; font-style: italic;"># antispam_dspam_args =</span>
 <span style="color: #666666; font-style: italic;"># antispam_dspam_args = --deliver=;--user;%u  # % expansion done by dovecot</span>
 <span style="color: #666666; font-style: italic;"># antispam_dspam_args = --mode=teft</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># Ignore mails where the DSPAM result header contains any of the</span>
 <span style="color: #666666; font-style: italic;"># strings listed in the blacklist</span>
 <span style="color: #666666; font-style: italic;"># (default unset i.e. none)</span>
 <span style="color: #666666; font-style: italic;"># antispam_dspam_result_header = X-DSPAM-Result</span>
 <span style="color: #666666; font-style: italic;"># semicolon-separated list of blacklisted results, case insensitive</span>
 <span style="color: #666666; font-style: italic;"># antispam_dspam_result_blacklist = Virus</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">#=====================</span>
 <span style="color: #666666; font-style: italic;"># mail sending plugin</span>
 <span style="color: #666666; font-style: italic;">#</span>
 <span style="color: #666666; font-style: italic;"># Because of the way this plugin works, you can also use it</span>
 <span style="color: #666666; font-style: italic;"># to train via an arbitrary program that receives the message</span>
 <span style="color: #666666; font-style: italic;"># on standard input, in that case you can use the config</span>
 <span style="color: #666666; font-style: italic;"># options antispam_mail_spam and antispam_mail_notspam for</span>
 <span style="color: #666666; font-style: italic;"># the argument that distinguishes between ham and spam.</span>
 <span style="color: #666666; font-style: italic;"># For example:</span>
 <span style="color: #666666; font-style: italic;">#   antispam_mail_sendmail = /path/to/mailtrain</span>
 <span style="color: #666666; font-style: italic;">#   antispam_mail_sendmail_args = --for;%u</span>
 <span style="color: #666666; font-style: italic;">#   antispam_mail_spam = --spam</span>
 <span style="color: #666666; font-style: italic;">#   antispam_mail_notspam = --ham</span>
 <span style="color: #666666; font-style: italic;"># will call it, for example, like this:</span>
 <span style="color: #666666; font-style: italic;">#   /path/to/mailtrain --for jberg --spam</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># temporary directory</span>
 antispam_mail_tmpdir = <span style="color: #000000; font-weight: bold;">/</span>tmp
&nbsp;
 <span style="color: #666666; font-style: italic;"># spam/not-spam addresses (default unset which will give errors)</span>
 antispam_mail_spam = spam
 antispam_mail_notspam = ham
&nbsp;
 <span style="color: #666666; font-style: italic;"># sendmail binary</span>
 antispam_mail_sendmail = <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>sbin<span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">sendmail</span>
 <span style="color: #666666; font-style: italic;">#antispam_mail_sendmail_args = -f;%u@example.com # % expansion done by dovecot</span>
&nbsp;
 <span style="color: #666666; font-style: italic;">#===================</span>
 <span style="color: #666666; font-style: italic;"># crm114-exec plugin</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># mailreaver binary</span>
 antispam_crm_binary = <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: #666666; font-style: italic;"># antispam_crm_binary = /usr/share/crm114/mailreaver.crm</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># semicolon-separated list of extra arguments to dspam</span>
 <span style="color: #666666; font-style: italic;"># (default unset i.e. none)</span>
 <span style="color: #666666; font-style: italic;"># antispam_crm_args =</span>
 <span style="color: #666666; font-style: italic;"># antispam_crm_args = --config=/path/to/config</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># NOTE: you need to set the signature for this backend</span>
 antispam_signature = X-CRM114-CacheID
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<h2>Sieve zum automatischen Verschieben der Spamnachrichten</h2>
<p>Das Einzige, was jetzt noch fehlt, ist die Einrichtung des Sieve-Filters durch den die Spam-Nachrichten direkt in den Spam-Ordner verschoben und als gelesen markiert werden. Auch hier bitte ggfs. den Namen des Spamordners anpassen.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">require <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #ff0000;">&quot;fileinto&quot;</span>,<span style="color: #ff0000;">&quot;imapflags&quot;</span><span style="color: #7a0874; font-weight: bold;">&#93;</span>;
&nbsp;
<span style="color: #666666; font-style: italic;"># Spam</span>
<span style="color: #666666; font-style: italic;"># Catch mail tagged as spam, except spam retrained and delivered to the mailbox</span>
<span style="color: #000000; font-weight: bold;">if</span> allof<span style="color: #7a0874; font-weight: bold;">&#40;</span>header :contains <span style="color: #ff0000;">&quot;X-DSPAM-Result&quot;</span> <span style="color: #ff0000;">&quot;Spam&quot;</span>,
 not header :contains <span style="color: #ff0000;">&quot;X-DSPAM-Reclassified&quot;</span> <span style="color: #ff0000;">&quot;Innocent&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
&nbsp;
 <span style="color: #666666; font-style: italic;"># Mark as read</span>
 setflag <span style="color: #ff0000;">&quot;\\Seen&quot;</span>;
&nbsp;
 <span style="color: #666666; font-style: italic;"># Move into the Junk folder</span>
 fileinto <span style="color: #ff0000;">&quot;Spam&quot;</span>;
&nbsp;
 <span style="color: #666666; font-style: italic;"># Stop processing here</span>
 stop;
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># The rest goes into INBOX</span>
<span style="color: #666666; font-style: italic;"># default is &quot;implicit keep&quot;, we do it explicitly here</span>
keep;</pre></div></div>

<p>So, damit ist der Spamfilter fertig eingerichtet. Was jetzt noch fehlt, ist das Webinterface für dspam (das Binär-Paket dafür haben wir aber schon erzeugt) und der Webmail-Zugriff mit Roundcube. Fortsetzung folgt..</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2010/02/20/dovecot-exim-openldap-und-getmail-unter-ubuntu-%e2%80%93-5-dspam/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Kleine Helferlein im Alltag</title>
		<link>http://www.effinger.org/blog/2009/12/30/kleine-helferlein-im-alltag/</link>
		<comments>http://www.effinger.org/blog/2009/12/30/kleine-helferlein-im-alltag/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 14:31:22 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Thunderbird]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=266</guid>
		<description><![CDATA[<p>In diesem Artikel möchte ich das Augenmerk auf ein paar kleine Programme lenken, die einem das Leben einfacher machen können &#8211; eben kleine Helferlein im Alltag.</p>
<p>Helferlein unter Ubuntu</p>

Glipper der Manager der Zwischenablage unter Gnome hat auch einen Fan unter ubuntu.wordpress.com. Installation mit

sudo apt-get install glipper

Shutter (vormals GScrot) ein Screenshot-Programm mit deutlich größerem Funktionsumfang als gnome-screenshot [...]]]></description>
			<content:encoded><![CDATA[<p>In diesem Artikel möchte ich das Augenmerk auf ein paar kleine Programme lenken, die einem das Leben einfacher machen können &#8211; eben kleine Helferlein im Alltag.</p>
<p><strong>Helferlein unter Ubuntu</strong></p>
<ul>
<li><a href="http://glipper.sourceforge.net/">Glipper</a> der Manager der Zwischenablage unter Gnome hat auch einen <a href="http://embraceubuntu.com/2006/12/12/cut-copy-paste-clipboard-management/">Fan unter ubuntu.wordpress.com</a>. Installation mit</li>

<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> glipper</pre></div></div>

<li><a href="https://launchpad.net/shutter/">Shutter</a> (vormals GScrot) ein Screenshot-Programm mit deutlich größerem Funktionsumfang als gnome-screenshot und <a href="http://wiki.ubuntuusers.de/Shutter">ausführlicher Anleitung auf ubuntuusers.de</a></li>
<li><a href="http://gftp.seul.org/">gFTP</a>, ein grafischer FTP-Client, der sich einfach via

<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> gftp</pre></div></div>

<p>installieren lässt.</li>
<li><a href="http://sshmenu.sourceforge.net">SSH-Menu</a> &#8211; mit einem Klick zum gewünschten Server verbinden. Installation mit

<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> sshmenu-gnome</pre></div></div>

</li>
<li>Mit <strong>rename</strong> kann man Dateien anhand von regulären Ausdrücken umbenennen. Das Programm ist unter Ubuntu standardmäßig vorinstalliert. <a href="http://tips.webdesign10.com/how-to-bulk-rename-files-in-linux-in-the-terminal">Eine Anleitung gibt es im Webmaster Tips Blog</a></li>
<li>Mit <a href="http://gnochm.sourceforge.net">gnochm</a>, kann man Windows-Hilfe Dateien (chm-Dateien) lesen. Dieses Format wird leider nach wie vor aus unerklärlichen Gründen für Ebooks eingesetzt.  Eine Alternative ist <a href="http://xchm.sourceforge.net/">xchm</a>.</li>
<li><a href="http://www.effinger.org/blog/2008/10/09/encspot-fur-linux/">Encspot</a> stellt bei MP3-Dateien fest, welcher Encoder verwendet wurde, so dass man hierdurch auch auf die Qualität der Umwandlung schließen kann.</li>
<li><a href="http://linuxundich.de/de/ubuntu/zweispaltige-ansicht-fur-nautilus/">Nautilus in der zweispaltigen Variante</a>. Vielen Dank an Christoph für den Tip! Außerdem ist es hilfreich mit

<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> nautilus-open-terminal</pre></div></div>

<p>die Erweiterung <strong>nautilus-open-terminal</strong> zu installieren, mit der man direkt aus Nautilus ein Terminalfenster im aktuellen Ordner öffnen kann.</li>
<li><a href="http://www.tipp10.de/">Tipp10</a>, ein Programm, mit dem man Maschinenschreiben lernen kann. Ein Ubuntu-Paket ist auf <a href="http://www.tipp10.de/">http://www.tipp10.de/</a> vorhanden.</li>
<li>Mit <a href="http://www.gcstar.org/">GCStar</a> lassen sich alle Möglichen Arten von Sammlungen verwalten, unter anderem CDs, Filme, Bücher. Unter Windows war ich ein Fan von WhereIsIt als der Festplattenspeicher teuer und die CDs billig waren. GCStar steht WhereIsIt in fast nichts nach. Miit 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;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> gcstar</pre></div></div>

<p>lässt es sich installieren und die Plugins, die sich Informationen aus verschiedenen Webseiten zusammensuchen, kann man durch</p>

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

<p>auf den letzten Stand bringen (der <a href="http://oshelpdesk.org/?p=44">Anleitung von oshelpdesk.org</a> entnommen).</li>
<li>Mit <strong>at</strong>, einem Kommandozeilentool, das cron ähnelt, lassen sich auch viele nette Dinge anstellen, wie ein <a href="http://marmaro.de/docs/at-freiesMagazin.pdf">Artikel im Freien Magazin</a> beweist.</li>
<li>Das Progamm unclutter verbirgt den Mauszeiger bei Inaktivität, was besonders nützlich ist, wenn man <a href="http://www.zattoo.com">Zattoo</a> schaut. Es lässt sich mittels

<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> unclutter</pre></div></div>

<p>installieren. Bei ubuntu-tutorials.com gibt es <a href="http://ubuntu-tutorials.com/2008/07/07/auto-hide-your-mouse-pointer-when-idle-with-unclutter/">weitere Informationen zur Einrichtung von unclutter</a>.</li>
</ul>
<p><a href="https://addons.mozilla.org/de/thunderbird/"><strong>Thunderbird Add-ons</strong></a> (laufen alle bis auf Lightning 0.9 mit Thunderbird 3.0)</p>
<ul>
<li><a href="http://nic-nac-project.de/~kaosmos/changequote-en.html">Change quote and reply format</a> erlaubt es, beim Antworten auf eine Mail, den Antwortkopf anzupassen also statt &#8220;xyz schrieb:&#8221; kann man folgendes Format festlegen:<br />
&#8212;&#8212;&#8211; Original-Nachricht &#8212;&#8212;&#8211;<br />
Betreff: XYZ<br />
Von: keine@mail.nix<br />
An: meine@email.nix<br />
Datum: 11.11.2009 11:11</li>
</ul>
<ul>
<li>Mit <a href="https://addons.mozilla.org/en-US/thunderbird/addon/2561">Copy Sent To Current</a> kann man direkt beim Schreiben der Mails auswählen, in welchen Ordner die Nachricht beim Versenden abgelegt werden soll.</li>
<li>Das <a href="http://www.thunderbird-mail.de/wiki/W%C3%B6rterb%C3%BCcher">deutsche Wörterbuch von thunderbird-mail.de</a></li>
<li><a href="https://addons.mozilla.org/de/thunderbird/addon/71">Enigmail</a> zum Verschlüsseln von E-Mails, sogar mit <a href="http://enigmail.mozdev.org/documentation/Enigmail_Handbook_1.0.0.pdf">Handbuch</a>.</li>
<li><a href="https://addons.mozilla.org/de/thunderbird/addon/2831">MinimizeToTray Plus</a>, damit der Bildschirmplatz durch Thunderbird nur minimal kleiner wird.</li>
<li><a href="https://addons.mozilla.org/de/thunderbird/addon/170">Quote Colors</a> hebt in verschachtelten Mails und News-Nachrichten die Ausführungen unterschiedlichen Autoren farblich hervor (wichtig, für alle, die den Überblick bei den ganzen &#8220;&gt;&gt;&#8221; &#8220;&gt;&gt;&gt;&#8221; usw. behalten wollen)</li>
<li><a href="https://addons.mozilla.org/de/thunderbird/addon/2548">Sieve</a>, ein super Plugin um die ganzen Sieve-Mailregeln auf dem Server zu verwalten. Prüft sogar den Syntax und funktioniert wunderbar mit meinem Dovecot-Setup zusammen.</li>
<li><a href="http://www.mozilla.org/projects/calendar/lightning/">Lightning</a> um Termine zu verwalten (wenn es doch nur eine Stable-Version für Thunderbird 3.0 geben würde).</li>
</ul>
<p><a href="https://addons.mozilla.org/de/firefox/"><strong>Firefox Add-ons</strong></a></p>
<ul>
<li><a href="http://adblockplus.org/de/">Adblock Plus</a>, damit Werbung der Vergangenheit angehört</li>
<li>Mit <a href="https://addons.mozilla.org/de/firefox/addon/743">CustomizeGoogle</a> kann man viele Optionen zur Google-Suche einstellen und der Datensammelwut wenigstens etwas Einhalt gebieten.</li>
<li><a href="http://getfirebug.com/">Firebug</a> hilft vor allem Webentwicklern beim Debuggen von JavaScript.</li>
<li><a href="https://addons.mozilla.org/de/firefox/addon/748">Greasemonkey</a> damit man Webseiten aufpeppen und modifizieren kann. In Kombination mit <a href="http://userscripts.org">http://userscripts.org</a> unschlagbar.</li>
<li><a href="https://addons.mozilla.org/de/firefox/addon/9808">StartupMaster</a> umgeht einen <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=499233">lästigen Bug von Firefox</a>, welches beim Starten sonst sehr oft das Master-Passwort abfragt. Wirklich schade, dass ein solcher nervenaufreibender Bug, der seit 2008 bekannt ist, immer noch nicht gefixt wurde.</li>
<li><a href="https://addons.mozilla.org/de/firefox/addon/1122">Tab Mix Plus</a>, mein Lieblingsmanager für Tabs mit einer sehr guten Sitzungsverwaltung.</li>
<li>Mit <a href="http://userchromejs.mozdev.org/">userChromeJS</a> kann man unter anderem <a href="http://www.effinger.org/blog/2008/10/23/erweiterte-menueintrage-in-firefox-mit-userchromjs/">die Menüs für Firefox anpassen</a>, was ich ja schon beschrieben hatte.</li>
<li><a href="http://www.zotero.org">Zotero</a> habe ich zum ersten Mal bei meiner Diplomarbeit als Literaturverwaltungsprogramm genutzt. Es eignet sich aber auch prima, um wichtige Webseiten zu archivieren, z.B. AGBs &amp; Co bei Online-Bestellungen.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2009/12/30/kleine-helferlein-im-alltag/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
