The openl2tp.org project allows Linux server admins to configure their server to accept VPN requests from windows boxes, and other clients supporting l2tp.
l2tp is desirable since its built into WindowXP (and all newer versions), so it should be possible for the average windows user to configure one of these VPNs up.
Typically VPN security may be username/password based but it is also possible to configure it with a certificate.
L2TP itself does not seem to offer any intrinsic security, it simply provides the tunneling facility to place the Windows box on the same network as the server. Security is provided by IPSec.
The following HOWTO is based upon information gleaned from the openl2tp quick start guide and other sources on the web, and about 3 days of grit an determination.
Stuff you will need
- A kernel built with L2TP support (CONFIG_L2TP)
- A kernel built with PPP support (CONFIG_PPP)
- A kernel built with PPP over L2TP support (CONFIG_PPPOL2TP)
- ippoold - This is referenced on the openl2tp page, you can get it from Sourceforge . It allows you to provide hosts with IP addresses from a pool
- pppd should be installed (It does not run as a service though)
- openl2tp packages - I built them from source for the armel arch.
Overview
We need to configure racoon to accept IPSec connections from our external windows host. Racoon supports authentication via certificate or pre-shared key. I am doing this via a preshared key since I want the solution to be usable from remote-sites where I dont have the ability/privilege to install a certificate. Currently I am supporting windows XP (however provision is there for other versions of windows, just currently untested). Once the IPSec channel is in place, the L2TP tunnel is negotiated over UDP port 1701. For L2TP the IPSec is entirely optional, and can be configured tested independently. Remember though without IPSec all comms are in the clear so you only want to tst this on the LAN.
Build and install the Debian package
The openl2tp package is not available for the debian armel platform. Building it is as simple as downloading the source and running dpkg-buildpackage from the unpacked directory. You may be required to install some build dependancies. You will need to install ppp, and both the debs generated. You will also need to enable ipsec support....
You will also have to build an ippool package. I needed to mess around with the init script to get it load, just look an the openl2tp one. I also had to make a change so it loaded configuration to start with. Depending of the version of pppd installed, you may also need to move the ippool.so into the appropriate ppp directory after installation
#cp /usr/lib/pppd/2.4.4/ippool.so /usr/lib/pppd/2.4.5/ippool.so
start) log_begin_msg "Starting ippoold..." start-stop-daemon --start --quiet --exec $DAEMON log_end_msg $? /usr/bin/ippoolconfig $(cat /etc/ippool.conf) ;;
The changes to the above should be incorporated into the debian package at some point....
openl2tp Configuration
Tell openl2tp we are using it with ipsec
/etc/default/openl2tp
OPENL2TPD_ARGS="-p ipsec.so"
Configure l2tp to use only port 1701, configre the allowed authentication types, and set up the IP addresses, include the ippool that will be used
/etc/openl2tp.conf
tunnel profile modify profile_name=default \
our_udp_port=1701
ppp profile modify profile_name=default \
use_radius=no \
auth_pap=no \
auth_chap=yes \
auth_mschapv1=no \
auth_mschapv2=no \
auth_eap=no \
auth_none=no \
dns_ipaddr_pri=192.168.x.x \
wins_ipaddr_pri=192.168.x.x \
local_ipaddr=192.168.x.x \
ip_pool_name=default \
proxy_arp=yes
We also need to config the ippool to assign an address to the connection host. I am allows up-to 10 hosts in my pool. They are getting addresses on my 192.168.x.x. LAN
/etc/ippool.conf
pool create pool_name=default first_addr=192.168.x.Y num_addrs=10
We also need to configure our PPP chap password so that the VPN user can authenticate. This is where you configure the usernames and passwords for your VPN users. The *'s indicate we do not care about the IP addresses, it will just match on the username.
Be sure to have the correct permissions on this file, otherwise all users will be able to see the passwords
/etc/ppp/chap-secrets
# Secrets for authentication using CHAP # client server secret IP addresses username * my_password *
With all of the above configuration in place it should be possible to make and authenticate L2TP connections to the server.....at this point they willl not be encrypted!
Racoon Configuration
Racoon is used to secure the connection using IPsec. Once the IPsec connection is set up, racoon us ised to add a policy between the hosts (generate_policy on;) which ensures all comms is secured
/etc/racoon/racoon.conf
path pre_shared_key "/etc/racoon/psk.txt";
listen {
isakmp N.N.N.N;
isakmp_natt N.N.N.N[4500];
}
padding { maximum_length 20; # maximum padding length. randomize off; # enable randomize length. strict_check off; # enable strict check. exclusive_tail off; # extract last one octet. }
remote anonymous { exchange_mode main, aggressive; doi ipsec_doi; situation identity_only; nat_traversal on; initial_contact off; passive on; nonce_size 16; proposal_check obey; generate_policy on; send_cr off; send_cert off; proposal { # Win7 pararmeters. encryption_algorithm 3des; hash_algorithm sha1; authentication_method pre_shared_key; dh_group modp1024; } proposal { # WinXP pararmeters. encryption_algorithm 3des; hash_algorithm md5; authentication_method pre_shared_key; dh_group modp1024; } proposal { # Linux clients encryption_algorithm aes; hash_algorithm sha1; authentication_method pre_shared_key; dh_group modp1024; } } sainfo anonymous { lifetime time 1 hour; encryption_algorithm aes, 3des; authentication_algorithm hmac_sha1, hmac_md5; compression_algorithm deflate; }
/etc/racoon/psk.txt
We are happy for this password to be used for all connections so using a '*' as the match
* some_other_password
/etc/ipsec-tools.conf
I think this is to ensure that all L2TP comms are done only over IPsec, hence securing that connection.
spdadd N.N.N.N/32[1701] 0.0.0.0/0 udp -P in ipsec
esp/transport//require;
spdadd 0.0.0.0/0 0.0.0.0/0[1701] udp -P out ipsec
esp/transport//require;
Windows configuration
On Windows you should add a VPN connection, and then edit its properties. On the security tab click IPSec settings and enter your pre-shared key. Configure the hostname of the server, and you should be good to go.
Categories: Debian, LinkStation, Linux