<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description></description><title>NullPointerException</title><generator>Tumblr (3.0; @roguefrequency)</generator><link>http://roguefrequency.tumblr.com/</link><item><title>Protecting a Windows laptop with iptables</title><description>&lt;p&gt;&lt;strong&gt;Background&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;One night last week I sat down to tune up the native firewall running on my copy of Windows 7.  I quickly became frustrated with how long it was taking to point-and-click my way through the process of pruning back permissions.  Between the annoyance of finding entries that various installers had entered without my permission and seeing that almost every rule had triplicates to cover each profile (Private, Public, and Domain), I decided that there had to be a better way.&lt;/p&gt;
&lt;p&gt;As much as I would love to cut the Microsoft-cord and live in a pure open-source world, some of my frequently used applications don&amp;#8217;t come in Linux-flavor (iTunes, Guitar Pro, Visio, etc).  Occasionally, I also like to take my laptop to local LAN parties and get my Unreal Tournament and StarCraft II on.  Because of this, I am reliant on a non-virtualized Window operating system.  After some thought and research, I decided to create a virtual machine to act as a gateway/firewall for my host OS.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Preparation:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;I first started by downloading and installing an updated version of Oracle&amp;#8217;s &lt;a title="VirtualBox" target="_blank" href="http://www.virtualbox.org"&gt;VirtualBox&lt;/a&gt; virtualization environment.&lt;/li&gt;
&lt;li&gt;I also grabbed the 64-bit version of the &lt;a title="Ubuntu Server" target="_blank" href="http://www.ubuntu.com/business/server/overview"&gt;Ubuntu Server&lt;/a&gt; 11.04 ISO.  Debian or Fedora would have easily taken care of the job as well.&lt;/li&gt;
&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Install the VM:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Create a new VM.&lt;br/&gt;&lt;br/&gt;&lt;strong&gt;&lt;img src="http://media.tumblr.com/tumblr_lmrk0kWW291qio859.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;I have 16GB of RAM in my laptop, so I had no problem dishing out 512MB to the VM, but if you need to be more frugal with your memory, you&amp;#8217;ll probably be fine with 128MB.&lt;/li&gt;
&lt;li&gt;I allocated 4GB to the dynamically-expanding virtual hard drive, but again, you could probably go as low as 2GB without problems.&lt;/li&gt;
&lt;li&gt;Removed the floppy device and disabled the audio.&lt;/li&gt;
&lt;li&gt;Set up the network adapters as listed below.&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lmrkjdth1t1qio859.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lmrkjkxiCy1qio859.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/li&gt;
&lt;li&gt;Point the CD device at the Ubuntu Server ISO.&lt;/li&gt;
&lt;li&gt;Start the VM.&lt;/li&gt;
&lt;li&gt;Select &amp;#8220;Install Ubuntu Server&amp;#8221;.&lt;/li&gt;
&lt;li&gt;When Ubuntu asks which network interface to use as the primary, select &amp;#8220;eth0&amp;#8221;.  That will be Bridged Adapter.&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lmrkp24tXQ1qio859.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/li&gt;
&lt;li&gt;Pick a hostname.&lt;/li&gt;
&lt;li&gt;I chose to format the disk using the quick &amp;#8220;Guided - Use Entire Disk&amp;#8221; method for simplicity sake, but you can partition it up however you want.&lt;/li&gt;
&lt;li&gt;When it comes time to set a username and password, note that if you configure the firewall the way I did, there will be no access to the VM&amp;#8217;s operating system except through the VirtualBox window.  Because of this, I wouldn&amp;#8217;t bother making an uber-secure 16-character password for this.&lt;/li&gt;
&lt;li&gt;Disable automatic updates (the VM will not have the ability to connect to the internet).&lt;/li&gt;
&lt;li&gt;Don&amp;#8217;t select any packages.&lt;/li&gt;
&lt;li&gt;Wait for the install to complete.&lt;/li&gt;
&lt;li&gt;Answer &amp;#8216;yes&amp;#8217; to the GRUB question.&lt;/li&gt;
&lt;li&gt;Reboot the VM.  Optionally you can shut down instead, remove the CD device, and start back up.&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;&lt;strong&gt;Configure the VM:&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Log in to the VM.&lt;/li&gt;
&lt;li&gt;Edit the network interfaces configuration file to include the following:&lt;br/&gt;&lt;em&gt;sudo vim /etc/network/interfaces&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;pre&gt;auto lo&lt;br/&gt;iface lo inet loopback&lt;br/&gt;&lt;br/&gt;auto eth0&lt;br/&gt;iface eth0 inet dhcp&lt;br/&gt;&lt;br/&gt;auto eth1&lt;br/&gt;iface eth1 inet static&lt;br/&gt;    address 192.168.56.1&lt;br/&gt;    netmask 255.255.255.0&lt;br/&gt;    network 192.168.56.0&lt;br/&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Create the iptables firewall setup script.  Note that all scripts in the &amp;#8216;if-up.d&amp;#8217; directory will automatically be run when a network interface comes up.  To allow incoming connections to reach your Windows OS, add space-separated port numbers into the FORWARDED_TCP_PORTS or FORWARD_UDP_PORTS arrays.&lt;br/&gt;For example, allowing a web server: &amp;#8220;FORWARDED_TCP_PORTS=( 80&amp;#160;443 )&amp;#8221;&lt;br/&gt;&lt;br/&gt;&lt;em&gt;sudo vim /etc/network/if-up.d/iptables&lt;/em&gt;&lt;br/&gt;&lt;br/&gt;&lt;pre&gt;#!/bin/bash&lt;br/&gt;&lt;br/&gt;IPTABLES=/sbin/iptables&lt;br/&gt;IF_PUBLIC=eth0&lt;br/&gt;IF_PRIVATE=eth1&lt;br/&gt;HOST=192.168.56.2&lt;br/&gt;FORWARDED_TCP_PORTS=()&lt;br/&gt;FORWARDED_UDP_PORTS=()&lt;br/&gt;&lt;br/&gt;echo -n "Flushing existing iptables rules... "&lt;br/&gt;$IPTABLES -F&lt;br/&gt;$IPTABLES -F -t nat&lt;br/&gt;$IPTABLES -X&lt;br/&gt;$IPTABLES -P INPUT DROP&lt;br/&gt;$IPTABLES -P OUTPUT DROP&lt;br/&gt;$IPTABLES -P FORWARD DROP&lt;br/&gt;echo "DONE"&lt;br/&gt;&lt;br/&gt;echo -n "Setting up ingress rules... "&lt;br/&gt;# No inbound traffic allowed&lt;br/&gt;echo "DONE"&lt;br/&gt;&lt;br/&gt;echo -n "Setting up egress rules... "&lt;br/&gt;# No outbound traffic allowed&lt;br/&gt;echo "DONE"&lt;br/&gt;&lt;br/&gt;echo -n "Setting up the NAT... "&lt;br/&gt;$IPTABLES -A FORWARD -m state --state INVALID -j DROP&lt;br/&gt;$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT&lt;br/&gt;$IPTABLES -A FORWARD -i $IF_PRIVATE -j ACCEPT&lt;br/&gt;$IPTABLES -t nat -A POSTROUTING -s $HOST -o $IF_PUBLIC -j MASQUERADE&lt;br/&gt;echo "DONE"&lt;br/&gt;&lt;br/&gt;echo -n "Setting up forwarded ports... "&lt;br/&gt;for PORT in ${FORWARDED_TCP_PORTS[@]}; do&lt;br/&gt;    $IPTABLES -A FORWARD -p tcp --dport $PORT -i $IF_PUBLIC -j ACCEPT&lt;br/&gt;    $IPTABLES -t nat -A PREROUTING -p tcp --dport $PORT -i $IF_PUBLIC -j DNAT --to $HOST:$PORT&lt;br/&gt;done&lt;br/&gt;for PORT in ${FORWARDED_UDP_PORTS[@]}; do&lt;br/&gt;    $IPTABLES -A FORWARD -p udp --dport $PORT -i $IF_PUBLIC -j ACCEPT&lt;br/&gt;    $IPTABLES -t nat -A PREROUTING -p udp --dport $PORT -i $IF_PUBLIC -j DNAT --to $HOST:$PORT&lt;br/&gt;done&lt;br/&gt;echo "DONE"&lt;br/&gt;&lt;br/&gt;&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Add execution permissions to the script.&lt;br/&gt;&lt;em&gt;sudo chmod +x /etc/network/if-up.d/iptables&lt;br/&gt;&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Configure the kernel to allow IP forwarding by uncommenting the line:&lt;br/&gt;&lt;strong&gt;&amp;#8220;net.ipv4.ip_forward=1&amp;#8221;&lt;/strong&gt; in the sysctl configuration file.&lt;br/&gt;&lt;em&gt;sudo vim /etc/sysctl.conf&lt;br/&gt;&lt;br/&gt;&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;Shut down the VM and optionally take a snapshot.&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;&lt;strong&gt;Configure VirtualBox Networking&lt;br/&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;In the main VirtualBox application, open up the network preferences (found in the File -&amp;gt; Preference window and under the Network section).&lt;/li&gt;
&lt;li&gt;Select the Host-Only Adapter and click the edit button on the right-hand side of the pane (looks like a screwdriver).&lt;/li&gt;
&lt;li&gt;Verify the IPv4 address is 192.168.56.1.&lt;/li&gt;
&lt;li&gt;On the DHCP Server tab, uncheck the &amp;#8220;Enable Server&amp;#8221; option.&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lmrn03fzbg1qio859.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;&lt;strong&gt;Configure the Windows Host Networking&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;&lt;li&gt;Open the Windows network adapters control window.  This will be labeled and in different places depending on your version of Windows.&lt;/li&gt;
&lt;li&gt;Right-click on your Wireless LAN and/or Wired LAN adapter and click properties.&lt;/li&gt;
&lt;li&gt;Uncheck or remove everything except what is shown in the image below.&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lmrn92PrLk1qio859.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/li&gt;
&lt;li&gt;Select the IPv4 protocol and click the Properties button.  Fill out the values to match the following image below.&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lmrncrsJd01qio859.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/li&gt;
&lt;li&gt;Click &amp;#8220;OK&amp;#8221; twice to return back to the list of network adapters.  Right-click on the &amp;#8220;VirtualBox Host-Only&amp;#8221; adapter and click properties.&lt;/li&gt;
&lt;li&gt;Uncheck or remove everything except what is shown in the image below.&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lmrngtyvea1qio859.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/li&gt;
&lt;li&gt;Select the IPv4 protocol and click the Properties button.  Fill out the values to match the following image below.  I have my own DNS server as the preferred server and the OpenDNS servers as two alternate servers (more than two DNS servers can be specified by using the &amp;#8220;Advanced&amp;#8230;&amp;#8221; button).&lt;br/&gt;&lt;br/&gt;&lt;img src="http://media.tumblr.com/tumblr_lmrnkbujSH1qio859.png"/&gt;&lt;br/&gt;&lt;br/&gt;&lt;/li&gt;
&lt;li&gt;Optionally, you could disable your native Windows firewall entirely unless you want to maintain application-level firewall rules.&lt;/li&gt;
&lt;li&gt;Press &amp;#8220;OK&amp;#8221; and you&amp;#8217;re done.&lt;/li&gt;
&lt;/ol&gt;&lt;p&gt;&lt;strong&gt;Done!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;With any luck, you should be able to start up your Firewall VM, minimize it, and go about your business on the interwebs.&lt;/p&gt;</description><link>http://roguefrequency.tumblr.com/post/6514847622</link><guid>http://roguefrequency.tumblr.com/post/6514847622</guid><pubDate>Tue, 14 Jun 2011 02:33:48 -0400</pubDate><category>firewall</category><category>Windows</category><category>iptables</category><category>VM</category><category>VirtualBox</category><category>virtual machine</category><category>Ubuntu</category><category>network</category><category>tutorial</category><category>guide</category></item><item><title>So the girlfriend and I were hiking today...</title><description>&lt;p&gt;&amp;#8230;and we noticed a sign beside the trail stating &amp;#8220;CAUTION: This area is open to hunting&amp;#8221;.  At one point I caught myself thinking how we were now flagged for PvP.&lt;/p&gt;</description><link>http://roguefrequency.tumblr.com/post/5291566420</link><guid>http://roguefrequency.tumblr.com/post/5291566420</guid><pubDate>Sat, 07 May 2011 22:17:22 -0400</pubDate><category>hiking</category><category>hunting</category><category>caution</category><category>pvp</category></item><item><title>The newest track to achieve the ultimate honor of receiving the...</title><description>&lt;iframe class="tumblr_audio_player tumblr_audio_player_5071473619" src="http://roguefrequency.tumblr.com/post/5071473619/audio_player_iframe/roguefrequency/tumblr_lkh24vTAEN1qjbtoi?audio_file=http%3A%2F%2Fwww.tumblr.com%2Faudio_file%2Froguefrequency%2F5071473619%2Ftumblr_lkh24vTAEN1qjbtoi" frameborder="0" allowtransparency="true" scrolling="no" width="500" height="169"&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;The newest track to achieve the ultimate honor of receiving the coveted 5-star rating in my iTunes library.  &lt;em&gt;This Is Letting Go&lt;/em&gt; joins other 5-star Rise Against tracks such as &lt;em&gt;Rumors of My Demise Have Been Greatly Exaggerated&lt;/em&gt;, &lt;em&gt;Whereabouts Unknown&lt;/em&gt;, and &lt;em&gt;Collapse&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;Artist: Rise Against&lt;br/&gt;Track: This Is Letting Go&lt;br/&gt;Album: Endgame (2011)&lt;/p&gt;</description><link>http://roguefrequency.tumblr.com/post/5071473619</link><guid>http://roguefrequency.tumblr.com/post/5071473619</guid><pubDate>Sat, 30 Apr 2011 11:38:00 -0400</pubDate><category>Rise Against</category><category>5-star</category><category>tracks</category><category>music</category><category>punk rock</category></item><item><title>IM bots are getting smarter... slightly</title><description>&lt;p&gt;I logged into my IM accounts on Pidgin this evening and  instantaneously messaged by an unknown user with an attractive female as  the profile picture.  Ignoring the alias, I checked the actual username  expecting to see something along the lines of &amp;#8220;htwcgv84209&amp;#8221;, but  instead it was a very normal looking username.  Despite the author&amp;#8217;s  best attempts, it didn&amp;#8217;t take but three lines for me to tell it was a  bot though.&lt;/p&gt;
&lt;p&gt;What I found interesting was the response I got when asking if the user was a bot:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;i don&amp;#8217;t think so. lol&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;I asked a second time and got the response:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;whats that? like a robot?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;After simply typing the word &amp;#8220;bot&amp;#8221; several more times, I found that  these were canned responses that were selected randomly and repeated  after a few inquiries.&lt;/p&gt;
&lt;p&gt;At this point I got curious and began trying to find other keywords  that the author had embedded in his program.  Aside from triggering the  &amp;#8220;let&amp;#8217;s cam&amp;#8221; / &amp;#8220;click here for a private area where no one can watch us&amp;#8221; /  &amp;#8220;you just have to use your credit card to prove you are old enough&amp;#8221;  standard script, I did manage to find a couple keywords.  My favorite  was the response to the word &amp;#8220;police&amp;#8221;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;hahaha!  call em! and tell them you are reporting a felony&amp;#8230;  YOUR HAIRSTYLE!!  You might wanna get that looked at!&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://roguefrequency.tumblr.com/post/5055636539</link><guid>http://roguefrequency.tumblr.com/post/5055636539</guid><pubDate>Fri, 29 Apr 2011 20:47:00 -0400</pubDate><category>bots</category></item></channel></rss>
