<?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>Allen Pomeroy &#187; server</title>
	<atom:link href="http://www.pomeroy.us/tag/server/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.pomeroy.us</link>
	<description>IT security thoughts and personal stuff</description>
	<lastBuildDate>Sat, 28 Jan 2012 08:55:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WordPress notes for pomeroy.us</title>
		<link>http://www.pomeroy.us/2011/09/wordpress-notes-for-pomeroy-us/</link>
		<comments>http://www.pomeroy.us/2011/09/wordpress-notes-for-pomeroy-us/#comments</comments>
		<pubDate>Sat, 17 Sep 2011 19:09:48 +0000</pubDate>
		<dc:creator>apomeroy</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.networkforensics.us/?p=390</guid>
		<description><![CDATA[Production site is www.networkforensics.us (or www.pomeroy.us) Development site is dev.networkforensics.us (or dev.pomeroy.us) Assumptions: - webserver root directory is /var/web - production node is called prod - development node is called dev - WordPress database is called wpdb Procedure to copy production WordPress instance to the development node: 1. Copy webserver www root dir via a [...]]]></description>
			<content:encoded><![CDATA[<p>Production site is www.networkforensics.us (or www.pomeroy.us)<br />
Development site is dev.networkforensics.us (or dev.pomeroy.us)</p>
<p>Assumptions:<br />
- webserver root directory is  /var/web<br />
- production node is called  prod<br />
- development node is called  dev<br />
- WordPress database is called  wpdb</p>
<p>Procedure to copy production WordPress instance to the development node:<br />
1. Copy webserver www root dir via a tarball<br />
<code>tar czf prod-20110909.tgz /var/web</code></p>
<p>2. Dump the WordPress database to a MySQL dmp file:<br />
<code>mysqldump -u$mysqluser -p$mysqlpass wpdb | \<br />
&nbsp;gzip -c > prod-20110909.dmp.gz</code></p>
<p>3. Copy these two backup files to the dev node:<br />
<code>scp prod-20110909* user@dev:.</code></p>
<p>On the development node:<br />
4. Unpack the webserver tarball:<br />
<code>mv /var/web /var/web.previous<br />
cd /<br />
tar xzvf prod-20110909.tgz</code></p>
<p>5. Drop the WordPress database and restore the new version:<br />
<code>mysql> drop database wpdb;<br />
mysql> create database wpdp;<br />
$ gunzip prod-20110909.dmp.gz<br />
$ mysql -u$mysqluser -p wpdb < prod-20110909.dmp</code></p>
<p>6. Update the WordPress 'siteurl' and 'home' options to point to the development node:<br />
<code>update wp_options set option_value='http://dev.pomeroy.us' where option_name='siteurl';<br />
update wp_options set option_value='http://dev.pomeroy.us' where option_name='home';</code></p>
<p>Should be all done!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pomeroy.us/2011/09/wordpress-notes-for-pomeroy-us/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a new PVR</title>
		<link>http://www.pomeroy.us/2011/02/building-a-new-pvr/</link>
		<comments>http://www.pomeroy.us/2011/02/building-a-new-pvr/#comments</comments>
		<pubDate>Wed, 23 Feb 2011 21:16:02 +0000</pubDate>
		<dc:creator>apomeroy</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mythtv]]></category>
		<category><![CDATA[pvr]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.networkforensics.us/?p=234</guid>
		<description><![CDATA[&#60;Updated Aug 18, 2011 after a successful PVR rollout&#62; Technology has evolved since the last MythTV PVR I built, as chronicled here.  Here&#8217;s the latest techniques and tech that I&#8217;ve used to (start) build(ing) my current PVR. I&#8217;ll update this article as I go, as there&#8217;s been some bumps along the way, so completion of [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><em><strong>&lt;Updated Aug 18, 2011 after a successful PVR rollout&gt;</strong><br />
</em></p>
<p>Technology has evolved since the last MythTV PVR I built, as chronicled <a href="http://www.networkforensics.us/2009/05/how-to-build-a-mythtv-pvr-on-fedora-core-7/">here</a>.  Here&#8217;s the latest techniques and tech that I&#8217;ve used to (start) build(ing) my current PVR. I&#8217;ll update this article as I go, as there&#8217;s been some bumps along the way, so completion of the project has been slower than I anticipated.</p>
<p>Requirements for my new PVR include:</p>
<ul>
<li>Linux operating system for cost and flexibility reasons</li>
<li>Quiet! Fan-less operation if at all possible, external power supply ok</li>
<li>Small form factor, black case to fit in with my current home theater gear</li>
<li>Video capture with MPEG-2 hardware acceleration to help keep the CPU needed as small as possible, in an expansion card format for the most compact physical footprint .. additionally there must be at least two independent tuners</li>
<li>Analog tuners, but would be good if they were capable of digital for when I eventually move to digital/HD</li>
<li>IR receiver and transmitter capability for easy remote control and ability of the PVR to use my current set-top box as a source (gives me all the cable company movies and channels that are not available via the basic cable connection</li>
<li>Ability to schedule at least 10 shows and retain 5 episodes of each show .. also ability to schedule based on show name alone</li>
<li>Ability to perform post-recording processing, such as removing commercials or changing formats</li>
<li>Should be able to use a pre-packaged distribution for most if not all of the functions .. I know it&#8217;s a home-brew, but I&#8217;m tired of messing with individual packages, firmware, and custom codes to make it work. Using a distribution package makes it easier to maintain through updates.</li>
<li>Want to purchase the parts from the same supplier if possible (ended up using <a href="http://www.newegg.ca">newegg.ca</a>)</li>
</ul>
<p>Since I already run MythTV, it was an obvious starting point and given I don&#8217;t have an affinity to a specific Linux distribution, I looked at Mythbuntu and Mythdora since I&#8217;m familiar with and already run both Ubuntu and Fedora distributions.</p>
<p>After downloading the Mythbuntu 10.10 ISO disk image, I discovered I didn&#8217;t have my USB DVD drive, so I wanted to create a bootable USB flash disk.  I followed the excellent instructions at <a href="https://help.ubuntu.com/community/Installation/FromUSBStick">https://help.ubuntu.com/community/Installation/FromUSBStick</a> and successfully burned a bootable Mythbuntu disk on a 2GB USB flash disk via a Ubuntu VM running on my MacBook Pro.</p>
<p><a href="http://www.networkforensics.us/wp-content/uploads/2011/01/ISK_QC1.jpg"><img class="alignright size-medium wp-image-238" title="ISK-300-65" src="http://www.networkforensics.us/wp-content/uploads/2011/01/ISK_QC1-300x300.jpg" alt="" width="300" height="300" /></a><strong>The Hardware</strong></p>
<p>The hardware that I chose to use included:</p>
<ul>
<li>An <a title="Antec ISK-300-65" href="http://www.antec.com/pdf/manuals/ISK%20300-65%20Manual_EN.pdf">Antec ISK-300-65</a> case, good for fan-less operation</li>
<li>ASUS AT5IONT-I mainboard dual core Atom D525 CPU</li>
<li>Hauppauge WinPVR-2250 dual tuner PVR card with MPEG-2 hardware acceleration (PCI-express)</li>
<li>4GB DDR3 SO-DIMM memory (2x 2GB)</li>
<li>2x 750GB 2.5&#8243; SATA HDDs</li>
<li>My existing Microsoft MCE USB IR receiver/blaster and remote</li>
</ul>
<p>I evaluated the very cool and potentially high performance hybrid HDD/SSD disks, but there were too many experiences users expressed that were sub-optimal, most stating the technology is too new. Having a terabyte 2.5&#8243; disk with 4GB of SSD would be sweet, but for now I&#8217;m just sticking with 750GB 7200RPM 2.5&#8243; SATA disks. Since I changed my mind and I&#8217;m not going to put a DVD drive into the case, I chose to put another HDD in and mirror them up (since there are two SATA adapters on the mainboard and space in the case for two HDD).</p>
<p>The ASUS mainboard is designed for fan-less operations, and coupled with the Antek case as one massive heat sink, it is incredibly quiet. Video outputs are all handled by the mainboard versus the video capture card and include DVI, HDMI and component video outputs. On initial power on, I was somewhat <a href="http://www.networkforensics.us/wp-content/uploads/2011/02/IMG_1281.jpg"><img class="alignright size-full wp-image-266" title="ISK-rear-view" src="http://www.networkforensics.us/wp-content/uploads/2011/02/IMG_1281.jpg" alt="" width="224" height="300" /></a>underwhelmed, since although the power on button turned on the blue power light on the mainboard, then spun up the disk and fan, no joy on the mainboard BIOS POST. After some Googling, I found the Asus board uses the very finicky Intel memory controller that is used with the Atom CPU. I purchased a pair of KVR1066D3S7/1G (Kingston 1GB 204-Pin DDR3 SO-DIMM DDR3 1066 (PC3 8500) Laptop Memory) to boot the AT5IONT-I far enough to get the BIOS updated. See the forum thread <a href="http://vip.asus.com/forum/view.aspx?SLanguage=en-us&amp;id=20100817160043390&amp;board_id=1&amp;model=AT5IONT-I&amp;page=1&amp;count=33">here</a> for other people&#8217;s experiences. Version 312 of the ASUS BIOS did not support the 2GB DIMMs so I was a bit annoyed that I had to purchase 1GB DIMMs (Kingston KVR1066D3S7/1G) in order to get into the BIOS.  I downloaded the 316 BIOS ROM image from the ASUS website and put it onto a FAT formatted USB memory stick, thinking I&#8217;d have to go through the pain of booting some form of Windows or DOS to run some lame BIOS updater utility. I was pleasantly surprised to find a BIOS update utility built into the BIOS! All I had to do is plug in the USB stick and select the option to update the BIOS. It worked! Not only the most painless BIOS update I&#8217;ve ever done, now the 2GB memory DIMMs work (anyone want to buy my 1GB DIMMs for the cost of shipping?). On to the installation of Mythbuntu.</p>
<p>I originally wanted to have a slim DVD drive to play DVDs but then realized that I don&#8217;t even have any movies on DVD any more.  All the oldie goldies that I had, I now have copies in iTunes. Since the mainboard only supports two SATA interfaces, I chose to reserve one for a future redundant HDD (as it turns out I just ordered the extra disk when I purchased the 1GB DIMMs).</p>
<p>The Hauppauge card is a dual-tuner analog/digital that has an IR receiver and blaster &#8211; so it can change channels on a cable set top box. The 2250 also has dual tuners so that the conflicts that I often encountered with a single tuner can be avoided.  <a href="http://www.networkforensics.us/wp-content/uploads/2011/01/hvr2250.jpg"><img class="alignright size-medium wp-image-241" title="hvr2250" src="http://www.networkforensics.us/wp-content/uploads/2011/01/hvr2250-300x156.jpg" alt="" width="300" height="156" /></a></p>
<p><strong>OS Install</strong></p>
<p>I tried a couple of All-In-One distributions (Mythdora and Mythbuntu) and even a couple of versions of each.  Seemed like I ran into issues with both distros in different areas. Mythbuntu 10.10 wouldn&#8217;t save the Video Sources. Mythdora had a better setup interface than Mythbuntu 10.10, but would not setup a default route for some reason &#8211; all the subsequent updates and package installs would obviously fail.  Sigh. Doing a base install of Fedora 14 then installing from ATrpm repositories would go better for the OS install (including full mdadm mirroring of the two SATA drives), but compiling the Hauppauge HVR 2250 analog driver from Steve Toth&#8217;s excellent support site would fail with usb_ function call mismatch errors. Apparently the usb_ memory function definitions have changed in recent 2.6 kernels. Arrrg!</p>
<blockquote><p><strong><em>Fortunately I set this aside for a while and in the mean time, Mythbuntu came out with release 11.04 &#8230; would it work??</em></strong></p></blockquote>
<p>So now it works for analog .. exactly what I wanted. Ironically I don&#8217;t need the digital tuners for a while yet.</p>
<p><span id="more-234"></span>Here&#8217;s how:</p>
<p>I downloaded Mythbuntu 11.04 64 bit ISO and created bootable USB flashdrive via<br />
<a title="Pen Drive Linux" href="http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3">http://www.pendrivelinux.com/universal-usb-installer-easy-as-1-2-3</a> on my HP notebook (Windows 7). Booted off the USB and selected the Install option. Ultimately I wanted to partition the drives and use mdadm software RAID 1 with LVM2 on top for partition and filesystem management options. No matter how I tried, the Mythbuntu 11.04 installer just would not let me do an install in that configuration. So I did a vanilla install, configured things the way I wanted THEN did a transition to LVM2 mirroring setup.</p>
<p><strong>1. Use USB stick to boot Mythbuntu 11.04 and perform MythTV install</strong><br />
Use the following partition table on /dev/sda with all primary partitions and ignore /dev/sdb for now &#8211; note you&#8217;ll need to use /srv for the MythTV storage fs as those are the mount point options available in the install image. Don&#8217;t worry, we&#8217;ll change it later to /storage and only /dev/sda1 (/boot) will remain after we&#8217;re done the conversion to LVM mirroring.<br />
<code>/dev/sda1 /boot 150MB<br />
/dev/sda2 / 8GB<br />
/dev/sda3 swap 8GB<br />
/dev/sda4 /srv 630GB</code></p>
<p>Once the install is done, change the /srv filesystem to /storage and make it owned by user mythtv then create the storage directories that MythTV will use for LiveTV and Recordings.<br />
<code>umount /srv<br />
vi /etc/fstab (change /srv to /storage)<br />
mkdir /storage<br />
mount /storage<br />
mkdir /storage/livetv<br />
mkdir /storage/recordings<br />
mkdir /storage/db_backups<br />
chown mythtv:mythtv /storage/*</code></p>
<p><strong>2. Compile V4L code</strong><br />
Install tools needed to get and build the code<br />
<code>apt-get install git patch patchutils libproc-processtable-perl gcc make</code></p>
<p>Get the code base and build it &#8211; based on the forum post &#8220;<a href="http://www.linuxtv.org/wiki/index.php/How_to_Obtain,_Build_and_Install_V4L-DVB_Device_Drivers">How to Obtain, Build and Install V4L-DVB Device Drivers</a>&#8221;<br />
<code>git clone git://linuxtv.org/media_build.git<br />
cd media_build<br />
./build<br />
sudo make install<br />
</code></p>
<p><strong>3. Download HVR 2250 firmware and install in /lib/firmware</strong><br />
<code>wget http://www.steventoth.net/linux/hvr22xx/firmwares/4019072/NXP7164-2010-03-10.1.fw<br />
sudo cp NXP7164-2010-03-10.1.fw /lib/firmware</code></p>
<p>I found that the HVR 2250 card wasn&#8217;t completely recognized even with the firmware in place, as seen in dmesg output .. and no /dev/video* or /dev/dvb/&#8230; devices were created. Googling found a <a href="http://ubuntuforums.org/archive/index.php/t-1526513.html">few forum posts</a> that discuss the issue .. the solution: create /etc/modprobe.d/saa7164.conf and force a card selection.</p>
<p><code>Jun 23 22:17:54 pvr kernel: [10.642158] saa7164 driver loaded<br />
Jun 23 22:17:54 pvr kernel: [10.642321] saa7164 0000:07:00.0: PCI INT A -&gt; GSI 19 (level, low) ...<br />
Jun 23 22:17:54 pvr kernel: [10.643371] saa7164[0]: Your board isn't known (yet) to the driver.<br />
Jun 23 22:17:54 pvr kernel: [10.643376] saa7164[0]: Try to pick one of the existing card configs via<br />
Jun 23 22:17:54 pvr kernel: [10.643380] saa7164[0]: card=&lt;n&gt; insmod option.  Updating to the latest<br />
Jun 23 22:17:54 pvr kernel: [10.643384] saa7164[0]: version might help as well.<br />
Jun 23 22:17:54 pvr kernel: [10.643395] saa7164[0]: Here are valid choices for the card=&lt;n&gt; insmod option:<br />
Jun 23 22:17:54 pvr kernel: [10.643403] saa7164[0]:    card=0 -&gt; Unknown<br />
Jun 23 22:17:54 pvr kernel: [10.643410] saa7164[0]:    card=1 -&gt; Generic Rev2<br />
Jun 23 22:17:54 pvr kernel: [10.643417] saa7164[0]:    card=2 -&gt; Generic Rev3<br />
Jun 23 22:17:54 pvr kernel: [10.643424] saa7164[0]:    card=3 -&gt; Hauppauge WinTV-HVR2250</code></p>
<p>To set a card number option, create a modprobe directive file /etc/modprobe.d/saa7164.conf<br />
<code>options saa7164 card=3</code></p>
<p>Now reboot and watch the dmesg output to ensure the firmware is loaded properly<br />
<code>Aug 18 19:31:29 pvr1 kernel: [24.480644] saa7164 driver loaded<br />
Aug 18 19:31:29 pvr1 kernel: [24.480891] saa7164 0000:07:00.0: PCI INT A -&gt; GSI 19 (level, low) ...<br />
Aug 18 19:31:29 pvr1 kernel: [24.490973] CORE saa7164[0]: subsystem: 0070:8891, board: Hauppauge WinTV-HVR2250 [card=3,insmod option]<br />
Aug 18 19:31:29 pvr1 kernel: [24.490992] saa7164[0]/0: found at 0000:07:00.0, rev: 129, irq: 19, latency: 0, mmio: 0xfb800000<br />
Aug 18 19:31:29 pvr1 kernel: [24.700362] saa7164_downloadfirmware() Waiting for firmware upload (NXP7164-2010-03-10.1.fw)<br />
Aug 18 19:31:29 pvr1 kernel: [27.153217] saa7164_downloadfirmware() firmware read 4019072 bytes.<br />
Aug 18 19:31:29 pvr1 kernel: [27.153227] saa7164_downloadfirmware() firmware loaded.<br />
Aug 18 19:31:29 pvr1 kernel: [27.153257] saa7164_downloadfirmware() SecBootLoader.FileSize = 4019072<br />
Aug 18 19:31:29 pvr1 kernel: [27.153269] saa7164_downloadfirmware() FirmwareSize = 0x1fd6<br />
Aug 18 19:31:29 pvr1 kernel: [27.153276] saa7164_downloadfirmware() BSLSize = 0x0<br />
Aug 18 19:31:29 pvr1 kernel: [27.153282] saa7164_downloadfirmware() Reserved = 0x0<br />
Aug 18 19:31:29 pvr1 kernel: [27.153289] saa7164_downloadfirmware() Version = 0x1661c00<br />
Aug 18 19:31:29 pvr1 kernel: [27.304006] Modules linked in: nvidia(P+) snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel(+) ir_lirc_codec lirc_dev ir_mce_kbd_decoder ir_sony_decoder snd_hda_codec ir_jvc_decoder snd_hwdep snd_pcm snd_seq_midi rc_rc6_mce psmouse ir_rc6_decoder ir_rc5_decoder mceusb serio_raw snd_rawmidi ir_nec_decoder joydev snd_seq_midi_event rc_core snd_seq saa7164(+) snd_timer snd_seq_device snd xhci_hcd asus_atk0110 dvb_core v4l2_common videodev media v4l2_compat_ioctl32 tveeprom soundcore snd_page_alloc lp parport usbhid hid ahci r8169 libahci<br />
Aug 18 19:31:35 pvr1 kernel: [34.380040] saa7164_downloadimage() Image downloaded, booting...<br />
Aug 18 19:31:35 pvr1 kernel: [34.490037] saa7164_downloadimage() Image booted successfully.<br />
Aug 18 19:31:36 pvr1 kernel: [36.830033] saa7164_downloadimage() Image downloaded, booting...<br />
Aug 18 19:31:38 pvr1 kernel: [38.270702] saa7164_downloadimage() Image booted successfully.<br />
Aug 18 19:31:38 pvr1 kernel: [38.996628] DVB: registering new adapter (saa7164)<br />
Aug 18 19:31:38 pvr1 kernel: [38.999488] saa7164[0]: registered device video0 [mpeg]<br />
Aug 18 19:31:39 pvr1 kernel: [39.231624] saa7164[0]: registered device video1 [mpeg]<br />
Aug 18 19:31:39 pvr1 kernel: [39.443888] saa7164[0]: registered device vbi0 [vbi]<br />
Aug 18 19:31:39 pvr1 kernel: [39.444038] saa7164[0]: registered device vbi1 [vbi]<br />
</code></p>
<p><strong>4. Run MythTV Backend setup, use IVTV MPEG driver and /dev/video0, /dev/video1</strong><a href="http://www.networkforensics.us/wp-content/uploads/2011/02/mythtv-backend-setup1.png"><img class="alignright size-medium wp-image-316" title="mythtv-backend-setup1" src="http://www.networkforensics.us/wp-content/uploads/2011/02/mythtv-backend-setup1-300x228.png" alt="" width="300" height="228" /></a></p>
<p>This configuration will result in the NTSC (analog) tuners to function with MythTV by initializing the tuner as an &#8220;IVTV MPEG-2 Encoder&#8221; defined for /dev/video0 and /dev/video1.</p>
<p><em>&lt;I&#8217;ll post an update here for each of the backend setup steps, but for now follow the setup steps in order starting with General&gt;</em></p>
<p>Under Storage, change the default directories for Recordings, LiveTV and Database Backups to the directories you created in step 1.</p>
<p><strong>5. Setup mail transport agent so we can send status email</strong><br />
<code>apt-get install postfix bsd-mailx</code></p>
<p>Since I locate the PVR behind a firewall on a residential Internet connection, I choose &#8220;Internet connected with Smart (Relay) host&#8221;<br />
<code>shawmail.cg.shawcable.net</code></p>
<p><strong>6. Fix up some of the annoying outstanding problems</strong></p>
<p><strong>Arrow Buttons Repeat</strong></p>
<p>For some reason, the Windows Media Center remote control IR codes are working but arrow button presses cause double movements. Huh? Ok, Google solves it:</p>
<p>MCE remote menu entries skipping twice for every button push<br />
<a href="http://www.mythtv.org/wiki/MCE_Remote#Arrow_Buttons_Repeat">http://www.mythtv.org/wiki/MCE_Remote#Arrow_Buttons_Repeat</a></p>
<p>When navigating the menus in MythTV, it may appear that each time you hit the up or down arrow, that the button his hit twice but if you are using irw, the button only appears to be pressed once. This is likely caused by another kernel module that is attempting to treat the MCE remote as a keyboard. As a test try unloading a few modules<br />
<code>modprobe -r ir_rc6_decoder<br />
modprobe -r rc_rc6_mce<br />
modprobe -r ir_rc5_decoder</code></p>
<p>Since this solved the problem, the post author suggests the following command on system boot (in /etc/rc.local)<br />
<code>echo lirc &gt; /sys/class/rc/rc0/protocols</code></p>
<p><strong>Audio Pauses and Stutters</strong></p>
<p>Turns out the default 4096 buffer size is too small for this system, so I increase it to 16384 (trial and error).</p>
<p>Put these lines in /etc/rc.local:</p>
<p><code># prevent Arrow Button repeat<br />
echo lirc &gt; /sys/class/rc/rc0/protocols<br />
# increase of audio buffer - from 4096 default to 16384<br />
echo 16384 | tee /proc/asound/card0/pcm1p/sub0/prealloc</code></p>
<p><strong>7. Setup the Disk Mirroring</strong></p>
<p>I&#8217;m not going to use mdadm (dang it!) because mdadm (3.1.4) breaks initramfs (<a title="mdadm broken" href="http://ubuntuforums.org/showthread.php?t=1744498">forum posts here</a>). People upgrading Ubuntu to the &#8220;natty&#8221; release experienced this behavior where initramfs could not mount /root. For now I&#8217;ll use LVM2 to do the mirroring of</p>
<p>/<br />
swap<br />
/storage</p>
<p>but /boot will still be a standalone ext4 partition and filesystem on /dev/sda1. For recovery if /dev/sda dies, I&#8217;ll partition /dev/sdb the same and keep /dev/sdb1 in sync with /dev/sda1 &#8211; as well as have grub install a boot loader on both /dev/sda and /dev/sdb.  With the Asus AT5IONT-I mainboard, you can designate which SATA disk is the &#8220;Primary&#8221; and which is the &#8220;Secondary&#8221;. Worst case, if /dev/sda dies the Secondary drive can be manually mapped to the Primary disk (/dev/sda). Whew. A lot of extra work because mdadm is broken!</p>
<p><strong>7.1. Install the lvm2 package</strong></p>
<p><code>apt-get install lvm2</code></p>
<p><strong>7.2. Partition the second drive with the desired end state</strong></p>
<p><code>fdisk /dev/sdb</code></p>
<p>primary partition 1, 150M, <strong>set active</strong>, partition type flags &#8220;83&#8243; (normal Linux fs)<br />
primary partition 2, rest of the disk, partition type flags &#8220;fd&#8221; (Linux logical volume)</p>
<p><strong>7.3. Setup the first LVM partition for pvr on /dev/sdb</strong></p>
<p><code># initialize the LVM volume<br />
pvcreate /dev/sdb2<br />
pvdisplay /dev/sdb2<br />
# create the volume group<br />
vgcreate rootvg /dev/sdb2<br />
# create the logical volumes (with extents from one physical disk)<br />
lvcreate -L 8G -n lv_root rootvg<br />
lvcreate -L 8G -n lv_swap rootvg<br />
lvcreate -L 650G -n lv_storage rootvg</code></p>
<p>This gives us the volumes we&#8217;ll use in our final configuration. Go ahead a get the filesystem contents copied across to the new LVM volumes.</p>
<p><code># create the filesystems<br />
mkfs.ext4 /dev/rootvg/lv_root<br />
mkfs.ext4 /dev/rootvg/lv_storage<br />
mkswap /dev/rootvg/lv_swap<br />
# copy the old fs to new fs<br />
mkdir /mnt/root<br />
mount /dev/rootvg/lv_root /mnt/root<br />
cd /<br />
find . -xdev -print | cpio -pmd /mnt/root<br />
umount /mnt/root<br />
mkdir /mnt/storage<br />
mount /dev/rootvg/lv_storage /mnt/storage<br />
cd /storage<br />
find . -xdev -print | cpio -pmd /mnt/storage<br />
umount /mnt/storage</code></p>
<p><strong>7.4. Update boot configuration to use LVM root volume</strong></p>
<p>Copy the /dev/sda1 /boot filesystem to /dev/sdb1 for a backup in case something goes horribly wrong, you&#8217;ll at least have a starting point to recover.</p>
<p>To update GRUB to use the LVM device, add <code>GRUB_DEVICE=/dev/mapper/rootvg-lv_root</code><br />
to /etc/default/grub and disable the UUID volume label tracking by uncommenting the <code>GRUB_DISABLE_LINUX_UUID=true</code> line.</p>
<p>Update the /boot/grub/grub.cfg by running<br />
<code>cp /boot/grub/grub.cfg /boot/grub/grub.cfg.orig<br />
update-grub -o /boot/grub/grub.cfg</code><br />
You should see update-grub detect the original boot env on /dev/sda1 (/boot) with a root of /dev/sda2 (where we configured /) and you should also see it detect the new root environment on /dev/mapper/rootvg-lv_root.</p>
<p>Then install the grub boot environment on /dev/sda and optionally /dev/sdb. Note /dev/sdb will not have a boot block or env loaded yet, so no worries about having to save what might be there.<br />
<code>grub-install /dev/sda<br />
grub-install /dev/sdb</code></p>
<p>Update the /etc/fstab to swing the filesystems over to the LVM volumes &#8211; update the device specs from their UUID labels to /dev/mapper/rootvg-lv_root, /dev/mapper/rootvg-lv_swap and /dev/mapper/rootvg-lv_storage<br />
<code>cp /etc/fstab /etc/fstab.orig<br />
vi /etc/fstab</code></p>
<p>It should look something like<br />
<code># / was on /dev/sda2 during installation<br />
#UUID=fc0fa1e9-e2b6-4d11-9a51-d3c432bb3137 / ext4 errors=remount-ro 0 1<br />
/dev/mapper/rootvg-lv_root / ext4 errors=remount-ro 0 1<br />
# leave /boot alone<br />
/dev/sda1 /boot ext4 defaults 0 2<br />
# /storage was on /dev/sda4 during installation<br />
#UUID=131514d2-3911-45df-8d6f-b9a19f2379bb /storage ext4 defaults 0 2<br />
/dev/mapper/rootvg-lv_storage /storage ext4 errors=remount-ro 2<br />
# swap was on /dev/sda3 during installation<br />
#UUID=eedc9a3b-d957-4904-988e-32b117def5ac none swap sw 0 0<br />
/dev/mapper/rootvg-lv_swap none swap sw 0 0</code></p>
<p>This is the nail-biting time, now reboot. When GRUB comes up and shows you the boot environments, select the normal boot Ubuntu Linux with the root on /dev/mapper/rootvg-lv_root.</p>
<p><strong>7.5. Extend the LVM to use /dev/sda</strong><br />
Now we&#8217;re running on the LVM volumes on /dev/sdb, we want to reclaim the plain 0&#215;83 Linux filesystem partitions off /dev/sda and add them to the rootvg volume group then extend each logical volume so it has a mirror on /dev/sda.</p>
<p><code># delete /dev/sda2, /dev/sda3, /dev/sda4 partitions<br />
# add /dev/sda2 as the remaining disk, toggle the partition<br />
# type flags to 0xfd (Linux LVM)<br />
fdisk /dev/sda</code></p>
<p>Now clear the first few blocks of /dev/sda2 since it will still have a Linux ext4 filesystem signature on it and we don&#8217;t want to confuse LVM.<br />
<code>dd if=/dev/zero of=/dev/sda2 count=100</code></p>
<p>Extend the volume group to include /dev/sda2 and add a mirror onto each logical volume.</p>
<p><code># initialize the /dev/sda2 partition for LVM<br />
pvcreate /dev/sda2<br />
pvdisplay /dev/sda2<br />
# extend the volume group to include /dev/sda2<br />
vgextend rootvg /dev/sda2<br />
vgdisplay -v<br />
# now extend each logical volume to /dev/sda2<br />
lvconvert -m1 --mirrorlog core /dev/rootvg/lv_root /dev/sda2<br />
lvconvert -m1 --mirrorlog core /dev/rootvg/lv_swap /dev/sda2<br />
lvconvert -m1 --mirrorlog core /dev/rootvg/lv_storage /dev/sda2</code></p>
<p>Let this run for a while, the system will be very busy syncing (re-silvering) the physical extents on /dev/sdb2 to /dev/sda2.</p>
<p>Side note: If something messes up and you need to remove the /dev/sda2 or /dev/sdb2 volume, or if you need to tear down the lvm2 setup (such as to remove or play around with RAID volumes), use</p>
<p><code>lvremove /dev/mapper/rootvg-lv_root<br />
vgremove rootvg<br />
pvremove /dev/sdb2</code></p>
<p>so you don&#8217;t have problems with residual signatures when you try to initialize the LVM volume group an physical devices again.</p>
<p><strong>7.6. Update /boot on /dev/sdb</strong></p>
<p><code>mount /dev/sdb1 /mnt/boot<br />
cd /boot<br />
find . -print | cpio -pvmd /mnt/boot<br />
umount /mnt/boot</code></p>
<p>Now you should be able to boot off either /dev/sda or /dev/sdb.</p>
<p><strong>8. Remaining issues</strong><br />
Despite turning off the screen saver, the HDMI to TV output dims occasionally and I&#8217;m pretty sure it&#8217;s not my Sony Bravia that&#8217;s doing it.</p>
<p>Audio is still a pain in the butt &#8211; I&#8217;m using the analog audio out on the Asus mainboard into a pair of Audio Engine speakers to get audio, since I think the HDMI driver needs to be changed to support audio over HDMI. I&#8217;m using the Open Source video driver instead of the nVidia and I think that&#8217;s the culprit. No time to test it right now though.</p>
<p><strong>Update:</strong><br />
Tried out a LVM volume extend for the /storage filesystem:</p>
<p><code>df -h /storage</code><br />
Filesystem Size Used Avail Use% Mounted on<br />
/dev/mapper/rootvg-lv_storage<br />
669G 70G 565G 11% /storage</p>
<p><code>vgdisplay</code><br />
&#8212; Volume group &#8212;<br />
VG Name rootvg<br />
System ID<br />
Format lvm2<br />
Metadata Areas 2<br />
Metadata Sequence No 11<br />
VG Access read/write<br />
VG Status resizable<br />
MAX LV 0<br />
Cur LV 3<br />
Open LV 3<br />
Max PV 0<br />
Cur PV 2<br />
Act PV 2<br />
VG Size 1.36 TiB<br />
PE Size 4.00 MiB<br />
Total PE 357628<br />
Alloc PE / Size 355728 / 1.36 TiB<br />
Free PE / Size <strong>1900 / 7.42 GiB</strong><br />
VG UUID JwB28k-Eeg6-HNq0-Ghdn-r4db-mNqd-fZWYfG</p>
<p>Since vgdisplay shows we have free space (7GB), issue the <code>lvextend</code> command:<br />
<code>lvextend -L +1G /dev/rootvg/lv_storage</code><br />
Extending 2 mirror images.<br />
Extending logical volume lv_storage to 679.78 GiB<br />
Logical volume lv_storage successfully resized</p>
<p>After extending the logical volume, we can extend the filesystem. We will extend the fs while it&#8217;s mounted, since the current versions of resize2fs allow online extension or shrinkage.</p>
<p><code>resize2fs /dev/mapper/rootvg-lv_storage</code><br />
resize2fs 1.41.14 (22-Dec-2010)<br />
Filesystem at /dev/mapper/rootvg-lv_storage is mounted on /storage; on-line resizing required<br />
old desc_blocks = 43, new_desc_blocks = 43<br />
Performing an on-line resize of /dev/mapper/rootvg-lv_storage to 178200576 (4k) blocks.<br />
The filesystem on /dev/mapper/rootvg-lv_storage is now 178200576 blocks long.</p>
<p>Yay! LVM sure makes fs and volume manipulation easy.</p>
<p><code>df -h /storage</code><br />
Filesystem Size Used Avail Use% Mounted on<br />
/dev/mapper/rootvg-lv_storage<br />
670G 70G 566G 11% /storage</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pomeroy.us/2011/02/building-a-new-pvr/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MySQL Notes</title>
		<link>http://www.pomeroy.us/2010/11/mysql-notes/</link>
		<comments>http://www.pomeroy.us/2010/11/mysql-notes/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 18:13:30 +0000</pubDate>
		<dc:creator>apomeroy</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.networkforensics.us/?p=159</guid>
		<description><![CDATA[MySQL Command Line and Configuration Notes Drop tables with wildcard: There are multiple ways to specify MySQL credentials, this is not the best, but simply an example of how to drop tables using a wildcard pattern. In this case, command line history such as .bash_history will store your MySQL username and password plaintext, and an [...]]]></description>
			<content:encoded><![CDATA[<p><strong>MySQL Command Line and Configuration Notes</strong></p>
<p><strong>Drop tables with wildcard:</strong></p>
<p>There are multiple ways to specify MySQL credentials, this is not the best, but simply an example of how to drop tables using a wildcard pattern. In this case, command line history such as .bash_history will store your MySQL username and password plaintext, and an extended process listing will also reveal both username and password. When run from the command line like this, the SQL commands and the credentials are not stored in the MySQL history file (.mysql_history).  On closed (private) systems, the risk is low, especially if you clean up after these maintenance activities by purging the command histories.</p>
<p><code>mysql -u user -p password database -e "show tables" | grep "table_pattern_to_drop_" | awk '{print "drop table " $1 ";"}' | mysql -u user -p password database</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pomeroy.us/2010/11/mysql-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update WordPress home URL</title>
		<link>http://www.pomeroy.us/2010/11/update-wordpress-home-url/</link>
		<comments>http://www.pomeroy.us/2010/11/update-wordpress-home-url/#comments</comments>
		<pubDate>Wed, 03 Nov 2010 04:04:46 +0000</pubDate>
		<dc:creator>apomeroy</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.networkforensics.us/?p=153</guid>
		<description><![CDATA[There are times when moving or copying WordPress blogs from one server to another, the owner may want to update the URL associated with the specific site. A simple MySQL update can match the WordPress blog to a new site URL: mysql&#62; select option_value from wp_options where option_name = &#39;siteurl&#39;; +--------------------------------+ &#124; option_value&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#124; +--------------------------------+ [...]]]></description>
			<content:encoded><![CDATA[<p>There are times when moving or copying WordPress blogs from one server to another, the owner may want to update the URL associated with the specific site.</p>
<p>A simple MySQL update can match the WordPress blog to a new site URL:</p>
<p>mysql&gt; <code>select option_value from wp_options where option_name = &#39;siteurl&#39;;</code><br />
<code><br />
	+--------------------------------+<br />
	| option_value&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br />
	+--------------------------------+<br />
	| http://www.example.com |<br />
	+--------------------------------+<br />
	1 row in set (0.00 sec)</code></p>
<p>mysql&gt; <code>select option_value from wp_options where option_name = &#39;home&#39;;</code><br />
<code><br />
	+--------------------------------+<br />
	| option_value&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |<br />
	+--------------------------------+<br />
	| http://www.example.com |<br />
	+--------------------------------+<br />
	1 row in set (0.00 sec)</code></p>
<p>mysql&gt; <code>update wp_options set option_value=&#39;http://server.newsite.com&#39; where option_name=&#39;siteurl&#39;;</code><br />
<code><br />
	Query OK, 1 row affected (0.00 sec)<br />
	Rows matched: 1&nbsp; Changed: 1&nbsp; Warnings: 0</code></p>
<p>mysql&gt; <code>update wp_options set option_value=&#39;http://server.newsite.com&#39; where option_name=&#39;home&#39;;</code><br />
<code><br />
	Query OK, 1 row affected (0.00 sec)<br />
	Rows matched: 1&nbsp; Changed: 1&nbsp; Warnings: 0<br />
	&nbsp;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pomeroy.us/2010/11/update-wordpress-home-url/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>w3af web security assessment tool gets support from Rapid7</title>
		<link>http://www.pomeroy.us/2010/08/w3af-web-security-assessment-tool-gets-support-from-rapid7/</link>
		<comments>http://www.pomeroy.us/2010/08/w3af-web-security-assessment-tool-gets-support-from-rapid7/#comments</comments>
		<pubDate>Thu, 05 Aug 2010 18:05:09 +0000</pubDate>
		<dc:creator>apomeroy</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[malware]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.networkforensics.us/?p=129</guid>
		<description><![CDATA[Rapid7, which purchased the Metasploit attack framework last year, has agreed to sponsor the open source w3af web assessment and exploit project. This is fantastic news for web application development teams, since it shows the open source (and hence more affordable) tools they can use to improve the security of their applications are maturing. Websites [...]]]></description>
			<content:encoded><![CDATA[<p><a title="Rapid7" href="http://www.rapid7.com/" target="_blank">Rapid7</a>, which purchased the Metasploit attack framework last year, has agreed to sponsor the open source <a title="w3af" href="http://w3af.sourceforge.net/" target="_blank">w3af web assessment and exploit</a> project.  This is fantastic news for web application development teams, since it shows the open source (and hence more affordable) tools they can use to improve the security of their applications are maturing.</p>
<p>Websites like <a title="sectools insecure dot org" href="http://sectools.org/" target="_blank">sectools.org</a> maintain lists of various security tools and point to numerous open source web application fuzzing and testing tools, including BurpSuite, Nikto, WebScarab, Whisker and Wikto. Although each of the open source tools I use have various strengths, w3af is IMHO the first reasonable challenger to commercial web application testing tools like IBM&#8217;s AppScan.</p>
<blockquote><p><em><strong>Can we please get rid of bad input validation errors now??</strong></em></p></blockquote>
<p>For a commercial IT security professional that wants to help an internal web application development team improve the security of their applications, tools like IBM&#8217;s AppScan and Acunetix WVS can save valuable time by generating reports that include not only the vulnerable URI but also include vulnerability background information (CVSS, OWASP, WASC), the specific HTTP request/response strings and suggested code fixes. This is particularly valuable to a security architect or operations role that is pressed for time (an army of one anyone?).</p>
<p>The w3af support from Rapid7 will enable this excellent tool to mature more quickly and improves the capability for any web development team, regardless of funding, to improve their security. Can we please get rid of bad input validation errors now?? My recent thesis illustrated the downright depressing numbers of SQL injection flaws that continue to exist. With tools like w3af, there is no excuse left for web developers to press applications into production with these injection flaws that are trivial to avoid. At the very least a survey of the NIST National Vulnerability Database does show the number of SQL injection flaws starting to drop. Unfortunately they still substantially outnumber traditional memory corruption flaws such as buffer overflows.</p>
<div id="attachment_131" class="wp-caption alignright" style="width: 310px"><a href="http://www.nuclearserver.com/wp-content/uploads/2010/08/sql-buffer-v2.png"><img class="size-medium wp-image-131" title="sql-buffer-v2" src="http://www.networkforensics.us/wp-content/uploads/2010/08/sql-buffer-v2-300x245.png" alt="Explosion of SQL buffer errors" width="300" height="245" /></a><p class="wp-caption-text">Explosion of SQL buffer errors</p></div>
<p>As you can see, the story up to 2008 was pretty grim for web applications &#8211; SQL injection flaws increased by over 1,500% in the same time buffer overflow errors increased by just over 500%.</p>
<p>Although it looks like there has been a reversal of the shocking explosion of SQL injection flaws, the sheer volume of these web application flaws is astonishing .. especially since injection flaws have been around for about 10 years. Not exactly a problem that has recently snuck up on us.</p>
<p>Web developers that still turn out applications that contain SQL or command injection errors and most cross site request forgery errors are simply guilty of gross negligence.</p>
<p>Despite the web development industry knowing these errors exist and good developers designing and coding to avoid these issues, there is still a need to build sufficient forensics around externally facing (publicly accessible) applications to enable reconstruction of attacks. In my next post, I outline a summary of my thesis &#8220;Effective SQL injection attack reconstruction using network recording&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pomeroy.us/2010/08/w3af-web-security-assessment-tool-gets-support-from-rapid7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resetting WordPress user passwords</title>
		<link>http://www.pomeroy.us/2010/06/resetting-wordpress-user-passwords/</link>
		<comments>http://www.pomeroy.us/2010/06/resetting-wordpress-user-passwords/#comments</comments>
		<pubDate>Tue, 01 Jun 2010 20:23:28 +0000</pubDate>
		<dc:creator>apomeroy</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://www.networkforensics.us/?p=132</guid>
		<description><![CDATA[Resetting WordPress 3.0 user passwords can be done directly within MySQL through the following procedure.  This assumes your installation of WordPress stores user passwords in the wp_users table as MD5 hashes and the unique site prefix for all WordPress tables in MySQL is _x. Connect to the database via your favorite GUI (phpMyAdmin, Navicat) or [...]]]></description>
			<content:encoded><![CDATA[<p>Resetting WordPress 3.0 user passwords can be done directly within MySQL through the following procedure.  This assumes your installation of WordPress stores user passwords in the wp_users table as MD5 hashes and the unique site prefix for all WordPress tables in MySQL is _x.</p>
<p>Connect to the database via your favorite GUI (phpMyAdmin, Navicat) or command line with either the WordPress role account or any other MySQL user account with select and update privileges on the WordPress database:</p>
<p><code>update wp_x_users set user_pass = MD5('123abc890') where user_login = 'administrator';</code></p>
<p>This will update the password for user &#8216;administrator&#8217; to &#8217;123abc890&#8242;.  Once this has completed, either flush the wp_x_users table or exit the tool used to access the database to cause the updates to be committed.  Sign into WordPress with the new password and optionally change the password via the user interface.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.pomeroy.us/2010/06/resetting-wordpress-user-passwords/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IMAP mailstore migration .. again</title>
		<link>http://www.pomeroy.us/2009/11/imap-mailstore-migration-again/</link>
		<comments>http://www.pomeroy.us/2009/11/imap-mailstore-migration-again/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 02:47:07 +0000</pubDate>
		<dc:creator>apomeroy</dc:creator>
				<category><![CDATA[tech]]></category>
		<category><![CDATA[imap]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://www.networkforensics.us/?p=97</guid>
		<description><![CDATA[So last weekend, I discovered that Spamhaus decided it would be a good idea to place all of the public IP addresses for Slicehost (my Linux VPS hoster) into their Spamhaus block list (SBL). This covered both my slice in Dallas and the one in St. Louis &#8211; meaning an impressive chunk of inbound mail [...]]]></description>
			<content:encoded><![CDATA[<p>So last weekend, I discovered that <strong><a title="www.spamhaus.org" href="http://www.spamhaus.org/" target="_blank">Spamhaus</a></strong> decided it would be a good idea to place all of the public IP addresses for <a title="www.slicehost.com" href="http://www.slicehost.com" target="_self">Slicehost</a> (my Linux VPS hoster) into their Spamhaus block list (<a title="http://www.spamhaus.org/sbl/index.lasso" href="http://www.spamhaus.org/sbl/index.lasso">SBL</a>). This covered both my slice in Dallas and the one in St. Louis &#8211; meaning an impressive chunk of inbound mail to my domains was being trashed by the sending MTA and an even bigger chunk of my outbound mail was being outright rejected since the sending IP&#8217;s were on the SBL.  Slicehost worked hard to convince Spamhaus to recind the blocklist, so the Slicehost IP&#8217;s got moved over to the less-nasty-but-you&#8217;re-still-probably-a-spamming-dirtbag <a title="PBL" href="http://www.spamhaus.org/pbl/index.lasso" target="_blank">Policy Block list</a> (PBL) assuming affected IP owners would request to be removed from that list.</p>
<blockquote><p><em><strong>Sample query to see if you&#8217;re on any Spamhaus block list:  http://www.spamhaus.org/query/bl?ip=10.11.12.13</strong></em></p></blockquote>
<p>It seems it&#8217;s time to relinquish the care and feeding of my own Postfix mail system and turn to a hosted solution.  This means I need to migrate about 5GB of IMAP store to another site (again).  Last time I did a wholesale migration, I used <em><strong><a href="http://freshmeat.net/projects/imapsync/">imapsync</a></strong></em> to make the transition painless.  In the code example below, an SSL connection to the IMAPS server at imap-server.sourcedomain.com is made with username@sourcedomain.com and the password stored in the plaintext file secret1.  An SSL connection is made to the target system (which happens to be the server on which the imapsync tool is running, but could just as easily be another IMAPS server somewhere on a network accessible to the host where imapsync is running).  The &#8211;delete and &#8211;expunge1 arguments will clean the successfully moved messages from IMAP store #1 .. so be sure you have your messages on the target successfully!  Imapsync can be run iteratively to ensure you have got all the messages from your source.</p>
<p><code><br />
/usr/bin/imapsync \<br />
--host1 imap-server.sourcedomain.com \<br />
--ssl1 \<br />
--authmech1 LOGIN \<br />
--user1 username@sourcedomain.com --passfile1 secret1 \<br />
--host2 127.0.0.1 --user2 username@targetdomain.com --passfile2 secret2 \<br />
--ssl2 \<br />
--delete --expunge1 \<br />
--buffersize=128<br />
</code><br />
And one can use the<br />
<code><br />
--dry<br />
</code><br />
option to just test the process but not actually move any of the messages.</p>
<p>So that&#8217;s it &#8211; I&#8217;m about half way though migrating my current IMAP stores over to a hosted mail solution, so that I don&#8217;t need to keep up with the increasing level of care and feeding that running your own mail service requires.  Before I get too many darts about that .. I first started running my own personal MTA in 1995, adding spam and av filtering over time, and adding substantial redundancy (servers, sites, storage) so I could rely on it and fix things that broke as I had time rather than right when they broke (which was <em><strong>always</strong></em> at a bad time).  My new hosted solution takes over from two VPS servers running Postfix, Spamassassin, ClamAV, Greylisting with the IMAP store replicated across data centers in different states (15 minute rsyncs).  So soon, the (hopefully) last Allen Pomeroy owned and operated MTA can be turned off, while I get to work on fun stuff, rather than figuring out why my email is bouncing.  <img src='http://www.pomeroy.us/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.pomeroy.us/2009/11/imap-mailstore-migration-again/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Building a web security lab (with VMware Fusion)</title>
		<link>http://www.pomeroy.us/2009/10/building-a-web-security-lab/</link>
		<comments>http://www.pomeroy.us/2009/10/building-a-web-security-lab/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 14:28:50 +0000</pubDate>
		<dc:creator>apomeroy</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[lab]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[lvm]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[vm]]></category>

		<guid isPermaLink="false">http://www.networkforensics.us/?p=88</guid>
		<description><![CDATA[Problem: VMware machines load boot loader immediately, no BIOS banner, so can&#8217;t get into BIOS to alter boot settings. Solution: Edit the vm&#8217;s .vmx file and add the line: bios.bootDelay = "5000" which adds a 5000 millisecond (5 second) delay to the boot, or add: bios.forceSetupOnce = "TRUE" to make the VM enter the BIOS [...]]]></description>
			<content:encoded><![CDATA[<p>Problem: VMware machines load boot loader immediately, no BIOS banner, so can&#8217;t get into BIOS to alter boot settings.<br />
Solution: Edit the vm&#8217;s .vmx file and add the line:<br />
<code><br />
bios.bootDelay = "5000"<br />
</code><br />
which adds a 5000 millisecond (5 second) delay to the boot, or add:<br />
<code><br />
bios.forceSetupOnce = "TRUE"<br />
</code><br />
to make the VM enter the BIOS setup at the next boot.</p>
<p>Problem: VMware Fusion 3.0 doesn&#8217;t give a way to edit the virtual network settings via the GUI.<br />
Solution: To change the subnet used by the NAT or HostOnly networks, go root in Mac OS X and edit<br />
<code><br />
/Library/Application Support/VMware Fusion/networking<br />
</code><br />
and set the following lines to the subnets desired:<br />
<code><br />
answer VNET_1_HOSTONLY_SUBNET 192.168.35.0<br />
answer VNET_8_HOSTONLY_SUBNET 10.10.1.0<br />
</code><br />
To add additional custom isolated host only VLANs, also edit the networking file and add additional VNET definitions. There can apparently only be 8 VLANs with VLAN 1 and 8 already pre-defined.<br />
<code><br />
answer VNET_2_DHCP no<br />
answer VNET_2_HOSTONLY_NETMASK 255.255.255.0<br />
answer VNET_2_HOSTONLY_SUBNET 10.10.21.0<br />
answer VNET_2_VIRTUAL_ADAPTER yes<br />
answer VNET_3_DHCP no<br />
answer VNET_3_HOSTONLY_NETMASK 255.255.255.0<br />
answer VNET_3_HOSTONLY_SUBNET 10.10.22.0<br />
answer VNET_3_VIRTUAL_ADAPTER yes<br />
answer VNET_4_DHCP no<br />
answer VNET_4_HOSTONLY_NETMASK 255.255.255.0<br />
answer VNET_4_HOSTONLY_SUBNET 10.10.23.0<br />
answer VNET_4_VIRTUAL_ADAPTER yes<br />
</code><br />
Now create your vm with as many network interfaces as you have separate VLANs (vnet) then edit the node.vmx vm configuration file and change the interfacename.connectionType to custom, and define the VLAN (vnet) that interface will attach to:<br />
<code><br />
#ethernet0.connectionType = "nat"<br />
ethernet0.connectionType = "custom"<br />
ethernet0.vnet = "vmnet3"<br />
</code><br />
Also realize that VMware will take the .1 host address on each vmnet &#8211; so you cannot assign .1 to any of your VMs.</p>
<p>Problem: Ubuntu 9.10 persistent network configuration (stores the MAC address of network adapters), so if you copy a machine, by default Ubuntu will setup a new logical adapter (eth1) since the MAC address has changed (when you answer I Copied It in VMware).<br />
Solution: Tell VMware you copied the machine, so it will chose a unique MAC address. Boot Ubuntu into single user mode (another article on that to follow) then edit the MAC address associated with eth0.<br />
<code><br />
sudo vi /etc/udev/rules.d/70-persistent-net.rules<br />
</code><br />
find the stanza of the network interface in question (NAME=&#8221;eth0&#8243;) and set the following ATTR tag to the new MAC address:<br />
<code><br />
ATTR{address}=="new-mac-address-here"<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pomeroy.us/2009/10/building-a-web-security-lab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Technology I want to investigate</title>
		<link>http://www.pomeroy.us/2009/05/technology-i-want-to-investigate/</link>
		<comments>http://www.pomeroy.us/2009/05/technology-i-want-to-investigate/#comments</comments>
		<pubDate>Sat, 23 May 2009 18:27:37 +0000</pubDate>
		<dc:creator>apomeroy</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[financial]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[wish list]]></category>

		<guid isPermaLink="false">http://blog.networkforensics.us/?p=69</guid>
		<description><![CDATA[Citrix XenServer vmware like virtual server software &#8211; free vmotion functionality http://www.xenserver5.com/landing/FreeXS_LM/ Property management, condo management, rental property management &#8211; sourceforge http://sourceforge.net/projects/roomba/]]></description>
			<content:encoded><![CDATA[<p>Citrix XenServer vmware like virtual server software &#8211; free vmotion functionality <a href="http://www.xenserver5.com/landing/FreeXS_LM/">http://www.xenserver5.com/landing/FreeXS_LM/</a><br />
<br />
Property management, condo management, rental property management &#8211; sourceforge <a href="http://sourceforge.net/projects/roomba/">http://sourceforge.net/projects/roomba/</a><br /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pomeroy.us/2009/05/technology-i-want-to-investigate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux RAID, LVM and crypto Filesystem Notes</title>
		<link>http://www.pomeroy.us/2009/05/linux-virtual-manager-lvm-notes/</link>
		<comments>http://www.pomeroy.us/2009/05/linux-virtual-manager-lvm-notes/#comments</comments>
		<pubDate>Fri, 15 May 2009 02:47:02 +0000</pubDate>
		<dc:creator>apomeroy</dc:creator>
				<category><![CDATA[notes]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://blog.networkforensics.ca/blog/?p=21</guid>
		<description><![CDATA[LVM Notes I wanted to upgrade the disks in my Linux PVR to a 1TB pair and thus had to migrate from one existing disk (/dev/sda) to the new (/dev/sdb): 1. Add new physical disk to system 2. Partition disk to have a linux LVM partition &#8211; use flag 0x8e # fdisk /dev/sdb 3. Add [...]]]></description>
			<content:encoded><![CDATA[<p><strong>LVM Notes</strong></p>
<p>I wanted to upgrade the disks in my Linux PVR to a 1TB pair and thus had to migrate from one existing disk (/dev/sda) to the new (/dev/sdb):</p>
<p>1. Add new physical disk to system</p>
<p>2. Partition disk to have a linux LVM partition &#8211; use flag 0x8e</p>
<p># fdisk /dev/sdb</p>
<p>3. Add to LVM</p>
<p># pvcreate /dev/sdb2</p>
<p>4. Add physical LVM volume to a LVM volume group (VolGroup00)</p>
<p># vgextend /dev/VolGroup00 /dev/sdb2</p>
<p>2. Move all lvm volumes off old lvm disk</p>
<p># vgdisplay -v (look for old physical volume name)</p>
<p># pvmove /dev/olddisk      # will move all physical extents from olddisk to any available pv in the vg</p>
<p>3. Remove old disk from vg</p>
<p># vgreduce /dev/olddisk</p>
<p>4. Remove old disk from LVM</p>
<p># pvremove /dev/olddisk</p>
<p><span style="font-weight: bold;">RAID Notes</span><br />
Debian RAID setup on my PVR:<br />
/dev/md0   /boot<br />
/dev/hda1<br />
/dev/hdb1<br />
/dev/md1   /<br />
/dev/hda2<br />
/dev/hdb2<br />
/dev/md2   swap<br />
/dev/hda3<br />
/dev/hdb3<br />
/dev/md3   /data<br />
/dev/hda4<br />
/dev/hdb4</p>
<p>Show detail of RAID set:<br />
# mdadm &#8211;detail /dev/md0</p>
<p>Detach mirror member:<br />
- first mark member as bad (unless is really is bad, in which case it&#8217;ll already be marked faulty):<br />
# mdadm &#8211;set-faulty /dev/md0 /dev/hdb1<br />
- now remove it from the RAID1 set<br />
# mdadm &#8211;remove  /dev/md0 /dev/hdb1</p>
<p>To reattach member (after partitioning, or if it&#8217;s the same disk):<br />
# mdadm   /dev/md0  &#8211;add  /dev/hdb1<br />
- to watch the progress on the resync, look at /proc/mdstat<br />
# cat /proc/mdstat</p>
<p>I think now (2010/01/24) the faulty syntax is:</p>
<p>mdadm /dev/md0 &#8211;fail /dev/sdb1</p>
<p>then</p>
<p>mdadm /dev/md0 &#8211;remove /dev/sdb1</p>
<p><strong>Crypto Filesystem Notes</strong></p>
<p>Linux (2.6) crypto filesystems are supported via a loopback device. Various ciphers can be specified.  This example, default AES cipher is used and the disk partition is /dev/sdb1 &#8211; which is just setup as a normal Linux (0&#215;83) partition.</p>
<p>1. Load the crypto filesystem module</p>
<p><code>modprobe cryptoloop<br />
</code></p>
<p>2. Start the crypto device (I&#8217;ll insert initialization instructions here later)</p>
<p>Note &#8211; you don&#8217;t need losetup, if the parameters are specified in fstab and mount does the startup. When losetup runs, it will prompt for the passphrase used to encrypt the partition. Once the crypto driver has the correct key to allow on the fly encryption/decryption, then processes that use the partition see cleartext (such as mount).</p>
<p><code>losetup -e aes /dev/loop0 /dev/sdb1 || exit 1<br />
mount /bu<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.pomeroy.us/2009/05/linux-virtual-manager-lvm-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

