This post describes how you can setup secure web browsing using Firefox3 and by setting up a SSH tunnel from your PC/host to a remote PC/host. Your PC will then act as a local SOCKS proxy and all applications that supports SOCKS5 interface to this port. This is a handy solution if you are on a untrusted net like a wireless connection. The solution can also be used in Thunderbird if you would like.
Note
It is important to note that it’s only the connection between your host and the remote host that is secure. It is also important to note that Firefox will do DNS queries to the untrusted netwoork. This can be fixed by opening the about:config page and change network.proxy.socks_remote_dns to true.
Start a SSH connection to a host that you want to proxy through. Use the -D option to specify a SOCKS5 port on your localhost. The port doesn’t really matter. Just make sure you use the same port in your SOCKS client application.
# ssh -D 3333 username@example.com
In Firefox select “Tools | Options… | Advanced | Network |Settings… button”.

Then select “Manual proxy configuration”. All you need to fill out is “SOCKS Host: Localhost”, “Port: 3333″, then select “SOCKS v5″.

Type in “localhost” in the SOCKS host field and press the OK button.
You are now ready to surf using Firefox3 and SOCKS5 througt a SSH tunnel.
You can also use Putty if you are a Windows user. The configuration is then as follows:

Tags: firefox3, putty, SOCKS5, ssh
Posted by Hans-Henry Jakobsen
It is possible to control which source address is put in to ARP headers using the ARP_ANNOUNCE option in the kernel.
It takes the following values.
0 (default) Any local address 1 Use address from the same subnet as the target address 2 prefer primary address.
This is worth knowing because the default can give some very strange results when routing packets with linux.
To test this you can run the following command
# sysctl -w net.ipv4.conf.all.arp_announce=1
To make it a permanent solution add a line like this to /etc/sysctl.conf
net.ipv4.conf.all.arp_announce = 1
Posted by Hans-Henry Jakobsen
This is a little script I’ve written to correct all my image files since the EXIF timestamp information is one hour out of sync. The filenames have been renamed to comply to the EXIF information and has to be renamed again because of the one hour scew. The filename can look something like this 20080102-1201_DSC_0910.JPG where the name is built up like YYYYMMDD-HHMM_Original_Filename.JPG
Remember to backup your imagefiles before you continue. You have been warned!
This is the files we are going to rename
20080102-1201_DSC_0910.JPG 20080105-1923_DSC_1006.JPG 20080111-1220_DSC00189.JPG 20080122-0929_DSC00190.JPG
The mmv command is a command that lets you move/copy/append/link multiple files by wildcard patterns. It can be installed in Debian (or Debian based distributions like Ubuntu) by issuing the command
# aptitude install mmv
Now rename the files back to their original name
# mmv "*_DSC*" "DSC#2"
The result after this operation looks like this
DSC_0910.JPG DSC_1006.JPG DSC_1179.JPG DSC_1302.JPG DSC_1587.JPG
Next adjust the EXIF information stored in the image files to fix the one hour difference. This can be done using different EXIF tools like exiftool, but I will show you how it can be done using jhead and exiv2. The advantage with exiv2 is that it can also handle Nikon NEF files while jhead only can prosess JPG.
The current timestamp can be determined as follows
# exiftool DSC_0910.JPG | grep "File Mo"
The result in this case is
File Modification Date/Time : 2008:01:02 08:34:09
# exiftool -AllDates+=1 DSC_0910.JPG
# jhead -ta +1 DSC_0910.JPG
Install the jhead package using aptitude as mentioned earlier for the mmv package
# exiv2 ad -a 1 DSC_0910.JPG
It is now time to rename the files back to the YYYYMMDD-HHMM_Original_Filename.JPG format I used before this operation. This operation has been describe in a previous post named Rename image files according to EXIF date
exiv2 -r'%Y%m%d-%H%M_:basename:' rename $(ls D*)
#!/bin/bash -x # Needed software: # exiftool # exiv2 # mmv # Script tested on Nikon D80 and Sony Cybershot DSC-W12 files # Make a printout of how the files look like now ls -l > repair_name_and_exif_before.txt # Rename files to remove date formatting back to original name mmv "*_DSC*" "DSC#2" # Change EXIF info on JPG files (order is important) exiftool -overwrite_original -AllDates+=1 D*.JPG # Preserve date/time of original file when writing exiftool -overwrite_original '-DateTimeOriginal>FileModifyDate' D*.JPG # Change EXIF info on NEF files (order is important) exiftool -overwrite_original -AllDates+=1 '-DateTimeOriginal>FileModifyDate' D*.NEF # Preserve date/time of original file when writing exiftool -overwrite_original '-DateTimeOriginal>FileModifyDate' D*.NEF # Rename files back to date formatting (YYYYMMDD-HHMM_Filename) based on the new EXIF info exiv2 -r'%Y%m%d-%H%M_:basename:' rename $(ls D*) # Make a printout of how the files look like after conversion ls -l > repair_name_and_exif_after.txt
Tags: Debian, EXIF, exiv2, jhead, JPG, mmv, NEF, Nikon, rename, Sony
Posted by Hans-Henry Jakobsen
This post will describe how I configured a Huawei E620 3g/Edge PCMCIA card on my Ubuntu 8.04 (Hardy Heron) to use the Norwegian Netcom network and can be considered a simple HOWTO.
Determine what Huawei card you have installed
lspci | grep -i huawei ... 12d1:1001 Huawei Technologies Co., Ltd. E620 USB Modem ...
Next download the Swedish Vodaphone Mobile Connect Card Driver. This post describes how to install driver version 1.99.17 since I haven’t tried version 2.0 beta 3.
dpkg -i vodafone-mobile-connect-card-driver-for-linux_1.99.17_i386.deb
Next start the Vodaphone Connect Card Driver for Linux from Applications –> Internet –> Vodaphone Connect Card Driver for Linux
You will hopefully be presented with this window where you type in your PIN code

