Building a SOCKS proxy on EC2 to get around wifi port blocking

At the NXNE Mobile Hackathon, we ran into a small problem. The wifi set up in the room would only allow connections over HTTP and HTTPS, which made it impossible to do many things you might want to do at a hackathon, like:

  1. Push to GitHub over SSH

  2. Connect to MongoDB instances

  3. Connect to... anything... that isn't on ports 80 or 443... so a lot.

If you can configure your tools correctly, the easiest way to get around this kind of problem is via a SOCKS proxy. Normally, I'd set up an SSH tunnel and run the SOCKS proxy over that... but no SSH. So the next best thing is to get a SOCKS server running on EC2. Let's go through the steps required to set this up so that if you end up in the same situation, you can help those around you.

Doing this assumes that you temporarily have an internet connection that is unrestricted, like a tethered smartphone or a wired connection. I'm also assuming that you know your way around EC2 a bit.

  1. Connect to your unrestricted internet connection

  2. Login to EC2

  3. Ensure that you have a keypair setup

  4. Create an EC2 Security Group that opens ports 22 and 443 to the world

  5. Fire up an Ubuntu 12.04 LTS instance (micro will usually do) with your keypair and Security Group

  6. SSH into the new machine with the SSH key (default username: ubuntu)

  7. Run the following commands at the prompt or in a shell script:

    sudo apt-get install build-essential
    wget http://www.inet.no/dante/files/dante-1.3.2.tar.gz # or another version
    tar -zxvf dante-1.3.2.tar.gz
    cd dante-1.3.2
    ./configure
    make
    sudo make install
    
  8. Put the following config in /etc/sock.conf

    ## general configuration (taken from FAQ)
    
    internal: eth0 port = 443
    external: eth0
    method: username none
    user.privileged: root
    user.unprivileged: nobody
    logoutput: stderr
    
    ## client access rules
    
    client pass { from: 0.0.0.0/0 to: 0.0.0.0/0 } # address-range on internal nic.
    
    
    ## server operation access rules
    
    # block connections to localhost, or they will appear to come from the proxy.
    block { from: 0.0.0.0/0 to: lo log: connect }
    
    # allow the rest
    pass { from: 0.0.0.0/0 to: 0.0.0.0/0 }
    
  9. Run sudo sockd -D

Now that we've got the server running, we have to configure our clients to connect to it. Fortunately, this is relatively easy. If you're on linux, run your programs with tsocks. On Windows or Mac, you can try Proxifier (never tried it myself). Remember that the proxy is on port 443.

If you're using PuTTY, you can set your proxy under Connection > Proxy.

This set of steps creates an open proxy that anyone can use to proxy to anywhere. Don't leave it running unless you want really big EC2 bills.

In doing this, I realized that it would be even better to be able to do this via a VPN instead of a SOCKS proxy in order to get better Windows and Mac full capture support. I'm going to play with this idea and post again when I've got something.

Switching to Squarespace

You may have noticed my blog now looks different. That's because I've migrated to Squarespace. Why? Well, when I first built the blog I was building out my Drupal skills, and so I built on Drupal. Now I'm not really developing those skills any longer, and so maintenance of a Drupal site is just extra work. I thought about moving to Wordpress, but Squarespace is easier to manage. Plus, I can export from Squarespace to Wordpress if it doesn't meet my needs.

Ludum Dare 23 Post-Mortem

I'm about a month overdue in writing this entry, but better late than never. Back in April, I participated in the 23rd Ludum Dare by creating a game in 48h by myself. You can play my finished product: Tiny World Defense. Results of the competition were released last week, and I was really proud. I managed to get #176 in the "Fun" category, and #244 overall. For a field of over 1000 games, that's pretty good. If you're looking for some really fun games, check out the top 50, and top 25 per category. They're pretty awesome. Remember, each one was completed in 48h.

Overall, it was a great experience. I got to challenge myself to finish something that I never had before, and I learned a lot along the way. It's a lot of fun to watch the #ludumdare IRC channel during the compo, and the community is fun, even though I didn't participate much.

