Klips Manual Key Protected Connection Examples


Introduction

This document is intended to provide some background on what is most easily accomplished with the existing tools. See 'man ipsec_auto' and 'man ipsec_manual' first.

It intended for practical use only beyond the capabilities of 'ipsec auto' and 'ipsec manual'. For now, (981127) that includes extruded subnets.

Note: Be warned that once a route(8) is set via an ipsec? device, packets without an eroute(8) that are sent to that device will be dropped on the floor.


Macros

These definitions of macros make the commands more readable and the scripts easier to use by centralising the information. Obviously, the keys are for example purposes only and cryptographically strong keys should be substituted.

	hmask=255.255.255.255
	nmask0=0.0.0.0
	nmask16=255.255.0.0
	nmask24=255.255.255.0
	nmask28=255.255.255.240
	nmask29=255.255.255.248

	local_public_ip=207.236.55.216
	local_public_nexthop=207.236.55.1
	local_public_bcast=207.236.55.255
	local_public_nmask=$nmask24
	local_private_net=192.168.2.0
	local_private_nmask=$nmask24

	remote_public_ip=209.157.90.146
	remote_private_net=209.157.90.160
	remote_private_nmask=$nmask29

	ext_private_ip=209.157.90.198
	ext_private_net=209.157.90.192
	ext_private_bcast=209.157.90.199
	ext_private_nmask=$nmask29

	default_net=0.0.0.0
	default_bcast=255.255.255.255
	default_nmask=$nmask0

	ipsecdev=ipsec1
	aliasdev=eth0:1
	physdev=eth2

	enckey8=0x0123456789abcdef
	enckey24=0x0123456789abcdef0123456789abcdef0123456789abcdef
	authkey16=0x0123456789abcdef0123456789abcdef
	authkey20=0x0123456789abcdef0123456789abcdef01234567
    

Setup

These commands must be run before any of the connection-specific commands will work.

	depmod -a	# only if klips is compiled as a module
	modprobe ipsec	# only if klips is compiled as a module
	ipsec tncfg --attach --virtual $ipsecdev --physical $physdev
	ifconfig $ipsecdev $local_public_ip \
		broadcast $local_public_bcast \
		netmask $local_public_nmask
    

Unload

These commands must be run before the module can be unloaded.

	ipsec tncfg --detach --virtual $ipsecdev
	ifconfig $ipsecdev down
	rmmod ipsec	# only if klips is compiled as a module
    
Warning: Each of the Setup scripts first deletes the route for the destinations it needs to protect, if it exists. When the route gets deleted with the deletion of the protected connection, that route will no longer exist. This route must be put back manually, or reboot the network configuration if it was installed automatically.

Transport mode

Transport mode is used between two hosts that each have IPSEC capabilities. They don't rely on a security gateway since they are by definition same. This mode has a lower overhead per packet and is therefore more efficient. The outside header is protected against modification if authentication is used.

Assumptions: Both machines have had networking set up and can pass packets.


Tunnel mode

Tunnel mode is used between two security gateways to protect their own traffic to another security gateway, or any combination of hosts behind it who may or may not be IPSEC aware. Only the inner headers are protected if authentication is enabled. There is extra overhead since there is an internal IP header. This mode is often preferable to make traffic analysis more difficult.

Assumptions: Any subnets have been set up and all machines can see the internet.

Transform Examples

A number of different transforms can be used to provide the protection intended by the IPSEC protocol suite. All these examples are using transport mode, but the techniques are equally applicable to tunnel mode, adding the extra SA to the spigrp command as necessary.

Assumptions: Both machines have had networking set up and can pass packets.