# Adapted from example ipsec.conf files shipped with OpenSwan

config ipsec_recipe blank
	option _shortdesc		"Empty/Unconfigured"

config ipsec_recipe ipv6_host_host
	option _shortdesc		"Host-to-Host, IPv6, RSA keys"
	option connaddrfamily		"ipv6"
	option auto			"add"
	option leftid			"@sunset.example.net"
	option left			"2002:4a6b:e723:3:205:4eff:fe4b:c8cf"
	option leftrsasigkey		"0sAQNM....hIp"
	option leftnexthop		"fe80::201:2ff:fe29:564d"
	option rightid			"east.example.net"
	option right			"2002:4387:d370::"
	option rightrsasigkey		"0sAQP....LMsP"

config ipsec_recipe ipv6_subnet_subnet
	option _shortdesc		"Subnet-to-Subnet, IPv6, RSA keys"
	option auto			"add"
	option connaddrfamily		"ipv6"
	option leftid			"@sunset.example.net"
	option left			"2002:4a6b:e723:3:205:4eff:fe4b:c8cf"
	option leftrsasigkey		"0sAQNM....hIp"
	option leftnexthop		"fe80::201:2ff:fe29:564d"
	list leftsubnets		"2002:4a6b:e723:8003:205:4eff:fe4b:c8cf/128"
	option leftsourceip		"2002:4a6b:e723:8003:205:4eff:fe4b:c8cf"
	option rightid			"east.example.net"
	option right			"2002:4387:d370::"
	option rightrsasigkey		"0sAQP....LMsP"
	list rightsubnets		"2002:4387:d370:8000::/128"

config ipsec_recipe l2tp_x509
	option _shortdesc		"Server for L2TP/IPsec, RSA certs"
	option _longdesc		"Configuration for one user with any type of IPsec/L2TP client including the updated Windows 2000/XP (MS KB Q818043), but excluding the non-updated Windows 2000/XP. Use a certificate. Disable Perfect Forward Secrecy.  Left is us, right is remote.  We cannot rekey for %any, let client rekey.  Set ikelifetime and keylife to same defaults Windows has.  L2TP over IPsec is transport mode.  In rightprotoport, using the magic port of '0' means 'any one single port'. This is a work around required for Apple OSX clients that use a randomly high port, but propose '0' instead of their port. If that does not work, try 17/%any"
	option authby			"rsasig"
	option pfs			"no"
	option auto			"add"
	option rekey			"no"
	option ikelifetime		"8h"
	option keylife			"1h"
	option type			"transport"
	option left			"YourServerIP"
	option leftid			"%fromcert"
	option leftrsasigkey		"%cert"
	option leftcert			"/etc/ipsec.d/certs/YourGatewayCertHere.pem"
	option leftprotoport		"17/1701"
	option right			"%any"
	option rightca			"%same"
	option rightrsasigkey		"%cert"
	option rightprotoport		"17/0"
	list rightsubnets		"vhost:%priv,%no"

config ipsec_recipe passthrough_for_non_l2tp
	option _shortdesc		"Passthrough for non-L2TP with KLIPS"
	option _longdesc		"Normally, KLIPS drops all plaintext traffic from IP's it has a crypted connection with. With L2TP clients behind NAT, that's not really what you want. The connection below allows both l2tp/ipsec and plaintext connections from behind the same NAT router.  The l2tpd use a leftprotoport, so they are more specific and will be used first. Then, packets for the host on different ports and protocols (eg ssh) will match this passthrough conn."
        option type			"passthrough"
        option left			"YourServerIP"
        option leftnexthop		"YourGwIP"
        option right			"0.0.0.0"
        list rightsubnets		"0.0.0.0/0"
        option auto			"route"

config ipsec_recipe l2tp_psk
	option _shortdesc		"Server for L2TP/IPsec, PSK"
	option _longdesc		'Configuration for one user with any type of L2TP/IPsec client including the updated Windows 2000/XP (MS KB Q818043), but excluding the non-updated Windows 2000/XP.  Use a Preshared Key. Disable Perfect Forward Secrecy.  PreSharedSecret needs to be specified in /etc/ipsec.secrets.  Left is us, right is remote.  We cannot rekey for %any, let client rekey.  Set ikelifetime and keylife to same defaults Windows has.  L2TP over IPsec is transport mode.  In rightprotoport, using the magic port of "0" means "any one single port". This is a work around required for Apple OSX clients that use a randomly high port, but propose "0" instead of their port. If that does not work, try 17/%any'
	option authby			"secret"
	option pfs			"no"
	option auto			"add"
	option keyingtries		"3"
	option rekey			"no"
	option ikelifetime		"8h"
	option keylife			"1h"
	option type			"transport"
	option left			"YourGatewayIP"
	option leftprotoport		"17/1701"
	option right			"%any"
	option rightprotoport		"17/0"

