<?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>Vault</title>
	<atom:link href="http://www.rockerssoft.org/brockers/feed" rel="self" type="application/rss+xml" />
	<link>http://www.rockerssoft.org/brockers</link>
	<description>the place i store my stuff...</description>
	<lastBuildDate>Tue, 19 Feb 2013 23:33:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>A Date Which Will Live In Infamy</title>
		<link>http://www.rockerssoft.org/brockers/archives/2342</link>
		<comments>http://www.rockerssoft.org/brockers/archives/2342#comments</comments>
		<pubDate>Tue, 19 Feb 2013 23:32:44 +0000</pubDate>
		<dc:creator>Bobby Rockers</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[VAULT Information]]></category>

		<guid isPermaLink="false">http://www.rockerssoft.org/brockers/?p=2342</guid>
		<description><![CDATA[Date string conversion is fairly painless in JavaScript but sometimes the sheer number of options can be a little annoying to remember.  Below is a table of date display/conversion functions generated from new Date(&#8220;2013-02-19T21:03:39.818Z&#8221;). Hopefully this is helpful to someone else who doesn&#8217;t want to look up the output of each of these options.  One [...]]]></description>
				<content:encoded><![CDATA[<p>Date string conversion is fairly painless in JavaScript but sometimes the sheer number of options can be a little annoying to remember.  Below is a table of date display/conversion functions generated from</p>
<p style="padding-left: 30px;"><strong>new Date(&#8220;2013-02-19T21:03:39.818Z&#8221;)</strong>.</p>
<p>Hopefully this is helpful to someone else who doesn&#8217;t want to look up the output of each of these options.  One more note, these are outputs for US locals in the Central time-zone; other locals and other time-zones would very accordingly.</p>
<table width="466" rules="rows">
<tbody>
<tr>
<th>Date Function</th>
<th>Output</th>
</tr>
<tr>
<td> <code>toString()</code></td>
<td>Tue Feb 19 2013 15:03:39 GMT-0600 (CST)</td>
</tr>
<tr>
<td><code>toDateString()</code></td>
<td> Tue Feb 19 2013</td>
</tr>
<tr>
<td><code>toGMTString() </code></td>
<td>Tue, 19 Feb 2013 21:03:39 GMT</td>
</tr>
<tr>
<td><code>toISOString()</code></td>
<td>2013-02-19T21:03:39.818Z</td>
</tr>
<tr>
<td> <code>toUTCString()</code></td>
<td> Tue, 19 Feb 2013 21:03:39 GMT</td>
</tr>
<tr>
<td><code>toTimeString()</code></td>
<td>15:03:39 GMT-0600 (CST)</td>
</tr>
<tr>
<td> <code>toLocaleString()</code></td>
<td>Tue 19 Feb 2013 03:03:39 PM CST</td>
</tr>
<tr>
<td> <code>toLocaleDateString()</code></td>
<td> 02/19/2013</td>
</tr>
<tr>
<td> <code>toLocaleTimeString()</code></td>
<td> 03:03:39 PM</td>
</tr>
<tr>
<td> <code>toJSON()</code></td>
<td> 2013-02-19T21:03:39.818Z</td>
</tr>
<tr>
<td> <code>valueOf()</code></td>
<td> 1361307819818</td>
</tr>
<tr>
<td><code>toSource()</code></td>
<td>(new Date(1361307819818))</td>
</tr>
</tbody>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.rockerssoft.org/brockers/archives/2342/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Of Liberty and Theater</title>
		<link>http://www.rockerssoft.org/brockers/archives/2333</link>
		<comments>http://www.rockerssoft.org/brockers/archives/2333#comments</comments>
		<pubDate>Wed, 16 Jan 2013 16:53:41 +0000</pubDate>
		<dc:creator>Bobby Rockers</dc:creator>
				<category><![CDATA[VAULT Information]]></category>

		<guid isPermaLink="false">http://www.rockerssoft.org/brockers/?p=2333</guid>
		<description><![CDATA[The first and second Amendments are really the counter weights to Democracy. Those who ignore the second will ultimately loose the first, and a society that limits the first proves itself unworthy of the second. My biggest fear, with regard to the tragedies of late, is that in an attempt to save &#8220;just one child&#8221; [...]]]></description>
				<content:encoded><![CDATA[<p>The first and second Amendments are really the counter weights to Democracy. Those who ignore the second will ultimately loose the first, and a society that limits the first proves itself unworthy of the second. My biggest fear, with regard to the tragedies of late, is that in an attempt to save &#8220;just one child&#8221; we will surrender their future freedoms for security theater. That liberty will be forfeit at the alter of good intentions, doing nothing more than to make a world that is little less worthy of their sacrifice.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rockerssoft.org/brockers/archives/2333/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Beautiful mălum</title>
		<link>http://www.rockerssoft.org/brockers/archives/2336</link>
		<comments>http://www.rockerssoft.org/brockers/archives/2336#comments</comments>
		<pubDate>Mon, 07 Jan 2013 14:39:07 +0000</pubDate>
		<dc:creator>Bobby Rockers</dc:creator>
				<category><![CDATA[VAULT Information]]></category>

		<guid isPermaLink="false">http://www.rockerssoft.org/brockers/?p=2336</guid>
		<description><![CDATA[GroundWarp has a new contract to do web based development for an Oklahoma City software firm called Phase2 Interactive.  One of the benefits of the job is a brand new Apple MacBook Air for use on the companies projects.  I have booted OSX just long enough to shrink the main system partition to almost nothing [...]]]></description>
				<content:encoded><![CDATA[<p>GroundWarp has a new contract to do web based development for an Oklahoma City software firm called Phase2 Interactive.  One of the benefits of the job is a brand new Apple MacBook Air for use on the companies projects.  I have booted OSX just long enough to shrink the main system partition to almost nothing so I could Linux on it.  So far the entire process has been working pretty well and I am really excited about the quality of the Apple hardware.  Below are some of the system specific fixes I needed to make so overcome the non-standard Apple configuration is places.</p>
<ul>
<li>Setup and install is fundamentally the same as a normal Linux install (at least for Fedora 18) on a 64 bit OS.  As the MacBook Air doesn&#8217;t have a built in CDROM you will need to burn the iso file to a USB stick for the install.  The only thing that might catch you is that some iso-to-usb tools (most notably unetbootin) actually copy the files to the USB drive then create their own custom boot menu.  The new secure EFI boot will not allow this without being signed (which Fedora is) so you will need to create your install USB with good old fashioned dd.  Make sure you use the 64 bit edition.<br />
<blockquote><p>dd if=../Fedora-18-x86-64-DVD.iso of=/dev/sdb</p></blockquote>
</li>
<li>Apple obviously hates its users, and feels they should be punished for their insolence.  At least that is the only explanation I can come up with them flipping the default location of the Alt and Meta keys (key locations that pre-date the Apple by a dozen years&#8230; it would be like making the keyboard layout standard but swapping the location of the F and G keys.)  Thankfully this is an easy fix if you are using KDE.  Go to you <strong>System Settings</strong>, choose<strong> Input Devices</strong>, choose <strong>Keyboard</strong>, then choose the <strong>Advanced</strong> tab.  There is an expandable option titled <strong>Alt/Win key Behavior</strong>, click on the <strong>Left Alt is Swapped with Left Win</strong>. Select Apply.</li>
<li>By default Apple maps the F1 through F12 keys to their system function options (things like volume up/down and screen brightness.)  This is probably fine for most people but if you are a keyboard jokey or a programmer you almost certainly us the F keys constantly.  The quick fix for this is to run the following command as root:<br />
<blockquote><p>echo 2 &gt; /sys/module/hid_apple/parameters/fnmode</p></blockquote>
</li>
<li>I am not sure what the &#8220;right&#8221; way to set kernel module parameters on system boot now that Lennart Poettering bastardized evil systemd has infect the entire Linux world (remember when Linux was simple and intuitive) but once I find the official way to set that it I will update this post.</li>
<li>Got to go, but there is more to come.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.rockerssoft.org/brockers/archives/2336/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A Life Spent Making Mistakes</title>
		<link>http://www.rockerssoft.org/brockers/archives/2324</link>
		<comments>http://www.rockerssoft.org/brockers/archives/2324#comments</comments>
		<pubDate>Fri, 16 Nov 2012 23:20:35 +0000</pubDate>
		<dc:creator>Bobby Rockers</dc:creator>
				<category><![CDATA[VAULT Treasures]]></category>

		<guid isPermaLink="false">http://www.rockerssoft.org/brockers/?p=2324</guid>
		<description><![CDATA[Couple other bash tips to help with more robust code.  The main improvement I learned from the previous link is the trap function.  This function lets you cleanup when specific system signals get sent from the OS, like INT (what gets sent to a program when Ctrl+c is typed) and the TERM signal.  A great [...]]]></description>
				<content:encoded><![CDATA[<p>Couple other bash tips to help with <a title="Writing Robust Shell Scripts" href="http://www.davidpashley.com/articles/writing-robust-shell-scripts.html">more robust</a> code.  The main improvement I learned from the previous link is the trap function.  This function lets you cleanup when specific system signals get sent from the OS, like INT (what gets sent to a program when Ctrl+c is typed) and the TERM signal.  A great example is:</p>
<blockquote><p>trap &#8220;rm -f $lockfile; exit&#8221; INT TERM EXIT</p></blockquote>
<p>In this case a lockfile is being removed just before closing a bash script.   You can get a full list of all the different system signals with the <strong>kill -l</strong> command.</p>
<p>The other major bash tool that I have used without ever really understanding what it did is the <strong>eval</strong> expression.  If you have ever written a sysinit configuration script, you know that you use eval to basically load/set variables from other subscripts or external files.  The reason eval does this is explained here.  The quick explanation is that eval forces bash to evaluate<strong><em> a second time</em></strong> any code reference passed to it.  So setting bash variables in-line is as easy as:</p>
<blockquote><p>eval $(LANG=C grep -F &#8220;DEVICE=&#8221; ifcfg-$i)</p></blockquote>
<p>Overall, I am consistently amazed at the power and flexibility of the Linux command line.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rockerssoft.org/brockers/archives/2324/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>If the line is good</title>
		<link>http://www.rockerssoft.org/brockers/archives/2320</link>
		<comments>http://www.rockerssoft.org/brockers/archives/2320#comments</comments>
		<pubDate>Wed, 14 Nov 2012 17:27:28 +0000</pubDate>
		<dc:creator>Bobby Rockers</dc:creator>
				<category><![CDATA[VAULT Links]]></category>

		<guid isPermaLink="false">http://www.rockerssoft.org/brockers/?p=2320</guid>
		<description><![CDATA[Found a couple links to articles that discuss Linux usage across a number of different markets.&#160; Just citing the authors: 88% Of Top 500 Super Computers Running Linux Linux Android OS ships on 60.5% US phones, 87.7% in China. 64.2% of websites run on Linux/Unix (excluding MacOS) Linux use in embedded devices forecast for around [...]]]></description>
				<content:encoded><![CDATA[<p>Found a couple links to articles that discuss Linux usage across a number of different markets.&nbsp; Just citing the authors:</p>
<ul>
<li><a href="http://www.internetnews.com/skerner/2009/11/linux-dominates-top-500-superc.html">88% Of Top 500 Super Computers Running Linux</a></li>
<li><a href="http://dawn.com/2012/11/13/googles-android-finally-earns-respect-with-developers/">Linux Android OS ships on 60.5% US phones, 87.7% in China.</a></li>
<li><a href="http://w3techs.com/technologies/overview/operating_system/all">64.2% of websites run on Linux/Unix (excluding MacOS)</a></li>
<li><a href="http://www.linuxfordevices.com/c/a/Linux-For-Devices-Articles/Snapshot-of-the-embedded-Linux-market-April-2007/">Linux use in embedded devices forecast for around 70% by 2012</a></li>
</ul>
<p>All of the above noted, Linux desktop usage still hovers around 1-3%</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rockerssoft.org/brockers/archives/2320/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trust the Engineer</title>
		<link>http://www.rockerssoft.org/brockers/archives/2294</link>
		<comments>http://www.rockerssoft.org/brockers/archives/2294#comments</comments>
		<pubDate>Mon, 12 Nov 2012 21:10:50 +0000</pubDate>
		<dc:creator>Bobby Rockers</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[VAULT Treasures]]></category>

		<guid isPermaLink="false">http://www.rockerssoft.org/brockers/?p=2294</guid>
		<description><![CDATA[A client project along with my &#8220;Hacking &#38; Countermeasures&#8221; class has recently necessitated a need for my own VPN for use in wireless applications. I needed to connect the VPN to my server rack and the system needed to be an &#8220;in-house&#8221; system I could turn up myself (sorry Cisco, no ASA for me.)  Finally, [...]]]></description>
				<content:encoded><![CDATA[<p>A client project along with my &#8220;Hacking &amp; Countermeasures&#8221; class has recently necessitated a need for my own VPN for use in wireless applications. I needed to connect the VPN to my server rack and the system needed to be an &#8220;in-house&#8221; system I could turn up myself (sorry Cisco, no ASA for me.)  Finally, it needed to be an SSL based VPN solution as I have had entirely too many issues with locations filtering nonstandard Internet traffic effectively blocking IPSec VPN access on their networks.</p>
<p>I use <a href="http://www.rackspace.com">Rackspace</a> for my server infrastructure, so it only took me about 15 minutes to get the physical (errr&#8230; cloud&#8230; damn&#8230; whatever) Linux machine (Fedora 17 x64) up and running but actually setting up OpenVPN was significantly more challenging that I originally had considered.  The problem wasn&#8217;t the lack of documentation (actually the opposite was generally true.)  The problem is that VPN connectivity is so inherently picky, and there are SO many options, that getting a specific configuration running for a specific distribution can be a little overwhelming.</p>
<p>So, for my own personal benefit, here is some of the information I needed to get OpenVPN working on a Fedora 17 server routing http traffic as well as direct traffic to my private subnet.  OpenVPN will be configured to use port 443 (the standard web SSL port) using the TCP protocol.)  As OpenVPN uses SSL, and we will be using TCP on the HTTPS port, all the traffic will look like standard secure web traffic to the network, effectively keeping it from being filtered.</p>
<p><strong>On the Server (as root):</strong></p>
<ul>
<li>Start by install openvpn and other support packages:
<ul>
<li><code>yum install openvpn pkcs11-tools pkc11-dump</code></li>
</ul>
</li>
<li>We will use the easy-rsa script toolkit to create our shared keys.  So start by coping the example easy-rsa files into your home directory:
<ul>
<li><code>cp -ai /usr/share/openvpn/easy-rsa/2.0 ~/easy-rsa</code></li>
<li><code>cd ~/easy-rsa</code></li>
</ul>
</li>
<li>Next you will need to edit the <strong>vars</strong> file.  Basically it is ID information for your server certificate.  The values other than the PKCS11_MODULE_PATH (which will be set to /usr/lib64/ on x64 machines) are not particularly critical but don&#8217;t leave them blank!  Mine looked something like this:</li>
</ul>
<blockquote><p>export KEY_COUNTRY=&#8221;US&#8221;<br />
export KEY_PROVINCE=&#8221;OK&#8221;<br />
export KEY_CITY=&#8221;Norman&#8221;<br />
export KEY_ORG=&#8221;Rockerssoft&#8221;<br />
export KEY_EMAIL=&#8221;name@emailaddress.com&#8221;<br />
export KEY_EMAIL=name@emailaddress.com<br />
export KEY_CN=rockerssoft-vpn<br />
export KEY_NAME=rockerssoft-vpn-key<br />
export KEY_OU=rockerssoft-vpn<br />
export PKCS11_MODULE_PATH=/usr/lib64/</p></blockquote>
<ul>
<li>Now we generate our server keys and setup our openvpn service directories:
<ul>
<li><em><code>. vars</code></em></li>
<li><em><code>./clean-all</code></em></li>
<li><em><code>./build-ca</code></em></li>
<li><em><code>./build-inter $( hostname | cut -d. -f1 )</code></em></li>
<li><code>./build-dh</code></li>
</ul>
<ul>
<li><code>mkdir /etc/openvpn/keys</code></li>
</ul>
</li>
<li><code>Now with our keys built, we need to copy all of them (along with our certificates and template configuration information) into our service directory.</code>
<ul>
<li><code>cp -ai keys/$( hostname | cut -d. -f1 ).{crt,key} keys/ca.crt keys/dh*.pem /etc/openvpn/keys/</code></li>
<li><code>cp -ai /usr/share/doc/openvpn-*/sample-config-files/roadwarrior-server.conf /etc/openvpn/server.conf</code></li>
</ul>
</li>
<li>The config file we just copied to /etc/openvpn/server.conf will need to be edited for your specific server configuration.  If you have problems connecting later on it is most like an issue with either the server configuration file or the client configuration file not matching.  As we want the system to be a full VPN proxy for all internet traffic start by adding the following to the BOTTOM of your config file:
<ul>
<li><code>comp-lzo yes</code></li>
<li><code>push "redirect-gateway def1"</code></li>
</ul>
</li>
<li>In <em> /etc/openvpn/server.conf</em>, edit the port number and add a line to have openvpn use tcp instead of udp for port 443.  This should be somewhere between line 9 and 12 and should look something like this when you are done.</li>
</ul>
<blockquote><p>port 443<br />
proto tcp-server</p></blockquote>
<ul>
<li>In <em> /etc/openvpn/server.conf</em>, edit the cert and key file location names somewhere between line 17 and 20.  Add the full path to your key/cert files we moved two steps previous.  They should look something like this (notice the /etc/openvpn/keys preceding each entry:)</li>
</ul>
<blockquote><p>tls-server<br />
ca /etc/openvpn/keys/ca.crt<br />
cert /etc/openvpn/keys/bob-vpn-1.crt<br />
key /etc/openvpn/keys/bob-vpn-1.key<br />
dh /etc/openvpn/keys/dh1024.pem</p></blockquote>
<ul>
<li>After you have modified your server configuration files, you will need to tell the Linux Security subsystem (aka SELinux) to recognize the to file layout.  To do this type the following command:
<ul>
<li><code>restorecon -Rv /etc/openvpn</code></li>
</ul>
</li>
<li>If you need to test your server settings you can run openvpn directly, say to debug your config file,  this way (press Ctrl+c to stop it):
<ul>
<li><code>openvpn /etc/openvpn/server.conf</code></li>
</ul>
</li>
<li>Finally, you can turn the openvpn server on and enable it so that it starts during future reboots as well.
<ul>
<li><code>systemctl enable openvpn@server.service</code></li>
<li><code>systemctl start openvpn@server.service</code></li>
</ul>
</li>
<li>Now that the server is running you will need to configure the firewall to allow vpn traffic connections AND route all your traffic through the system (via Network Address Translation.)  Start by backing up your old iptables configuration and enabling NAT forwarding in the Linux kernel:
<ul>
<li><code>mv /etc/sysconfig/iptables /etc/sysconfig/iptables.old</code></li>
<li><code>sysctl -w net.ipv4.ip_forward=1</code></li>
</ul>
</li>
<li>Open up your favorite text editor and copy the following iptable rules into the file.  You will need to save the file as <strong>/etc/sysconfig/iptables</strong>.  This configuration assumes that eth0 is your public IP address and eth1 is your private.  If this is backwards just change eth0 to eth1 and vice versa.  Also it keeps port 22 open for ssh connectivity.</li>
</ul>
<blockquote><p># Modified from iptables-saved by Bob Rockers<br />
*nat<br />
:PREROUTING ACCEPT [15:1166]<br />
:INPUT ACCEPT [4:422]<br />
:OUTPUT ACCEPT [0:0]<br />
:POSTROUTING ACCEPT [0:0]<br />
-A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE<br />
*filter<br />
:INPUT ACCEPT [0:0]<br />
:FORWARD ACCEPT [0:0]<br />
:OUTPUT ACCEPT [118860:18883888]<br />
-A INPUT -m state &#8211;state RELATED,ESTABLISHED -j ACCEPT<br />
-A INPUT -p icmp -j ACCEPT<br />
-A INPUT -i lo -j ACCEPT<br />
-A INPUT -p tcp -m state &#8211;state NEW -m tcp &#8211;dport 22 -j ACCEPT<br />
-A INPUT -i eth0 -p tcp -m tcp &#8211;dport 443 -j ACCEPT<br />
-A INPUT -i tun+ -j ACCEPT<br />
-A INPUT -j REJECT &#8211;reject-with icmp-host-prohibited<br />
-A FORWARD -i tun+ -j ACCEPT<br />
-A FORWARD -i eth1 -o tun+ -j ACCEPT<br />
-A FORWARD -i eth0 -o tun+ -m state &#8211;state RELATED,ESTABLISHED -j ACCEPT<br />
-A FORWARD -j REJECT &#8211;reject-with icmp-host-prohibited<br />
COMMIT</p></blockquote>
<ul>
<li>To make NAT work across reboots you will need to modify the <strong>/etc/sysctl.conf</strong><strong> </strong>file and change the line <em>net.ipv4.ip_forward = 0</em>to the following:
<ul>
<li><code>net.ipv4.ip_forward = 1</code></li>
</ul>
</li>
<li>To make everything permanent type the following:
<ul>
<li><code>sysctl -p /etc/sysctl.conf</code></li>
</ul>
</li>
<li>Now restart your firewall configuration:
<ul>
<li><code>systemctl restart iptables.service</code></li>
</ul>
</li>
</ul>
<p>That should take care of our server configuration. I will follow this post up with client configurations for Windows and Fedora 17 KDE installs. Please feel free to email any fixes/updates to the above configuration if you see something.  Below are a couple of the links I used to get this configuration working:</p>
<ul>
<li><a title="Fedora and OpenVPN" href="http://fedoraproject.org/wiki/Openvpn">Fedora Wki OpenVPN</a></li>
<li><a title="Windows 7 and Fedora 11 OpenVPN Client setup" href="http://zhaoke.com/blog/436.html">Zhaoke&#8217;s Blog, Setting up OpenVPN on Fedora 11 and Windows7</a></li>
<li><a title="VPN tab disabled on networkmanager" href="http://www.cyberciti.biz/faq/deiban-ubuntu-linux-networkmanager-pptp-cisco-vpn-tab-disabled/">Ciberciti NetworkManager OpenVPN configuration</a></li>
<li><a title="Routing and DNS configuration" href="https://stomp.colorado.edu/blog/blog/2010/07/02/on-networkmanager-openvpn-and-routes/">Steel Blog, OpenVPN, DNS, Routing, and NetworkManager</a></li>
<li><a title="OpenVPN.net Documentation" href="http://openvpn.net/index.php/open-source/documentation/howto.html">OpenVPN.org HowTo Tutorial</a></li>
<li><a title="Unix.com forum post" href="http://www.unix.com/ip-networking/133401-help-route-all-traffic-through-openvpn-road-warrior-surf-web-anonymously-safely.html">Unix.com forum, OpenVPN, NAT, and Routing</a></li>
<li><a title="Fedora 14 Wiki Routing NAT " href="http://docs.fedoraproject.org/en-US/Fedora/12/html/Security_Guide/sect-Security_Guide-Firewalls-FORWARD_and_NAT_Rules.html">Fedora Wiki Firwall Routing and NAT configuration</a></li>
<li><a title="OpenVPN wiki on routing" href="http://openvpn.net/index.php/open-source/documentation/howto.html#redirect">OpenVPN.org HowTo Routing</a></li>
</ul>
<p>Finally, the above solution is susceptible to a man-in-the-middle attack from another client impersonating the server (not a problem for my setup as I personally know everyone who I have issued client certificates to.)  The solution is sign the server certificate with a tls-server only key and force clients to check this status on connection.  There is more documentation for this setup <a title="OpenVPN Man In The Middle Risk" href="http://openvpn.net/index.php/open-source/documentation/howto.html#mitm">here</a> and specifics about the easy-rsa setup <a title="OpenVPN wiki RSA Key Management" href="http://openvpn.net/index.php/open-source/documentation/miscellaneous/77-rsa-key-management.html">here</a>.  At some point I will update this tutorial to fix that issue but, for now, this has been a long enough post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rockerssoft.org/brockers/archives/2294/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>But what&#8217;s my motivation?</title>
		<link>http://www.rockerssoft.org/brockers/archives/2275</link>
		<comments>http://www.rockerssoft.org/brockers/archives/2275#comments</comments>
		<pubDate>Sun, 11 Nov 2012 23:03:04 +0000</pubDate>
		<dc:creator>Bobby Rockers</dc:creator>
				<category><![CDATA[VAULT Information]]></category>

		<guid isPermaLink="false">http://www.rockerssoft.org/brockers/?p=2275</guid>
		<description><![CDATA[Scripts in generally and bash in particular fill an enormous amount of my time.  The ability to create scripts that can handle a number of diverse inputs is directly related to how flexible and robust the code-base is.  The most common problem when handling files in Bash is the problem with spaces.  Linux is both [...]]]></description>
				<content:encoded><![CDATA[<p>Scripts in generally and bash in particular fill an enormous amount of my time.  The ability to create scripts that can handle a number of diverse inputs is directly related to how flexible and robust the code-base is.  The most common problem when handling files in Bash is the problem with spaces.  Linux is both case sensitive and handles spaces with less&#8230; grace&#8230; than some OSes.  Bash suffers from these same issues.  The easiest way to handle this is with the IFS system variable.  IFS is simply the field delimiter for Linux (i.e. white space) and, because it is a modifiable system variable, you set it to something that you will not run into.  For example:</p>
<blockquote><p>#!/bin/bash<br />
KEEPOLDVALUE=$IFS<br />
IFS=$(echo -en &#8220;\n\b&#8221;)<br />
for var in *<br />
do<br />
# Do something with each line of a file<br />
echo &#8220;$var&#8221;<br />
done<br />
IFS=$KEEPOLDVALUE</p></blockquote>
<p>That will solve the problem dealing with spaces when developing simple/basic scripts that are written for quick and dirty system management.  That said, when you are building scripts to use regularly you will need to do be a more comprehensive when testing your script.</p>
<p>A good place to start is by setting -u. Whenever testing new scripts, try running them without any arguments but WITH -u. If you fail to correctly initialize your variables running them with -u will warn you that there is a problem. For example:</p>
<blockquote><p>$bash -u /tmp/mynewtestscript.sh<br />
/tmp/mynewtestscript.sh: line 34: $DIRNAME: unbound variable</p></blockquote>
<p>We can then verify that we have (at the very least) correctly initialized any variables that we will use and reduce the probability of side-effects.</p>
<p>A problem I ran into a lot with my early script creation was that I often needed standard output from one command to be sent to another command as <em>command line input</em> (as opposed to standard input.) The best way to solve this problem with using the bash built-in command execution form, for example:</p>
<blockquote><p>echo $(ls)</p></blockquote>
<p>But this isn&#8217;t always very elegant to implement directly, so another options is the wonderful xargs command.  xargs breaks the output of one command into individual arguments that it feeds to another command.  This allows you to use standard piping between otherwise un-pipeable commands.  For example:</p>
<blockquote><p><code>ls | xargs echo</code></p></blockquote>
<p>Sometime joining two vars can be complicated when those var names need characters between them.  To solve this you can you can use parameter substitution.  What this means, effectively, is that the var $tempvar and ${tempvar} are the same thing.  This allows you to combine variables with in-between characters without concern.</p>
<blockquote><p>_a=&#8221;test&#8221;<br />
_b=&#8221;/file&#8221;<br />
newvar=${_a}folder${_b}</p></blockquote>
<p>Another useful tip (found via <a title="10 Tips for Writing Bash Scripts" href="http://hacktux.com/bash/script/efficient">this article</a> from hacktux) is the mktemp executables for temporary file creation.  Needing a temp file to store intermediate data try the following:</p>
<blockquote><p><code>tempfile=$(/bin/mktemp)<br />
tempdir=$(/bin/mktemp -d)</code></p></blockquote>
<p>Another common problem for bash scripts being used for administration is that they need to be run as root (or sudo root on Ubuntu systems.)  The way to solve this is to check the EUID environmental variable.  Root will always be 0 for EUID and you can put a simple check at the beginning of your script with the following:</p>
<blockquote><p>if [[ $EUID -ne 0 ]]; then<br />
echo &#8220;This script must be run as root&#8221; 1&gt;&amp;2<br />
exit 1<br />
fi</p></blockquote>
<p>Need a random number of characters for your bash script?  Use dd and /dev/random to get a variable number of characters.  For example:</p>
<blockquote><p>random=&#8221;$(dd if=/dev/urandom bs=3 count=1)&#8221;</p></blockquote>
<p>Will give you three random characters (stored in $random) out of urandom current entropy pool.  Unfortunately the character  set is likely to be UTF-32 giving you a bunch of ?? symbols.  To convert those to base64 encoding just pipe the output through base64 (the conversion process may likely give you more than 3 characters to be sure to regexp to the number of characters you need):</p>
<blockquote><p>random=&#8221;$(dd if=/dev/urandom bs=3 count=1 | base64)&#8221;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.rockerssoft.org/brockers/archives/2275/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What I have been Tweeting</title>
		<link>http://www.rockerssoft.org/brockers/archives/2290</link>
		<comments>http://www.rockerssoft.org/brockers/archives/2290#comments</comments>
		<pubDate>Mon, 24 Sep 2012 01:20:00 +0000</pubDate>
		<dc:creator>Bobby Rockers</dc:creator>
				<category><![CDATA[Tweets]]></category>

		<guid isPermaLink="false">http://www.rockerssoft.org/brockers/archives/2290</guid>
		<description><![CDATA[Anyone who thinks government is the answer to our healthcare problems should make a trip to the drivers license office. #neverendingwait # Contacted 5 govmt offices, in 2 states, waited 2.5 hours in 1 of those offices; to fix a ticket from 2000 and resolved in 2009&#8230; REALLY??!? #]]></description>
				<content:encoded><![CDATA[<ul class="aktt_tweet_digest">
<li>Anyone who thinks government is the answer to our healthcare problems should make a trip to the drivers license office.   #<a href="http://search.twitter.com/search?q=%23neverendingwait" class="aktt_hashtag">neverendingwait</a>  <a href="http://twitter.com/rrockers/statuses/247727744161562625" class="aktt_tweet_time">#</a></li>
<li>Contacted 5 govmt offices, in 2 states, waited 2.5 hours in 1 of those offices; to fix a ticket from 2000 and resolved in 2009&#8230; REALLY??!?  <a href="http://twitter.com/rrockers/statuses/248074986143752192" class="aktt_tweet_time">#</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.rockerssoft.org/brockers/archives/2290/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Starting Dropbox</title>
		<link>http://www.rockerssoft.org/brockers/archives/2282</link>
		<comments>http://www.rockerssoft.org/brockers/archives/2282#comments</comments>
		<pubDate>Thu, 20 Sep 2012 04:35:17 +0000</pubDate>
		<dc:creator>Bobby Rockers</dc:creator>
				<category><![CDATA[VAULT Humor]]></category>

		<guid isPermaLink="false">http://www.rockerssoft.org/brockers/?p=2282</guid>
		<description><![CDATA[My brother wanted a quick explanation on how to create an executable to start Dropbox. While I was helping him he was kind enough to mock my freakishly awesome IBM Model M Unicomp keyboard&#8230; the greatest keyboard in the world. This setup is designed to work the the local tar.gz install of Dropbox on Linux [...]]]></description>
				<content:encoded><![CDATA[<p>My brother wanted a quick explanation on how to create an executable to start Dropbox.  While I was helping him he was kind enough to mock my freakishly awesome IBM Model M Unicomp keyboard&#8230; the greatest keyboard in the world.   This setup is designed to work the the local tar.gz install of Dropbox on Linux and NOT the rpm based install (that requires Gnome for the file manager.)</p>
<p>Create a new file in your ~/bin directory called startdropbox.sh with the following content</p>
<blockquote><p>#!/bin/bash<br />
~/.dropbox-dist/dropboxd &amp;</p></blockquote>
<p>After you have saved the file make the file executable by typeing</p>
<p style="padding-left: 30px;"><strong>chmod 755 ~/bin/startdropbox.sh</strong></p>
<p>Now you can start up dropbox by clicking on that icon at any time.</p>
<p>AND I LOVE MY <a title="Unicomp IBM Model M Keyboard" href="http://pckeyboard.com/page/product/UB40P4A">CLICKY KEYBOARD</a> BITCHES!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rockerssoft.org/brockers/archives/2282/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What I have been Tweeting</title>
		<link>http://www.rockerssoft.org/brockers/archives/2279</link>
		<comments>http://www.rockerssoft.org/brockers/archives/2279#comments</comments>
		<pubDate>Mon, 17 Sep 2012 01:20:00 +0000</pubDate>
		<dc:creator>Bobby Rockers</dc:creator>
				<category><![CDATA[Tweets]]></category>

		<guid isPermaLink="false">http://www.rockerssoft.org/brockers/archives/2279</guid>
		<description><![CDATA[Dear Oklahoma, your insane liquor laws are driving me to drink!!! #OKC #]]></description>
				<content:encoded><![CDATA[<ul class="aktt_tweet_digest">
<li>Dear Oklahoma, your insane liquor laws are driving me to drink!!! #<a href="http://search.twitter.com/search?q=%23OKC" class="aktt_hashtag">OKC</a>  <a href="http://twitter.com/rrockers/statuses/246627628432367618" class="aktt_tweet_time">#</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.rockerssoft.org/brockers/archives/2279/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
