<?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>Ingent &#187; system administration</title>
	<atom:link href="http://www.ingent.net/category/sysadmin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ingent.net</link>
	<description></description>
	<lastBuildDate>Tue, 06 Nov 2012 10:15:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Server virtualization</title>
		<link>http://www.ingent.net/en/2012/03/server-virtualization-kvm-hetzner/</link>
		<comments>http://www.ingent.net/en/2012/03/server-virtualization-kvm-hetzner/#comments</comments>
		<pubDate>Fri, 23 Mar 2012 12:53:59 +0000</pubDate>
		<dc:creator>Lluís</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[kvm]]></category>
		<category><![CDATA[p2v]]></category>
		<category><![CDATA[shorewall]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://www.ingent.net/?p=473</guid>
		<description><![CDATA[Sorry, this entry is only available in Català.]]></description>
				<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://www.ingent.net/ca/category/sysadmin/feed/">Català</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ingent.net/en/2012/03/server-virtualization-kvm-hetzner/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(Català) Accelerar el temps de càrrega de les aplicacions RubyOnRails</title>
		<link>http://www.ingent.net/en/2012/03/catala-accelerar-el-temps-de-carrega-de-les-aplicacions-rubyonrails/</link>
		<comments>http://www.ingent.net/en/2012/03/catala-accelerar-el-temps-de-carrega-de-les-aplicacions-rubyonrails/#comments</comments>
		<pubDate>Fri, 23 Mar 2012 09:58:47 +0000</pubDate>
		<dc:creator>Lluís</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[passenger]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[ruby on rails]]></category>

		<guid isPermaLink="false">http://www.ingent.net/?p=517</guid>
		<description><![CDATA[Sorry, this entry is only available in Català.]]></description>
				<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://www.ingent.net/ca/category/sysadmin/feed/">Català</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ingent.net/en/2012/03/catala-accelerar-el-temps-de-carrega-de-les-aplicacions-rubyonrails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux desktops for windows users</title>
		<link>http://www.ingent.net/en/2012/02/linux-desktops-for-windows-ex-users/</link>
		<comments>http://www.ingent.net/en/2012/02/linux-desktops-for-windows-ex-users/#comments</comments>
		<pubDate>Tue, 28 Feb 2012 12:12:58 +0000</pubDate>
		<dc:creator>Lluís</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[internet explorer]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[migration]]></category>
		<category><![CDATA[rdp]]></category>
		<category><![CDATA[terminal server]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[wine]]></category>
		<category><![CDATA[workstation]]></category>

		<guid isPermaLink="false">http://www.ingent.net/?p=392</guid>
		<description><![CDATA[Sorry, this entry is only available in Català and Español.]]></description>
				<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://www.ingent.net/ca/category/sysadmin/feed/">Català</a> and <a href="http://www.ingent.net/es/category/sysadmin/feed/">Español</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ingent.net/en/2012/02/linux-desktops-for-windows-ex-users/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Expeditious P2V method</title>
		<link>http://www.ingent.net/en/2012/01/from-physical-to-virtual-with-dd-over-the-net/</link>
		<comments>http://www.ingent.net/en/2012/01/from-physical-to-virtual-with-dd-over-the-net/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 23:08:49 +0000</pubDate>
		<dc:creator>Lluís</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[kvm]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[p2v]]></category>
		<category><![CDATA[virtualization]]></category>

		<guid isPermaLink="false">http://www.ingent.net/?p=331</guid>
		<description><![CDATA[This is the P2V method that we used to convert a physical Linux server to a virtual machine running on KVM. It is a quick virtualization method that dumps the entire disk over the network to a new host machine. Ideally the origin server should be stopped in order to boot in rescue mode, thus&#8230;]]></description>
				<content:encoded><![CDATA[<p>This is the <a href="http://en.wikipedia.org/wiki/Physical-to-Virtual">P2V</a> method that we used to convert a physical Linux server to a virtual machine running on <a href="http://www.linux-kvm.org/">KVM</a>. It is a quick virtualization method that dumps the entire disk over the network to a new host machine.  Ideally the origin server should be stopped in order to boot in rescue mode, thus making the copy with unmounted file systems. In our scenario it was not possible to halt the physical server, and this procedure did the trick.</p>
<h2>Copy the disc</h2>
<p>At the destination server start <a href="http://en.wikipedia.org/wiki/Netcat">netcat</a> listening to a port (in this example 43333), redirecting all its input to a file. If you connect using SSH do it in a <a href="http://es.wikipedia.org/wiki/GNU_Screen">screen</a> so you can close the session.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">nc <span style="color: #660033;">-nvv</span> <span style="color: #660033;">-w30</span> <span style="color: #660033;">-l</span> <span style="color: #000000;">43333</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">gzip</span> <span style="color: #660033;">-dc</span> <span style="color: #000000; font-weight: bold;">&gt;</span> disk.raw</div></div>
<p>At the origin server use dd to dump its disk. It is then compressed and sent to the netcat at port 43333 waiting with the command above. Gzip compresses the stream and reduces the amount of data to be transferred over the net. Our disk was 72 GB and took 4 hours to 10 Mbps, via the Internet.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>cciss<span style="color: #000000; font-weight: bold;">/</span>c0d0 <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">gzip</span> <span style="color: #660033;">-c</span> <span style="color: #000000; font-weight: bold;">|</span> nc <span style="color: #660033;">-w30</span> <span style="color: #660033;">-vvn</span> your_server_address <span style="color: #000000;">43333</span></div></div>
<p>Note: The syntax of nc depends on the package you have installed. In this example it is netcat-openbsd.</p>
<h2>Review the file systems</h2>
<p>Now you have a disk image named disk.raw in the desination server. But the origin server was accessing its filesystems while dd was reading: you should run an fsck of them. If you are lucky the filesystem should not be badly damaged.</p>
<p>In Linux <a href="http://equivocation.org/node/107">you can configure a file to be treated as a device</a> assigning it to a loop device. We check the next free loop device.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">losetup <span style="color: #660033;">-f</span><br />
<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop0</div></div>
<p>Assign disk.raw to loop0 and it can be accessed using /dev/loop0</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">losetup <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop0 disk.raw</div></div>
<p>Now read loop0 partitions and create appropriate devices to access it, we use kpartx.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">kpartx <span style="color: #660033;">-av</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop0</div></div>
<p>The partitions are accessible via /dev/mapper/loop0p<em>[n]</em>. Do an fsck.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">fsck.ext3 <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>loop0p1<br />
fsck.ext3 <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>mapper<span style="color: #000000; font-weight: bold;">/</span>loop0p2<br />
...</div></div>
<p>At this point you can mount the partitions to verify that the files are indeed there and maybe fix the device names in /etc/fstab.</p>
<p>Before starting the virtual machine, you need to undo this process to prevent damage to the filesystem.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">kpartx <span style="color: #660033;">-dv</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop0<br />
losetup <span style="color: #660033;">-d</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>loop0</div></div>
<h2>Create the virtual machine</h2>
<p>Create a KVM virtual machine with disk.raw attached and try booting.</p>
<p>It may not boot because the device name of the disc may have changed and the kernel does not find the root filesystem. Using the KVM console you will have to fix the line in GRUB or LILO, correcting the root = option in the kernel line. When it finally boots remember to fix the boot loader and /etc/fstab.</p>
<p>In our case the physical device /dev/cciss/c0d0p<em>[n]</em> became /dev/hda<em>[n]</em> in the VM.</p>
<h2>Wrapping up</h2>
<p>You must configure the new virtual network interface and verify that the services work properly.</p>
<p>During the virtualization the data on the original physical server has been updated and it must be synchronized before any real server change. So stop the service within a maintenance window, sync the data and then you can change DNS zones or whatever. Downtime has been minimized.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ingent.net/en/2012/01/from-physical-to-virtual-with-dd-over-the-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Software RAID 5 recovery</title>
		<link>http://www.ingent.net/en/2011/12/linux-software-raid-5-recovery/</link>
		<comments>http://www.ingent.net/en/2011/12/linux-software-raid-5-recovery/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 18:01:11 +0000</pubDate>
		<dc:creator>David Escala</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mdadm]]></category>
		<category><![CDATA[raid]]></category>
		<category><![CDATA[raid5]]></category>

		<guid isPermaLink="false">http://www.ingent.net/?p=287</guid>
		<description><![CDATA[Sorry, this entry is only available in Català.]]></description>
				<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://www.ingent.net/ca/category/sysadmin/feed/">Català</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ingent.net/en/2011/12/linux-software-raid-5-recovery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Avoid Postfix&#8217;s backscatter with Exchange as backend</title>
		<link>http://www.ingent.net/en/2011/11/catala-evitant-el-backscatting-amb-postfix-i-exchange/</link>
		<comments>http://www.ingent.net/en/2011/11/catala-evitant-el-backscatting-amb-postfix-i-exchange/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 08:00:34 +0000</pubDate>
		<dc:creator>Lluís</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[backscatting]]></category>
		<category><![CDATA[exchange]]></category>
		<category><![CDATA[postfix]]></category>

		<guid isPermaLink="false">http://www.ingent.net/?p=229</guid>
		<description><![CDATA[Backscatter? Well, this happens when there is an spam filter in front of an MTA, but the filter don&#8217;t know which mailboxes do really exist in the MTA and which ones not. The procedure explained here is about how to tell a Postfix filter which are the recipients of an Exchange MTA and thus avoid&#8230;]]></description>
				<content:encoded><![CDATA[<p>Backscatter? Well, this happens when there is an spam filter in front of an MTA, but the filter don&#8217;t know which mailboxes do really exist in the MTA and which ones not.</p>
<p>The procedure explained here is about how to tell a Postfix filter which are the recipients of an Exchange MTA and thus avoid becoming a <a href="http://en.wikipedia.org/wiki/Backscatter_%28e-mail%29">backscatter</a></p>
<h2>What is Backscatting?</h2>
<p>When a server receives an email for an address that does not exist, it should reject it during the SMTP conversation, when the origin server is still connected. Thus the origin can inform the real sender about the problem. Otherwise, if the server accepts an email which is unable to deliver, it must generate a bounce that will be sent to the mail &#8220;From&#8221; header. Spammers manipulate the sender header of messages, and a misconfigured server ends up sending spam bounces. This type of spam is called Backscatter.</p>
<h2>Postfix in front of an Exchange</h2>
<p>In our scenario we have a Postfix MTA that receives mail, checks it with for spam, virus and other policies, and finally sends  it to a Microsoft Exchange. Since this Postfix MTA does not have mailboxes, we were accepting all mail addressed to our domains. After a while our IP was added to a blacklist for Backscatting.</p>
<p>To fix this we need to know which mailboxes exist in Exchange, in order to reject emails to recipients that does not exist.</p>
<p>The easy part is the Postfix setup, at main.cf we add <a href="http://www.postfix.org/postconf.5.html#relay_recipient_maps">relay_recipient_maps</a>, to check recipients.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">relay_domains = example.com<br />
relay_recipient_maps = hash:<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</div></div>
<p>we create /etc/postfix/relay_recipients with mailbox list, like this:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">foo<span style="color: #000000; font-weight: bold;">@</span>example.com &nbsp; &nbsp; OK<br />
bar<span style="color: #000000; font-weight: bold;">@</span>example.com &nbsp; &nbsp; OK</div></div>
<p>we need to do postmap and reload postfix</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">postmap <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>relay_recipients<br />
<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>postfix reload</div></div>
<h2>Keep the list updated</h2>
<p>We are not generating Backscatting any more, but must keep the mailbox list up to date. That list is stored in an ActiveDirectory, to get it we used <a href="http://postfix.state-of-mind.de/patrick.koetter/mailrelay/">this VBS script</a>, with some changes:</p>
<div class="codecolorer-container vb default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="vb codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #008000;">' Export all valid recipients (= proxyAddresses) into a<br />
</span><span style="color: #008000;">' file virtual.txt<br />
</span><span style="color: #008000;">'<br />
</span><span style="color: #008000;">' Ferdinand Hoffmann &amp; Patrick Koetter<br />
</span><span style="color: #008000;">' 20021100901<br />
</span><span style="color: #008000;">' Shamelessly stolen from <br />
</span><span style="color: #008000;">' http://www.microsoft.com/windows2000/techinfo/ \<br />
</span><span style="color: #008000;">' planning/activedirectory/bulksteps.asp<br />
</span><br />
<br />
<span style="color: #008000;">'Global variables<br />
</span><span style="color: #151B8D; font-weight: bold;">Dim</span> Container<br />
<span style="color: #151B8D; font-weight: bold;">Dim</span> OutPutFile<br />
<span style="color: #151B8D; font-weight: bold;">Dim</span> FileSystem<br />
<br />
<span style="color: #008000;">'Initialize global variables<br />
</span><span style="color: #151B8D; font-weight: bold;">Set</span> FileSystem = WScript.<span style="color: #E56717; font-weight: bold;">CreateObject</span>(<span style="color: #800000;">&quot;Scripting.FileSystemObject&quot;</span>)<br />
<span style="color: #151B8D; font-weight: bold;">Set</span> OutPutFile = FileSystem.CreateTextFile(<span style="color: #800000;">&quot;virtual.txt&quot;</span>, <span style="color: #00C2FF; font-weight: bold;">True</span>)<br />
<br />
<span style="color: #151B8D; font-weight: bold;">Set</span> Container=<span style="color: #E56717; font-weight: bold;">GetObject</span>(<span style="color: #800000;">&quot;LDAP://DC=example,DC=com&quot;</span>)<br />
EnumerateUsers Container<br />
<br />
<span style="color: #008000;">'Clean up<br />
</span>OutPutFile.<span style="color: #8D38C9; font-weight: bold;">Close</span><br />
<span style="color: #151B8D; font-weight: bold;">Set</span> FileSystem = <span style="color: #00C2FF; font-weight: bold;">Nothing</span><br />
<span style="color: #151B8D; font-weight: bold;">Set</span> Container = <span style="color: #00C2FF; font-weight: bold;">Nothing</span><br />
<br />
<span style="color: #008000;">'Say Finished when your done<br />
</span>WScript.Echo <span style="color: #800000;">&quot;Finished&quot;</span><br />
WScript.Quit(0)<br />
<br />
<span style="color: #008000;">'List all Users<br />
</span><span style="color: #E56717; font-weight: bold;">Sub</span> EnumerateUsers(Cont)<br />
<span style="color: #151B8D; font-weight: bold;">Dim</span> User<br />
<br />
<span style="color: #008000;">'Go through all Users and select them<br />
</span><span style="color: #8D38C9; font-weight: bold;">For</span> <span style="color: #8D38C9; font-weight: bold;">Each</span> User <span style="color: #8D38C9; font-weight: bold;">In</span> Cont<br />
<span style="color: #8D38C9; font-weight: bold;">Select</span> <span style="color: #8D38C9; font-weight: bold;">Case</span> LCase(User.Class)<br />
<br />
<span style="color: #008000;">'If you find Users and Groups<br />
</span><span style="color: #008000;">'Added groups after Милен Панков mailed me about it :)<br />
</span><span style="color: #8D38C9; font-weight: bold;">Case</span> <span style="color: #800000;">&quot;user&quot;</span>, <span style="color: #800000;">&quot;group&quot;</span><br />
&nbsp; <span style="color: #008000;">'Select all proxyAddresses<br />
</span> &nbsp;<span style="color: #151B8D; font-weight: bold;">Dim</span> Alias<br />
&nbsp; <span style="color: #8D38C9; font-weight: bold;">If</span> IsEmpty(User.proxyAddresses) <span style="color: #8D38C9; font-weight: bold;">Then</span><br />
&nbsp; &nbsp; <span style="color: #008000;">' do nothing.<br />
</span> &nbsp;<span style="color: #8D38C9; font-weight: bold;">ElseIf</span> (TypeName(User.proxyAddresses) = <span style="color: #800000;">&quot;String&quot;</span>) <span style="color: #8D38C9; font-weight: bold;">Then</span><br />
&nbsp; &nbsp; &nbsp; OutPutFile.WriteLine <span style="color: #800000;">&quot;alias: &quot;</span> &amp; User.proxyAddresses<br />
&nbsp; <span style="color: #8D38C9; font-weight: bold;">Else</span><br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">For</span> <span style="color: #8D38C9; font-weight: bold;">Each</span> Alias <span style="color: #8D38C9; font-weight: bold;">in</span> User.proxyAddresses<br />
&nbsp; &nbsp; OutPutFile.WriteLine <span style="color: #800000;">&quot;alias: &quot;</span> &amp; Alias<br />
&nbsp; &nbsp; <span style="color: #8D38C9; font-weight: bold;">Next</span><br />
&nbsp; <span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">If</span><br />
&nbsp; <br />
<span style="color: #8D38C9; font-weight: bold;">Case</span> <span style="color: #800000;">&quot;organizationalunit&quot;</span>, <span style="color: #800000;">&quot;container&quot;</span><br />
&nbsp; EnumerateUsers User<br />
<br />
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #8D38C9; font-weight: bold;">Select</span><br />
<span style="color: #8D38C9; font-weight: bold;">Next</span><br />
<span style="color: #8D38C9; font-weight: bold;">End</span> <span style="color: #E56717; font-weight: bold;">Sub</span></div></div>
<p>the script output looks like this:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">alias: smtp:foo<span style="color: #000000; font-weight: bold;">@</span>example.com<br />
alias: smtp:bar<span style="color: #000000; font-weight: bold;">@</span>example.com</div></div>
<p>the script is called daily from a scheduled task and writes the mailbox list to a file named virtual.txt<br />
To access this file from Postfix server we decided to mount its folder with cifs+autofs. We installed and configured autofs:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;"># /etc/auto.master</span><br />
<span style="color: #000000; font-weight: bold;">/</span>auto <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>auto.cifs<br />
<br />
<span style="color: #666666; font-style: italic;"># /etc/auto.cifs</span><br />
activedirectory <span style="color: #660033;">-fstype</span>=cifs,rw,<span style="color: #007800;">username</span>=Administrator,<span style="color: #007800;">domain</span>=EXAMPLE,<span style="color: #007800;">password</span>=secret &nbsp; :<span style="color: #000000; font-weight: bold;">//</span>192.168.1.17<span style="color: #000000; font-weight: bold;">/</span>spamassassin</div></div>
<p>so when accessing to /auto/activedirectory it will mount //192.168.1.17/spamassassin through samba, that&#8217;s where we left the VBS script and the virtual.txt file</p>
<p>Finally another script, called from cron, updates the relay_recipients file and restarts postfix if anything changed</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/bash</span><br />
<br />
<span style="color: #007800;">USERSFILE</span>=<span style="color: #000000; font-weight: bold;">/</span>auto<span style="color: #000000; font-weight: bold;">/</span>activedirectory<span style="color: #000000; font-weight: bold;">/</span>virtual.txt<br />
<span style="color: #007800;">TMPFILE</span>=<span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>exchangesync<span style="color: #000000; font-weight: bold;">/</span>users_exchange.txt<br />
<span style="color: #007800;">TMPFILE2</span>=<span style="color: #000000; font-weight: bold;">/</span>root<span style="color: #000000; font-weight: bold;">/</span>exchangesync<span style="color: #000000; font-weight: bold;">/</span>users_exchange.parsed<br />
<br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;--- Start: <span style="color: #780078;">`date`</span> ----------&quot;</span><br />
<br />
<span style="color: #666666; font-style: italic;"># Try to access file 10 times so autofs</span><br />
<span style="color: #666666; font-style: italic;"># have time to mount folder through samba</span><br />
<span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">seq</span> <span style="color: #000000;">1</span> <span style="color: #000000;">10</span><span style="color: #000000; font-weight: bold;">`</span>;<br />
<span style="color: #000000; font-weight: bold;">do</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$USERSFILE</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;found <span style="color: #007800;">$USERSFILE</span>&quot;</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">break</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$i</span> <span style="color: #660033;">-eq</span> <span style="color: #000000;">10</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;can't access <span style="color: #007800;">$USERSFILE</span> after 10 retries&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;------ Fi: <span style="color: #780078;">`date`</span> ----------&quot;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
&nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;can't access <span style="color: #007800;">$USERSFILE</span>, retrying...&quot;</span><br />
&nbsp; &nbsp; <span style="color: #c20cb9; font-weight: bold;">sleep</span> <span style="color: #000000;">2</span><br />
&nbsp; <span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #000000; font-weight: bold;">done</span><br />
<br />
<span style="color: #c20cb9; font-weight: bold;">cat</span> <span style="color: #007800;">$USERSFILE</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$TMPFILE</span><br />
dos2unix <span style="color: #007800;">$TMPFILE</span><br />
<span style="color: #c20cb9; font-weight: bold;">awk</span> -F: <span style="color: #ff0000;">'/alias: (SMTP|smtp):/ {printf(&quot;%s\tOK\n&quot;,$3)}'</span> <span style="color: #007800;">$TMPFILE</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sort</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$TMPFILE2</span><br />
<span style="color: #007800;">oldmd5</span>=<span style="color: #000000; font-weight: bold;">`</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>postfix<span style="color: #000000; font-weight: bold;">/</span>relay_recipients.md5<span style="color: #000000; font-weight: bold;">`</span><br />
<span style="color: #007800;">newmd5</span>=<span style="color: #000000; font-weight: bold;">`</span>md5sum <span style="color: #007800;">$TMPFILE2</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cut</span> <span style="color: #660033;">-d</span><span style="color: #ff0000;">&quot; &quot;</span> -f1<span style="color: #000000; font-weight: bold;">`</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$oldmd5</span>&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;<span style="color: #007800;">$newmd5</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;md5 differ, reloading postfix&quot;</span><br />
&nbsp; <span style="color: #c20cb9; font-weight: bold;">diff</span> <span style="color: #660033;">-b</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 <span style="color: #007800;">$TMPFILE2</span><br />
&nbsp; <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>relay_recipients <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.old<br />
&nbsp; <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #007800;">$TMPFILE2</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<br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-n</span> <span style="color: #007800;">$newmd5</span> <span style="color: #000000; font-weight: bold;">&gt;</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.md5<br />
&nbsp; <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>postmap <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>postfix<span style="color: #000000; font-weight: bold;">/</span>relay_recipients <span style="color: #000000; font-weight: bold;">&amp;&amp;</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>postfix reload<br />
<span style="color: #000000; font-weight: bold;">else</span><br />
&nbsp; <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;md5 match, not reloading postfix&quot;</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;------ End: <span style="color: #780078;">`date`</span> ----------&quot;</span><br />
<span style="color: #7a0874; font-weight: bold;">echo</span></div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ingent.net/en/2011/11/catala-evitant-el-backscatting-amb-postfix-i-exchange/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP4 and PHP5 in Debian Squeeze</title>
		<link>http://www.ingent.net/en/2011/11/php4-i-php5-debian-squeeze/</link>
		<comments>http://www.ingent.net/en/2011/11/php4-i-php5-debian-squeeze/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 09:21:08 +0000</pubDate>
		<dc:creator>Lluís</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://www.ingent.net/?p=208</guid>
		<description><![CDATA[One of out clients needs a PHP4 stack to run legacy web applications. We use Debian and we do not want to replace Squeeze&#8217;s PHP5, as many other Debian-packaged applications like squirrelmail or PhpMyAdmin need it. Our solution is to run PHP4 through fcgid. PHP4 as CGI In order to install php4-cgi we choose to&#8230;]]></description>
				<content:encoded><![CDATA[<p>One of out clients needs a PHP4 stack to run legacy web applications. We use <a href="http://www.debian.org/">Debian</a> and we do not want to replace Squeeze&#8217;s PHP5, as many other Debian-packaged applications like <a href="http://packages.debian.org/squeeze/squirrelmail">squirrelmail</a> or <a href="http://packages.debian.org/squeeze/phpmyadmin">PhpMyAdmin</a> need it. Our solution is to run PHP4 through <a href="http://packages.debian.org/squeeze/libapache2-mod-fcgid">fcgid</a>.</p>
<h2>PHP4 as CGI</h2>
<p>In order to install php4-cgi we choose to add the amazing <a href="http://snapshot.debian.org/">debian snapshots archive</a> to apt sources.list. This gives us access to old Debian packages (there are <a href="http://lists.debian.org/debian-user/2011/02/msg01045.html">other methods</a>).</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><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>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list.d<span style="color: #000000; font-weight: bold;">/</span>etch.list <br />
<span style="color: #666666; font-style: italic;"># installed from http://snapshot.debian.org/package/php4/</span><br />
deb http:<span style="color: #000000; font-weight: bold;">//</span>snapshot.debian.org<span style="color: #000000; font-weight: bold;">/</span>archive<span style="color: #000000; font-weight: bold;">/</span>debian<span style="color: #000000; font-weight: bold;">/</span>20070612T000000Z lenny main</div></div>
<p>install php4 normally</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">apt-get update</span><br />
<span style="color: #c20cb9; font-weight: bold;">apt-get install</span> php4-cgi php4-cli php4-common php4-curl php4-dev php4-domxml php4-gd php4-imap php4-mcal php4-mcrypt php4-mysql</div></div>
<p>to configure an Apache VirtualHost to use PHP4 instead of PHP5 add this configuration:</p>
<div class="codecolorer-container apache default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="apache codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;<span style="color: #000000; font-weight:bold;">VirtualHost</span> ...&gt;<br />
&nbsp; &nbsp; (...)<br />
<br />
&nbsp; <span style="color: #adadad; font-style: italic;"># PHP4</span><br />
&nbsp; &lt;<span style="color: #000000; font-weight:bold;">FilesMatch</span> <span style="color: #7f007f;">&quot;<span style="color: #000099; font-weight: bold;">\.</span>ph(p3?|tml)$&quot;</span>&gt;<br />
&nbsp; &nbsp; <span style="color: #00007f;">Options</span> ExecCGI <span style="color: #0000ff;">FollowSymLinks</span><br />
&nbsp; &nbsp; <span style="color: #00007f;">SetHandler</span> fcgid-<span style="color: #00007f;">script</span><br />
&nbsp; &nbsp; FCGIWrapper /usr/bin/php-cgi .php<br />
&nbsp; &lt;/<span style="color: #000000; font-weight:bold;">FilesMatch</span>&gt;<br />
<br />
&lt;/<span style="color: #000000; font-weight:bold;">VirtualHost</span>&gt;</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ingent.net/en/2011/11/php4-i-php5-debian-squeeze/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Optimizing Munin with tmpfs</title>
		<link>http://www.ingent.net/en/2011/10/optimitzar-munin-amb-tmpfs/</link>
		<comments>http://www.ingent.net/en/2011/10/optimitzar-munin-amb-tmpfs/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 08:31:20 +0000</pubDate>
		<dc:creator>Lluís</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[iowait]]></category>
		<category><![CDATA[munin]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[tmpfs]]></category>

		<guid isPermaLink="false">http://www.ingent.net/?p=198</guid>
		<description><![CDATA[Sorry, this entry is only available in Català.]]></description>
				<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://www.ingent.net/ca/category/sysadmin/feed/">Català</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ingent.net/en/2011/10/optimitzar-munin-amb-tmpfs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bandwith metrics with Munin and Shorewall</title>
		<link>http://www.ingent.net/en/2011/10/grafiques-amb-shorewall-i-munin/</link>
		<comments>http://www.ingent.net/en/2011/10/grafiques-amb-shorewall-i-munin/#comments</comments>
		<pubDate>Mon, 17 Oct 2011 10:27:51 +0000</pubDate>
		<dc:creator>Lluís</dc:creator>
				<category><![CDATA[system administration]]></category>
		<category><![CDATA[accounting]]></category>
		<category><![CDATA[bandwidth]]></category>
		<category><![CDATA[munin]]></category>
		<category><![CDATA[shorewall]]></category>
		<category><![CDATA[traffic]]></category>

		<guid isPermaLink="false">http://www.ingent.net/?p=170</guid>
		<description><![CDATA[Sorry, this entry is only available in Català.]]></description>
				<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://www.ingent.net/ca/category/sysadmin/feed/">Català</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ingent.net/en/2011/10/grafiques-amb-shorewall-i-munin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>(Català) Català</title>
		<link>http://www.ingent.net/en/2011/08/catala-catala-2/</link>
		<comments>http://www.ingent.net/en/2011/08/catala-catala-2/#comments</comments>
		<pubDate>Thu, 11 Aug 2011 14:52:55 +0000</pubDate>
		<dc:creator>David Escala</dc:creator>
				<category><![CDATA[system administration]]></category>

		<guid isPermaLink="false">http://www.ingent.net/?p=112</guid>
		<description><![CDATA[Sorry, this entry is only available in Català.]]></description>
				<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://www.ingent.net/ca/category/sysadmin/feed/">Català</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ingent.net/en/2011/08/catala-catala-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
