In my last position with APL several people on staff asked us about providing a VPN for secure access to our intranet. I decided there were several options for meeting this goal:
Summary:
I decided to use the Linux Free S/Wan server implementation of IPSEC and IKE (http://www.freeswan.org) since it uses standard protocols and the code was free. From my perusal of Tina Bird's excellent VPN website (http://kubarb.phsx.ukans.edu/~tbird/vpn.html), it seemed a better choice than PPTP.
> wget ftp://ftp.xs4all.nl/pub/crypto/freeswan/freeswan-1.91.tar.gz > wget ftp://ftp.xs4all.nl/pub/crypto/freeswan/freeswan-1.91.tar.gz.sig > # Check signature (once I've added the public signature to my ring) > pgp /tmp/freeswan-1.91.tar.gz.sig /tmp/freeswan-1.91.tar.gz > cd /usr/src > sudo tar -zxvf freeswan-1.91.tar.gz >$ cd freeswan-1.91 > # Steps which shouldn't have to happen > # oops, no GMP (gnu multi-precision library) > rpm -ivh gmp-devel-3.1.1-3.i386.rpm > # patch ipsec_tunnel.c so 'ip_select_ident()' has # 'NULL' as third argument > sudo /bin/su # become root $ make oldgo # this takes about 75 minutes to configure and # compile kernel $ make modules_install $ cp arch/i386/boot/bzImage /boot/freeswan $ vi /etc/lilo.conf $ lilo
Rebooting shows IPSEC is up. At this point I have a kernel this links into IPSec, and the code under /usr/local/lib/ipsec, and the following execs running:
root 553 0.0 0.0 1916 4 ? S Jul24 0:00 /bin/sh /usr/local/lib/ipsec/_plutorun --debug none --uniqueids yes - root 554 0.0 0.0 1308 4 ? S Jul24 0:00 logger -p daemon.error -t ipsec__plutorun root 555 0.0 0.0 1916 4 ? S Jul24 0:00 /bin/sh /usr/local/lib/ipsec/_plutorun --debug none --uniqueids yes - root 556 0.0 0.0 1788 148 ? S Jul24 0:00 /usr/local/lib/ipsec/pluto --nofork --debug-none --uniqueids root 557 0.0 0.0 1904 60 ? S Jul24 0:00 /bin/sh /usr/local/lib/ipsec/_plutoload --load %search --start %searc
For starters, I'll test this against a client on the local network, where my network diagram will look something like:
West--------------------------East
untrusted net
(using the network notation that the FreeSwan folks do). For me, this will
be
hb(.241)-----------------------tko(.242)
local net
ipsec whack --listen # reloads secrets /etc/rc.d/init.d/ipsec restart # reloads all
Need to edit /etc/ipsec.conf and specify shared secrets. Now, on hillburkholder:
]$ route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface compaq compaq 255.255.255.255 UGH 0 0 0 ipsec0 65.100.135.240 * 255.255.255.248 U 0 0 0 eth0 65.100.135.240 * 255.255.255.248 U 0 0 0 ipsec0 172.16.243.0 * 255.255.255.0 U 0 0 0 vmnet1 127.0.0.0 * 255.0.0.0 U 0 0 0 lo default cisco 0.0.0.0 UG 0 0 0 eth0 [peter@hillburkholder config]$ ping compaq PING compaq (65.100.135.242) from 65.100.135.241 : 56(84) bytes of data. --- compaq ping statistics --- 4 packets transmitted, 0 packets received, 100% packet loss -------
These are now going over ipsec0 interface to the eth0 interface. Pinging 65.100.135.241 shows nothing coming back to the application layer, but sniffing with ethereal shows ESP (encrypted) are going back and forth. Perhaps I need to enable ip_forward?
Tearing down of connections doesn't happen cleanly. Something other than 'ipsec restart'?
I can get to 65.100.135.242 webpage in the clear. Now I should build a gateway to it.
I'll need to get back to this
The network topology host-to-host on this small network is actually more complicated than trying to access the subnet remotely
Return to Peter's Systems Administration Page.
Please feel free to contact me at pburkholder@pobox.com.