<?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>Junk Coder &#187; Software</title>
	<atom:link href="http://junkcoder.com/category/software/feed/" rel="self" type="application/rss+xml" />
	<link>http://junkcoder.com</link>
	<description>Random stuff about life and technology</description>
	<lastBuildDate>Tue, 06 Jul 2010 19:24:36 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Configuring a VPN with tinc on a WRT54GL running OpenWrt</title>
		<link>http://junkcoder.com/2010/06/06/configuring-a-vpn-with-tinc-on-a-wrt54gl-running-openwrt/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://junkcoder.com/2010/06/06/configuring-a-vpn-with-tinc-on-a-wrt54gl-running-openwrt/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 11:31:30 +0000</pubDate>
		<dc:creator>junkcoder</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[network]]></category>
		<category><![CDATA[openwrt]]></category>
		<category><![CDATA[tinc]]></category>
		<category><![CDATA[vpn]]></category>

		<guid isPermaLink="false">http://junkcoder.com/?p=72</guid>
		<description><![CDATA[If you are already running OpenWrt on your router and need to create a VPN with multiple networks over the internet, tinc seems to be the right way to go.
Installing tinc
OpenWrt already comes with a package for tinc, which you can easily install via the web interface. You will also need the &#8220;kmod-tun&#8221; package, which [...]]]></description>
			<content:encoded><![CDATA[<p>If you are already running <a href="http://openwrt.org/">OpenWrt</a> on your router and need to create a <a href="http://en.wikipedia.org/wiki/Virtual_private_network">VPN</a> with multiple networks over the internet, <a href="http://www.tinc-vpn.org/">tinc</a> seems to be the right way to go.</p>
<p><strong>Installing tinc</strong></p>
<p>OpenWrt already comes with a package for tinc, which you can easily install via the web interface. You will also need the &#8220;kmod-tun&#8221; package, which is not installed by default.<br />
After installing the packages, ssh into your router and create the configuration for your VPN. We will name our VPN &#8220;myvpn&#8221;, but you can change the name to whatever you want. We will create a VPN between two hosts, and assume the following configuration:</p>
<p>node1: 1.2.3.4 (external), 192.168.100.1 (internal)<br />
node2: 2.3.4.5 (external), 192.168.101.1 (internal)</p>
<p><strong>Creating the keys</strong></p>
<p>Connect to node1 via ssh and create the key pair.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span>myvpn<span style="color: #000000; font-weight: bold;">/</span>hosts
tincd <span style="color: #660033;">-n</span> myvpn <span style="color: #660033;">--generate-keys</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span>myvpn<span style="color: #000000; font-weight: bold;">/</span>hosts<span style="color: #000000; font-weight: bold;">/</span>myvpn <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span>myvpn<span style="color: #000000; font-weight: bold;">/</span>hosts<span style="color: #000000; font-weight: bold;">/</span>node1</pre></div></div>

<p>Edit /etc/tinc/myvpn/hosts/node1 and add the following lines above the key:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">Address</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1.2.3.4</span>
<span style="color: #000099;">Subnet</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 192.168.100.0/24</span>
-----BEGIN RSA PUBLIC KEY-----
...
-----END RSA PUBLIC KEY-----</pre></div></div>

<p>You also need to create a key on node2:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span>myvpn<span style="color: #000000; font-weight: bold;">/</span>hosts
tincd <span style="color: #660033;">-n</span> myvpn <span style="color: #660033;">--generate-keys</span>
<span style="color: #c20cb9; font-weight: bold;">mv</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span>myvpn<span style="color: #000000; font-weight: bold;">/</span>hosts<span style="color: #000000; font-weight: bold;">/</span>myvpn <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span>myvpn<span style="color: #000000; font-weight: bold;">/</span>hosts<span style="color: #000000; font-weight: bold;">/</span>node2</pre></div></div>

<p>Edit /etc/tinc/myvpn/hosts/node2 and add the following lines above the key:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">Address</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 2.3.4.5</span>
<span style="color: #000099;">Subnet</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 192.168.101.0/24</span>
-----BEGIN RSA PUBLIC KEY-----
...
-----END RSA PUBLIC KEY-----</pre></div></div>

<p><strong>Exchanging keys</strong></p>
<p>Copy the public definition of each node (/etc/tinc/myvpn/hosts/node<em>n</em>) to every node in the network. You should have the files node1 and node2 in /etc/tinc/myvpn/hosts on every router.</p>
<p><strong>Configuring tinc</strong></p>
<p>After you have all the necessary keys, configuring tinc itself is quite easy. Create the configuration file /etc/tinc/myvpn/tinc.conf with the following content:</p>
<p>On node1:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">Name</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> node1</span>
<span style="color: #000099;">ConnectTo</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> node2</span>
<span style="color: #000099;">Address</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 1.2.3.4</span>
<span style="color: #000099;">Subnet</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 192.168.100.0/24</span></pre></div></div>

<p>On node2:</p>

<div class="wp_syntax"><div class="code"><pre class="ini" style="font-family:monospace;"><span style="color: #000099;">Name</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> node2</span>
<span style="color: #000099;">ConnectTo</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> node1</span>
<span style="color: #000099;">Address</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 2.3.4.5</span>
<span style="color: #000099;">Subnet</span> <span style="color: #000066; font-weight:bold;">=</span><span style="color: #660066;"> 192.168.101.0/24</span></pre></div></div>

<p><strong>Adjusting firewall rules</strong></p>
<p>To allow connections to tinc from the internet, and allow routing traffic through tinc into your internal network, you need to create some rules for your firewall. We will adjust firewall rules in a script which will be called by tinc on startup.</p>
<p>node1: /etc/tinc/myvpn/tinc-up</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #007800;">$INTERFACE</span> 192.168.100.1 netmask 255.255.0.0
iptables <span style="color: #660033;">--append</span> input_wan <span style="color: #660033;">--protocol</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #000000;">655</span> <span style="color: #660033;">--jump</span> ACCEPT
iptables <span style="color: #660033;">--append</span> input_wan <span style="color: #660033;">--protocol</span> udp <span style="color: #660033;">--dport</span> <span style="color: #000000;">655</span> <span style="color: #660033;">--jump</span> ACCEPT
iptables <span style="color: #660033;">--append</span> forwarding_rule <span style="color: #660033;">-i</span> myvpn <span style="color: #660033;">-o</span> br-lan <span style="color: #660033;">-s</span> 192.168.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">16</span> <span style="color: #660033;">-d</span> 192.168.100.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span>
iptables <span style="color: #660033;">-A</span> forwarding_rule <span style="color: #660033;">-o</span> myvpn <span style="color: #660033;">-j</span> ACCEPT
iptables <span style="color: #660033;">-A</span> forwarding_rule <span style="color: #660033;">-i</span> myvpn <span style="color: #660033;">-j</span> ACCEPT</pre></div></div>

<p>node2: /etc/tinc/myvpn/tinc-up</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
<span style="color: #c20cb9; font-weight: bold;">ifconfig</span> <span style="color: #007800;">$INTERFACE</span> 192.168.101.1 netmask 255.255.0.0
iptables <span style="color: #660033;">--append</span> input_wan <span style="color: #660033;">--protocol</span> tcp <span style="color: #660033;">--dport</span> <span style="color: #000000;">655</span> <span style="color: #660033;">--jump</span> ACCEPT
iptables <span style="color: #660033;">--append</span> input_wan <span style="color: #660033;">--protocol</span> udp <span style="color: #660033;">--dport</span> <span style="color: #000000;">655</span> <span style="color: #660033;">--jump</span> ACCEPT
iptables <span style="color: #660033;">--append</span> forwarding_rule <span style="color: #660033;">-i</span> myvpn <span style="color: #660033;">-o</span> br-lan <span style="color: #660033;">-s</span> 192.168.0.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">16</span> <span style="color: #660033;">-d</span> 192.168.101.0<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">24</span>
iptables <span style="color: #660033;">-A</span> forwarding_rule <span style="color: #660033;">-o</span> myvpn <span style="color: #660033;">-j</span> ACCEPT
iptables <span style="color: #660033;">-A</span> forwarding_rule <span style="color: #660033;">-i</span> myvpn <span style="color: #660033;">-j</span> ACCEPT</pre></div></div>

<p>This file needs to be executable:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">chmod</span> +x <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>tinc<span style="color: #000000; font-weight: bold;">/</span>myvpn<span style="color: #000000; font-weight: bold;">/</span>tinc-up</pre></div></div>

<p><strong>Starting tinc</strong></p>
<p>On all nodes, create the file /etc/init.d/tinc and make it executable:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/sh</span>
tincd <span style="color: #660033;">-n</span> myvpn</pre></div></div>

<p>Then create a symlink to automatically start tinc when you power up your router:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>init.d<span style="color: #000000; font-weight: bold;">/</span>tinc <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>rc.d<span style="color: #000000; font-weight: bold;">/</span>S70tinc</pre></div></div>

<p>After starting /etc/init.d/tinc (or rebooting) on both nodes, your VPN should be up and running.</p>
<p><strong>Troubleshooting</strong></p>
<p>If you experience problems, you can read tinc&#8217;s debug log with logread.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">logread    <span style="color: #666666; font-style: italic;"># read syslog</span>
logread <span style="color: #660033;">-f</span> <span style="color: #666666; font-style: italic;"># read log as it grows</span></pre></div></div>

<p>To increase the debug level of tinc, send it a SIGINT signal:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">kill</span> <span style="color: #660033;">-SIGINT</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">pidof</span> tincd<span style="color: #000000; font-weight: bold;">`</span></pre></div></div>

<p>Sending the signal again, will revert to the original log level.</p>
]]></content:encoded>
			<wfw:commentRss>http://junkcoder.com/2010/06/06/configuring-a-vpn-with-tinc-on-a-wrt54gl-running-openwrt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AJAX Thumbnail Rebuild plugin for Wordpress</title>
		<link>http://junkcoder.com/2009/10/10/ajax-thumbnail-rebuild-plugin-for-wordpress/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://junkcoder.com/2009/10/10/ajax-thumbnail-rebuild-plugin-for-wordpress/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 08:59:04 +0000</pubDate>
		<dc:creator>junkcoder</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[admin]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[rebuild]]></category>
		<category><![CDATA[thumbnail]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://junkcoder.com/?p=58</guid>
		<description><![CDATA[


This Wordpress plugin allows you to rebuild all thumbnails on your site. There are already some plugins available for this, but they have one thing in common: All thumbnails are rebuilt in a single step. This works fine when you don&#8217;t have that many photos on your site. When you have a lot of full-size [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-46" src="http://junkcoder.com/wp-content/uploads/ajax-thumbnail-rebuild.jpg" alt="ajax-thumbnail-rebuild" width="572" height="282" />This Wordpress plugin allows you to rebuild all thumbnails on your site. There are already some plugins available for this, but they have one thing in common: All thumbnails are rebuilt in a single step. This works fine when you don&#8217;t have that many photos on your site. When you have a lot of full-size photos, the script on the server side takes a long time to run. Unfortunately the time a script is allowed to run is limited, which sets an upper limit to the number of thumbnails you can regenerate. This number depends on the server configuration and the computing power your server has available. When you get over this limit, you won&#8217;t be able to rebuild your thumbnails.</p>
<p>Why would you want to rebuild your thumbnails? Wordpress allows you to change the size of thumbnails. This way, you can make the size of thumbnails fit the design of your website. When you change the size to fit for a new theme, all future photos you are going to upload will have this new size. Your old thumbnails won&#8217;t be resized. That&#8217;s where this plugin comes into action. After changing the image sizes, you can rebuild all thumbnails. But instead of telling the server to  recreate all thumbnails at once, they are rebuilt one after another. Rebuilding thumbnails for one photo won&#8217;t take all too long, so you won&#8217;t run into any script timeouts. Note that you still have to wait until all thumbnails have been rebuilt. If you close the page before the task is completed, you have to start all over again.</p>
<p>You can download the plugin on it&#8217;s <a href="http://junkcoder.com/ajax-thumbnail-rebuild/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">homepage</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://junkcoder.com/2009/10/10/ajax-thumbnail-rebuild-plugin-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wordpress MU: This file is too big. Files must be less than 1500 Kb in size</title>
		<link>http://junkcoder.com/2009/10/06/wordpress-mu-this-file-is-too-big-files-must-be-less-than-1500-kb-in-size/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed</link>
		<comments>http://junkcoder.com/2009/10/06/wordpress-mu-this-file-is-too-big-files-must-be-less-than-1500-kb-in-size/#comments</comments>
		<pubDate>Tue, 06 Oct 2009 18:06:55 +0000</pubDate>
		<dc:creator>junkcoder</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[code snippet]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[mu]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://junkcoder.com/?p=29</guid>
		<description><![CDATA[If you get the error above when you upload a file to a Wordpress MU blog, you need to change the maximum allowed upload file size. You can find this setting under &#8220;Site Admin &#8230; Options &#8230; Max upload file size&#8221;.
Unfortunately there is no option to change this value for existings blogs, but you can [...]]]></description>
			<content:encoded><![CDATA[<p>If you get the error above when you upload a file to a Wordpress MU blog, you need to change the maximum allowed upload file size. You can find this setting under &#8220;Site Admin &#8230; Options &#8230; Max upload file size&#8221;.</p>
<p>Unfortunately there is no option to change this value for existings blogs, but you can you change it directly in the database:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">UPDATE</span> <span style="color: #ff0000;">`#YOURDATABASENAME#`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`wp_sitemeta`</span> <span style="color: #993333; font-weight: bold;">SET</span> <span style="color: #ff0000;">`meta_value`</span> <span style="color: #66cc66;">=</span> <span style="color: #ff0000;">'32000'</span>
 <span style="color: #993333; font-weight: bold;">WHERE</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`wp_sitemeta`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`meta_value`</span> <span style="color: #66cc66;">=</span> <span style="color: #cc66cc;">1500</span><span style="color: #66cc66;">&#41;</span>
 <span style="color: #993333; font-weight: bold;">AND</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`wp_sitemeta`</span><span style="color: #66cc66;">.</span><span style="color: #ff0000;">`meta_key`</span> <span style="color: #993333; font-weight: bold;">LIKE</span> <span style="color: #ff0000;">&quot;fileupload_maxk&quot;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://junkcoder.com/2009/10/06/wordpress-mu-this-file-is-too-big-files-must-be-less-than-1500-kb-in-size/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
