Tunneling http traffic through ssh

James Strassburg gave a great tutorial on tunneling http(s) traffic through ssh with your Linksys WRT-54GL router.

Actually, if you have a server that you can ssh to that has web access, like your web host, you can tunnel all your http(s) traffic through that server from your Windows workstation. It is pretty simple to do:
1. Ignore James’ discussion on how to setup Linksys, unless that is what you want;
2. Download PuTTY client for Windows. PuTTY is a stand-alone Win32 executable. As such, it has no registry change, separate directory creation, and all other garbage associated with a typical Windows application. Get PuTTY.exe and it just works;
3. Follow the rest of James’ instruction on creating a SOCKS proxy (here entering the IP address of your web host), changing your connection setting in Firefox. And you are all set.

I found this to be extremely valuable. Thanks a lot James.

PS. I normally don’t look at calendars at home. But today I happened to look at our Swedish calendar, and noticed tomorrow, 2006/03/15 is the name day for Kristoffer. So happy name day to my Swedish friend Christoffer Hedgate. Somehow picture of tranorna kommer till Hornborgasjön, Västergötland on the calendar caught my attention.

File type, directory size, free space, disk usage, and tar in Linux

A few quick notes for people who want to know how to do simple things in *nix. This is for Windows users who are making the transition or find themselves dealing with *nix from time to time.

Use file FooBar to find out what kind of file FooBar is. This is helpful when you need to know what program is needed to open FooBar file.

To find out size of a directory, including the size of subdirectories, use du -ah.

To find file system disk usage, use df -h

Note on Solaris, based on my experience, -h won’t work. You will have to do -k, which to me is a pain.

Quick note on tar:
tar -cvf archive.tar FilesOrDirectoriesToBeArchived
tar -tvf archive.tar # List all files in archive.tar verbosely.
tar -xvf archive.tar # Extract all files from archive.tar with verbose output message.

To archive and compress in one shot, add z, which uses gzip/gunzip for compression/decompression:
tar -czvf archive.tar FilesOrDirectoriesToBeArchived
tar -tzvf archive.tar # List all files in archive.tar verbosely.
tar -xzvf archive.tar # Extract all files from archive.tar.

64-bit, virturalization, and their impact

VMWare recently released a freeware called VMWare Player that can play a pre-built virtual machine file. A virtual machine is an OS bundled with whatever the virtual machine creator put there. This is perfect for people to test-drive various operating systems and software, without going through the hassle of installing themselves. VMWare currently provides virtual machines preloaded with RedHat, Novell Suse, ubuntu, Oracle, MySql, and Bea, among others.

Memory used to be a bottleneck for virtualization software to take off. However, on the hardware side of things, both Intel and AMD are pushing 64-bit processors pretty aggressively now. With 64-bit architecture, the memory space the operating system can access increases exponentially (from 2^32 to 2^64). With the push towards 64-bit and the emergence of virtualization technology, I wonder what kind of impact this will have on the software landscape, like operating systems, database software, web server, and application server, etc..

Linux, MySql, Apache and other open source software have made great headway in enterprise server market, especially for large financial firms. I do believe there are still a big learning curve and intimidating factor at play for mid-size to smaller firms when it comes to learning and evaluating alternative software products like Linux. Maybe the combination of 64-bit and virtualization software will help. Using the cliche popularized by the book The World Is Flat, 64-bit and virtualization will help bring down barrier of entry and flatten the competitive landscape. With more memory and more powerful processor, virtualization software helps people test things out that they may not able to or too difficult for them to try otherwise. And that will be a good thing.

The current market leader in this arena seems to be VMWare, since it works on both Windows and Linux platforms. Microsoft’s Virtual PC and Virtual Server only works on Windows, and my limited testing in installing Fedora Core 2 on Virtual PC didn’t work out very well.

