There is an updated and bugfixed version of this script now added to the OE git repository where all updates from now will be done.
Latest Version
At a request from TI developers I have decided to change the license of the script to GPLv2 as its more important to me that people can use the the script than spend their time arguing legal points.
Download
#! /bin/sh
# mkcard.sh v0.3
# (c) Copyright 2009 Graeme Gregory
# Licensed under terms of GPLv2
DRIVE=$1
dd if=/dev/zero of=$DRIVE bs=1024 count=1024
SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{
echo ,9,0x0C,*
echo ,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
if [ -b ${DRIVE}1 ]; then
mkfs.vfat -F 32 -n "boot" ${DRIVE}1
else
if [ -b ${DRIVE}p1 ]; then
mkfs.vfat -F 32 -n "boot" ${DRIVE}p1
else
echo "Cant find boot partition in /dev"
fi
fi
if [ -b ${DRIVE}2 ]; then
mke2fs -j -L "rootfs" ${DRIVE}2
else
if [ -b ${DRIVE}p2 ]; then
mke2fs -j -L "rootfs" ${DRIVE}p2
else
echo "Cant find rootfs partition in /dev"
fi
fi
There is an updated and bugfixed version of this script now added to the OE git repository where all updates from now will be done.
Latest Version
Got some feedback from people on IRC so added some checks so people with builtin card readers can run the script without having to edit it.
Download
#! /bin/sh
# mkcard.sh v0.2
# (c) Copyright 2009 Graeme Gregory
# Licensed under terms of GPLv3
DRIVE=$1
dd if=/dev/zero of=$DRIVE bs=1024 count=1024
SIZE=`fdisk -l $DRIVE | grep Disk | awk '{print $5}'`
echo DISK SIZE - $SIZE bytes
CYLINDERS=`echo $SIZE/255/63/512 | bc`
echo CYLINDERS - $CYLINDERS
{
echo ,9,0x0C,*
echo ,,,-
} | sfdisk -D -H 255 -S 63 -C $CYLINDERS $DRIVE
if [ -b ${DRIVE}1 ]; then
mkfs.vfat -F 32 -n "boot" ${DRIVE}1
else
if [ -b ${DRIVE}p1 ]; then
mkfs.vfat -F 32 -n "boot" ${DRIVE}p1
else
echo "Cant find boot partition in /dev"
fi
fi
if [ -b ${DRIVE}2 ]; then
mke2fs -j -L "rootfs" ${DRIVE}2
else
if [ -b ${DRIVE}p2 ]; then
mke2fs -j -L "rootfs" ${DRIVE}p2
else
echo "Cant find rootfs partition in /dev"
fi
fi
So it took me a little while to gather the right set of docs to get this working but I find it useful when in places where you can get http/https connections but nothing else.
This is using tun network interface so make sure that is available on your server.
I also created a dummy0 with a random ip 192.168.123.1 so I could connect to services on my server without bypassing the VPN tunnel. The dns server running on 192.168.123.1 redirects server.external to that ip address.
Anyway here is my server config.
As you can see OpenVPN binds to the external port 443 and forwards non VPN traffic to localhost:443 where the webserver is listening.