Vodaphone Mobile Connect Card Driver for Linux Pin-code

Vodaphone Mobile Connect Card Driver for Linux
Now it’s time to set the preferences according to the Netcom network

Vodaphone Mobile Connect Card Driver for Linux - Preferences
Username and password can be anything you like since it’s not being used. The important part is that the APN host is internet or internet.netcom.no. Make your changes and click the OK button.
Connect to the Internet by clicking the Connect button in the upper left corner and you should now be connected to the world wide web.
This HOWTO will most likely work on Debian Etch too, but I haven’t tested it yet.
Tags: 8.04, E620, howto, Huawei, Netcom, PCMCIA, Ubuntu
Posted by Hans-Henry Jakobsen
This post is a short description/HOWTO of how I configured a “Telenor Mobilt Bredbånd” on Ubuntu 8.04 (Hardy Heron)I’ve borrowed from a friend of mine. I might have forgotten some steps on this guide and haven’t verified it on a fresh Ubuntu 8.04 installation.
This HOWTO has been written for the GlobeSurfer ICON 225 modem from Telenor. To determine if you have this modem insert it into a spare USB slot and type the following command
# lspci ... Bus 005 Device 003: ID 0af0:6971 Option ...
Download the HSOlink and HSOconnect packages from http://www.pharscape.org/component/option,com_forum/Itemid,68/page,viewtopic/t,457/
Install the packages downloaded
sudo dpkg -i hsolink_1.0.46-1_i386.deb sudo dpkg -i hsoconnect_1.1.61_all.deb
Install the build-essential package (if it’s not installed already) since we’re going to compile software during this HOWTO
# sudo aptitude install build-essential
Download the REZeroCD (hso-udev.tar.gz) from http://www.pharscape.org/component/option,com_forum/Itemid,68/page,viewtopic/t,425/ to change the behavior for the dongle to be a modem.
Unpack and install the file
# tar xfz hso-udev.tar.gz # cd hso-udev # sudo make # sudo make install
Install the HSO module by downloading the file hso-1.2.tar.gz from http://www.pharscape.org/component/option,com_forum/Itemid,68/page,viewtopic/t,445/
Unpack the file hso-1.2.tar.gz and compile it
# sudo tar xfz hso-1.2.tar.gz # cd hso # make # make install
Verify that the module has been installed
lsmod | grep hso
Load themodule if it isn’t loaded
modprobe hso
Unplug your modem and wait about 30 seconds and plut it in again before continuing this HOWTO
Start the HSOconnect software : Applications –> Internet –> HSOconnect.
APN: telenor Username: anything Password: anything
Accept the settings and press the Connect button.
You are now (most likely) connected to the Internet using your Telenor Mobile Broadband dongle.
You might experience that Firefox 3.x won’t load webpages. This might occur because the browser is in “Offline mode”. Just change this behaviour by unselecting the File –> Work Offline mode and try again.
Tags: 8.04, Hardy Heron, howto, Telenor, Ubuntu, usb
Posted by Hans-Henry Jakobsen