<?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>controlc.de &#187; debian</title>
	<atom:link href="http://controlc.de/tag/debian/feed/" rel="self" type="application/rss+xml" />
	<link>http://controlc.de</link>
	<description>mehr als nur ein Notizblock</description>
	<lastBuildDate>Mon, 16 Apr 2012 12:43:35 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>debian &#124; OpenVPN-Server als Standard-Gateway</title>
		<link>http://controlc.de/2010/12/15/debian-openvpn-server-als-standard-gateway/</link>
		<comments>http://controlc.de/2010/12/15/debian-openvpn-server-als-standard-gateway/#comments</comments>
		<pubDate>Wed, 15 Dec 2010 14:04:14 +0000</pubDate>
		<dc:creator>controlc.de</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[netzwerk]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[ip_forward]]></category>
		<category><![CDATA[lenny]]></category>
		<category><![CDATA[opendns]]></category>
		<category><![CDATA[openvpn]]></category>
		<category><![CDATA[redirect gateway]]></category>
		<category><![CDATA[skript]]></category>
		<category><![CDATA[sysctl.conf]]></category>

		<guid isPermaLink="false">http://controlc.de/?p=1899</guid>
		<description><![CDATA[Wie im Artikel OpenVPN-Server einrichten geschrieben soll der auf dem vServer installierte OpenVPN-Server auch als Standard-Gateway für das Notebook auf Auslandsreisen fungieren, um staatliche Restriktionen umgehen zu können. Damit dies funktioniert müssen folgende Konfigurationen gemacht werden: Auf dem OpenVPN-Server muss IP-Forwarding angeschaltet sein sysctl -w net.ipv4.ip_forward=1 bzw. dauerhaft in /etc/sysctl.conf eintragen. Ebenfalls muss das OpenVPN-Netz [...]]]></description>
			<content:encoded><![CDATA[	<p><a href="http://controlc.de/wp-content/uploads/2010/12/Tunnelblick-Logo.png" class="floatbox" rev="group:1899 caption:`Tunnelblick-Logo`"><img class="aligncenter size-full wp-image-1924" title="Tunnelblick-Logo" src="http://controlc.de/wp-content/uploads/2010/12/Tunnelblick-Logo.png" alt="" width="127" height="127" /></a>Wie im Artikel <a href="http://controlc.de/2009/06/03/debian-openvpn-server-einrichten/">OpenVPN-Server einrichten</a> geschrieben soll der auf dem vServer installierte OpenVPN-Server auch als Standard-Gateway für das Notebook auf Auslandsreisen fungieren, um staatliche Restriktionen umgehen zu können. Damit dies funktioniert müssen folgende Konfigurationen gemacht werden:<span id="more-1899"></span></p>
	<ul>
	<li>Auf dem OpenVPN-Server muss IP-Forwarding angeschaltet sein</li>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">sysctl <span style="color: #660033;">-w</span> net.ipv4.ip_forward=<span style="color: #000000;">1</span></pre></div></div>

	<p>bzw. dauerhaft in <em>/etc/sysctl.conf</em> eintragen.</ul>
	<ul>
	<li>Ebenfalls muss das OpenVPN-Netz beim Übergang ins Internet geNATet werden. Dazu muss eine iptables Regel gesetzt werden. Diese Befehlszeile muss jedesmal ausgeführt werden, wenn OpenVPN gestartet wird, damit es funktioniert. Deswegen wird unter <em>/etc/openvpn/firewall.sh</em> ein Script angelegt, welches folgenden Inhalt hat.</li>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
iptables <span style="color: #660033;">-t</span> nat <span style="color: #660033;">-A</span> POSTROUTING <span style="color: #660033;">-s</span> 10.8.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span> <span style="color: #660033;">-o</span> eth0 <span style="color: #660033;">-j</span> MASQUERADE</pre></div></div>

	<p>Und anschließend muß noch in die OpenVPN-Konfigurationsdatei auf dieses Script gezeigt werden.</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">route-up <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>openvpn<span style="color: #000000; font-weight: bold;">/</span>firewall.sh</pre></div></div>

	</ul>
	<p>Dann wird für in die clientspezifische Konfigurationsdatei in <em>/etc/openvpn/ccd</em> folgendes geschrieben:</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">push <span style="color: #ff0000;">&quot;redirect-gateway def1&quot;</span>
push <span style="color: #ff0000;">&quot;dhcp-option DNS 208.67.222.222&quot;</span>
push <span style="color: #ff0000;">&quot;dhcp-option DNS 208.67.220.220&quot;</span></pre></div></div>

	<p>Ersteres weist den Client an den OpenVPN-Server als Default-Gateway einzutragen und die nächsten beiden Anweisungen geben dem Client die OpenDNS-Server als DNS-Server.</p>
	<p>Ich habe dafür extra clientspezifische Konfigurationsdateien in <em>/etc/openvpn/ccd </em>abgelegt, damit man zukünftig die Wahl hat.
</p>
]]></content:encoded>
			<wfw:commentRss>http://controlc.de/2010/12/15/debian-openvpn-server-als-standard-gateway/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bash &#124; Backups mit tar</title>
		<link>http://controlc.de/2009/11/22/bash-backups-mit-tar/</link>
		<comments>http://controlc.de/2009/11/22/bash-backups-mit-tar/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 11:40:58 +0000</pubDate>
		<dc:creator>controlc.de</dc:creator>
				<category><![CDATA[allgemeine IT]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[command line]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[tar]]></category>

		<guid isPermaLink="false">http://controlc.de/?p=1041</guid>
		<description><![CDATA[In einem älteren Artikel habe ich mich schon mal damit beschäftigt, wie man in *nix-basierten Betriebssystemen leicht Backups anlegen kann. Da der Bedarf bei mir wieder mal akuter wurde, haber ich mich wieder mal damit beschäftigt und möchte hier erklären, wie man was machen kann. Backup von bestimmten Dateien Häufiger möchte man, wenn man mal [...]]]></description>
			<content:encoded><![CDATA[	<p><a href="http://controlc.de/wp-content/uploads/2009/11/Bash.png" class="floatbox" rev="group:1041 caption:`Bash`"><img class="aligncenter size-medium wp-image-1063" title="Bash" src="http://controlc.de/wp-content/uploads/2009/11/Bash-300x232.png" alt="Bash" width="300" height="232" /></a>In einem <a href="http://controlc.de/2009/05/20/bash-schnelles-backup-anlegen/">älteren Artikel</a> habe ich mich schon mal damit beschäftigt, wie man in *nix-basierten Betriebssystemen leicht Backups anlegen kann. Da der Bedarf bei mir wieder mal akuter wurde, haber ich mich wieder mal damit beschäftigt und möchte hier erklären, wie man was machen kann.</p>
	<h4><span id="more-1041"></span>Backup von bestimmten Dateien</h4>
	<p>Häufiger möchte man, wenn man mal schnell etwas in einer Config-Datei etwas ändert, davon fix ein Backup anlegen. Klassisch habe ich das meist schnell mit</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cp</span> DATEI.conf DATEI.conf.orig</pre></div></div>

	<p>gelöst. Was aber passiert, wenn man dann später nochmal was ändern will respektive ein neues Backup angelegt werden soll?! Wie man dieses Problem erschlägt, habe ich schon mal in <a href="http://controlc.de/2009/05/20/bash-schnelles-backup-anlegen/">diesem Artikel</a> erklärt — das war aber nur ein Schnellschuß. Das Problem dabei ist nämlich, das man ja jeweils die alten Backups nochmal mitsichert und dadurch die Backups immer größer werden. Dies kann man durch einen Exclude-Parameter von tar auschließen. Der Befehl um in einem Verzeichnis alle Dateien zu sichern lautet also</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-cz</span> <span style="color: #660033;">--no-recursion</span> <span style="color: #660033;">--exclude</span>=backup-<span style="color: #000000; font-weight: bold;">*</span>.tar.gz <span style="color: #660033;">-f</span> backup-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>F-<span style="color: #000000; font-weight: bold;">%</span>H-<span style="color: #000000; font-weight: bold;">%</span>M<span style="color: #7a0874; font-weight: bold;">&#41;</span>.tar.gz <span style="color: #000000; font-weight: bold;">*</span></pre></div></div>

	<h4>Backup von ganzen Pfaden inkl. der Unterverzeichnisse</h4>
	<p>In einigen Fällen will man nicht nur die Dateien in einem Verzeichnis sichern sondern lieber gleich den Inhalt gesamte Verzeichnis inklusive aller Unterverzeichnisse</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> <span style="color: #660033;">-cz</span> <span style="color: #660033;">--exclude</span>=backup-<span style="color: #000000; font-weight: bold;">*</span>.tar.gz <span style="color: #660033;">-f</span> backup-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>F-<span style="color: #000000; font-weight: bold;">%</span>H-<span style="color: #000000; font-weight: bold;">%</span>M<span style="color: #7a0874; font-weight: bold;">&#41;</span>.tar.gz .</pre></div></div>

	<h4>Backup von Dateien bzw. Pfaden, die im gesamten System verteilt sind</h4>
	<p>Und schließlich hat man den Fall, das man alle wichtigen Dateien eines Systems sichern will, die aber über das gesamte System verteilt sind. Dies erreicht man mit einer Include-Datei</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> cvzf <span style="color: #000000; font-weight: bold;">/</span>backup-$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">date</span> +<span style="color: #000000; font-weight: bold;">%</span>F-<span style="color: #000000; font-weight: bold;">%</span>T<span style="color: #7a0874; font-weight: bold;">&#41;</span>.tar.gz <span style="color: #660033;">-T</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>backup-include-dir.conf</pre></div></div>

	<p>wobei man in die Datei <em>/etc/backup-include-dir.conf</em> alle Pfade bzw. alle Dateien reinschreibt, die gesichert werden sollen. Wichtig ist dabei nur: Pro Datei/Pfad jeweils eine Zeile.</p>
	<p>Und denkt daran: Solche Befehlszeilen eignen sich wunderbar dazu als alias definiert zu werden, damit man schnell drauf zugreifen kann, wenn man es mal braucht.
</p>
]]></content:encoded>
			<wfw:commentRss>http://controlc.de/2009/11/22/bash-backups-mit-tar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>debian &#124; OpenWRT und eigenes Image bauen</title>
		<link>http://controlc.de/2009/09/26/debian-openwrt-und-eigenes-image-bauen/</link>
		<comments>http://controlc.de/2009/09/26/debian-openwrt-und-eigenes-image-bauen/#comments</comments>
		<pubDate>Sat, 26 Sep 2009 15:58:39 +0000</pubDate>
		<dc:creator>controlc.de</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[netzwerk]]></category>
		<category><![CDATA[openwrt]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[kamikaze]]></category>
		<category><![CDATA[luci]]></category>
		<category><![CDATA[openvpn]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[trunk]]></category>

		<guid isPermaLink="false">http://controlc.de/?p=873</guid>
		<description><![CDATA[Ich nutze schon seit Jahren Router, die ich mit der alternativen Firmware OpenWRT betreibe. Mir geht es dabei nicht darum, das ich den Herstellern misstraue, sondern primär darum, das mir OpenWRT die Möglichkeit lässt selbst zu entscheiden, welche Dienste ich auf dem Router anbieten will und welche nicht. Dazu kommt, das die Firewall deutlich besser [...]]]></description>
			<content:encoded><![CDATA[	<p><a href="http://controlc.de/wp-content/uploads/2009/09/openwrt-logo.png" class="floatbox" rev="group:873 caption:`openwrt-logo`"><img class="aligncenter size-medium wp-image-882" title="openwrt-logo" src="http://controlc.de/wp-content/uploads/2009/09/openwrt-logo-300x76.png" alt="openwrt-logo" width="300" height="76" /></a></p>
	<p>Ich nutze schon seit Jahren Router, die ich mit der alternativen Firmware <a href="http://openwrt.org/">OpenWRT</a> betreibe. Mir geht es dabei nicht darum, das ich den Herstellern misstraue, sondern primär darum, das mir OpenWRT die Möglichkeit lässt selbst zu entscheiden, welche Dienste ich auf dem Router anbieten will und welche nicht. Dazu kommt, das die Firewall deutlich besser konfigurierbar ist und das ich mich per SSH auf den Router und über darüber gesetzte Tunnel auch auf das Netzwerk dahinter Zugriff habe. Davon einmal ganz abgesehen ist es natürlich auch gut zu wissen, das die Macher hinter OpenWRT Sicherheitslöcher stopfen — ein Verhalten, was man sich von den Hardware-Herstellern wünschen würde. Ich bin bis dato immer gut mit den Routern der Firma ASUS gefahren — zuerst hatte ich einen <a href="http://de.asus.com/products.aspx?l1=12&amp;l2=43&amp;l3=0&amp;l4=0&amp;model=359&amp;modelmenu=1">Asus WL-500g Deluxe</a>, später einen <a href="http://de.asus.com/products.aspx?l1=29&amp;l2=172&amp;l3=743&amp;l4=59&amp;model=1121&amp;modelmenu=1">Asus WL-500g Premium</a>. Der Vorteil dieser Router: Sie haben zwei USB 2.0-Ports — da kann man z.B. Festplatten dranhängen und diese als Netzwerkplatten freigeben.</p>
	<p>Aber zurück zu OpenWRT: Mit der neuesten Version von <a href="http://kamikaze.openwrt.org/8.09.1/">OpenWRT Kamikaze 8.09.1</a> ist aber über die Weboberfläche LuCI keine Steuerungs– und Konfigurationsmöglichkeit von <a href="http://www.openvpn.net/index.php/open-source.html">OpenVPN</a> möglich. Deswegen kann aus dem OpenWRT-Forum der Tipp, es mit der Trunk-Version von OpenWRT zu probieren. Da es diese Versionen aber nicht als fertiges Image gibt, muss man diese selbst kompilieren.<span id="more-873"></span></p>
	<p>Dazu habe ich mir in einer VM ein frisches <a href="http://www.debian.org/">Debian Lenny</a> aufgesetzt und mit</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential mercurial subversion <span style="color: #c20cb9; font-weight: bold;">cvs</span> zlib1g-dev <span style="color: #c20cb9; font-weight: bold;">gawk</span> <span style="color: #c20cb9; font-weight: bold;">bison</span> <span style="color: #c20cb9; font-weight: bold;">flex</span> libncurses5-dev <span style="color: #c20cb9; font-weight: bold;">unzip</span></pre></div></div>

	<p>die Basis geschaffen.</p>
	<p><strong>Update: Also entweder hat noch nie jemand versucht meine Anleitung nachzuvollziehen, Ihr wart zu faul was zu schreiben oder aber Ihr hattet schon fertige Debian-Installationen — in der Aufzählung der benötigten Pakete fehlte noch <em>unzip</em>. Ich habe die Befehlszeile mal vervollständigt.</strong></p>
	<p>Anschließend legt man sich am besten ein neues Unterverzeichnis an</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> openwrt</pre></div></div>

	<p>und wechselt in dieses Verzeichnis</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> openwrt</pre></div></div>

	<p>Jetzt kann man sich die OpenWRT-Dateien herunterladen</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">svn</span> <span style="color: #c20cb9; font-weight: bold;">co</span> <span style="color: #c20cb9; font-weight: bold;">svn</span>:<span style="color: #000000; font-weight: bold;">//</span>svn.openwrt.org<span style="color: #000000; font-weight: bold;">/</span>openwrt<span style="color: #000000; font-weight: bold;">/</span>trunk<span style="color: #000000; font-weight: bold;">/</span> .</pre></div></div>

	<p>Wichtig dabei ist, das man dies alles als normaler Nutzer macht — nicht als <em>root</em>.</p>
	<p>Da die LuCI-Weboberfläche für OpenVPN nur in den Trunk-Paketen ist, müssen die Quellen für die Pakete noch angepasst werden</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;src-svn packages svn://svn.openwrt.org/openwrt/packages&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> feeds.conf
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;src-svn luci http://svn.luci.subsignal.org/luci/trunk/contrib/package&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> feeds.conf</pre></div></div>

	<p>Jetzt noch die Paketliste aktualisieren</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>feeds update</pre></div></div>

	<p>Und die Pakete für LuCI einbinden</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>scripts<span style="color: #000000; font-weight: bold;">/</span>feeds <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">-a</span> <span style="color: #660033;">-p</span> luci</pre></div></div>

	<p>Und schon kann man mit</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span> menuconfig</pre></div></div>

	<p>das Image vorbereiten — sprich die Auswahl machen, was alles in das Image hinein soll.</p>
	<p>Abschließend ein</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">make</span></pre></div></div>

	<p>und nach ewig langer Zeit liegt ein Imagefile in dem Unterverzeichnis <em>bin</em>, welches geflasht werden möchte.</p>
	<h4>Links</h4>
	<p><a href="http://openwrt.org/">http://openwrt.org/</a></p>
	<p><a href="http://de.asus.com/products.aspx?l1=29&amp;l2=172&amp;l3=743&amp;l4=59&amp;model=1121&amp;modelmenu=1">http://de.asus.com/products.aspx?l1=29&amp;l2=172&amp;l3=743&amp;l4=59&amp;model=1121&amp;modelmenu=1</a></p>
	<p><a href="http://de.asus.com/products.aspx?l1=12&amp;l2=43&amp;l3=0&amp;l4=0&amp;model=359&amp;modelmenu=1">http://de.asus.com/products.aspx?l1=12&amp;l2=43&amp;l3=0&amp;l4=0&amp;model=359&amp;modelmenu=1</a></p>
	<p><a href="http://kamikaze.openwrt.org/8.09.1/">http://kamikaze.openwrt.org/8.09.1/</a></p>
	<p><a href="http://www.openvpn.net/index.php/open-source.html">http://www.openvpn.net/index.php/open-source.html</a></p>
	<p><a href="https://forum.openwrt.org/viewtopic.php?pid=94844#p94844">https://forum.openwrt.org/viewtopic.php?pid=94844#p94844</a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://controlc.de/2009/09/26/debian-openwrt-und-eigenes-image-bauen/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>debian &#124; Paketverwaltung und die Quellen</title>
		<link>http://controlc.de/2009/08/06/debian-paketverwaltung-und-die-quellen/</link>
		<comments>http://controlc.de/2009/08/06/debian-paketverwaltung-und-die-quellen/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 12:32:31 +0000</pubDate>
		<dc:creator>controlc.de</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[apt]]></category>
		<category><![CDATA[paketverwaltung]]></category>

		<guid isPermaLink="false">http://controlc.de/?p=802</guid>
		<description><![CDATA[Über die Paketverwaltung wurde schon viel geschrieben und ich will das auch nicht alle nochmal durchkauen. Aber, da man das nicht jeden Tag anfässt, möchte ich — auch für mich — zusammenfassen, mit welchen Einträgen man die optimale Paketauswahl hat. Direkt nach der Installation findet man eine recht minimale Version der Quellen in /etc/apt/sources.list # [...]]]></description>
			<content:encoded><![CDATA[	<p>Über die Paketverwaltung wurde schon viel geschrieben und ich will das auch nicht alle nochmal durchkauen. Aber, da man das nicht jeden Tag anfässt, möchte ich — auch für mich — zusammenfassen, mit welchen Einträgen man die optimale Paketauswahl hat.<br />
<span id="more-802"></span><br />
Direkt nach der Installation findet man eine recht minimale Version der Quellen in <code>/etc/apt/sources.list</code></p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># deb cdrom:[Debian GNU/Linux 5.0.2 _Lenny_ - Official i386 NETINST Binary-1 20090629-11:06]/ lenny main</span>
&nbsp;
deb http:<span style="color: #000000; font-weight: bold;">//</span>ftp.de.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> lenny main
deb-src http:<span style="color: #000000; font-weight: bold;">//</span>ftp.de.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> lenny main
&nbsp;
deb http:<span style="color: #000000; font-weight: bold;">//</span>security.debian.org<span style="color: #000000; font-weight: bold;">/</span> lenny<span style="color: #000000; font-weight: bold;">/</span>updates main
deb-src http:<span style="color: #000000; font-weight: bold;">//</span>security.debian.org<span style="color: #000000; font-weight: bold;">/</span> lenny<span style="color: #000000; font-weight: bold;">/</span>updates main
&nbsp;
deb http:<span style="color: #000000; font-weight: bold;">//</span>volatile.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian-volatile lenny<span style="color: #000000; font-weight: bold;">/</span>volatile main
deb-src http:<span style="color: #000000; font-weight: bold;">//</span>volatile.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian-volatile lenny<span style="color: #000000; font-weight: bold;">/</span>volatile main</pre></div></div>

	<p>Das Format einer solchen Zeile läßt sich wie folgt zusammenfassen:</p>
	<p><code>deb/deb-src uri distribution [component1] [component2] [...]</code></p>
	<p>Kurz zum Aufbau einer solchen Zeile:</p>
	<h4><code>deb bzw. deb-src</code></h4>
	<p>Darüber definiert man die Art der Pakete. <em>deb</em> stellt dabei die debian-Pakete im Binärformat dar, <em>deb-src</em> die Pakete mit den Programmquellen, welche selbstständig kompiliert werden können. Wenn man nicht selber aus Quelldateien etwas kompilieren will, kann man alle deb-src Einträge löschen — das spart Platz und beschleunigt die Aktualisierung der zur Verfügung stehende Pakete.</p>
	<h4><code>uri</code></h4>
	<p>Hier steht die URL des sogenannten Repository,  sprich dem Ort, wo alle Pakete zu finden sind.</p>
	<h4><code>distribution</code></h4>
	<p>Mit diesem Eintrag definiert man die debian-Version, für die man Pakete haben möchte. Dies geht einmal über den Namen der Version — im obigen Beispiel <em>lenny</em>, oder aber über die Platzhalter <em>stable, testing</em> und <em>unstable</em>.</p>
	<h4><code>component</code></h4>
	<p>Das ist der interessanteste Teil der Zeile, da hier die Paketsektion definiert ist, die aus lizenzrechtlichen Gründen eingerichtet wurden — die Unterscheidung ist bisher<em> main, contrib </em>und <em>non-free</em>.  Wen die Unterschiede näher interessiert, der sollte <a href="http://www.debian.org/distrib/packages.de.html">hier</a> weiterlesen.</p>
	<p>Nun aber zum »Pimpen« der<em><code>/etc/apt/sources.list</code></em>:</p>
	<p>In meinem Fall fliegen alle <em>deb-src</em> Einträge weg, alle <em>deb</em> Einträge bekommen zu main noch <em>contrib</em> und <em>non-free</em> hinzu. Dann kommen die <a href="http://www.backports.org/">Backports</a> Einträge hinzu. Was das ist, <a href="http://www.backports.org/dokuwiki/doku.php">sagen</a> die Macher perfekt</p>
	<blockquote><p>Backports are recompiled packages from testing (mostly) and unstable (in a few cases only, e.g. security updates), so they will run without new libraries (wherever it is possible) on a stable Debian distribution. I recommend you to pick out single backports which fits your needs, and not to use all backports available here.</p></blockquote>
	<p>Damit sieht die sources.list jetzt so aus</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># deb cdrom:[Debian GNU/Linux 5.0.2 _Lenny_ - Official i386 NETINST Binary-1 20090629-11:06]/ lenny main</span>
&nbsp;
deb http:<span style="color: #000000; font-weight: bold;">//</span>ftp.de.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span> lenny main contrib non-free
&nbsp;
deb http:<span style="color: #000000; font-weight: bold;">//</span>security.debian.org<span style="color: #000000; font-weight: bold;">/</span> lenny<span style="color: #000000; font-weight: bold;">/</span>updates main contrib non-free
&nbsp;
deb http:<span style="color: #000000; font-weight: bold;">//</span>volatile.debian.org<span style="color: #000000; font-weight: bold;">/</span>debian-volatile lenny<span style="color: #000000; font-weight: bold;">/</span>volatile main contrib non-free
&nbsp;
deb http:<span style="color: #000000; font-weight: bold;">//</span>www.backports.org<span style="color: #000000; font-weight: bold;">/</span>debian lenny-backports main contrib non-free</pre></div></div>

	<p>Nachdem man die Backports eingetragen hat, muss man noch die digitalen Signatur für die Backports installieren:</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> debian-backports-keyring
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut
Lese Status-Informationen ein... Fertig
Die folgenden NEUEN Pakete werden installiert:
  debian-backports-keyring
<span style="color: #000000;">0</span> aktualisiert, <span style="color: #000000;">1</span> neu installiert, <span style="color: #000000;">0</span> zu entfernen und <span style="color: #000000;">0</span> nicht aktualisiert.
Es müssen 3362B an Archiven heruntergeladen werden.
Nach dieser Operation werden <span style="color: #000000;">49</span>,2kB Plattenplatz zusätzlich benutzt.
WARNUNG: Die folgenden Pakete können nicht authentifiziert werden<span style="color: #000000; font-weight: bold;">!</span>
  debian-backports-keyring
Diese Pakete ohne Überprüfung installieren <span style="color: #7a0874; font-weight: bold;">&#91;</span>j<span style="color: #000000; font-weight: bold;">/</span>N<span style="color: #7a0874; font-weight: bold;">&#93;</span>? j
Hole:<span style="color: #000000;">1</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.backports.org lenny-backports<span style="color: #000000; font-weight: bold;">/</span>main debian-backports-keyring 2009.02.20 <span style="color: #7a0874; font-weight: bold;">&#91;</span>3362B<span style="color: #7a0874; font-weight: bold;">&#93;</span>
Es wurden 3362B <span style="color: #000000; font-weight: bold;">in</span> 0s geholt <span style="color: #7a0874; font-weight: bold;">&#40;</span>9289B<span style="color: #000000; font-weight: bold;">/</span>s<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Wähle vormals abgewähltes Paket debian-backports-keyring.
<span style="color: #7a0874; font-weight: bold;">&#40;</span>Lese Datenbank ... <span style="color: #000000;">30406</span> Dateien und Verzeichnisse sind derzeit installiert.<span style="color: #7a0874; font-weight: bold;">&#41;</span>
Entpacke debian-backports-keyring <span style="color: #7a0874; font-weight: bold;">&#40;</span>aus ...<span style="color: #000000; font-weight: bold;">/</span>debian-backports-keyring_2009.02.20_all.deb<span style="color: #7a0874; font-weight: bold;">&#41;</span> ...
Richte debian-backports-keyring ein <span style="color: #7a0874; font-weight: bold;">&#40;</span>2009.02.20<span style="color: #7a0874; font-weight: bold;">&#41;</span> ...
OK</pre></div></div>

	<p>Das Alles kann man natürlich noch verfeinern mit den Quellen von <em>testing</em> und <em>unstable</em>, aber wer da noch nicht soviel drüber weiß, kann Vieles kaputt machen — deswegen lieber »Finger weg«.</p>
	<h3>Links</h3>
	<p><a href="http://debiananwenderhandbuch.de/sources.list.html">http://debiananwenderhandbuch.de/sources.list.html</a></p>
	<p><a href="http://www.debian.org/distrib/packages.de.html">http://www.debian.org/distrib/packages.de.html</a></p>
	<p><a href="http://www.backports.org/">http://www.backports.org/</a>
</p>
]]></content:encoded>
			<wfw:commentRss>http://controlc.de/2009/08/06/debian-paketverwaltung-und-die-quellen/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>postfix &#124; eigener Einlieferungsweg für Exchange-Server definieren</title>
		<link>http://controlc.de/2009/06/26/postfix-eigener-einlieferungsweg-fur-exchange-server-definieren/</link>
		<comments>http://controlc.de/2009/06/26/postfix-eigener-einlieferungsweg-fur-exchange-server-definieren/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 21:15:02 +0000</pubDate>
		<dc:creator>controlc.de</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://controlc.de/?p=732</guid>
		<description><![CDATA[Das Problem in einer Installation wie der meinen ist, das für das Mail-Gateway jeder einliefernde Server gleich aussieht und somit auch gleich behandelt wird. Da ich aber für meinen eigenen Exchange-Server nahezu die Hand ins Feuer legen kann, möchte ich natürlich, das die ressourcenfressenden Tests auf alle Mails, die der Exchange an das Mail-Gateway übergibt, [...]]]></description>
			<content:encoded><![CDATA[	<p>Das Problem in einer Installation wie der meinen ist, das für das Mail-Gateway jeder einliefernde Server gleich aussieht und somit auch gleich behandelt wird. Da ich aber für meinen eigenen Exchange-Server nahezu die Hand ins Feuer legen kann, möchte ich natürlich, das die ressourcenfressenden Tests auf alle Mails, die der Exchange an das Mail-Gateway übergibt, nicht angewendet werden. Ich habe mich dabei für folgende Lösung entschieden:<span id="more-732"></span></p>
	<p>Zuerst habe ich einen neuen Service in <code>/etc/services</code> definiert</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># Local services</span>
exchange        <span style="color: #000000;">12345</span><span style="color: #000000; font-weight: bold;">/</span>tcp                       <span style="color: #666666; font-style: italic;"># Hilfsport für Exchangeeinlieferung</span></pre></div></div>

	<p>Anschließend wird ein neuer Transportweg in <code>/etc/postfix/master.cf</code> definiert</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">exchange inet n    -       n       -       -     smtpd
        <span style="color: #660033;">-o</span> <span style="color: #007800;">content_filter</span>=
        <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_delay_reject</span>=no
        <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_helo_restrictions</span>=
        <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_sender_restrictions</span>=
        <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_recipient_restrictions</span>=permit_tls_clientcerts,reject
        <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_data_restrictions</span>=reject_unauth_pipelining
        <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_end_of_data_restrictions</span>=
        <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_restriction_classes</span>=
        <span style="color: #660033;">-o</span> <span style="color: #007800;">mynetworks</span>=127.0.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">8</span>
        <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_error_sleep_time</span>=<span style="color: #000000;">0</span>
        <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_soft_error_limit</span>=<span style="color: #000000;">1001</span>
        <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_hard_error_limit</span>=<span style="color: #000000;">1000</span>
        <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_client_connection_count_limit</span>=<span style="color: #000000;">0</span>
        <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_client_connection_rate_limit</span>=<span style="color: #000000;">0</span>
        <span style="color: #660033;">-o</span> <span style="color: #007800;">receive_override_options</span>=no_header_body_checks,no_unknown_recipient_checks,no_milters
        <span style="color: #660033;">-o</span> <span style="color: #007800;">local_header_rewrite_clients</span>=
        <span style="color: #660033;">-o</span> <span style="color: #007800;">smtpd_milters</span>=
        <span style="color: #660033;">-o</span> <span style="color: #007800;">local_recipient_maps</span>=
        <span style="color: #660033;">-o</span> <span style="color: #007800;">transport_maps</span>=<span style="color: #7a0874; font-weight: bold;">hash</span>:<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>transport
        <span style="color: #660033;">-o</span> <span style="color: #007800;">relay_recipient_maps</span>=</pre></div></div>

	<p>Damit haben wir den Weg für den Exchange-Server auf dem Mail-Gateway geebnet. Nun müssen wir noch den Exchange-Server konfigurieren. Zuerst müssen wir den Smarthost  definieren, also den Server, an den der Exchange alle Mails schicken soll, für die er selber nicht zuständig ist. Das ist in unserem Fall das Mail-Gateway. Definiert wird das Ganze im Default-SMTP-Connector, in meinem Fall heißt dieser Smallbusiness-SMTP-Connector und ist zu unter <em>Administrative Gruppen/Erste administrative Gruppe/Routinggruppen/Erste Routinggruppe/Connectors</em>. Auf der Reiterkarte <em>Allgemein</em> gibt man entweder den FQDN an oder aber, wie in meinem Falle,  die IP in eckigen Klammern an.</p>
	<p><div id="attachment_735" class="wp-caption aligncenter" style="width: 310px"><a href="http://controlc.de/wp-content/uploads/2009/06/SMTP-Connector-smarthost.JPG" class="floatbox" rev="group:732 caption:`Smarthost im SMTP-Connector`"><img class="size-medium wp-image-735" title="Smarthost im SMTP-Connector" src="http://controlc.de/wp-content/uploads/2009/06/SMTP-Connector-smarthost-300x188.jpg" alt="Im SMTP-Connector wird der Smarthost definiert" width="300" height="188" /></a><p class="wp-caption-text">Im SMTP-Connector wird der Smarthost definiert</p></div></p>
	<p>Weitere Informationen findet man in der <a href="http://support.microsoft.com/?scid=kb%3Ben-us%3B314961&amp;x=17&amp;y=12">Microsoft Knowledgebase</a>.</p>
	<p>Anschließend muß man noch festlegen, an welchen Port der Exchange-Server für seine ausgehende SMTP-Kommunikation benutzt. Dies definiert man in <em>Administrative Gruppen/Erste administrative Gruppe/Server/SERVERNAME/Protokolle/SMTP</em>. Hier legt der Server nach der Grundinstallation den <em>Virtueller Standardserver für SMTP</em> an. In der Reiterkarte Übermittlung gibt es <em>Ausgeh. Verbindungen</em> und dort findet man den <em>TCP-Anschluß</em>.</p>
	<p><div id="attachment_736" class="wp-caption aligncenter" style="width: 310px"><a href="http://controlc.de/wp-content/uploads/2009/06/SMTP-outgoing-port.JPG" class="floatbox" rev="group:732 caption:`SMTP-outgoing-port`"><img class="size-medium wp-image-736" title="SMTP-outgoing-port" src="http://controlc.de/wp-content/uploads/2009/06/SMTP-outgoing-port-300x186.jpg" alt="Im virtuellen Standardserver für SMTP wird der ausgehende Port definiert" width="300" height="186" /></a><p class="wp-caption-text">Im virtuellen Standardserver für SMTP wird der ausgehende Port definiert</p></div></p>
	<p>Weitere Infos zum ausgehenden Port findet man in der <a href="http://support.microsoft.com/?scid=kb%3Ben-us%3B274842&amp;x=11&amp;y=10">Microsoft Knowledgebase</a>.
</p>
]]></content:encoded>
			<wfw:commentRss>http://controlc.de/2009/06/26/postfix-eigener-einlieferungsweg-fur-exchange-server-definieren/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>debian &#124; OpenVPN-Server einrichten</title>
		<link>http://controlc.de/2009/06/03/debian-openvpn-server-einrichten/</link>
		<comments>http://controlc.de/2009/06/03/debian-openvpn-server-einrichten/#comments</comments>
		<pubDate>Wed, 03 Jun 2009 22:33:29 +0000</pubDate>
		<dc:creator>controlc.de</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[netzwerk]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[openssl]]></category>
		<category><![CDATA[openvpn]]></category>
		<category><![CDATA[zertifikate]]></category>

		<guid isPermaLink="false">http://controlc.de/?p=554</guid>
		<description><![CDATA[VPN-Server sind ne tolle Geschichte, da man damit verschiedenste Dinge erledigen kann: abgesicherte Kommunikation exklusive und vertraute Verbindungen Umgehung von providerabhängigen Gängeleien Neben dem reinen Interesse an der Technik möchte ich folgendes davon erreichen: Über den VPN-Tunnel soll mein Heim-Exchange seine Mails an das Mail-Gateway absetzen können — dabei kann ich die spezielle smtpd-Instanz mit [...]]]></description>
			<content:encoded><![CDATA[	<p>VPN-Server sind ne tolle Geschichte, da man damit verschiedenste Dinge erledigen kann:</p>
	<ul>
	<li>abgesicherte Kommunikation</li>
	<li>exklusive und vertraute Verbindungen</li>
	<li>Umgehung von providerabhängigen Gängeleien</li>
	</ul>
	<p>Neben dem reinen Interesse an der Technik möchte ich folgendes davon erreichen:</p>
	<ul>
	<li>Über den VPN-Tunnel soll mein Heim-Exchange seine Mails an das Mail-Gateway absetzen können — dabei kann ich die spezielle smtpd-Instanz mit weniger Restriktionen laufen lassen (z.B. keine Überprüfung auf Viren und Spam)</li>
	<li>wenn ich das nächste Mail in China bin möchte ich über den VPN-Tunnel ohne Einschränkungen im Internet unterwegs sein können</li>
	</ul>
	<p>Aber nun zur Einrichtung: <span id="more-554"></span></p>
	<h2>Vorbereitung</h2>
	<p>Zuerst müssen wir die Pakete <em>openvpn</em> (klar, was sonst) und <em>udev </em>installieren. <em>udev</em> benötigen wir, damit das Erstellen des virtuellen Interface dynamisch erfolgt.</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> udev openvpn</pre></div></div>

	<p>Damit man über den Server eine Verbindung ins Internet aufbauen kann muß man noch das IP-Forwarding einschalten. Dazu editiert man die Datei <code>/etc/sysctl.conf</code> und aktiviert den Eintrag  <code>net.ipv4.ip_forward = 1</code></p>
	<h2>Zertifikate erstellen</h2>
	<p>Wir benötigen für OpenVPN Zertifikate, d.h. eine bestehende CA und müssen dann weitere Clientzertifikate erstellen. Zuerst aber müssen wir einen sogenannten Diffie-Hellman Parameter erzeugen. Dieser wird, laut dem <a href="http://wiki.openvpn.eu/index.php/Erzeugen_einer_PKI_mit_EasyRSA#Diffie-Hellman_Parameter_erzeugen">OpenVPN.eu-Wiki</a>, »vom OpenVPN Server verwendet um bei vielen gleichzeitigen Clientverbindungen den TLS-Handshake zu beschleunigen.«</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #666666; font-style: italic;"># openssl dhparam -out dh1024.pem 1024</span>
Generating DH parameters, <span style="color: #000000;">1024</span> bit long safe prime, generator <span style="color: #000000;">2</span>
This is going to take a long <span style="color: #000000; font-weight: bold;">time</span>
..................+......................+......+...............</pre></div></div>

	<p>Nun nutze ich mein <a href="http://controlc.de/2009/05/11/zertifikaterstellungsskript/">Zertifikatsskript</a> zur Erstellung des Server-Zertifikats</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">create_certs vpn.domain.de</pre></div></div>

	<p>Und damit habe ich folgende Dateien erstellt, die ich zukünftig brauche  <code>/etc/ssl/vpn.domain.de-cert.pem /etc/ssl/private/vpn.domain.de-key.pem</code> Natürlich brauche ich noch Zertifikate für die Clients, diese erstell ich mit</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">create_certs client1</pre></div></div>

	<p>Wichtig ist dabei, das als <em>common name</em> der Clientname (in dem Beispiel <code>client1</code>) angegeben wird. Anschließend können die Dateien <code>/etc/ssl/client1-cert.pem</code> und <code>/etc/ssl/private/client1-key.pem</code> sowie <code>/etc/ssl/cacert.pem</code> auf den Client kopiert werden, damit dieser sich mit einem gültigen Zertifikat später verbinden kann.</p>
	<h2>Konfigurationsdatei erstellen</h2>
	<p>Anschließend habe ich aus /usr/share/doc/openvpn/examples die Datei server.conf.gz nach /etc/openssl kopiert und dort ausgepackt. Beim Editieren dieser Datei habe ich die Pfade und die Namen der Zertifikatsdateien sowie das Logging angepaßt. Die Datei (meine Änderungen sind rot markiert) sieht anschließend so aus</p>
	<blockquote>
	<pre>#################################################
# Sample OpenVPN 2.0 config file for            #
# multi-client server.                          #
#                                               #
# This file is for the server side              #
# of a many-clients &lt;-&gt; one-server              #
# OpenVPN configuration.                        #
#                                               #
# OpenVPN also supports                         #
# single-machine &lt;-&gt; single-machine             #
# configurations (See the Examples page         #
# on the web site for more info).               #
#                                               #
# This config should work on Windows            #
# or Linux/BSD systems.  Remember on            #
# Windows to quote pathnames and use            #
# double backslashes, e.g.:                     #
# \"C:\\Program Files\\OpenVPN\\config\\foo.key\" #
#                                               #
# Comments are preceded with '#' or ';'         #
#################################################
	
# Which local IP address should OpenVPN
# listen on? (optional)
;local a.b.c.d
	
# Which TCP/UDP port should OpenVPN listen on?
# If you want to run multiple OpenVPN instances
# on the same machine, use a different port
# number for each one.  You will need to
# open up this port on your firewall.
port 1194
	
# TCP or UDP server?
;proto tcp
proto udp</pre>
	<pre># \"dev tun\" will create a routed IP tunnel,
# \"dev tap\" will create an ethernet tunnel.
# Use \"dev tap0\" if you are ethernet bridging
# and have precreated a tap0 virtual interface
# and bridged it with your ethernet interface.
# If you want to control access policies
# over the VPN, you must create firewall
# rules for the the TUN/TAP interface.
# On non-Windows systems, you can give
# an explicit unit number, such as tun0.
# On Windows, use \"dev-node\" for this.
# On most systems, the VPN will not function
# unless you partially or fully disable
# the firewall for the TUN/TAP interface.
;dev tap
dev tun
	
# Windows needs the TAP-Win32 adapter name
# from the Network Connections panel if you
# have more than one.  On XP SP2 or higher,
# you may need to selectively disable the
# Windows firewall for the TAP adapter.
# Non-Windows systems usually don't need this.
;dev-node MyTap
	
# SSL/TLS root certificate (ca), certificate
# (cert), and private key (key).  Each client
# and the server must have their own cert and
# key file.  The server and all clients will
# use the same ca file.
#
# See the \"easy-rsa\" directory for a series
# of scripts for generating RSA certificates
# and private keys.  Remember to use
# a unique Common Name for the server
# and each of the client certificates.
#
# Any X509 key management system can be used.
# OpenVPN can also use a PKCS #12 formatted key file
# (see \"pkcs12\" directive in man page).
<span style=\"color: #ff0000;\">ca /etc/ssl/cacert.pem
cert /etc/ssl/vpn.domain.de-cert.pem
key /etc/ssl/private/vpn.domain.de-key.pem</span>  # This file should be kept secret
	
# Diffie hellman parameters.</pre>
	<pre># Generate your own with:
#   openssl dhparam -out dh1024.pem 1024
# Substitute 2048 for 1024 if you are using
# 2048 bit keys.
<span style=\"color: #ff0000;\">dh /etc/ssl/dh1024.pem</span>
	
# Configure server mode and supply a VPN subnet
# for OpenVPN to draw client addresses from.
# The server will take 10.8.0.1 for itself,
# the rest will be made available to clients.
# Each client will be able to reach the server
# on 10.8.0.1. Comment this line out if you are
# ethernet bridging. See the man page for more info.
server 10.8.0.0 255.255.255.0
	
# Maintain a record of client &lt;-&gt; virtual IP address
# associations in this file.  If OpenVPN goes down or
# is restarted, reconnecting clients can be assigned
# the same virtual IP address from the pool that was
# previously assigned.
ifconfig-pool-persist ipp.txt
	
# Configure server mode for ethernet bridging.
# You must first use your OS's bridging capability
# to bridge the TAP interface with the ethernet
# NIC interface.  Then you must manually set the
# IP/netmask on the bridge interface, here we
# assume <a class=\"linkification-ext\" title=\"Linkification: http://10.8.0.4/255.255.255.0\" href=\"http://10.8.0.4/255.255.255.0\">10.8.0.4/255.255.255.0</a>.  Finally we
# must set aside an IP range in this subnet
# (start=10.8.0.50 end=10.8.0.100) to allocate
# to connecting clients.  Leave this line commented
# out unless you are ethernet bridging.
;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100
	
# Configure server mode for ethernet bridging
# using a DHCP-proxy, where clients talk
# to the OpenVPN server-side DHCP server
# to receive their IP address allocation
# and DNS server addresses.  You must first use
# your OS's bridging capability to bridge the TAP
# interface with the ethernet NIC interface.
# Note: this mode only works on clients (such as
# Windows), where the client-side TAP adapter is
# bound to a DHCP client.
;server-bridge</pre>
	<pre># Push routes to the client to allow it
# to reach other private subnets behind
# the server.  Remember that these
# private subnets will also need
# to know to route the OpenVPN client
# address pool (<a class=\"linkification-ext\" title=\"Linkification: http://10.8.0.0/255.255.255.0\" href=\"http://10.8.0.0/255.255.255.0\">10.8.0.0/255.255.255.0</a>)
# back to the OpenVPN server.
;push \"route 192.168.10.0 255.255.255.0\"
;push \"route 192.168.20.0 255.255.255.0\"
	
# To assign specific IP addresses to specific
# clients or if a connecting client has a private
# subnet behind it that should also have VPN access,
# use the subdirectory \"ccd\" for client-specific
# configuration files (see man page for more info).
	
# EXAMPLE: Suppose the client
# having the certificate common name \"Thelonious\"
# also has a small subnet behind his connecting
# machine, such as <a class=\"linkification-ext\" title=\"Linkification: http://192.168.40.128/255.255.255.248\" href=\"http://192.168.40.128/255.255.255.248\">192.168.40.128/255.255.255.248</a>.
# First, uncomment out these lines:
;client-config-dir ccd
;route 192.168.40.128 255.255.255.248
	
# Then create a file ccd/Thelonious with this line:
#   iroute 192.168.40.128 255.255.255.248
# This will allow Thelonious' private subnet to
# access the VPN.  This example will only work
# if you are routing, not bridging, i.e. you are
# using \"dev tun\" and \"server\" directives.
	
# EXAMPLE: Suppose you want to give
# Thelonious a fixed VPN IP address of 10.9.0.1.
# First uncomment out these lines:
;client-config-dir ccd
;route 10.9.0.0 255.255.255.252
	
# Then add this line to ccd/Thelonious:
#   ifconfig-push 10.9.0.1 10.9.0.2
	
# Suppose that you want to enable different
# firewall access policies for different groups
# of clients.  There are two methods:
# (1) Run multiple OpenVPN daemons, one for each
#     group, and firewall the TUN/TAP interface
#     for each group/daemon appropriately.
# (2) (Advanced) Create a script to dynamically
#     modify the firewall in response to access
#     from different clients.  See man
#     page for more info on learn-address script.
;learn-address ./script
	
# If enabled, this directive will configure
# all clients to redirect their default
# network gateway through the VPN, causing
# all IP traffic such as web browsing and
# and DNS lookups to go through the VPN
# (The OpenVPN server machine may need to NAT
# or bridge the TUN/TAP interface to the internet
# in order for this to work properly).
;push \"redirect-gateway def1 bypass-dhcp\"
	
# Certain Windows-specific network settings
# can be pushed to clients, such as DNS
# or WINS server addresses.  CAVEAT:
# <a class=\"linkification-ext\" title=\"Linkification: http://openvpn.net/faq.html#dhcpcaveats\" href=\"http://openvpn.net/faq.html#dhcpcaveats\">http://openvpn.net/faq.html#dhcpcaveats</a>
# The addresses below refer to the public
# DNS servers provided by opendns.com.
;push \"dhcp-option DNS 208.67.222.222\"
;push \"dhcp-option DNS 208.67.220.220\"
	
# Uncomment this directive to allow different
# clients to be able to \"see\" each other.
# By default, clients will only see the server.
# To force clients to only see the server, you
# will also need to appropriately firewall the
# server's TUN/TAP interface.
;client-to-client
	
# Uncomment this directive if multiple clients
# might connect with the same certificate/key
# files or common names.  This is recommended
# only for testing purposes.  For production use,
# each client should have its own certificate/key
# pair.
#
# IF YOU HAVE NOT GENERATED INDIVIDUAL
# CERTIFICATE/KEY PAIRS FOR EACH CLIENT,
# EACH HAVING ITS OWN UNIQUE \"COMMON NAME\",
# UNCOMMENT THIS LINE OUT.
;duplicate-cn
	
# The keepalive directive causes ping-like
# messages to be sent back and forth over
# the link so that each side knows when
# the other side has gone down.
# Ping every 10 seconds, assume that remote
# peer is down if no ping received during
# a 120 second time period.
keepalive 10 120
	
# For extra security beyond that provided
# by SSL/TLS, create an \"HMAC firewall\"
# to help block DoS attacks and UDP port flooding.
#
# Generate with:
#   openvpn --genkey --secret ta.key
#
# The server and each client must have
# a copy of this key.
# The second parameter should be '0'
# on the server and '1' on the clients.
;tls-auth ta.key 0 # This file is secret
	
# Select a cryptographic cipher.
# This config item must be copied to
# the client config file as well.
;cipher BF-CBC        # Blowfish (default)
;cipher AES-128-CBC   # AES
;cipher DES-EDE3-CBC  # Triple-DES
	
# Enable compression on the VPN link.
# If you enable it here, you must also
# enable it in the client config file.
comp-lzo
	
# The maximum number of concurrently connected
# clients we want to allow.
;max-clients 100
	
# It's a good idea to reduce the OpenVPN
# daemon's privileges after initialization.
#
# You can uncomment this out on
# non-Windows systems.
;user nobody
;group nogroup
	
# The persist options will try to avoid
# accessing certain resources on restart
# that may no longer be accessible because
# of the privilege downgrade.
persist-key
persist-tun
	
# Output a short status file showing
# current connections, truncated
# and rewritten every minute.
status openvpn-status.log
	
# By default, log messages will go to the syslog (or
# on Windows, if running as a service, they will go to
# the \"\Program Files\OpenVPN\log\" directory).
# Use log or log-append to override this default.
# \"log\" will truncate the log file on OpenVPN startup,
# while \"log-append\" will append to it.  Use one
# or the other (but not both).
;log         openvpn.log
<span style=\"color: #ff0000;\">log-append  /var/log/openvpn.log</span>
	
# Set the appropriate level of log
# file verbosity.
#
# 0 is silent, except for fatal errors
# 4 is reasonable for general usage
# 5 and 6 can help to debug connection problems
# 9 is extremely verbose
verb 3
	
# Silence repeating messages.  At most 20
# sequential messages of the same message
# category will be output to the log.
;mute 20</pre>
	</blockquote>
	<p>Natürlich ist die Konfiguration noch lange nicht optimiert und ermöglicht noch nicht alles, was ich mir als Ziel gesetzt habe.  Mit einem</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>openvpn start</pre></div></div>

	<p>starten wir den Server. Um zu schauen, ob alles funktioniert schauen wir uns zuerst die  Datei <code>/var/log/openvpn.log</code> an</p>
	<blockquote>
	<pre>Wed Jun  3 23:26:18 2009 OpenVPN 2.1_rc11 i486-pc-linux-gnu [SSL] [LZO2] [EPOLL] [PKCS11] built on Sep 18 2008
Wed Jun  3 23:26:18 2009 Diffie-Hellman initialized with 1024 bit key
Wed Jun  3 23:26:18 2009 WARNING: file '/etc/ssl/private/vpn.domain.de-key.pem' is group or others accessible
Wed Jun  3 23:26:18 2009 /usr/bin/openssl-vulnkey -q -b 1024 -m &lt;modulus omitted&gt;
Wed Jun  3 23:26:18 2009 TLS-Auth MTU parms [ L:1542 D:138 EF:38 EB:0 ET:0 EL:0 ]
Wed Jun  3 23:26:18 2009 ROUTE default_gateway=180.190.200.1
Wed Jun  3 23:26:18 2009 TUN/TAP device tun0 opened
Wed Jun  3 23:26:18 2009 TUN/TAP TX queue length set to 100
Wed Jun  3 23:26:18 2009 /sbin/ifconfig tun0 10.8.0.1 pointopoint 10.8.0.2 mtu 1500
Wed Jun  3 23:26:18 2009 /sbin/route add -net 10.8.0.0 netmask 255.255.255.0 gw 10.8.0.2
Wed Jun  3 23:26:18 2009 Data Channel MTU parms [ L:1542 D:1450 EF:42 EB:135 ET:0 EL:0 AF:3/1 ]
Wed Jun  3 23:26:18 2009 Socket Buffers: R=[129024-&gt;131072] S=[129024-&gt;131072]
Wed Jun  3 23:26:18 2009 UDPv4 link local (bound): [undef]:1194
Wed Jun  3 23:26:18 2009 UDPv4 link remote: [undef]
Wed Jun  3 23:26:18 2009 MULTI: multi_init called, r=256 v=256
Wed Jun  3 23:26:18 2009 IFCONFIG POOL: base=10.8.0.4 size=62
Wed Jun  3 23:26:18 2009 IFCONFIG POOL LIST
Wed Jun  3 23:26:18 2009 Initialization Sequence Completed</pre>
	</blockquote>
	<p>Damit steht unser Server schon mal und in einem <a href="http://controlc.de/2009/06/09/mac-openvpn-und-tunnelblick/">weiteren Beitrag</a> zeige ich, wie man sich mit einem Client verbindet.
</p>
]]></content:encoded>
			<wfw:commentRss>http://controlc.de/2009/06/03/debian-openvpn-server-einrichten/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>debian &#124; Webseiten auf Deutsch</title>
		<link>http://controlc.de/2009/05/27/debian-webseiten-auf-deutsch/</link>
		<comments>http://controlc.de/2009/05/27/debian-webseiten-auf-deutsch/#comments</comments>
		<pubDate>Wed, 27 May 2009 10:35:41 +0000</pubDate>
		<dc:creator>controlc.de</dc:creator>
				<category><![CDATA[allgemeine IT]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[deutsch]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[locale]]></category>

		<guid isPermaLink="false">http://controlc.de/?p=537</guid>
		<description><![CDATA[Öfter hat man Web-Applikationen, welche man in der Default-Sprache konfigurieren kann. Leider klappt das nicht immer, d.h. man stellt zwar die Sprache ein, aber es bleibt alles in Englisch. Ein Möglichkeit ist, das sich einige Applikationen auf die locale–Einstellungen des Servers verlassen. Um herauszubekommen, ob unsere Server überhaupt Deutsch versteht gibt man locale -a ein. [...]]]></description>
			<content:encoded><![CDATA[	<p>Öfter hat man Web-Applikationen, welche man in der Default-Sprache konfigurieren kann. Leider klappt das nicht immer, d.h. man stellt zwar die Sprache ein, aber es bleibt alles in Englisch. Ein Möglichkeit ist, das sich einige Applikationen auf die <em>locale</em>–Einstellungen des Servers verlassen.<br />
<span id="more-537"></span><br />
Um herauszubekommen, ob unsere Server überhaupt Deutsch versteht gibt man</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">locale <span style="color: #660033;">-a</span></pre></div></div>

	<p>ein. Sollte die Ausgabe</p>
	<p><code>C<br />
POSIX<br />
</code></p>
	<p>sein, dann ist klar, warum das nicht funktioniert. Ein</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> locales</pre></div></div>

	<p>Und dann als Auswahl</p>
	<p style="text-align: center;"><a href="http://controlc.de/wp-content/uploads/2009/05/debian-locales.png" class="floatbox" rev="group:537 caption:`debian-locales`"><img class="size-full wp-image-538 aligncenter" title="debian-locales" src="http://controlc.de/wp-content/uploads/2009/05/debian-locales.png" alt="debian-locales" width="361" height="409" /></a></p>
	<p style="text-align: center;">
	<p style="text-align: center;">
	<p>Nach einem Neustart von <em>apache2</em> mit</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>apache2 restart</pre></div></div>

	<p>sollte dann alles in Deutsch sein.
</p>
]]></content:encoded>
			<wfw:commentRss>http://controlc.de/2009/05/27/debian-webseiten-auf-deutsch/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>debian &#124; postfix und relay_recipient_maps vom Exchange (II)</title>
		<link>http://controlc.de/2009/05/25/debian-postfix-und-relay_recipient_maps-vom-exchange-ii/</link>
		<comments>http://controlc.de/2009/05/25/debian-postfix-und-relay_recipient_maps-vom-exchange-ii/#comments</comments>
		<pubDate>Mon, 25 May 2009 10:00:58 +0000</pubDate>
		<dc:creator>controlc.de</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[spamschutz]]></category>

		<guid isPermaLink="false">http://controlc.de/?p=474</guid>
		<description><![CDATA[Weiter gehts im schnellen Lauf, denn der Teddy gibt nicht auf Hier der versprochene zweite Teil zum Thema postfix und relay_recipient_maps vom Exchange. Nachdem wir nun nahezu automatisch die Liste aller gültigen Empfänger auf das Mail-Gateway kopieren können, müssen wir nun die Liste so aufbereiten, das postfix damit etwas anfangen kann. Bisher sieht die Liste [...]]]></description>
			<content:encoded><![CDATA[	<p><em>Weiter gehts im schnellen Lauf, denn der Teddy gibt nicht auf <img src='http://controlc.de/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
</em></p>
	<p><em>Hier der versprochene zweite Teil zum Thema <a href="http://controlc.de/2009/05/24/debian-postfix-und-relay_recipient_maps-vom-exchange-i/">postfix und relay_recipient_maps vom Exchange</a>.</em></p>
	<p>Nachdem wir nun nahezu automatisch die Liste aller gültigen Empfänger auf das Mail-Gateway kopieren können, müssen wir nun die Liste so aufbereiten, das postfix damit etwas anfangen kann.</p>
	<p>Bisher sieht die Liste in etwa so aus:</p>
	<blockquote><p>dn: CN=Administrator,CN=Users,DC=example,DC=de<br />
changetype: add<br />
proxyAddresses: SMTP:Administrator@example.de<br />
proxyAddresses: X400:c=DE;a= ;p=EXAMPLE;o=Exchange;s=Administrator;</p></blockquote>
	<p><span id="more-474"></span><br />
So kann man die Liste natürlich nicht an postfix geben. Wenn man sich dann die Liste genau anschaut, dann findet man viele Einträge von EMail-Adressen, die der Exchange selber benötigt und die man nicht über das Mail-Gateway erreichbar machen muß. Es müssen also folgende Dinge gemacht werden:</p>
	<ol>
	<li>Löschen der unnötigen Zeilen.</li>
	<li>Aufbereiten der Textdatei</li>
	<li>Hinzufügen des Kommandos OK zu jeder Zeile</li>
	<li>Löschen der unbenötigten Emailadressen</li>
	</ol>
	<p>Dazu verwenden wir das Script von <a href="http://www.postfix-buch.com/download/extract_e3k_recipients.tar.gz">postfix-buch.com</a>. Leider hat sich in dem Script ein kleiner Fehler eingeschlichen <img src='http://controlc.de/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> . Das Original-Script sieht so aus:</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># Extract all Adresses that start with SMTP or smtp from</span>
<span style="color: #666666; font-style: italic;"># an Active Directory export, but omit those that are listed in blacklist</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">\&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> , \\n<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> \; \\n <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> -F\: <span style="color: #ff0000;">'/(SMTP|smtp):/ {printf(&quot;%s\tOK\n&quot;,$2)}'</span> <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: #660033;">-f</span> blacklist <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$2</span></pre></div></div>

	<p>Wenn man sich das Script aus dem Buch anschaut, dann findet man schnell den Fehler — nach der Korrektur sieht das Script so aus:</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
<span style="color: #666666; font-style: italic;"># Extract all Adresses that start with SMTP or smtp from</span>
<span style="color: #666666; font-style: italic;"># an Active Directory export, but omit those that are listed in blacklist</span>
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">\&quot;</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> , \\n<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tr</span> \; \\n <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> -F\: <span style="color: #ff0000;">'/^proxyAddresses: (SMTP|smtp):/ {printf(&quot;%s\tOK\n&quot;,$3)}'</span> <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: #660033;">-f</span> blacklist <span style="color: #000000; font-weight: bold;">&amp;</span>gt; <span style="color: #007800;">$2</span></pre></div></div>

	<p>Die Email-Adressen, welche man nicht in der Tabelle haben möchte, schreibt man in eine Datei <code>blacklist</code>. Meine <code>blacklist</code> sieht so aus:</p>
	<blockquote><p>SystemMailbox<br />
Administrator<br />
Default<br />
exchangeV1<br />
globalevents<br />
internal<br />
KontaktevonEXAMPLE<br />
EXAMPLE<br />
EXAMPLE-Archiv<br />
OABVersion2<br />
OABVersion3a<br />
Offlineadressbuch-firstadministrativegroup<br />
PublicFolder08275515@example.de<br />
PublicFolder94568143@example.de<br />
schema-root</p></blockquote>
	<p>Wenn man jetzt das Script ausführt</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>extract_valid_recipient <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>exchange<span style="color: #000000; font-weight: bold;">/</span>recipient.txt <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>exchange<span style="color: #000000; font-weight: bold;">/</span>relay_recipient</pre></div></div>

	<p>So sieht das Ergebnis (<code>less /home/exchange/relay_recipients</code>)  dann so aus:</p>
	<blockquote><p>user1@example.de^M         OK<br />
useruser2@example.de^M         OK<br />
user2@example.de^M         OK<br />
Administrator@example.de^M         OK</p></blockquote>
	<p>Wie man sieht hat debian Probleme mit dem DOS-Zeilenumbruch. Um diesen Unix-Konform geradezubiegen installiert man sich das Paket <em>tofrodos</em>, welches den Befehl <em>dos2unix</em> mit sich bringt.</p>
	<p><span style="text-decoration: line-through;">Mit einem</span><br />
<span style="text-decoration: line-through;">dos2unix relay_recipients</span><br />
<span style="text-decoration: line-through;">wandelt man die Liste um und Voilá!</span></p>
	<p>Das ist natürlich falsch. Man muß die DOS-Zeilenumbrüche in der Original-Datei <em>recipient.txt</em> schon löschen und kann anschließend die Datei durch den Filter schicken.</p>
	<p>(Wer es komplizierter mag, der nehme den Befehl <em>flip</em>. Eine Erklärung dazu findet er <a href="http://www.debianadmin.com/flip-convert-text-file-line-endings-between-unix-and-dos-formats.html">hier</a>.)</p>
	<p>Jetzt wandeln wir die Datei in eine Postfix-Datenbank um</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">postmap <span style="color: #7a0874; font-weight: bold;">hash</span>:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>exchange<span style="color: #000000; font-weight: bold;">/</span>relay_recipients</pre></div></div>

	<p>und kopieren wir die Datei in das postfix-Verzeichnis</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>home<span style="color: #000000; font-weight: bold;">/</span>exchange<span style="color: #000000; font-weight: bold;">/</span>relay_recipients.db <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>relay_recipients.db</pre></div></div>

	<p>Wichtig ist der Hinweis im Buch, das die Datenbank-Datei im Home-Verzeichnis unseres exchange-Users erstellt und anschließend kopiert wird, da es beim Fehlschlagen des <em>postmap</em>–Befehls ansonsten keine <code>relay_recipients.db</code> im postfix-Verzeichnis geben und Postfix seinen Betrieb einstellen würde.</p>
	<p>Eingebunden in postfix wird es mit einem Eintrag in der /etc/postfix/main.cf</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">relay_recipient_maps = <span style="color: #7a0874; font-weight: bold;">hash</span>:<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>relay_recipients</pre></div></div>

	<p>Jetzt kann man, wenn man es möchte, natürlich das Ganze noch automatisieren und in Scripte packen, dazu noch als Taskplaner/cron ausführen lassen. Aber das kommt später.
</p>
]]></content:encoded>
			<wfw:commentRss>http://controlc.de/2009/05/25/debian-postfix-und-relay_recipient_maps-vom-exchange-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>debian &#124; postfix und relay_recipient_maps vom Exchange (I)</title>
		<link>http://controlc.de/2009/05/24/debian-postfix-und-relay_recipient_maps-vom-exchange-i/</link>
		<comments>http://controlc.de/2009/05/24/debian-postfix-und-relay_recipient_maps-vom-exchange-i/#comments</comments>
		<pubDate>Sun, 24 May 2009 10:52:48 +0000</pubDate>
		<dc:creator>controlc.de</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[putty]]></category>
		<category><![CDATA[spamschutz]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://controlc.de/?p=451</guid>
		<description><![CDATA[Nachdem ich im Kapitel »Mail-Gateways« aus dem Buch Postfix — Einrichtung, Betrieb und Wartung gelesen habe, wie man eine Empfängerliste auf dem Exchange exportiert und in postfix einbindet habe ich mich mal dran gemacht das zu realisieren. Die Bemühungen kommen daher, das regelmäßig Versuche gestartet werden auf die Email-Adresse micha AT makomi DE einzuliefern — [...]]]></description>
			<content:encoded><![CDATA[	<p>Nachdem ich im Kapitel »Mail-Gateways« aus dem Buch <a href="http://www.postfix-buch.com/">Postfix — Einrichtung, Betrieb und Wartung</a> gelesen habe, wie man eine Empfängerliste auf dem Exchange exportiert und in postfix einbindet habe ich mich mal dran gemacht das zu realisieren. Die Bemühungen kommen daher, das regelmäßig Versuche gestartet werden auf die Email-Adresse micha AT makomi DE einzuliefern — eine Adresse die bei mir gar nicht existiert. Nachdem ich mal die Suchmaschine meines Vertrauens mit der »ominösen« Emailadresse gefüttert habe war klar: Da hat jemand die Adresse in einem Forum angegeben und die Betreiber hat nix Besseres zu tun, als die Profile öffentlich zu machen.<br />
<span id="more-451"></span><br />
Nun, eine erste Mail an den Admin hat keine Reaktion vorgerufen, also selber nach Lösungen suchen. Die Lösung steht in dem obigen Buch — übrigens sehr zu empfehlen.</p>
	<p>Jetzt aber zur Realisierung:</p>
	<p>Zuerst muß auf dem Exchange die aktuelle Email-Adressenliste generiert werden. Die Daten sind schon alle im Active Directory vorhanden, man muß sie da nur rausbekommen. Das geht mit Boardmitteln, aber der Reihe nach. Als Erstes lohnt es sich für den Austausch der Listen ein eigenes Verzeichnis anzulegen:</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> c:\mailgw</pre></div></div>

	<p>Dann wird die Liste extrahiert:</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ldifde <span style="color: #660033;">-m</span> <span style="color: #660033;">-n</span> <span style="color: #660033;">-g</span> <span style="color: #660033;">-f</span> <span style="color: #ff0000;">&quot;C:\Mailgw<span style="color: #000099; font-weight: bold;">\r</span>ecipient.txt&quot;</span> <span style="color: #660033;">-r</span> <span style="color: #ff0000;">&quot;(mailnickname=*)&quot;</span> <span style="color: #660033;">-l</span> proxyAddresses</pre></div></div>

	<p>Ein kurze Erklärung zu den Parametern:</p>
	<blockquote><p>–g              Deaktiviert die seitenweise Suche.<br />
–m              Aktiviert die SAM-Logik beim Export.<br />
–n              Exportiert keine Binärwerte.<br />
–f Dateiname    Dateiname für die Eingabe bzw. Ausgabe.<br />
–r Filter       LDAP-Suchfilter (Standard: »(objectClass=*)«).<br />
–l Liste        Liste der Attribute (durch Komma getrennt), nach denen bei<br />
der LDAP-Suche gesucht wird.</p></blockquote>
	<p>Das Komplizierteste ist nun der Datenaustausch vom Exchange-Server zum Mail-Gateway. Um dies zu bewältigen muß man dem Exchange-Server zuerst beibringen, wie man per Secure Copy (kurz SCP) Dateien verschicken kann. Es gibt verschiedene Programme dafür, am bekanntesten ist aber als Kommandozeilentool <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">PuTTYs PSCP</a>. Wir benötigen die beiden Programme <em>pscp.exe</em> und <em>puttygen.exe</em>.</p>
	<p>Nun legen wir zuerst auf dem debian-Server einen neuen Benutzer an, der nur für den Transfer der Listen auf das Mail-Gateway verantwortlich ist:</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">useradd <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>exchange<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #660033;">-m</span> exchange</pre></div></div>

	<p>Im Gegensatz zu den Angaben im Buch mußte ich bei debian Lenny das Homeverzeichnis explizit mit angeben, da Lenny anscheinend das nicht selbstständig anlegt.</p>
	<p>Nachdem der Benutzer existiert geben wir ihm zuerst einmal ein Passwort:</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">passwd</span> exchange</pre></div></div>

	<p>Anschließend generieren wir ein SSH-Schlüsselpaar, damit der Dateitransfer ohne die Eingabe von Passwörtern erfolgen kann:</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">su</span> - exchange
<span style="color: #7a0874; font-weight: bold;">cd</span> ~
<span style="color: #c20cb9; font-weight: bold;">ssh-keygen</span> <span style="color: #660033;">-t</span> rsa</pre></div></div>

	<p>Bei der Nachfrage nach einer Passphrase bitte nix eingeben. Nur wenn hier kein Passwort eingegeben wird, kann der Dateiaustausch wirklich vollautomatisch erfolgen.</p>
	<pre>Generating public/private rsa key pair.
Enter file in which to save the key (/home/exchange/.ssh/id_rsa):
Created directory '/home/exchange/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/exchange/.ssh/id_rsa.
Your public key has been saved in /home/exchange/.ssh/id_rsa.pub.
The key fingerprint is:
ba:90:03:e8:06:20:5f:30:00:52:a9:11:c6:2e:ae:10 exchange@example.de
The key's randomart image is:
+--[ RSA 2048]----+
|&amp;+..             |
|=*.              |
|.o+              |
|.+ +             |
|. o +   S        |
|E. . . o         |
|..    =          |
|o      +         |
|.     .          |
+-----------------+</pre>
	<p>Es werden nun zwei neue Dateien im Unterverzeichnis <em>.ssh</em> erstellt: <em>id_rsa</em> und<em> id_rsa.pub</em></p>
	<p>Damit der Server weiß, das der Benutzer <em>exchange</em> mit Hilfe von Schlüsseln auf den Server zugreifen darf, muß man noch den Inhalt der Datei <em>id_rsa</em> an die Datei <em>~/.ssh/authorized_keys</em> angehängt werden. Dazu gibt man</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">cat</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa.pub <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> ~<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>authorized_keys</pre></div></div>

	<p>ein und gibt mit</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">644</span> authorized_keys</pre></div></div>

	<p>der Datei die richtigen Rechte.</p>
	<p>Nun muß der private Schlüssel des Paares auf einem sicheren Weg zum Exchange-Server kommen. Dazu nutzen wir gleich die <em>pscp.exe</em>.</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pscp exchange<span style="color: #000000; font-weight: bold;">@</span>mail.example.de:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>exchange<span style="color: #000000; font-weight: bold;">/</span>.ssh<span style="color: #000000; font-weight: bold;">/</span>id_rsa .</pre></div></div>

	<p>Ich denke der Syntax ist klar. Natürlich müssen wir uns jetzt mit einem Passwort authentifizieren — genau mit dem, welches wir oben vergeben haben.</p>
	<p>Um die Schlüsseldatei nutzen zu können müssen wir sie in ein PuTTY-verträgliches Format wandeln. Dazu nutzen wir die von PuTTY mitgelieferte <em>puttygen.de</em></p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">puttygen c:\mailgw\id_rsa</pre></div></div>

	<p>es öffnet sich eine GUI</p>
	<p><a href="http://controlc.de/wp-content/uploads/2009/05/puttygen-1.png" class="floatbox" rev="group:451 caption:`puttygen-1`"><img class="alignnone size-full wp-image-468" title="puttygen-1" src="http://controlc.de/wp-content/uploads/2009/05/puttygen-1.png" alt="puttygen-1" width="266" height="150" /></a></p>
	<p>Nach eine Klick auf OK öffnet sich der PuTTY Key Generator-Dialog:</p>
	<p><a href="http://controlc.de/wp-content/uploads/2009/05/puttygen-2.png" class="floatbox" rev="group:451 caption:`puttygen-2`"><img class="alignnone size-medium wp-image-469" title="puttygen-2" src="http://controlc.de/wp-content/uploads/2009/05/puttygen-2-300x287.png" alt="puttygen-2" width="300" height="287" /></a></p>
	<p>Hier kann man im Feld <em>Key comment</em> dem konvertierten Schlüssel einen Namen wegen und anschließend <em>Save private key</em> drücken.</p>
	<p><a href="http://controlc.de/wp-content/uploads/2009/05/puttygen-3.png" class="floatbox" rev="group:451 caption:`puttygen-3`"><img class="alignnone size-full wp-image-470" title="puttygen-3" src="http://controlc.de/wp-content/uploads/2009/05/puttygen-3.png" alt="puttygen-3" width="260" height="117" /></a></p>
	<p>Aufgrund der leeren Passphrase wird hier eine Warnung ausgegeben, was aber ok ist.</p>
	<p>Nun können wir mit dem eben erstellten/konvertierten Key eine verschlüsselte Verbindung zu unserem Mail-Gateway aufnehmen</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">pscp <span style="color: #660033;">-i</span> mail.example.de.ppk recipient.txt exchange<span style="color: #000000; font-weight: bold;">@</span>mail.example.de:<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>exchange<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

	<p>Nachdem das geklappt hat, können wir dem Benutzer <em>exchange</em> auf dem Mail-Gateway das Passwort wegnehmen — dann ist ein einloggen nur noch mit dem Key möglich.</p>
	
<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">usermod <span style="color: #660033;">-L</span> exchange</pre></div></div>

	<p><em><strong>Weiter geht es im <a href="http://controlc.de/2009/05/25/debian-postfix-und-relay_recipient_maps-vom-exchange-ii/">zweiten Teil</a><span style="text-decoration: line-through;">, der demnächst erscheint</span>.</strong></em>
</p>
]]></content:encoded>
			<wfw:commentRss>http://controlc.de/2009/05/24/debian-postfix-und-relay_recipient_maps-vom-exchange-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

