Setup of DMVPN on Alpine linux: Difference between revisions
Clandmeter (talk | contribs) |
Clandmeter (talk | contribs) |
||
Line 28: | Line 28: | ||
dmvpn { | dmvpn { | ||
version = 2 # enable IKEv2 | version = 2 # enable IKEv2 | ||
pull = no # | pull = no # IKEv1 only. Push enabled. IKEv2 does not support pull. | ||
mobike = no # disable support for mobile clients tunnel migration | mobike = no # disable support for mobile clients tunnel migration | ||
dpd_delay = 15 # Interval to check the liveness of a peer if not traffic has passed | dpd_delay = 15 # Interval to check the liveness of a peer if not traffic has passed | ||
Line 40: | Line 40: | ||
certs = cert # certificates used for authentication | certs = cert # certificates used for authentication | ||
auth = pubkey # a private key associated to a usable certificate | auth = pubkey # a private key associated to a usable certificate | ||
id = spoke1 # IKE identity which should be included in the certificate | id = spoke1 # IKE identity which should be included in the certificate. ie fqdn | ||
} | } | ||
remote { | remote { | ||
Line 47: | Line 47: | ||
children { | children { | ||
dmvpn { | dmvpn { | ||
esp_proposals = aes256-sha512-ecp384 | esp_proposals = aes256-sha512-ecp384 # docs say default is considered safe and has good interoperability | ||
local_ts = dynamic[gre] | local_ts = dynamic[gre] # traffic selectors, dynamic to use outer address of virtual ip. restrict to GRE protocol | ||
remote_ts = dynamic[gre] | remote_ts = dynamic[gre] # traffic selectors, dynamic to use outer address of virtual ip. restrict to GRE protocol | ||
inactivity = 90m | inactivity = 90m # close CHILD_SA after inactivity | ||
rekey_time = 100m | rekey_time = 100m # Time to schedule CHILD_SA rekeying | ||
mode = transport | mode = transport # | ||
dpd_action = clear | dpd_action = clear | ||
reqid = 1 | reqid = 1 |
Revision as of 10:05, 2 November 2015
Setting up mGRE tunnel
We start by adding mGRE tunnels to our network configuration.
Contents of /etc/networking/interfaces
Setting up IPSec VPN
To encrypt this tunnel, and the traffic in it, we will use strongswan ipsec with its vici plugin. The vici plugin provides VICI, the Versatile IKE Configuration Interface. As its name indicates, it provides an interface for external applications to not only configure, but also to control and monitor the IKE daemon charon. for this we also need a modified version of strongswan, provided by fabled.
apk add strongswan
Contents of /etc/swanctl/swanctl.conf
Generate PKI certificates
First, generate a private key, the default generates a 2048 bit RSA key
ipsec pki --gen > caKey.der
Now self-sign a CA certificate using the generated key:
ipsec pki --self --in caKey.der --dn "C=CH, O=strongSwan, CN=strongSwan CA" --ca > caCert.der
Adjust the distinguished name (DN) to your needs, it will be included in all issued certificates.
For each peer, i.e. for all VPN clients and VPN gateways in your network, generate an individual private key and issue a matching certificate using your new CA:
ipsec pki --gen > peerKey.der ipsec pki --pub --in peerKey.der
Certificate Revocation Lists (CRL)
In case end entity certificates have to be revoked, Certificate Revocation Lists (CRLs) may be generated with the ipsec pki --signcrl command:
ipsec pki --signcrl --cacert caCert.der --cakey caKey.der --reason superseded --cert peerCert.der > crl.der
Install certificates
On each peer store the following certificates and keys in the /etc/ipsec.d/ subdirectory tree:
/etc/ipsec.d/private/peerKey.der holds the private key of the given peer. /etc/ipsec.d/certs/peerCert.der holds the end entity certificate of the given peer. /etc/ipsec.d/cacerts/caCert.der holds the CA certificate which issued and signed all peer certificates.