Without further adieu, what went well:

  1. The Keynote. Ludum Dare had an awesome, interactive keynote this year. Go check it out.

  2. Working at KwartzLab. Having other people around who were working at the same time as me was extremely helpful. It was really encouraging, and provided a means to talk to people about successes/problems. For an extrovert like me that's necessary.

  3. Choosing Flixel. It's a very good framework, and helped me out a lot. Probably won't use it next time, but that's no fault of its own.

  4. Tools. mtPaint and bfxr made graphics and sound FX really easy. Aww yeah.

  5. Participating in Warmup Weekend. This was probably the most critical factor for my success. The fact that I had already done something with my language and framework allowed me to get to work quickly when I finally started working.

  6. Getting food delivered. Meant that we didn't have to get up in order to eat. Very important for continuous work. Pepi's Pizza is the bomb.

  7. Going out for food. Spending all your time in one place, even if it is as awesome as KwartzLab, sucks. Going for a walk is important.

  8. My heating regime. KwartzLab is cold in the spring and fall because of stingy heating from the landlord. I got myself a heated shrug for my legs, and a lizard heat lamp for my hands. Vital to my success in that environment.

  9. Sponsors. CCJ Clearline and TribeHR each bought us some food. That was awesome.

  10. Support from my wife. She recognised that this was important to me and let me do it. Without that, it never would have happened. Thanks, hon.

Things that could have been better:

  1. Better planning of snacks. I bought some at a Shoppers Drug Mart on day 2, but the whole situation was meh. Need to plan that better for next time.

  2. More sponsors! Food costs about $50/person for the weekend. I'm going to try to get that all raised so that it's all covered next time.

  3. Go deeper with the framework. There's a lot of tools out there for making certain types of games in certain frameworks. Working with those to lessen my personal workload would be a good way to improve.

  4. More testers, more often. One of the things that didn't quite work out with my game was the balance of the powerups. Had I taken more time to get that balance right earlier and had people test, I think I could have had a better game at the end.

  5. Participate in the community more. That would have been one way to get testers. Also to get help.

  6. Theme. Tiny World? Really? What's up with that? Bah.

As I said above, overall it was really awesome and one of the most fun things I've done in my life. Now I need to get ready for the next one in August!

How to trick yourself into getting more exercise

I still owe blog posts on Ludum Dare 23 followup, and my presentation at KWLUG. I haven't forgotten. I'm sure I'll get around to them eventually.

Yesterday, I biked to work. Near the end of the day, My brother called, saying that he wanted to pick up some boardgames for a gaming night he was going to. Of course I agreed, and said I could get them to him faster if he gave me a ride home (forgetting that I had biked to work).

Realized half-way home that I had left my bike at work. So now, I'm about to run to work to pick up my bike, which I will then ride home. At least I'll be getting my exercise in!

What I'm going to be using for Ludum Dare 23

I've now been playing with Flixel and PyGame for a weekend, and I think I'm going to end up working in Flash for Ludum Dare. PyGame was great. I was able to get up and running quickly, and working in Python definitely matches my brain nicely. Flixel is just so fast to build things though, and the language feels like a type-hinted bastard child of PHP and Javascript, so I'm comfortable enough with it.

I did find some new awesomeness with tools, however. First, mtPaint is great for pixel art. Much easier than GIMP. Second, Audacity has a bunch of new stuff in 2.0 that makes generating sounds a lot easier.

Oh, and for developing in Python, I would now recommend Aptana Studio (with vrapper if you are like me and need vim keybindings). Wonderful integrated environment. I might start using it on Linux for my PHP development at work. Of course, FlashDevelop is great for Flash (under Windows or Wine).

Overall, I'm very happy with what I got accomplished. My PyGame source and Flixel source are on GitHub, and you can try the Flixel game I made from a tutorial. See if you can beat my high score of 80!

Play the game!