<?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>blog.deadcode.net</title>
	<atom:link href="http://blog.deadcode.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.deadcode.net</link>
	<description></description>
	<lastBuildDate>Sat, 02 Feb 2013 15:55:14 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>Rooting LG Nexus 4</title>
		<link>http://blog.deadcode.net/2012/12/29/rooting-lg-nexus-4/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rooting-lg-nexus-4</link>
		<comments>http://blog.deadcode.net/2012/12/29/rooting-lg-nexus-4/#comments</comments>
		<pubDate>Fri, 28 Dec 2012 21:29:39 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[LG]]></category>
		<category><![CDATA[Nexus]]></category>
		<category><![CDATA[Nexus 4]]></category>
		<category><![CDATA[Root]]></category>

		<guid isPermaLink="false">http://blog.deadcode.net/?p=3407</guid>
		<description><![CDATA[<p>Ok! I got my new Nexus 4 last night and now I&#8217;m rooting it! Since I had experienced rooting Nexus S and Galaxy R, I&#8217;am pretty confident to do that again to my really new phone. It is better to do it as early as possible because rooting the phone always means resetting the [...]]]></description>
			<content:encoded><![CDATA[<p>Ok! I got my new Nexus 4 last night and now I&#8217;m rooting it! Since I had experienced rooting Nexus S and Galaxy R, I&#8217;am pretty confident to do that again to my really new phone. It is better to do it as early as possible because rooting the phone always means resetting the phone to factory state.</p>
<p>Allow me to off-topic, here is my biased opinion to this new phone</p>
<ol>
<li>I really think the overall size of Nexus S is the best. Nexus 4 is way too BIG to me.</li>
<li>Nexus 4 battery life is WAY TOOOOO SCARY. </li>
<li>It is really smooth and fast, compared with my old Nexus S. Android 4.2.1 is nice and I liked all the new features yeah.</li>
</ol>
<p>Ok, back to the topic.</p>
<p>The procedures is pretty much the same as rooting nexus S indeed. My most concerns of rooting a phone are</p>
<ol>
<li>Pick the safest procedures , never get the phone bricked!</li>
<li>Only install what really needed.</li>
<li>Do not replace stock recovery so that to enjoy further OTA update.</li>
</ol>
<p>My procedures are mostly referred to <a href="http://www.cursed4eva.com/root-nexus-4/">this article</a>, and I&#8217;ve performed a NAND backup just like what I did to my Nexus S before rooting the phone. This make the rooting even more &#8216;safest&#8217;.</p>
<p><strong>Unlock bootloader</strong></p>
<ol>
<li>Download the <a href="http://forum.xda-developers.com/showthread.php?t=1995688">Nexus 4 toolkit</a> from xda developers forum.</li>
<li>Install toolkit to c:\</li>
<li>Run C:\Google Nexus 4 ToolKit\Toolkit.exe as Administrator
<ul>
<li>Do you want to check if an Update is available [type yes or no]?  <strong>no</strong>
<p><a href="http://blog.deadcode.net/wp-content/uploads/2012/12/root_nexus4_001.jpg"><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/root_nexus4_001-300x64.jpg" alt="" title="root_nexus4_001" width="300" height="64" class="alignnone size-medium wp-image-3416" /></a>
</li>
<li>What Build do you have? <strong>[1. Android 4.2]</strong>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/root_nexus4_002-300x78.jpg" alt="" title="root_nexus4_002" width="300" height="78" class="alignnone size-medium wp-image-3419" />
	</li>
<li>To install the drivers to your PC:
<ol>
<li><strong>[1. Install/Uninstall google Nexus 4 Drivers on your PC]</strong></li>
<li>Select your operation system<br />
<img src="http://blog.deadcode.net/wp-content/uploads/2012/12/root_nexus4_003-300x114.jpg" alt="" title="root_nexus4_003" width="300" height="114" class="alignnone size-medium wp-image-3421" />
</li>
<li>Select the suitable drivers to install<br />
<img src="http://blog.deadcode.net/wp-content/uploads/2012/12/root_nexus4_004-300x201.jpg" alt="" title="root_nexus4_004" width="300" height="201" class="alignnone size-medium wp-image-3422" />
</li>
<li>In case a popup appeared. Click <strong>[Install this driver software anyway]</strong></li>
</ol>
</li>
</ul>
</li>
<li>Switch on nexus 4, go to Settings / About Phone , click the <strong>[ Build number ]</strong> 7 times
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/20121230_205941-225x300.jpg" alt="" title="20121230_205941" width="225" height="300" class="alignnone size-medium wp-image-3457" />
</li>
<li>Go to Settings / Developer options
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/20121230_205952-225x300.jpg" alt="" title="20121230_205952" width="225" height="300" class="alignnone size-medium wp-image-3456" /></p>
<p> Enable <strong>[USB debugging]</strong>.</p>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/20121230_210003-225x300.jpg" alt="" title="20121230_210003" width="225" height="300" class="alignnone size-medium wp-image-3455" />
</li>
<li>Now connect the Nexus 4 to the PC. The PC will begin to install the Nexus 4 driver.</li>
<li>Go back to the Toolkit window, input &#8217;3&#8242; <strong>[3 to unlock the bootloader]</strong>
<ol>
<li>Input 1. <strong>[1. UnLock Bootloader]</strong>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/root_nexus4_005-300x93.jpg" alt="" title="root_nexus4_005" width="300" height="93" class="alignnone size-medium wp-image-3425" />
</li>
<li>Input <strong>[no.] </strong>to reboot to fastboot mode
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/root_nexus4_009-300x52.jpg" alt="" title="root_nexus4_009" width="300" height="52" class="alignnone size-medium wp-image-3451" />
</li>
<li>The phone will be rebooted. After reboot, use volumn up / down key to highlight <strong>[Yes, Unlock bootloader (may void warranty)]</strong>,<br />
	  then press power button to continue</li>
<li>use volumn up / down key to highlight the green <strong>[Start]</strong>, then<br />
	  press power button to start unlock bootloader</li>
<li>Once bootloader is unlocked, the device is resetted, you need to setup the phone<br />
	  all over again.</li>
</ol>
</li>
<li>After setup, repeat step 4 and 5 to enable <strong>usb debugging</strong> option.</li>
</ol>
<p><strong>Backup Nand</strong></p>
<ol>
<li>Power off the phone </li>
<li>Press and hold volumn down button, then power on the phone. The phone will go to fastboot mode.</li>
<li>Press volumn up key until you see the red <strong>[Restart bootloader]</strong>, then press power button once to continue.</li>
<li>After reboot, connect the usb cable.</li>
<li>Go back to Toolkit window, select <strong>[10. Boot to Custom/Stock Recovery without Permanently Flashing it]</strong>
<ol>
<li>Select <strong>[1. Boot to Clockworkmod Touch Recovery 6.0.1.9]</strong><br />
<img src="http://blog.deadcode.net/wp-content/uploads/2012/12/root_nexus4_006-300x114.jpg" alt="" title="root_nexus4_006" width="300" height="114" class="alignnone size-medium wp-image-3428" /></li>
<li>Type <strong>[yes]</strong> to continue.
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/root_nexus4_008-300x52.jpg" alt="" title="root_nexus4_008" width="300" height="52" class="alignnone size-medium wp-image-3432" /></p>
<p>   This will just boot (not flash) to CWM recovery.</li>
</ol>
</li>
<li>Select <strong>[backup and restore] </strong>option.<br />
	- Select <strong>[backup]</strong></p>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/20121230_201735-300x225.jpg" alt="" title="20121230_201735" width="300" height="225" class="alignnone size-medium wp-image-3438" /></p>
<p>   This will backup the NAND.</p>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/20121230_201756-300x225.jpg" alt="" title="20121230_201756" width="300" height="225" class="alignnone size-medium wp-image-3436" />
</li>
<li>Select <strong>[+++++Go Back+++++]</strong></li>
<li>Select <strong>[reboot system now]</strong>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/20121230_204838-225x300.jpg" alt="" title="ClockworkMod Recovery : Reboot System Now" width="225" height="300" class="alignnone size-medium wp-image-3448" />
</li>
<li>Backup <strong>/mnt/shell/emulated/clockwordmod/backup/*</strong> to your PC.</li>
</ol>
<p><strong>Root the phone</strong></p>
<ol>
<li>Go back to the Toolkit window</li>
<li>Select <strong>[4. Root/UnRoot Options]</strong>
<ol>
<li>Select <strong>[4. Boot CWM Recovery, Install Root, Busybox + Rename Restore Files]</strong>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/root_nexus4_007-300x189.jpg" alt="" title="root_nexus4_007" width="300" height="189" class="alignnone size-medium wp-image-3430" />
</li>
<li>Read the warning, make sure you meet all the requirements, then type <strong>[yes]</strong> to continue.
<p>The phone will be rebooted.
</li>
</ol>
</li>
<li>After reboot, click [<strong>install zip from sdcard]</strong>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/20121230_203610-225x300.jpg" alt="" title="20121230_203610" width="225" height="300" class="alignnone size-medium wp-image-3446" />
</li>
<li>Click <strong>[choose zip from sdcard]</strong>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/20121230_204756-225x300.jpg" alt="" title="20121230_204756" width="225" height="300" class="alignnone size-medium wp-image-3450" />
</li>
<li>Select <strong>[0]</strong>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/20121230_204651-225x300.jpg" alt="" title="20121230_204651" width="225" height="300" class="alignnone size-medium wp-image-3453" />
</li>
<li>Scroll down and select <strong>[SuperSU-0.98-Busybox-RenameRecoveryRestore.zip]</strong>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/20121230_203742-225x300.jpg" alt="" title="20121230_203742" width="225" height="300" class="alignnone size-medium wp-image-3443" />
</li>
<li>Finally click <strong>[Yes - Install Super...]</strong></li>
<li>Select <strong>[+++++Go Back+++++]</strong></li>
<li>Select <strong>[reboot system now]</strong>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2012/12/20121230_204838-225x300.jpg" alt="" title="ClockworkMod Recovery : Reboot System Now" width="225" height="300" class="alignnone size-medium wp-image-3448" />
</li>
</ol>
<p>Your phone is now rooted.</p>
<p><strong>Reference</strong></p>
<p>http://www.cursed4eva.com/root-nexus-4/</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadcode.net/2012/12/29/rooting-lg-nexus-4/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Modding Series 35 &#8211; Organizing photo by date, the automatical way</title>
		<link>http://blog.deadcode.net/2012/10/11/organizing-photo-by-date/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=organizing-photo-by-date</link>
		<comments>http://blog.deadcode.net/2012/10/11/organizing-photo-by-date/#comments</comments>
		<pubDate>Wed, 10 Oct 2012 17:59:33 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Synology]]></category>
		<category><![CDATA[DS Photo]]></category>
		<category><![CDATA[DS207+]]></category>

		<guid isPermaLink="false">http://blog.deadcode.net/?p=3386</guid>
		<description><![CDATA[<p>I am really busy babysitting lately and really don&#8217;t have the time manually organizing all the baby&#8217;s photo anymore. I used to categorizes my photo like these:</p> <p> /baby/1 months/2012-01-10 /baby/1 months/2012-01-11 . .</p> <p>What I really need now is some kind of scripts or program to do these:</p> read all photo in a [...]]]></description>
			<content:encoded><![CDATA[<p>I am really busy babysitting lately and really don&#8217;t have the time manually organizing all the baby&#8217;s photo anymore. I used to categorizes my photo like these:</p>
<blockquote><p><code><br />
/baby/1 months/2012-01-10<br />
/baby/1 months/2012-01-11<br />
.<br />
.</code></p></blockquote>
<p>What I really need now is some kind of scripts or program to do these:</p>
<ul>
<li>read all photo in a directory</li>
<li>extract the timestamp of the photo from exif, NOT from file timestamp</li>
<li>move all photo to subdirectory based on photo&#8217;s exif timestamp</li>
</ul>
<p>Sound not much works, but I&#8217;ve got like 6 months didn&#8217;t have time sitting in front of a computer and got way too much of photo left un-categorized.</p>
<p>Did some search on google and here is how I get it done quickly on my old diskstation.</p>
<p><strong>Download and install Exiv2</strong></p>
<p>Prerequisites </p>
<ul>
<li>Got at least the following ipkg optware package installed
<ul>
<li>make</li>
<li>gcc</li>
</ul>
<p>Not really sure about the package dependency though, if anyone know, please update in the comment section below, thanks <img src='http://blog.deadcode.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />
        </li>
</ul>
<p><strong>Steps to download and install Exiv2</strong></p>
<blockquote><ol>
<li># SSH/Telnet to diskstation as root</li>
<li># cd </li>
<li># wget http://www.exiv2.org/exiv2-0.23.tar.gz</li>
<li># tar xvzf exiv2-0.23.tar.gz</li>
<li># cd exiv2</li>
<li># ./configure</li>
<li># make</li>
<li># make install</li>
</ol>
</blockquote>
<p><strong>Script to create directories by datestamp</strong></p>
<p>Since exiv2 does not create directory, I need a script to create the directory for me. Below is a simple one I found on the net.</p>
<p>Create the script:</p>
<blockquote><p># cd ~<br />
# vi mkDir.pl</p></blockquote>
<p>Copy and paste the script below:</p>
<blockquote><p><code><br />
#!/usr/bin/perl</p>
<p>use strict;<br />
use warnings;</p>
<p>use Time::Local;<br />
use POSIX 'strftime';</p>
<p><font color=red>my $start = date2epoch('2012-04-01');<br />
my $end   = date2epoch('2012-10-08');</font></p>
<p>my $curr = $start;<br />
while ($curr <= $end) {<br />
    my $mydate =  strftime "%Y-%m-%d", localtime($curr);<br />
    mkdir $mydate;<br />
    $curr += 24 * 60 * 60;<br />
}</p>
<p>sub date2epoch {<br />
      my ($y, $m, $d) = split /-/, shift;</p>
<p>      return timelocal(0, 0, 12, $d, $m - 1, $y - 1900);<br />
}<br />
</code></p></blockquote>
<p>As highlighted in red above, the script will create directories like that</p>
<blockquote><p><code><br />
./2012-04-01<br />
./2012-04-02<br />
.<br />
.<br />
./2012-10-08</code></p></blockquote>
<p><strong>Get the works done</strong></p>
<p>Now all the tools are ready...</p>
<blockquote><ol>
<li># cd /volume1/photo/baby</li>
<li># cp ~/mkDir.pl .</li>
<li># perl ./mkDir.pl</li>
<li># exiv2 mv -r "%Y-%m-%d/:basename:" *</li>
</ol>
</blockquote>
<p>Done!! Just a few commands all the photo were moved to all subdirectories created by mkDir.pl perl script.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadcode.net/2012/10/11/organizing-photo-by-date/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rollback Nexus S from 4.1.1 to 2.3.6</title>
		<link>http://blog.deadcode.net/2012/08/11/rollback-nexus-s-from-4-1-1-to-2-3-6/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rollback-nexus-s-from-4-1-1-to-2-3-6</link>
		<comments>http://blog.deadcode.net/2012/08/11/rollback-nexus-s-from-4-1-1-to-2-3-6/#comments</comments>
		<pubDate>Fri, 10 Aug 2012 20:50:55 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[2.3.6]]></category>
		<category><![CDATA[4.1.1]]></category>
		<category><![CDATA[Nexus S]]></category>
		<category><![CDATA[Restore]]></category>

		<guid isPermaLink="false">http://blog.deadcode.net/?p=3377</guid>
		<description><![CDATA[<p>Hate the performance and poor apps compatibilty for 4.1.1. I decided to rollback my phone to 2.3.6.</p> <p>Luckily I did a full nand backup using clockworkmod and here is how I rollback the phone</p> <p>&#160;</p> Copy the nand backup to /sdcard/clockworkmod/backup Setting / Application settings / Development / Click USB debugging Switch off the [...]]]></description>
			<content:encoded><![CDATA[<p>Hate the performance and poor apps compatibilty for 4.1.1. I decided to rollback my phone to 2.3.6.</p>
<p>Luckily I did a full nand backup using clockworkmod and here is how I rollback the phone</p>
<p>&nbsp;</p>
<ol>
<li>Copy the nand backup to /<em>sdcard/clockworkmod/backup</em></li>
<li>Setting / Application settings / Development / Click USB debugging</li>
<li>Switch off the phone. Keep pressing the volume up button without releasing it, at the same time switch on the phone.</li>
<li>Use volume button and navigate to the ‘Reboot Bootloader’ option, then press the power button once.</li>
<li>Now connect the usb cable to the phone and the PC</li>
<li>Double click the ‘c:\adb\install-fastboot-windows.bat’.</li>
<li>Use volumn button and navigate to &#8216;Backup and Restore&#8217;, then click power button to confirm. Then navigate to &#8216;Restore&#8217;, then select the nand backup directory.</li>
<li>Press power button to confirm and your phone will be back to 2.3.6.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadcode.net/2012/08/11/rollback-nexus-s-from-4-1-1-to-2-3-6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rooting ICS 4.0.4 for Nexus S</title>
		<link>http://blog.deadcode.net/2012/05/31/rooting-ics-4-0-4-for-nexus-s/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rooting-ics-4-0-4-for-nexus-s</link>
		<comments>http://blog.deadcode.net/2012/05/31/rooting-ics-4-0-4-for-nexus-s/#comments</comments>
		<pubDate>Wed, 30 May 2012 17:50:24 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[ICS]]></category>
		<category><![CDATA[Nexus S]]></category>
		<category><![CDATA[Root]]></category>
		<category><![CDATA[superuser]]></category>

		<guid isPermaLink="false">http://blog.deadcode.net/?p=3372</guid>
		<description><![CDATA[<p>I have a rooted Nexus S running 2.3.6 and recently upgraded to ICS 4.0.4 through OTA upgrade.</p> <p>I&#8217;m sooooooo happy that the superuser package is still there and the ICS is already rooted after OTA.</p> <p>However, a week after ICS upgrade, I received superuser app upgrade notice from Play Store and I gratefully hit [...]]]></description>
			<content:encoded><![CDATA[<p>I have a rooted Nexus S running 2.3.6 and recently upgraded to ICS 4.0.4 through OTA upgrade.</p>
<p>I&#8217;m sooooooo happy that the superuser package is still there and the ICS is already rooted after OTA.</p>
<p>However, a week after ICS upgrade, I received superuser app upgrade notice from Play Store and I gratefully hit the update button and voila&#8230;..the root no longer works.. </p>
<p>The first things always have to do is google again and downloaded myself a new <a href="http://blog.deadcode.net/downloads/5" title="Superuser-3.0.7-efghi-signed.zip" target="_blank">superuser package</a>, repeat my tutorial about <a href="http://blog.deadcode.net/2011/12/07/root-nexus-s/" title="Rooting Nexus S 2.3.6" target="_blank">rooting nexus s 2.3.6</a> using the new superuser app and everything works fine again. <img src='http://blog.deadcode.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If you have a unrooted phone, you need to start from the first step of <a href="http://blog.deadcode.net/2011/12/07/root-nexus-s/" title="Rooting Nexus S 2.3.6" target="_blank">my previous article</a>. If you like me, which have a rooted phone and need to update the superuser package only, follow the summary below.</p>
<ol>
<li>Download the <a href="http://blog.deadcode.net/downloads/5" title="Superuser-3.0.7-efghi-signed.zip" target="_blank">superuser package</a> to the phone&#8217;s sdcard root directory.</li>
<li>Download the <a href="http://blog.deadcode.net/downloads/2" title="adb4.zip" target="_blank">adb4.zip</a> to your pc, extract it.</li>
<li>Go to the phone&#8217;s Setting / Application settings / Development</li>
<li>Click USB debugging</li>
<li>Switch off the phone. Keep pressing the volume up button without releasing it, at the same time switch on the phone.</li>
<li>Use volume button and navigate to the ‘Reboot Bootloader’ option, then press the power button once.</li>
<li>Now connect the usb cable to the phone and the PC<br />
Double click the ‘c:\adb\install-fastboot-windows.bat’.</li>
<li>Select ‘Install zip from sdcard’</li>
<li>Select ‘Choose zip from sdcard’</li>
<li>Select the ‘Superuser-3.0.7-efghi-signed.zip’ from the sdcard</li>
<li>
After installed the su package, select ‘Reboot System Now’</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadcode.net/2012/05/31/rooting-ics-4-0-4-for-nexus-s/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Install OpenVPN Client on Nexus S</title>
		<link>http://blog.deadcode.net/2011/12/08/install-openvpn/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=install-openvpn</link>
		<comments>http://blog.deadcode.net/2011/12/08/install-openvpn/#comments</comments>
		<pubDate>Thu, 08 Dec 2011 15:51:00 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Nexus S]]></category>
		<category><![CDATA[OpenVPN]]></category>

		<guid isPermaLink="false">http://blog.deadcode.net/?p=3331</guid>
		<description><![CDATA[<p>Steps below is how I setup OpenVPN client on my Nexus S to connect to the OpenVPN server on my Synology NAS DS207+.</p> Root the phone first. Go to market and download busybox . Install busybox to /system/xbin. Go to market and download ES File Explorer. Using ES file explorer and mount root / [...]]]></description>
			<content:encoded><![CDATA[<p>Steps below is how I setup OpenVPN client on my Nexus S to connect to the <a href="http://blog.deadcode.net/openvpn" title="Synology DS207+ usage series 7 - Setup OpenVPN server (Routed mode) on DS207+ with dual authentication and Windows/DS101j/TomatoVPN OpenVPN Client" target="_blank">OpenVPN server on my Synology NAS DS207+</a>.</p>
<ol>
<li><a href="http://blog.deadcode.net/2011/12/07/root-nexus-s/" title="Root Nexus S 2.3.6" target="_blank">Root the phone first</a>.</li>
<li>Go to market and download <a href="https://market.android.com/details?id=stericson.busybox&#038;feature=search_result#?t=W251bGwsMSwxLDEsInN0ZXJpY3Nvbi5idXN5Ym94Il0." title="Busybox for Android" target="_blank">busybox </a>.  Install busybox to /system/xbin.</li>
<li>Go to market and download <a href="https://market.android.com/details?id=com.estrongs.android.pop&#038;feature=search_result#?t=W251bGwsMSwxLDEsImNvbS5lc3Ryb25ncy5hbmRyb2lkLnBvcCJd" target="_blank">ES File Explorer</a>. Using ES file explorer and mount root / as writable.</li>
<li>Go to market and download <a href="https://market.android.com/details?id=berserker.android.apps.sshdroid&#038;feature=search_result#?t=W251bGwsMSwxLDEsImJlcnNlcmtlci5hbmRyb2lkLmFwcHMuc3NoZHJvaWQiXQ.." title="SSHDroid" target="_blank">sshdroid</a>.</li>
<li>Download <a href="http://www.google.com.hk/url?sa=t&#038;rct=j&#038;q=putty&#038;source=web&#038;cd=1&#038;ved=0CCYQFjAA&#038;url=http%3A%2F%2Fwww.chiark.greenend.org.uk%2F~sgtatham%2Fputty%2Fdownload.html&#038;ei=E93gTujWJpGtiQemy6SXBQ&#038;usg=AFQjCNEawi7s0aRUeJP3qKnncgvPiSqZYA" title="putty" target="_blank">putty</a> and ssh to android (user root, password admin), executes the comment below<br />
<blockquote><p><code># busybox mkdir /system/xbin/bb<br />
# ln -s /system/xbin/busybox /system/xbin/bb/ifconfig<br />
# ln -s /system/xbin/busybox /system/xbin/bb/route<br />
</code></p></blockquote>
</li>
<li>Download <a href="http://blog.deadcode.net/downloads/4" title="tun.ko for android 2.3.6" target="_blank">tun.ko</a> and copy to android /system/modules</li>
<li>Go to market again and download <a href="https://market.android.com/details?id=de.schaeuffelhut.android.openvpn.installer&#038;feature=search_result" title="OpenVPN installer" target="_blank">openvpn installer</a> and <a href="https://market.android.com/details?id=de.schaeuffelhut.android.openvpn&#038;feature=search_result#?t=W251bGwsMSwxLDEsImRlLnNjaGFldWZmZWxodXQuYW5kcm9pZC5vcGVudnBuIl0." title="OpenVPN Setting" target="_blank">openvpn settings</a></li>
<li>Open OpenVPN Installer and click &#8216;Install&#8217; button.
<p><img src="http://blog.deadcode.net/wp-content/uploads/2011/12/shot_000008-180x300.png" alt="" title="Android OpenVPN Installer" width="180" height="300" class="alignnone size-medium wp-image-3346" />.</p>
<p>Click Install again to confirm installation.</p>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2011/12/shot_000009-180x300.png" alt="" title="Android OpenVPN Installer: Confirm installation" width="180" height="300" class="alignnone size-medium wp-image-3347" /></p>
<p>Choose &#8216;/system/xbin&#8217;.</p>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2011/12/shot_000011-180x300.png" alt="" title="Android OpenVPN Installer: Choose installation path" width="180" height="300" class="alignnone size-medium wp-image-3348" /></p>
<p>Keep clicking allow button to continue.</p>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2011/12/shot_000013-180x300.png" alt="" title="Android OpenVPN Installer: grant root access for installer" width="180" height="300" class="alignnone size-medium wp-image-3349" />
</li>
<li>Open OpenVPN Settings, click Menu/Advanced
<p>- Click &#8216;Load tun kernel module&#8217;<br />
- Input &#8216;/sdcard/openvpn&#8217; as path to configurations<br />
- Input &#8216;/system/xbin/openvpn&#8217; as path to openvpn binary</p>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2011/12/shot_000016-180x300.png" alt="" title="Android OpenVPN Setting: Advanced Setting" width="180" height="300" class="alignnone size-medium wp-image-3351" /></p>
<p>- Click &#8216;TUN module settings&#8217;, in &#8216;Load module using&#8217;, select &#8216;insmod&#8217; and input &#8216;/system/modules/tun.ko&#8217; as &#8216;path to tun module&#8217;.</p>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2011/12/shot_000017-180x300.png" alt="" title="Android OpenVPN Setting: TUN module settings" width="180" height="300" class="alignnone size-medium wp-image-3352" /></p>
</li>
<li>Connect your phone with the usb cable, create a &#8216;openvpn&#8217; directory to the sdcard root. Copy the OpenVPN client config file i.e. client.ovpn, ca.crt, client.crt, client.key, ta.key to the /sdcard/openvpn directory.</li>
<li>Back to OpenVPN Setting, click OpenVPN to turn on OpenVPN. Long click the OpenVPN client config and then click Preferences from the popup menu.
<p><img src="http://blog.deadcode.net/wp-content/uploads/2011/12/shot_000019-180x300.png" alt="" title="Android OpenVPN Settings: OpenVPN Preferences" width="180" height="300" class="alignnone size-medium wp-image-3353" />
</li>
<li>Select &#8216;Built-in + Scripts (passwords)&#8217; for Script Security Level.
<p><img src="http://blog.deadcode.net/wp-content/uploads/2011/12/shot_000020-180x300.png" alt="" title="Android OpenVPN Settings: VPN Preferences" width="180" height="300" class="alignnone size-medium wp-image-3355" />
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadcode.net/2011/12/08/install-openvpn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Root Nexus S 2.3.6 &#8211; the perfect way</title>
		<link>http://blog.deadcode.net/2011/12/07/root-nexus-s/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=root-nexus-s</link>
		<comments>http://blog.deadcode.net/2011/12/07/root-nexus-s/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 21:06:06 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Nexus S]]></category>
		<category><![CDATA[Root]]></category>

		<guid isPermaLink="false">http://blog.deadcode.net/?p=3321</guid>
		<description><![CDATA[<p>Tested device: GRK39F I9023 Android vers: 2.3.6</p> <p>UPDATE 2012-04-05</p> <p>I just received OTA 4.0.4 update notification from my rooted nexus s </p> <p>DISCLAIMER</p> <p>Rooting a device requires RESETTING the phone. This will erase ALL EXISTING DATA on your phone&#8217;s memory, SD card and usb storage!</p> <p>Rooting also can brick your phone and void your [...]]]></description>
			<content:encoded><![CDATA[<p>Tested device: GRK39F I9023<br />
Android vers: 2.3.6</p>
<p><strong>UPDATE 2012-04-05</strong></p>
<p>I just received OTA 4.0.4 update notification from my rooted nexus s <img src='http://blog.deadcode.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><strong>DISCLAIMER</strong></p>
<p>Rooting a device requires RESETTING the phone. This will erase ALL EXISTING DATA on your phone&#8217;s memory, SD card and usb storage!</p>
<p>Rooting also can brick your phone and void your warranty!</p>
<p>Make sure you backup everything before continue, you are warned.</p>
<p>Any downloads here is get from some android forum, I am not sure it is virus free.</p>
<p>Take your own risk. I&#8217;m not responsible for any loss following any steps below.</p>
<p>The steps here DO NOT FLASH CUSTOM RECOVERY, so it should not avoid google&#8217;s OTA update.</p>
<p><strong>UNLOCK BOOTLOADER</strong></p>
<ol>
<li>Download <a title="android debug bridge" href="http://blog.deadcode.net/downloads/2" target="_blank">adb4.zip</a> and extract adb folder to c:\</li>
<li>Download and extract <a title="Nexus S Driver" href="http://blog.deadcode.net/downloads/3" target="_blank">Nexus_S_Drivers_x86_%26_x64.zip</a> to any folder</li>
<li>Download and copy <a title="su 2.3.6.1 ef signed" href="http://blog.deadcode.net/downloads/1" target="_blank">su-2.3.6.1-ef-signed.zip</a> to the root of the phone&#8217;s sd card</li>
<li>Setting / Application settings / DevelopmentClick USB debugging</li>
<li>Switch off the phone. Keep pressing the volume up button without releasing it, at the same time switch on the phone.</li>
<li>Use volume button and navigate to the &#8216;Reboot Bootloader&#8217; option, then press the power button once.</li>
<li>Now connect the usb cable to the phone and the PC</li>
<li>When installing the driver to PC, select the folder where you extracted the Nexus_S_Drivers_x86_%26_x64.rar, install the driver to your PC.</li>
<li>Once the driver is installed, no, it is not done yet. Open Control Panel, click Device Manager, from &#8216;Other Devices&#8217;, you should found &#8216;Android 1.0&#8242; with a yellow &#8216;!&#8217;.</li>
<li>Right click the &#8216;Android 1.0&#8242;, click properties button.</li>
<li>Click &#8216;Device Driver&#8217; tab, then click the &#8216;Update Device Driver (P)&#8217; button</li>
<li>Navigate to [Nexus_S_Drivers_x86_%26_X64\x86\usbwin&#8217; from the file dialog and then click ok. Now the &#8216;Android 1.0&#8242; driver should be installed.</li>
<li>double click the c:\adb\install-unlock.bat</li>
<li>Select &#8216;Yes&#8217; on your phone then press the power button once.</li>
<li>After reboot, then select &#8216;Reboot&#8217; and press the power button once again.</li>
</ol>
<p><strong>BACKUP NAND</strong></p>
<p>Before rooting the phone, it is better to backup the nand first.</p>
<ol>
<li>Disconnect the usb cable</li>
<li>Setting / Application settings / DevelopmentClick USB debugging</li>
<li>Switch off the phone. Keep pressing the volume up button without releasing it, at the same time switch on the phone.</li>
<li>Use volume button and navigate to the &#8216;Reboot Bootloader&#8217; option, then press the power button once.</li>
<li>Now connect the usb cable to the phone and the PC</li>
<li>Double click the &#8216;c:\adb\install-fastboot-windows.bat&#8217;.</li>
<li>Select &#8216;Backup and restore&#8217;, then select &#8216;Backup&#8217;</li>
<li>After Backup, select &#8216;Reboot System Now&#8217;</li>
<li>Connect the phone to PC using usb cable. Backup the sdcard:/clockworkmod/backup folder to your PC.</li>
</ol>
<p><strong>ROOT THE PHONE</strong></p>
<ol>
<li>Disconnect the usb cable</li>
<li>Setting / Application settings / DevelopmentClick USB debugging</li>
<li>Switch off the phone. Keep pressing the volume up button without releasing it, at the same time switch on the phone.</li>
<li>Use volume button and navigate to the &#8216;Reboot Bootloader&#8217; option, then press the power button once.</li>
<li>Now connect the usb cable to the phone and the PC</li>
<li>Double click the &#8216;c:\adb\install-fastboot-windows.bat&#8217;.</li>
<li>Select &#8216;Install zip from sdcard&#8217;</li>
<li>Select &#8216;Choose zip from sdcard&#8217;</li>
<li>Select the &#8216;su-2.3.6.1-ef-signed.zip&#8217; from the sdcard</li>
<li>After installed the su package, select &#8216;Reboot System Now&#8217;</li>
</ol>
<p><strong>Reference</strong></p>
<p><a title="Mobile01 I9023 ROOT教學" href="http://www.mobile01.com/topicdetail.php?f=565&amp;t=2070033&amp;last=28330001" target="_blank">Mobile01 &#8211; I9023 ROOT教學</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadcode.net/2011/12/07/root-nexus-s/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Synology DS207+ modding series 34 &#8211; FreeRadius Accounting for OpenVPN with MySQL and daloRadius</title>
		<link>http://blog.deadcode.net/2011/11/26/freeradius-accounting-for-openvpn-with-mysql-and-daloradius/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=freeradius-accounting-for-openvpn-with-mysql-and-daloradius</link>
		<comments>http://blog.deadcode.net/2011/11/26/freeradius-accounting-for-openvpn-with-mysql-and-daloradius/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 20:58:08 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Synology]]></category>
		<category><![CDATA[daloRadius]]></category>
		<category><![CDATA[DS207+]]></category>
		<category><![CDATA[FreeRadius]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[OpenVPN]]></category>
		<category><![CDATA[php-pear]]></category>
		<category><![CDATA[php-pear-db]]></category>
		<category><![CDATA[Radius Accounting]]></category>

		<guid isPermaLink="false">http://blog.deadcode.net/?p=3289</guid>
		<description><![CDATA[<p><strong>Prerequisite</strong></p>
<ol>
<li><a href="http://blog.deadcode.net/openvpn" target="_blank">Modding series 7 &#8211; Setup OpenVPN Server</a></li>
<li><a href="http://blog.deadcode.net/2009/11/11/install-freeradius-server-and-integrate-with-openldap-server/" target="_blank">Modding series 21 &#8211; Install FreeRadius Server</a></li>
<li><a href="http://blog.deadcode.net/2009/11/11/putting-it-all-together-openvpnfreeradiusopenldap/" target="_blank">Modding series 22 &#8211; Install FreeRadius plugin for OpenVPN</a></li>
</ol>
<p>I&#8217;m using daloRadius as accounting and reporting tools here. The management function is not used (except NAS client part).</p>
<p><strong>Install daloRadius</strong></p>
<p>Download daloRadius 0.9.9 package </p>
<blockquote><p><code># cd /volume1/web<br />
# wget http://downloads.sourceforge.net/project/daloradius/daloradius/daloradius0.9-9/daloradius-0.9-9.tar.gz<br />
# tar xvzf daloradius-0.9-9.tar.gz<br />
# rm daloradius-0.9-9.tar.gz<br />
# chown -R nobody:nobody /volume1/web/daloradius-0.9-9<br />
# chown 644 /volume1/web/daloradius-0.9-9/library/daloradius.conf.php<br />
</code></p></blockquote>
<p>Edit /volume1/web/daloradius-0.9-9/library/daloradius.conf.php, update the values as below</p>
<blockquote><p><code><br />
$configValues['CONFIG_DB_USER'] = 'radius';<br />
$configValues['CONFIG_DB_PASS'] = 'radpass';<br />
$configValues['CONFIG_DB_NAME'] = 'radiusdb';<br />
$configValues['CONFIG_FILE_RADIUS_PROXY'] = '/opt/etc/raddb/proxy.conf';<br />
$configValues['CONFIG_PATH_DALO_VARIABLE_DATA'] = '/opt/var/daloradius';<br />
$configValues['CONFIG_LOG_FILE'] = '/opt/var/log/daloradius.log';<br />
</code></p></blockquote>
<p>Follow up</p>
<blockquote><p><code><br />
# mkdir /opt/var/daloradius<br />
# chown nobody:nobody /opt/var/daloradius<br />
# touch /opt/var/log/daloradius.log<br />
# chown nobody:nobody /opt/var/log/daloradius.log<br />
</code></p></blockquote>
<p>Create and import the database</p>
<blockquote><p><code><br />
# /usr/syno/mysql/bin/mysql -u root -p</p>
<p>&gt; CREATE DATABASE radiusdb;<br />
&gt; GRANT ALL ON radiusdb.* TO radius@localhost IDENTIFIED BY "radpass";<br />
&gt; GRANT ALL ON radiusdb.* TO radius@127.0.0.1 IDENTIFIED BY "radpass";<br />
&gt; exit;</p>
<p># cd /volume1/web/daloradius-0.9-9/contrib/db<br />
# /usr/syno/mysql/bin/mysql -u radius -p radiusdb < fr2-mysql-daloradius-and-freeradius.sql<br />
# password: radpass<br />
</code></p></blockquote>
<p><strong>Install PHP extension</strong></p>
<p>Install php-pear and php-pear-db</p>
<blockquote><p><code># ipkg install php-pear<br />
# pear config-set php_bin /usr/bin/php<br />
# cd /opt/share/pear<br />
# wget http://download.pear.php.net/package/DB-1.7.14.tgz<br />
# mv DB-1.7.14.tgz DB.tgz<br />
# tar xvzf DB.tgz<br />
# chown -R nobody:nobody /opt/share/pear<br />
</code></p></blockquote>
<p>Edit php configuration</p>
<blockquote><p>
# vi /usr/syno/etc/php.ini</p>
<p>include_path = .:/php/includes:/opt/share/pear:/opt/share/pear/DB</p>
<p># vi /usr/syno/etc/php/user-setting.ini</p>
<p>append <strong>/opt/share/pear:/opt/share/pear/DB</strong> to open_basedir</p></blockquote>
<p>Install php-gd</p>
<blockquote><p># ipkg install php-gd</p></blockquote>
]]></description>
			<content:encoded><![CDATA[<p><strong>Prerequisite</strong></p>
<ol>
<li><a href="http://blog.deadcode.net/openvpn" target="_blank">Modding series 7 &#8211; Setup OpenVPN Server</a></li>
<li><a href="http://blog.deadcode.net/2009/11/11/install-freeradius-server-and-integrate-with-openldap-server/" target="_blank">Modding series 21 &#8211; Install FreeRadius Server</a></li>
<li><a href="http://blog.deadcode.net/2009/11/11/putting-it-all-together-openvpnfreeradiusopenldap/" target="_blank">Modding series 22 &#8211; Install FreeRadius plugin for OpenVPN</a></li>
</ol>
<p>I&#8217;m using daloRadius as accounting and reporting tools here. The management function is not used (except NAS client part).</p>
<p><strong>Install daloRadius</strong></p>
<p>Download daloRadius 0.9.9 package </p>
<blockquote><p><code># cd /volume1/web<br />
# wget http://downloads.sourceforge.net/project/daloradius/daloradius/daloradius0.9-9/daloradius-0.9-9.tar.gz<br />
# tar xvzf daloradius-0.9-9.tar.gz<br />
# rm daloradius-0.9-9.tar.gz<br />
# chown -R nobody:nobody /volume1/web/daloradius-0.9-9<br />
# chown 644 /volume1/web/daloradius-0.9-9/library/daloradius.conf.php<br />
</code></p></blockquote>
<p>Edit /volume1/web/daloradius-0.9-9/library/daloradius.conf.php, update the values as below</p>
<blockquote><p><code><br />
$configValues['CONFIG_DB_USER'] = 'radius';<br />
$configValues['CONFIG_DB_PASS'] = 'radpass';<br />
$configValues['CONFIG_DB_NAME'] = 'radiusdb';<br />
$configValues['CONFIG_FILE_RADIUS_PROXY'] = '/opt/etc/raddb/proxy.conf';<br />
$configValues['CONFIG_PATH_DALO_VARIABLE_DATA'] = '/opt/var/daloradius';<br />
$configValues['CONFIG_LOG_FILE'] = '/opt/var/log/daloradius.log';<br />
</code></p></blockquote>
<p>Follow up</p>
<blockquote><p><code><br />
# mkdir /opt/var/daloradius<br />
# chown nobody:nobody /opt/var/daloradius<br />
# touch /opt/var/log/daloradius.log<br />
# chown nobody:nobody /opt/var/log/daloradius.log<br />
</code></p></blockquote>
<p>Create and import the database</p>
<blockquote><p><code><br />
# /usr/syno/mysql/bin/mysql -u root -p</p>
<p>&gt; CREATE DATABASE radiusdb;<br />
&gt; GRANT ALL ON radiusdb.* TO radius@localhost IDENTIFIED BY "radpass";<br />
&gt; GRANT ALL ON radiusdb.* TO radius@127.0.0.1 IDENTIFIED BY "radpass";<br />
&gt; exit;</p>
<p># cd /volume1/web/daloradius-0.9-9/contrib/db<br />
# /usr/syno/mysql/bin/mysql -u radius -p radiusdb < fr2-mysql-daloradius-and-freeradius.sql<br />
# password: radpass<br />
</code></p></blockquote>
<p><strong>Install PHP extension</strong></p>
<p>Install php-pear and php-pear-db</p>
<blockquote><p><code># ipkg install php-pear<br />
# pear config-set php_bin /usr/bin/php<br />
# cd /opt/share/pear<br />
# wget http://download.pear.php.net/package/DB-1.7.14.tgz<br />
# mv DB-1.7.14.tgz DB.tgz<br />
# tar xvzf DB.tgz<br />
# chown -R nobody:nobody /opt/share/pear<br />
</code></p></blockquote>
<p>Edit php configuration</p>
<blockquote><p>
# vi /usr/syno/etc/php.ini</p>
<p>include_path = .:/php/includes:/opt/share/pear:/opt/share/pear/DB</p>
<p># vi /usr/syno/etc/php/user-setting.ini</p>
<p>append <strong>/opt/share/pear:/opt/share/pear/DB</strong> to open_basedir</p></blockquote>
<p>Install php-gd</p>
<blockquote><p># ipkg install php-gd</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadcode.net/2011/11/26/freeradius-accounting-for-openvpn-with-mysql-and-daloradius/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Synology DS207+ modding series 33 &#8211; Install MOTP and integrate with FreeRadius</title>
		<link>http://blog.deadcode.net/2011/11/14/install-motp-with-freeradius/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=install-motp-with-freeradius</link>
		<comments>http://blog.deadcode.net/2011/11/14/install-motp-with-freeradius/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 17:42:04 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Synology]]></category>
		<category><![CDATA[DS207+]]></category>
		<category><![CDATA[FreeRadius]]></category>
		<category><![CDATA[Mobile-OTP]]></category>
		<category><![CDATA[MOTP]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[One-Time-Password]]></category>

		<guid isPermaLink="false">http://blog.deadcode.net/?p=3219</guid>
		<description><![CDATA[<p>MOTP stands for mobile one time password which provides one time password services.</p> <p>Download and install otp server</p> Login to DS as root mkdir -p /opt/usr/local/bin cd /opt/usr/local/bin Download otp server script <p># wget http://motp.sourceforge.net/bash/otpverify.sh Install necessary library <p># ipkg install findutils # ipkg install md5deep # ipkg install bash Edit otpverify.sh <p># vi [...]]]></description>
			<content:encoded><![CDATA[<p>MOTP stands for mobile one time password which provides one time password services.</p>
<p><strong>Download and install otp server</strong></p>
<ol>
<li>Login to DS as root</li>
<li>mkdir -p /opt/usr/local/bin</li>
<li>cd /opt/usr/local/bin</li>
<li>Download otp server script
<p># wget http://motp.sourceforge.net/bash/otpverify.sh</li>
<li>Install necessary library
<p># ipkg install findutils<br />
# ipkg install md5deep<br />
# ipkg install bash
</li>
<li>Edit otpverify.sh
<p># vi /opt/usr/local/bin/otpverify.sh</p>
<p>Changes highlighted in red.</p>
<blockquote><pre><code>
#!<font color=red>/opt/bin/bash</font>
#
# Mobile One Time Passwords (Mobile-OTP) for Java 2 Micro Edition, J2ME
# written by Matthias Straub, Heilbronn, Germany, 2003
# (c) 2003 by Matthias Straub
#
# Version 1.05a
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU Library General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
# 
# This software is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Library General Public License for more details.
#
# arguments:  $1 $2 $3 $4 $5
# $1 - username
# $2 - one-time-password that is to be checked 
# $3 - init-secred from token (to init token: #**#)
# $4 - user PIN
# $5 - time difference between token and server in 10s of seconds (360 = 1 hour)
#
# one-time-password must match md5(EPOCHTIME+SECRET+PIN)
# 

#
# otpverify.sh version 1.04b, Feb. 2003
# otpverify.sh version 1.04c, Nov. 2008
#  changed line 1 to ksh because of problems with todays bash an sh
# otpverify.sh version 1.05a, Jan. 2011
#  changed back to bash and added in shopts line to ensure aliases handled
#  correctly (bash is always available on any modern *nix unlike ksh)
#

PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin<font color=red>:/opt/usr/local/bin:/opt/bin:/opt/sbin</font>

# ensure aliases are expanded by bash
shopt -s expand_aliases

if [ -e "`which md5 2>/dev/null`" ]
then
	alias checksum=md5
	have_md5="true"
fi
if [ -e "`which md5sum 2>/dev/null`" ]
then
	alias checksum=md5sum
	have_md5="true"
fi

<font color=red>
alias checksum=md5deep
have_md5="true"
</font>

if [ $have_md5 != "true" ]
then
	echo "No md5 or md5sum available on server!"
	<font color=red>exit 16</font>
fi

function chop
{
	num=`echo -n "$1" | wc -c | sed 's/ //g' `
	nummin1=`expr $num "-" 1`
	echo -n "$1" | cut -b 1-$nummin1 
}

if [ ! $# -eq 5 ] ; then
echo "USAGE: otpverify.sh Username, OTP, Init-Secret, PIN, Offset"
<font color=red>exit 14</font>
fi

mkdir <font color=red>/opt/var/motp</font> 2>/dev/null
mkdir <font color=red>/opt/var/motp/cache</font> 2>/dev/null
mkdir <font color=red>/opt/var/motp/users</font> 2>/dev/null
chmod og-rxw <font color=red>/opt/var/motp</font> 2>/dev/null || { echo "FAIL! Need write-access to <font color=red>/opt/var/motp</font>"; <font color=red>exit 17</font>; }
chmod og-rxw <font color=red>/opt/var/motp/cache</font>
chmod og-rxw <font color=red>/opt/var/motp/users</font>

USERNAME=`echo -n "$1" | sed 's/[^0-9a-zA-Z._-]/X/g' `
PASSWD=`echo -n "$2" | sed 's/[^0-9a-f]/0/g' `
SECRET=`echo -n "$3" | sed 's/[^0-9a-f]/0/g' `
PIN=`echo -n "$4" | sed 's/[^0-9]/0/g' `
OFFSET=`echo -n "$5" | sed 's/[^0-9]/0/g' `
EPOCHTIME=`date +%s` ; EPOCHTIME=`chop $EPOCHTIME`

# delete old logins
<font color=red>/opt/bin/find /opt/var/motp/cache</font> -type f -cmin +5 | xargs rm 2>/dev/null

if [ -e "<font color=red>/opt/var/motp/cache/$PASSWD</font>" ]; then
	echo "FAIL"
	<font color=red>exit 15</font>
fi

# account locked?
if [ "`cat <font color=red>/opt/var/motp/users/$USERNAME</font> 2>/dev/null`" == "8" ]; then
	echo "FAIL"
	<font color=red>exit 13</font>
fi

I=0
EPOCHTIME=`expr $EPOCHTIME - 18`
EPOCHTIME=`expr $EPOCHTIME + $OFFSET`
while [ $I -lt 36 ] ; do # 3 minutes before and after
	OTP=`printf $EPOCHTIME$SECRET$PIN|checksum|cut -b 1-6`
	if [ "$OTP" = "$PASSWD" ] ; then
		/bin/touch <font color=red>/opt/var/motp/cache/$OTP</font> || { echo "FAIL! Need write-access to <font color=red>/opt/var/motp</font>" ; <font color=red>exit 17</font>; }
		echo "ACCEPT"
		rm "<font color=red>/opt/var/motp/users/$USERNAME</font>" 2>/dev/null
		exit 0
	fi
	I=`expr $I + 1`
	EPOCHTIME=`expr $EPOCHTIME + 1`
done

echo "FAIL"
NUMFAILS=`cat "<font color=red>/opt/var/motp/users/$USERNAME</font>" 2>/dev/null`
if [ "$NUMFAILS" = "" ]; then
	NUMFAILS=0
fi
NUMFAILS=`expr $NUMFAILS + 1`
echo $NUMFAILS > "<font color=red>/opt/var/motp/users/$USERNAME</font>"
<font color=red>exit 11</font>
</code></pre>
</blockquote>
<p>In case there is a newer version of this server script released in the future, here is the summary of changes:</p>
<ul>
<li>line 1 should point to optware bash: /opt/bin/bash</li>
<li>The script will only looks for md5 and md5sum binary, however, we are using md5deep from optware instead. Add two lines to assign md5deep as checksum binary.</li>
<li>Add 10 to all error code, otherwise it will fail the FreeRadius server</li>
<li>Basically I&#8217;ve appended /opt to every path inside the script.</li>
<li>It need the <strong>find </strong> binary. We should use the binary provided by optware instead of using the system default binary.</li>
</ul>
</li>
<li># chmod 755 /opt/usr/local/bin/otpverify.sh</li>
</ol>
<p><strong>Download and setup Android motp client</strong></p>
<p>Since I&#8217;ve an Android phone, I install the motp client to my phone.</p>
<ol>
<li>Download the android motp client &#8216;Mobile-OTP&#8217; from url below
<p>http://motp.sourceforge.net/Mobile-OTP.apk</li>
<li>Install the apk to the phone</li>
<li>Run the Mobile-OTP.</li>
<li>Input #**# and click &#8216;Calculate OTP&#8217; button. An init-secret value will be generated. Copy the <strong>init-secret</strong> and paste it to somewhere, i.e. notepad.</li>
<li>Input 1234 and click &#8216;Calculate OTP&#8217; button again. An <strong>one time password</strong> will be generated.</li>
<li>Now test the setup, SSH to the DiskStation as root and run the command as below:<br />
<blockquote><p><code><br />
# /opt/usr/local/bin/otpverify.sh testuser [<strong>one-time-password</strong>] [<strong>Init-secret</strong>] 1234 0<br />
</code></p></blockquote>
<p>If you run the command fast enough, the script should return &#8220;ACCEPT&#8221;. If you got a &#8220;FAIL&#8221;, repeats again by generating a new one-time-password and execute the command again couple times until you got &#8220;ACCEPT&#8221;. Make sure the Init-secret and One-time-password is input correctly.
</li>
</ol>
<p><strong>FreeRadius changes</strong></p>
<ol>
<li>SSH to DS as root</li>
<li># cd /opt/etc/raddb</li>
<li># wget http://motp.sourceforge.net/dictionary.motp</li>
<li>Edit /opt/etc/raddb/dictionary, add following line to the end of the file
<p>$INCLUDE dictionary.motp</li>
<li>Although I don&#8217;t think this step is needed, but it is suggested by the official installation guide.<br />
# wget http://motp.sourceforge.net/execparams</li>
<li>Add a test user by editing /opt/etc/raddb/users file. Add following lines to the end of the file.<br />
<blockquote><pre><code>
testuser Auth-Type = Accept
    Exec-Program-Wait = "/opt/usr/local/bin/otpverify.sh %{User-Name} %{User-Password} <font color=red>123412341234 1234</font> 0",
    Fall-Through = Yes,
    Reply-Message = "Hello, %{User-Name}"
</code></pre>
</blockquote>
<p>where 123412341234 is the init-secret and 1234 is the pin of the test user. Replace the value of init-secret with the one generated by the Android OTP client.
</li>
<li>Generate a new One-time-password using the Android OTP client (input 1234 and click &#8216;Calculate OTP&#8217; button), then test the freeradius setup by executing the command below:<br />
<blockquote><p><code><br />
#  radtest testuser [one-time-password] localhost 0 [FreeRadius shared secret password]<br />
</code></p></blockquote>
<p>If success, you should got a response similar to below:</p>
<blockquote><p><code><br />
rad_recv: <font color=red>Access-Accept</font> packet from host 127.0.0.1 port 1812, id=48, length=46<br />
        Reply-Message = "Hello, testuser  "<br />
</code></p></blockquote>
</li>
</ol>
<p>Now my services like OpenVPN and Squid  accept OTP login <img src='http://blog.deadcode.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong>Resources</strong></p>
<ul>
<li><a href="http://motp.sourceforge.net" title="Mobile OTP" target="_blank">Mobile-OTP</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadcode.net/2011/11/14/install-motp-with-freeradius/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Synology modding series 32 &#8211; Setup Wifi WPA2 Enterprise with Freeradius+Openldap/Client Certificate</title>
		<link>http://blog.deadcode.net/2011/11/13/setup-wifi-wpa2-enterprise-with-freeradiusopenldap/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=setup-wifi-wpa2-enterprise-with-freeradiusopenldap</link>
		<comments>http://blog.deadcode.net/2011/11/13/setup-wifi-wpa2-enterprise-with-freeradiusopenldap/#comments</comments>
		<pubDate>Sat, 12 Nov 2011 16:02:05 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Synology]]></category>
		<category><![CDATA[DS207+]]></category>
		<category><![CDATA[FreeRadius]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[OpenLDAP]]></category>
		<category><![CDATA[Wifi]]></category>
		<category><![CDATA[WPA2 Enterprise]]></category>

		<guid isPermaLink="false">http://blog.deadcode.net/?p=3177</guid>
		<description><![CDATA[<p><strong>Prerequisite</strong></p>
<ol>
<li><a href="http://blog.deadcode.net/2009/05/23/setup-openldap-on-ds207/" target="_blank">Modding series 9 &#8211; Setup an OpenLDAP Server</a></li>
<li><a href="http://blog.deadcode.net/2009/11/11/install-freeradius-server-and-integrate-with-openldap-server/" target="_blank">Modding series 21 &#8211; Install FreeRadius Server and integrate with OpenLDAP Server</a></li>
</ol>
<p><strong>Setup FreeRadius to support EAP-PEAP-TLS</strong></p>
<ol>
<li>SSH to DS as root</li>
<li>Edit /opt/etc/raddb/radiusd.conf, add following line to the config file
<p>$INCLUDE ${confdir}/sites-enabled/</p>
<blockquote><p><code><br />
# vi /opt/etc/raddb/radiusd.conf</p>
<p># <strong>add </strong> sites-enabled to the config<br />
$INCLUDE ${confdir}/sites-enabled/</p>
<p></code></p></blockquote>
</li>
<li>Edit /opt/etc/raddb/radiusd.conf again, looks for the authenticate section and then add mschap within the section.<br />
<blockquote><pre><code>
# vi /opt/etc/raddb/radiusd.conf

authenticate {
 .
 .
 .
  # add mschap
  mschap
}
</code></pre>
</blockquote>
<p>Looks for modules section and add three lines within modules section as below</p>
<blockquote><pre><code>
# vi /opt/etc/raddb/radiusd.conf

modules {
 # add expiration, logintime and attr_filter modules
 $INCLUDE ${confdir}/modules/expiration
 $INCLUDE ${confdir}/modules/logintime
 $INCLUDE ${confdir}/modules/attr_filter

}
</code></pre>
</blockquote>
</li>
<li>Edit /opt/etc/raddb/eap.conf, change default_eap_type to peap.<br />
<blockquote><pre><code>
# vi /opt/etc/raddb/eap.conf

.
.
default_eap_type = peap
.
.
</code></pre>
</blockquote>
</li>
<li>Edit /opt/etc/raddb/sites-enabled/default, looks for authorize section and un-comment the ldap line.<br />
<blockquote><pre><code>
# vi /opt/etc/raddb/sites-enabled/default

authorize {
.
.
# un-comment the ldap 
 ldap
.
.
}
</code></pre>
</blockquote>
<p>Then looks for authenticate section and uncomment Auth-Type LDAP as well.</p>
<blockquote><pre><code>
# vi /opt/etc/raddb/sites-enabled/default

authenticate {
.
.
# un-comment the ldap 
 Auth-Type LDAP{
     ldap
 }
.
.
}
</code></pre>
</blockquote>
</li>
<li>Edit /opt/etc/raddb/sites-enabled/inner-tunnel, looks for authorize section and un-comment the ldap line.<br />
<blockquote><pre><code>
# vi /opt/etc/raddb/sites-enabled/inner-tunnel

authorize {
.
.
# un-comment the ldap 
 ldap
.
.
}
</code></pre>
</blockquote>
<p>Then looks for authenticate section and uncomment Auth-Type LDAP as well.</p>
<blockquote><pre><code>
# vi /opt/etc/raddb/sites-enabled/inner-tunnel

authenticate {
.
.
# un-comment the ldap 
 Auth-Type LDAP{
     ldap
 }
.
.
}
</code></pre>
</blockquote>
</li>
<li>Edit /opt/etc/raddb/clients.conf, add the Wifi Access Point to the config file.<br />
<blockquote><p><code><br />
# vi /opt/etc/raddb/clients.conf</p>
<p># add access point details here, 192.168.0.1 is the ip of the access point</p>
<pre>
client 192.168.0.1 {
     secret = [shared secret password of radius server]
     shortname = [SSID of the access point]
     nastype = other
}
</pre>
<p></code></p></blockquote>
</li>
<li>If you have firewall activate on your diskstation, make sure to add a firewall rule to allow the wifi access point to access the udp port 1812, 1813 and 1814.</li>
</ol>
<p>For now the radius server is already able to perform authentication for wpa/wpa2 enterprise!</p>
<p><strong>Generate client certificate</strong></p>
<p>If you do not plan to perform authorization using client certificate, you can skip this part.</p>
<ol>
<li>SSH to DS as root</li>
<li>Edit /opt/etc/raddb/certs/client.cnf, refer to modding series 21 for details about this client certificate config file.
<p>** IMPORTANT The Country Name, State and Organization Name MUST match the value of the CA.
</li>
<li>Before we generate the client certificate, we MUST backup the original certificate first.<br />
<blockquote><p><code><br />
# cd /opt/etc/raddb<br />
# cp -r certs certs.b4genclient<br />
</code></p></blockquote>
</li>
<li>Generate a client certificate<br />
<blockquote><p><code><br />
# cd /opt/etc/raddb/certs<br />
# make client.pem</li>
<p></code></p></blockquote>
</li>
<li>If you want to generate another client certificate for other wifi client. Edit the client.cnf and run make client.pem again. If  make failed and said it couldn&#8217;t load a certificate, just copy the server.crt from backup directory and try again.<br />
<blockquote><p><code><br />
# cp /opt/etc/raddb/certs.b4genclient/server.crt /opt/etc/raddb/certs<br />
# make client.pem<br />
</code></p></blockquote>
</li>
</ol>
]]></description>
			<content:encoded><![CDATA[<p><strong>Prerequisite</strong></p>
<ol>
<li><a href="http://blog.deadcode.net/2009/05/23/setup-openldap-on-ds207/" target="_blank">Modding series 9 &#8211; Setup an OpenLDAP Server</a></li>
<li><a href="http://blog.deadcode.net/2009/11/11/install-freeradius-server-and-integrate-with-openldap-server/" target="_blank">Modding series 21 &#8211; Install FreeRadius Server and integrate with OpenLDAP Server</a></li>
</ol>
<p><strong>Setup FreeRadius to support EAP-PEAP-TLS</strong></p>
<ol>
<li>SSH to DS as root</li>
<li>Edit /opt/etc/raddb/radiusd.conf, add following line to the config file
<p>$INCLUDE ${confdir}/sites-enabled/</p>
<blockquote><p><code><br />
# vi /opt/etc/raddb/radiusd.conf</p>
<p># <strong>add </strong> sites-enabled to the config<br />
$INCLUDE ${confdir}/sites-enabled/</p>
<p></code></p></blockquote>
</li>
<li>Edit /opt/etc/raddb/radiusd.conf again, looks for the authenticate section and then add mschap within the section.<br />
<blockquote><pre><code>
# vi /opt/etc/raddb/radiusd.conf

authenticate {
 .
 .
 .
  # add mschap
  mschap
}
</code></pre>
</blockquote>
<p>Looks for modules section and add three lines within modules section as below</p>
<blockquote><pre><code>
# vi /opt/etc/raddb/radiusd.conf

modules {
 # add expiration, logintime and attr_filter modules
 $INCLUDE ${confdir}/modules/expiration
 $INCLUDE ${confdir}/modules/logintime
 $INCLUDE ${confdir}/modules/attr_filter

}
</code></pre>
</blockquote>
</li>
<li>Edit /opt/etc/raddb/eap.conf, change default_eap_type to peap.<br />
<blockquote><pre><code>
# vi /opt/etc/raddb/eap.conf

.
.
default_eap_type = peap
.
.
</code></pre>
</blockquote>
</li>
<li>Edit /opt/etc/raddb/sites-enabled/default, looks for authorize section and un-comment the ldap line.<br />
<blockquote><pre><code>
# vi /opt/etc/raddb/sites-enabled/default

authorize {
.
.
# un-comment the ldap 
 ldap
.
.
}
</code></pre>
</blockquote>
<p>Then looks for authenticate section and uncomment Auth-Type LDAP as well.</p>
<blockquote><pre><code>
# vi /opt/etc/raddb/sites-enabled/default

authenticate {
.
.
# un-comment the ldap 
 Auth-Type LDAP{
     ldap
 }
.
.
}
</code></pre>
</blockquote>
</li>
<li>Edit /opt/etc/raddb/sites-enabled/inner-tunnel, looks for authorize section and un-comment the ldap line.<br />
<blockquote><pre><code>
# vi /opt/etc/raddb/sites-enabled/inner-tunnel

authorize {
.
.
# un-comment the ldap 
 ldap
.
.
}
</code></pre>
</blockquote>
<p>Then looks for authenticate section and uncomment Auth-Type LDAP as well.</p>
<blockquote><pre><code>
# vi /opt/etc/raddb/sites-enabled/inner-tunnel

authenticate {
.
.
# un-comment the ldap 
 Auth-Type LDAP{
     ldap
 }
.
.
}
</code></pre>
</blockquote>
</li>
<li>Edit /opt/etc/raddb/clients.conf, add the Wifi Access Point to the config file.<br />
<blockquote><p><code><br />
# vi /opt/etc/raddb/clients.conf</p>
<p># add access point details here, 192.168.0.1 is the ip of the access point</p>
<pre>
client 192.168.0.1 {
     secret = [shared secret password of radius server]
     shortname = [SSID of the access point]
     nastype = other
}
</pre>
<p></code></p></blockquote>
</li>
<li>If you have firewall activate on your diskstation, make sure to add a firewall rule to allow the wifi access point to access the udp port 1812, 1813 and 1814.</li>
</ol>
<p>For now the radius server is already able to perform authentication for wpa/wpa2 enterprise!</p>
<p><strong>Generate client certificate</strong></p>
<p>If you do not plan to perform authorization using client certificate, you can skip this part.</p>
<ol>
<li>SSH to DS as root</li>
<li>Edit /opt/etc/raddb/certs/client.cnf, refer to modding series 21 for details about this client certificate config file.
<p>** IMPORTANT The Country Name, State and Organization Name MUST match the value of the CA.
</li>
<li>Before we generate the client certificate, we MUST backup the original certificate first.<br />
<blockquote><p><code><br />
# cd /opt/etc/raddb<br />
# cp -r certs certs.b4genclient<br />
</code></p></blockquote>
</li>
<li>Generate a client certificate<br />
<blockquote><p><code><br />
# cd /opt/etc/raddb/certs<br />
# make client.pem</li>
<p></code></p></blockquote>
</li>
<li>If you want to generate another client certificate for other wifi client. Edit the client.cnf and run make client.pem again. If  make failed and said it couldn&#8217;t load a certificate, just copy the server.crt from backup directory and try again.<br />
<blockquote><p><code><br />
# cp /opt/etc/raddb/certs.b4genclient/server.crt /opt/etc/raddb/certs<br />
# make client.pem<br />
</code></p></blockquote>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadcode.net/2011/11/13/setup-wifi-wpa2-enterprise-with-freeradiusopenldap/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Synology modding series 31 – Capturing Tomato Router Logs using syslog-ng</title>
		<link>http://blog.deadcode.net/2011/08/27/capturing-tomato-router-logs-using-syslog-ng/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=capturing-tomato-router-logs-using-syslog-ng</link>
		<comments>http://blog.deadcode.net/2011/08/27/capturing-tomato-router-logs-using-syslog-ng/#comments</comments>
		<pubDate>Sat, 27 Aug 2011 09:25:45 +0000</pubDate>
		<dc:creator>ray</dc:creator>
				<category><![CDATA[Synology]]></category>
		<category><![CDATA[DS207+]]></category>
		<category><![CDATA[NAS]]></category>
		<category><![CDATA[syslog-ng]]></category>
		<category><![CDATA[tomato]]></category>

		<guid isPermaLink="false">http://blog.deadcode.net/?p=3102</guid>
		<description><![CDATA[<p>Since NAS is running 24&#215;7, it is the best device to capture my tomato router logs.</p> <p>Install and Setup Syslog-ng</p> Login to NAS using ssh/telnet as root install syslog-ng <p>#ipkg install syslog-ng</p> <p>The glib and eventlog packages should be installed by ipkg as well. Backup syslog-ng configuration <p>#cd /opt/etc/syslog-ng #mv syslog-ng.conf syslog-ng.conf.bak Create configuration [...]]]></description>
			<content:encoded><![CDATA[<p>Since NAS is running 24&#215;7, it is the best device to capture my tomato router logs.</p>
<p><strong>Install and Setup Syslog-ng</strong></p>
<ol>
<li>Login to NAS using ssh/telnet as root</li>
<li>install syslog-ng
<p>#ipkg install syslog-ng</p>
<p>The glib and eventlog packages should be installed by ipkg as well. </li>
<li>Backup syslog-ng configuration
<p>#cd /opt/etc/syslog-ng<br />
#mv syslog-ng.conf syslog-ng.conf.bak
</li>
<li>Create configuration file
<p># vi /opt/etc/syslog-ng.conf</p>
<p>Below is my syslog-ng configuration to capture only the tomato router log</p>
<blockquote><p><code><br />
options { long_hostnames(off); sync(0); };</p>
<p>source src{<br />
            internal();<br />
            udp(port(<font color=red>5140</font>));<br />
};</p>
<p>destination tomatolog { file("/opt/var/log/tomato.log"); };</p>
<p>log {<br />
       source(src); destination(wrt54glog);<br />
};<br />
</code></p></blockquote>
<p>I&#8217;m using 5140 udp port, change to your own preferred port.
</li>
<li>Run the syslog-ng server
<p># /opt/etc/init.d/S01syslog-ng start
</li>
<li>If you have enabled the NAS firewall, you need to insert a firewall rule to allow the inbound logging traffic from the tomato router.
<p>Open a browser and go to the NAS control panel. Navigate to Control Panel / Firewall section. Click &#8216;Create&#8217; button to create a new firewall rule.</p>
<p><strong>Ports:</strong><br />
Custom Port Type: Destination port<br />
Protocol: UDP<br />
Ports: 5140</p>
<p><strong>Source IP</strong><br />
IP address: [IP address of tomato router, i.e. 192.168.1.1]</p>
<p><strong>Action</strong><br />
Allow</p>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2011/08/nas-firewall-syslog-customport-5140-udp-300x140.jpg" alt="" title="NAS Firewall Rules : syslog-ng : 5140 : udp" width="300" height="140" class="alignnone size-medium wp-image-3104" /></p>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2011/08/nas-firewall-syslog-sourceip-action-300x202.jpg" alt="" title="NAS Firewall Rules : syslog-ng : source ip : action" width="300" height="202" class="alignnone size-medium wp-image-3105" /></li>
</ol>
<p><strong>Setup Tomato Router</strong></p>
<ol>
<li>Open a browser and go to tomato admin page</li>
<li>Navigate to Administration / Logging page</li>
<li>Unclick the &#8216;Log Internally&#8217;<br />
Click the &#8216;Log To Remote System&#8217;<br />
Input the NAS IP address and syslog-ng port (which is 5140 defined in the syslog-ng.conf file)<br />
Choose the event(s) you want to capture.<br />
Input &#8217;0&#8242; in the limit textbox.<br />
Click &#8216;Save&#8217; button.</p>
<p><img src="http://blog.deadcode.net/wp-content/uploads/2011/08/tomato-syslog-config.jpg" alt="" title="Tomato remote logging configuration" width="495" height="414" class="alignnone size-full wp-image-3103" />
</li>
</ol>
<p>The router log is configured to /opt/var/log/tomato.log.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.deadcode.net/2011/08/27/capturing-tomato-router-logs-using-syslog-ng/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
