Created a tsocks fink package

I previously posted about how to build tsocks on Mac OS X.

Leveraging that work, I created my first Fink package, a package for tsocks. It’s in the package submission queue waiting for the Fink team to review it. In the meantime, here’s the .deb file that I built.

Creating a fink package is pretty easy and is quite similar to creating a FreeBSD port. I learned how to do it by following the packaging tutorial and browsing some of the Packaging Manual.

The San Francisco Burrito

While Nicole and I were eating at Chipotle today, I looked up “burrito” on Wikipedia and came across this most entertaining page:

Wikipedia: San Francisco burrito

Some of my favorite tidbits:

  • The aluminum foil wrapping–present whether the customer is eating in the restaurant or taking out–acts as a structural support to ensure that the flexible tortilla does not burst its contents. One of the main difficulties of the San Francisco burrito is the issue of structural integrity, but skilled burrito makers consistently produce huge burritos which do not burst when handled or eaten. A successfully large burrito depends on an understanding of the outer limit of potential burrito volume, correct steam hydration, proper folding technique, and perhaps most of all, assuring that the burrito ingredients have been properly drained of excess liquid.
  • As the Mission District faced increasing gentrification, particularly during the dot-com boom, some elements of the San Francisco burrito experience became politicized. One activist disdained the practice of charging extra for chips and salsa, for instance, as an anti-Mexican symptom of gentrification. Some taquerias also offer additional types of flour tortillas (for instance, whole wheat or spinach), but this same activist declared, “I will shoot my son and daughter if they ever order a green burrito.” These comments likely reflect a larger anxiety among SF burrito fans of all ethnicities that gentrification of the Mission could destroy the soul not only of the neighborhood but of the burrito.
  • anxieties about gentrification do not always require an orthodox attitude about the burrito: it could also be argued that the increasing number of options for fillings and tortillas simply extend the original innovation of the modular assembly model, designed to cater to the tastes of individuals, and thus do not violate the larger philosophical integrity of the San Francisco burrito.

Hacking myself

I couldn’t remember the password that I used for my SBC Yahoo! DSL account – I have it in my router config (for PPPoE) but I wanted to know it so that I could use it for dial-up.

Since it was already in my router, I tried to view the source of the router administration page, but the password was encrypted. Then I tried to use Ethereal to sniff the password but that wasn’t bearing fruit either. Eventually, I lucked out because I have the replacement Sveasoft Alchemy firmware on my WRT54G so I was able to ssh into the router and after poking around for a while, I found all the PPPoE settings, including the password in /tmp/ppp/options.pppoe.

Building tsocks on Mac OS X

I recently told you about a cool piece of software called tsocks which allows non-SOCKS-aware applications to use SOCKS by using LD_PRELOAD to intercept their socket calls and route them through a SOCKS server.

Installing on Debian was simple as the software was written for Linux and there is a Debian package available for it. Installing on FreeBSD is also simple as it turns out that someone did a FreeBSD port for it.

It took some patching to get tsocks (version 1.8 beta 5) to compile on Mac OS X. Here’s how I did it:

wget 'http://ftp1.sourceforge.net/tsocks/tsocks-1.8beta5.tar.gz' && \
tar -xzf tsocks-1.8beta5.tar.gz && cd tsocks-1.8 && \
wget 'http://marc-abramowitz.com/download/tsocks-1.8_macosx.patch' && \
patch < tsocks-1.8_macosx.patch && autoconf && \
./configure && make && sudo make install

Download tsocks-1.8_macosx.patch

Doing this patch was an education for me about Autoconf as well as how Mac OS X dynamic linking works.

The patch address issues such as:

  • Using gcc-4.0 ended up causing link errors for me so I force use of gcc-3.3.
  • Linking dynamic libraries requires special linker options, as does linking object files with multiply defined symbols.
  • Libraries typically have a .dylib extension rather than .so (because OS X uses the proprietary Mach-O object file format instead of ELF).
  • LD_PRELOAD is not supported. Instead I had to use OS X variables - DYLD_INSERT_LIBRARIES and DYLD_FORCE_FLAT_NAMESPACES.
  • The code itself needed a few minor patches in order to compile; the use of typedefs like socklen_t instead of non-portable types like int and the use of the OS X gcc extension __attribute__ ((constructor)) to defined a dynamic library initialization function.
  • I needed to do a bunch of autoconf stuff to support all of this and to make it so that the tsocks shell script gets generated to accomodate all of these differences.

Of course after doing all of this, I found out that there is a tsocks DarwinPort, which builds but doesn't seem to work because it still tries to use LD_PRELOAD.