<?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, 21 Feb 2010 17:21:31 +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>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>
		<item>
		<title>HTML Entities von der Shell aus in Text umwandeln</title>
		<link>http://www.effinger.org/blog/2009/12/30/html-entities-von-der-shell-aus-in-text-umwandeln/</link>
		<comments>http://www.effinger.org/blog/2009/12/30/html-entities-von-der-shell-aus-in-text-umwandeln/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 10:59:17 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Shell]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=829</guid>
		<description><![CDATA[<p>Bislang hatte ich noch kein Pogramm gesehen, bei dem man auf der Kommandozeile einfach HTML Entitäten, wie &#38;gt; oder &#38;amp; in den normalen Zeichensatz zurückkonvertieren kann. Sicher, es gibt dafür eine PHP-Funktion und bestimmt auch eine entsprechende Perl-Funktion, aber warum nicht etwas einfacheres nutzen..</p>

sudo apt-get install recode
recode HTML.. &#60; file.html &#62; file.txt

<p>Recode kann übrigens noch [...]]]></description>
			<content:encoded><![CDATA[<p>Bislang hatte ich noch kein Pogramm gesehen, bei dem man auf der Kommandozeile einfach HTML Entitäten, wie &amp;gt; oder &amp;amp; in den normalen Zeichensatz zurückkonvertieren kann. Sicher, es gibt dafür eine PHP-Funktion und bestimmt auch eine entsprechende Perl-Funktion, aber warum nicht etwas einfacheres nutzen..</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> recode
recode HTML.. <span style="color: #000000; font-weight: bold;">&lt;</span> file.html <span style="color: #000000; font-weight: bold;">&gt;</span> file.txt</pre></div></div>

<p>Recode kann übrigens noch mehr, z.B. die Zeilenumbrüche vom Linux-Format zu Windows konvertieren. Eine <a href="http://www.linux.co.uk/docs/center/manual/debian-reference/debian-tips/nifty-little-commands-to-remember/convert-a-text-file-with-recode">kleine Beispielsammlung gibt es bei linux.co.uk</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2009/12/30/html-entities-von-der-shell-aus-in-text-umwandeln/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WP-Syntax Editor Integration Plugin &#8211; WP-Syntax im WordPress Editor nutzen</title>
		<link>http://www.effinger.org/blog/2009/12/30/wp-syntax-editor-integration-plugin-wp-syntax-im-wordpress-editor-nutzen/</link>
		<comments>http://www.effinger.org/blog/2009/12/30/wp-syntax-editor-integration-plugin-wp-syntax-im-wordpress-editor-nutzen/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 10:11:45 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WP-Syntax]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=767</guid>
		<description><![CDATA[<p>Um komfortabel mit WP-Syntax im Wordpress-Editor zu arbeiten, habe ich ein Plugin geschrieben, welches jeweils einen Button im visuellen Editor (TinyMCE) und im HTML-Editor hinzufügt. Zuvor hatte ich immer die quicktag.php editiert, was aber auf Dauer sehr mühsam war, da man dies bei jedem Wordpress Update machen musste. Das Plugin ist ab sofort auf wordpress.org [...]]]></description>
			<content:encoded><![CDATA[<p>Um komfortabel mit WP-Syntax im Wordpress-Editor zu arbeiten, habe ich ein Plugin geschrieben, welches jeweils einen Button im visuellen Editor (TinyMCE) und im HTML-Editor hinzufügt. Zuvor hatte ich immer <a href="http://www.effinger.org/blog/2008/12/06/wordpress-syntax-highlighting-mit-wp-syntax/">die quicktag.php editiert</a>, was aber auf Dauer sehr mühsam war, da man dies bei jedem Wordpress Update machen musste. Das Plugin ist ab sofort auf wordpress.org unter <a href="http://wordpress.org/extend/plugins/wp-syntax-integration/">http://wordpress.org/extend/plugins/wp-syntax-integration/</a> verfügbar.</p>
<p>Nutzen kann man das Plugin im <strong>visuellen Modus</strong> folgendermaßen:</p>
<ol>
<li>Den zu hervorhebenden Code schreiben bzw. einfügen</li>
<li>Den Code markieren<br />
<a href="http://www.effinger.org/blog/wp-content/uploads/2009/12/SS-20091229161027.png"><img class="aligncenter size-full wp-image-879" title="Selected text" src="http://www.effinger.org/blog/wp-content/uploads/2009/12/SS-20091229161027.png" alt="" width="158" height="22" /></a></li>
<li>Auf den Button &#8220;Enclose with pre-block of WP-Syntax&#8221; klicken (im Screenshot rot markiert)<a href="http://www.effinger.org/blog/wp-content/uploads/2009/12/button_red.png"><img class="aligncenter size-full wp-image-872" title="Screenshot Button &quot;Enclose with pre-block of WP-Syntax&quot;" src="http://www.effinger.org/blog/wp-content/uploads/2009/12/button_red.png" alt="" width="767" height="69" /></a></li>
<li>Programmiersprache eingeben. Falls Zeilennummerierung gewünscht ist, durch ein Komma getrennt, die erste Zeilennummer ergänzen<br />
<a href="http://www.effinger.org/blog/wp-content/uploads/2009/12/Die_Seite_mit_der_Adresse_httpwww.effinger.org_meldet-20091229161212.png"><img class="aligncenter size-full wp-image-880" title="Screenshot von der Eingabe der Programmiersprache und der Zeilennummer" src="http://www.effinger.org/blog/wp-content/uploads/2009/12/Die_Seite_mit_der_Adresse_httpwww.effinger.org_meldet-20091229161212.png" alt="" width="326" height="145" /></a></li>
<li>OK klicken und fertig!</li>
</ol>
<p><strong>Wichtig:</strong> Bei der Eingabe im visuellen Modus werden HTML-Tags entfernt, die von TinyMCE nicht erlaubt werden. Dieses Verhalten lässt sich umgehen, wenn man HTML-Tags nicht im visuellen Modus sondern im HTML-Modus eingibt.</p>
<p>Das Plugin lässt sich auch im <strong>HTML-Modus</strong> nutzen. Die Vorgehensweise ist prinzipiell gleich:</p>
<ol>
<li>Den zu hervorhebenden Code schreiben bzw. einfügen</li>
<li>Den Code markieren<br />
<a href="http://www.effinger.org/blog/wp-content/uploads/2009/12/SS-20091229161027.png"><img title="Selected text" src="http://www.effinger.org/blog/wp-content/uploads/2009/12/SS-20091229161027.png" alt="" width="158" height="22" /></a></li>
<li>Auf den Button &#8220;pre (WP-Syntax)&#8221; klicken (im Screenshot rot markiert)<br />
<a href="http://www.effinger.org/blog/wp-content/uploads/2009/12/button_red_html.png"><img class="aligncenter size-full wp-image-881" title="Screenshot Button &quot;pre (WP-Syntax)&quot;" src="http://www.effinger.org/blog/wp-content/uploads/2009/12/button_red_html.png" alt="" width="769" height="60" /></a></li>
<li>Programmiersprache eingeben. Falls Zeilennummerierung gewünscht ist, durch ein Komma getrennt, die erste Zeilennummer ergänzen<br />
<a href="http://www.effinger.org/blog/wp-content/uploads/2009/12/Die_Seite_mit_der_Adresse_httpwww.effinger.org_meldet-20091229161212.png"><img title="Screenshot von der Eingabe der Programmiersprache und der Zeilennummer" src="http://www.effinger.org/blog/wp-content/uploads/2009/12/Die_Seite_mit_der_Adresse_httpwww.effinger.org_meldet-20091229161212.png" alt="" width="326" height="145" /></a></li>
<li>OK klicken und fertig!</li>
</ol>
<p>Ein herzliches Dankeschön an die Programmierer der folgenden Extensions bzw. deren Erläuterungen, die mir sehr weitergeholfen haben:</p>
<ul>
<li><a href="http://ctx2002.wordpress.com/2008/07/28/how-to-write-a-tinymce-plugin-for-wordpress/">How to write a TinyMCE plugin for Wordpress</a></li>
<li><a href="http://www.engfers.com/plugins/tinymce-valid-elements/">TinyMCE Valid Elements</a></li>
<li><a href="http://wiki.moxiecode.com/index.php/TinyMCE:Commands">TinyMCE Commands</a></li>
<li><a href="http://36flavours.com/2009/09/using-wp-syntax-and-the-visual-editor/">Using WP-Syntax and the visual editor</a></li>
<li><a href="http://granades.com/2007/02/14/adding-quicktags-to-wordpress/">Adding Quicktags to WordPress</a></li>
<li><a href="http://wordpress.org/extend/plugins/davids-ultra-quicktags/">David&#8217;s Ultra Quicktags</a></li>
<li><a href="http://scribu.net/wordpress/right-way-to-add-custom-quicktags.html">The right way to add custom quicktags</a></li>
<li><a href="http://website-in-a-weekend.net/extending-wordpress/diy-wordpress-unraveling-quicktags-wordpress-plugins/">Unraveling Quicktags for WordPress Plugins</a></li>
<li><a href="http://bytes.com/topic/javascript/answers/163382-need-escape-html-chracters-js#post630671">Escape HTML characters in JavaScript</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2009/12/30/wp-syntax-editor-integration-plugin-wp-syntax-im-wordpress-editor-nutzen/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Berechtigungen nach Einspielen eines Backups anpassen</title>
		<link>http://www.effinger.org/blog/2009/12/11/berechtigungen-nach-einspielen-eines-backups-anpassen/</link>
		<comments>http://www.effinger.org/blog/2009/12/11/berechtigungen-nach-einspielen-eines-backups-anpassen/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 17:03:55 +0000</pubDate>
		<dc:creator>Markus Effinger</dc:creator>
				<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[Backup]]></category>

		<guid isPermaLink="false">http://www.effinger.org/blog/?p=840</guid>
		<description><![CDATA[<p>Das Erscheinen von Ubuntu Karmic Koala habe ich zum Anlass genommen, meinen Rechner komplett neu aufzusetzen, um Balast loszuwerden. Dabei habe ich natürlich vorher ein Backup gemacht, um später wieder auf meine alten Daten und Konfigurationsdateien zugreifen zu können. Doch leider reicht es nicht, die Dateien mit cp oder rsync an die entsprechende Stelle im [...]]]></description>
			<content:encoded><![CDATA[<p>Das Erscheinen von Ubuntu Karmic Koala habe ich zum Anlass genommen, meinen Rechner komplett neu aufzusetzen, um Balast loszuwerden. Dabei habe ich natürlich vorher ein Backup gemacht, um später wieder auf meine alten Daten und Konfigurationsdateien zugreifen zu können. Doch leider reicht es nicht, die Dateien mit cp oder rsync an die entsprechende Stelle im System zu kopieren, denn oft stimmen die User- und GruppenIDs im neuen System nicht mit dem alten überein, so dass man sie anpassen muss. Folgende Befehle ändern die alte UserID 118 in die neue UserID 114 bzw. die alte GroupID 130 in 122 ab:</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;">chown</span> <span style="color: #660033;">-R</span> <span style="color: #660033;">--from</span>=<span style="color: #000000;">118</span> <span style="color: #000000;">114</span> <span style="color: #000000; font-weight: bold;">*</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chown</span> <span style="color: #660033;">-R</span> <span style="color: #660033;">--from</span>=:<span style="color: #000000;">130</span> :<span style="color: #000000;">122</span> <span style="color: #000000; font-weight: bold;">*</span></pre></div></div>

<p>Insgesamt sieht meine Vorgehensweise dann so aus, dass ich im ersten Schritt die Dateien mit rsync in ein temporäres Verzeichnis kopiere, wobei die Berechtigungen auch kopiert werden:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rsync <span style="color: #660033;">-avHAX</span> <span style="color: #660033;">--progress</span> <span style="color: #000000; font-weight: bold;">/</span>backup<span style="color: #000000; font-weight: bold;">/</span>path <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>path</pre></div></div>

<p>Dann passe ich die Berechtigungen an mit obigen Befehlen und verschiebe schließlich das Verzeichnis ans Ziel</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>path<span style="color: #000000; font-weight: bold;">/*</span> <span style="color: #000000; font-weight: bold;">/</span>target<span style="color: #000000; font-weight: bold;">/</span>path</pre></div></div>

<p>Der Zwischenschritt mit dem Verzeichnis /tmp ist nur nötig, wenn man neue und alte Dateien in einem Verzeichnis vermischt.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.effinger.org/blog/2009/12/11/berechtigungen-nach-einspielen-eines-backups-anpassen/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