config ipsec_recipe linux_to_linux
	option _shortdesc		"Host-to-host, RSA keys"
	option _longdesc		"Simple connection using raw RSA keys.  After starting openswan, run: 'ipsec showhostkey --left' (or --right) and fill in the connection similarly to the example.  Can add leftsubnet/rightsubnet to make host-to-subnet or subnet-to-subnet connections (e.g. leftsubnet=10.0.2.0/24)."
	option left			"1.2.3.4"
	option leftid			"@bofh.xelerance.com"
	option leftrsasigkey		"0sAQPWTXt8DDlEhTZJ91ngNMxTSyuos6JZxXQmtRcwUl6ppUCcuuWvjXrF/qiz6eiL1LMlpGJyG1oVhtFhTaFJl7ZkF/4J1B9LCFzYxvYI97AnLuC0op5pVAZ1SZx29+aRjeMcKC4zbZ6dMMjUdn9H1gqG9rpE0MBEFNSVLEu9U8rtlz14RfxQAQ9ePj64HnGLfgJlDB0VYhKEIcRihy72bvjZ4eoX16S1EY1FgnHyrveZPxRi8sgn6Q19RytEzSmUAlGjvMDhNfenq6WCSYMeqgj0jFSArTNBQmR2QBkUG6NSOXfb+18c6jDPicGmbmWfoRx/PUJo46WiRF4RRmsxnFpbHpklILFzEJ+/k6qHVAekpVfp"
	option right			"5.6.7.8"
	option rightid			"@tla.xelerance.com"
	option rightrsasigkey		"0sAQNxf6caKULJklYZycuo66Ko0U+iHaJUDr0QZHnG4MJ9IRNYi5H6kPxcwKIXkg+OGo+NeUyyWDEc+ox27BFYViAHQNEyBRLZu0kyE681h+cHm7lfCSy0AOEBSCyZF3aGcL8GWxVhtimpJQ4tNxXZg7tLX5sfYw8mZnUBjkHvyccIred/q3cNWbDlq2WU4TL+NBb5FnxXi9Hk/SRV7sMe56fvZuXkcJu4e2C7uocltzzF1b0BZx7yeXwHjzqAWnW/UA54fbSTvzgnrpSC+FMuhWTI1EdxcqGaOFIjGWWGV2nxg/QaPU9i8vpwFwrEEdCJTiqlbYYNudblg4vYthnVNez0/RkfZHfhAaHdbJRSaQzOu88h"
	option auto			"start"

config ipsec_recipe let_my_dns_go
	option _shortdesc		"Exclude DNS from Opportunistic Encryption"
        option left			"%defaultroute"
        option leftnexthop		"%defaultroute"
        option leftprotoport		"17/%any"
        option right			"0.0.0.0"
        list rightsubnets		"0.0.0.0/0"
        option rightprotoport		"17/53"
        option type			"passthrough"
        option auto			"route"

config ipsec_recipe subnet_any_subnet
	option _shortdesc		"Subnet-to-any with same CA"
	option _longdesc		"Connection configuration to allow any peer with a certificate from the same CA as ours to connect from anywhere and, optionally, to connect their subnet with any address range in virtual_private.  Any computer on our subnet can communicate with the peer."
	option authby			"rsasig"
	option left			"1.2.3.4"
	option leftsourceip		"10.0.0.1"
	list leftsubnets		"10.0.0.0/24"
	option leftcert			"servercert.pem"
	option leftid			"%fromcert"
	option leftrsasigkey		"%cert"
	option right			"%any"
	list rightsubnets		"vnet:%priv,%no"
	option rightca			"%same"
	option auto			"add"

config ipsec_recipe xauthserver
	option _shortdesc		"XAUTH server, RSA cert"
	option left			"1.2.3.4"
	option leftcert			"/etc/ipsec.d/certs/xauthserver.pem"
	option leftxauthserver		"yes"
	option leftmodecfgserver	"yes"
	option right			"%any"
	option rightxauthclient		"yes"
	option rightmodecfgclient	"yes"
	option auto			"add"
	option rekey			"yes"
	option modecfgpull		"yes"
	option modecfgdns1		"1.2.3.4"
	option modecfgdns2		"5.6.7.8"
	option modecfgwins1		"1.2.3.4"
	option modecfgwins2		"5.6.7.8"

config ipsec_recipe xauthclient
	option _shortdesc		"XAUTH client"
	option _longdesc		"You probably can not rekey, it requires xauth password, and OpenSwan does not cache it for you.  Other clients might cache it and rekey to an OpenSwan server."
	option left			"1.2.3.4"
	option leftxauthserver		"yes"
	option leftmodecfgserver	"yes"
	option right			"%defaultroute"
	option rightxauthclient		"yes"
	option rightmodecfgclient	"yes"
	option auto			"add"
	option rekey			"no"
	option modecfgpull		"yes"
