Saturday, 3 September 2011

DreamPlug HTTP Proxy

It looks like OpenVPN doesn't work too well with the iPhone so I'm going to try configuring an HTTP proxy so I can watch BBC iPlayer via my DreamPlug.

Since I have a fair amount of package manipulation to do, first I'm going to install Synaptic so I can use its GUI to see what's already installed and what's available.  This is pretty straightforward - apt-get install synaptic does the job.  And since I logged into the DreamPlug from my MacBook Air using ssh -X root@ I now just need to run synaptic to get going.  Excellent!

Next up, install the HTTP proxy.  I'm going to use Squid 2.7, though 3.0 is also available.  We also need apache2-utils to get the htpasswd program.

Now cd to /etc/squid and run htpasswd -c passwd to create a password for .

Now edit squid.conf and add these lines:
auth_param basic program /usr/lib/squid/ncsa_auth /etc/squid/passwd
acl auth_user proxy_auth REQUIRED
acl localnet src 192.168.8.0/24

http_access allow auth_user
http_access allow localnet
cache_dir null /tmp
cache deny all


And it works!

Tuesday, 30 August 2011

DreamPlug -- openVPN

I want to install openVPN on my DreamPlug so I can connect to the net from my iPhone over an open WiFi connection in a hotel without having to worry about eavesdroppers.  Step 1 is to install the package:

apt-get -u install openvpn

That seemed to work okay.  Wait for the edit to see what happened next...

DreamPlug -- first encounter

I bought a DreamPlug plug computer from www.newit.co.uk back in May and finally got round to plugging it in over the weekend.  The plug boots Ubuntu 9.04 Jaunty Jackalope from an internal uSD card, and starts up a WiFi AP straight away - SSID is DreamPlug-uAP-nnnn where nnnn is the last 4 digits of the MAC address.  After connecting to this you can ssh to the machine and login as root with a password of nosoup4u, and you can point a web broswer at the IP address to see the Lighttpd web server.

Forums are found at www.newit.co.uk/forum.  One handy post highlights a configuration problem with the package repository for Jaunty, which Canonical have moved.  It is fixed as follows:

cat > /etc/apt/sources.list << EOF
deb http://old-releases.ubuntu.com/ubuntu/ jaunty main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ jaunty-updates main restricted universe multiverse
deb http://old-releases.ubuntu.com/ubuntu/ jaunty-security main restricted universe multiverse
EOF

apt-get update

I tried that and it seemed to work okay.  (Incidentally, the URL was previously http://ports.ubuntu.com/).  Now for the tricky bit - update all the packages.  Here we go...

apt-get -u upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  bzip2 cron dhcp3-client dhcp3-common dpkg file gzip language-pack-en
  language-pack-en-base libbz2-1.0 libcurl3-gnutls libgnutls26 libkrb53
  libldap-2.4-2 libmagic1 libnewt0.52 libpam-modules libpam-runtime libpam0g
  libsasl2-2 libsasl2-modules libsqlite3-0 libssl0.9.8 libvolume-id1 libxcb1
  lsb-base lsb-release ntpdate openssl perl perl-base perl-modules sudo udev
  whiptail
35 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 17.4MB of archives.
After this operation, 1528kB of additional disk space will be used.
Do you want to continue [Y/n]? y

That worked too!  Now, what shall I do next?

Wednesday, 18 May 2011

Modifying the UNIX environment in MacOS X

I wanted to tweak PATH and a few other environment variables after installing some software on my Macbook Air which runs MacOS X 10.6 Snow Leopard.  Here's what I discovered:

The environment is set up by /etc/profile.  This does 2 things: first it calls /usr/libexec/path_helper to set up PATH; then it calls /etc/bashrc to set up other environment variables for the shell.

The path_helper script works by first reading /etc/paths to get the default path elements (the file contains one directory path per line) and then by reading the files in /etc/paths.d (which are in the same format).

In the end I went for something simpler and put all my settings in $HOME/.bash_profile.  You should use this in preference to $HOME/.bashrc for setting your default environment because the latter file is run every time a shell starts, making things like export PATH="$HOME/bin:$PATH" have an undesired effect.