Software vendors, jump on the wagon. Oracle, MySql, IBM, Bea have created and provided virtual machine files for downloading at VMWare’s Virtual Machine Center. I think that is a smart move. Even Microsoft has something to gain in doing so. For example, it can team up with VMWare and distribute Sql Server 2005 for a wider testing via their distributing channels.

I have personally tried ubuntu Linux distro on my laptop and it worked pretty well. My laptop is Acer Aspire 3500 with Celeron processor and 512M of memory.

Failed nbsmtp compile and some Linux and RPM tips

Earlier, I talked about my failed attempt to comiple and install msmtp.

I tried to install and compile nbsmtp, and got similar results. Googling revealed that many people would suggest install things from an RPM package.

So I searched around and found a msmtp package for Suse, but my web host is on RedHat. I decided to give it a shot anyway. By the way, to get a quick idea of the version and vendor of your Linux/Unix, you can use:

uname -a

Before you install an RPM package, it is a good idea to do a test first to find out potential dependency issues. Use this command to do it:

rpm -i PackageName –test

In my case, when I tested the msmtp package for Suse on this Redhat machine, this is what I got:

rpm -i msmtp-1.4.1-1.guru.suse100.i686.rpm –test
warning: msmtp-1.4.1-1.guru.suse100.i686.rpm: V3 DSA signature: NOKEY, key ID 58857177
error: Failed dependencies:
libcrypto.so.0.9.7 is needed by msmtp-1.4.1-1.guru.suse100
libc.so.6(GLIBC_2.3.4) is needed by msmtp-1.4.1-1.guru.suse100
libssl.so.0.9.7 is needed by msmtp-1.4.1-1.guru.suse100

Oh well, the search, and the learning, contunues…

msmtp compile and install

This is kind of my own Linux admin study notes. Like most of my other posts, it can be dry and boring;)

In an earlier post, I talked about my desire to compile Mutt and use it as my primary email client. Note there is a little more information on the comment section.

Things have changed a bit. Now my host server has been transferred to a new machine after I complained many, many times; and my site has been more stable since. So I am ok with it, for now.

I also discovered that Mutt is available on this machine. So is fetchmail and procmail. I configured fetchmail and procmail successfully to get my gmail. More tweaking is still needed, since all mail messages are dumped into one big file (no inbox, outbox, draft files, etc.), but I can at least read my gmail using Mutt. Judging from my limited experience with it, I do like Mutt. I think it is a great tool that can enhance productivity immensely. Together with vi, they are a great combo. Note to myself, I also need to do research on telling mutt to use lynx as the html reader, since a lot of emails these days are in html.

But I need a smtp client to send gmail. None of the common smtp clients, such as postfix, pine, sendmail, are available on this machine. Also, the fact I am not root complicate things.

Some Googling revealed that msmtp is a popular smtp client with TLS/SSL capabilities. As I mentioned earlier, I don’t have root to my web host server, I decided to compile and install it on my own test box as a regular user to gain experience, before I make an attempt on the web host.

On my own test box:
1. useradd haidong –Create regular user haidong
2. passwd haidong –Give haidong a password
3. su haidong
4. ./configure –prefix=$HOME/msmtp –Avoid /usr/bin, /usr/local/bin, and such
5. ./configure successful
6. make, make successful
7. make install, make install successful

Cool, it worked on my test box, which has Fedora Core 2. One funny observation is that there is a de folder in the locale directory. I guess the main writer of msmtp must be from a German-speaking region.

All right, now I am ready to try it on my web host. And it failed at the ./configure:( The message is
configure: error: C preprocessor “/lib/cpp” fails sanity check
See `config.log’ for more details.

I looked at config.log. It appears to be some kind of preprocessor error, stemmed probably from an older version of gcc on this box. I am not very proficient at C/C++ programming (my next big learning goal), so I will have to give up msmtp on this box, for now.

On to nbsmtp, another smtp client with TLS/SSL support. I suspect the results will be the same, but I don’t know for sure unless I roll up my sleeves and do it. Will report back after I am done.