diff --git a/HowtoIKED.md b/HowtoIKED.md new file mode 100644 index 00000000..2f8b38c1 --- /dev/null +++ b/HowtoIKED.md @@ -0,0 +1,117 @@ +--- +categories: openbsd network vpn security ipsec +title: Howto IKED +... + +Documentation : + +* +* + +IKED est le démon utilisé sous OpenBSD pour mettre en place un VPN IPsec avec IKEv2. + +## Configuration + +On met en place un VPN entre 2 machines OpenBSD : + +* GW1 avec l'IP publique 192.0.2.254 et le LAN 203.0.113.0/25 ; +* GW2 avec l'IP publique 198.51.100.254 et le LAN 203.0.113.128/25. + +Sur GW1 : + +Vérification de l'activation des paramètres sysctl : + +~~~ +# sysctl net.inet.esp.enable +net.inet.esp.enable=1 +# sysctl net.inet.ah.enable +net.inet.ah.enable=1 +# sysctl net.inet.ip.forwarding +net.inet.ip.forwarding=1 +~~~ + +Activation de l'interface enc0 : + +~~~ +# ifconfig enc0 up +# echo up >/etc/hostname.enc0 +~~~ + +Configuration de /etc/pf.conf : + +~~~ +set skip on {lo0 enc0} + +pass in on $ext_if proto esp from $addr_gw2 to ($ext_if) +pass in on $ext_if proto udp from $addr_gw2 to ($ext_if) port {isakmp, ipsec-nat-t} +~~~ + +Et application des modifications : + +~~~ +# pfctl -nf /etc/pf.conf && pfctl -f /etc/pf.conf +~~~ + +Configuration de /etc/iked.conf : + +~~~ +local_ip="192.0.2.254" +local_network="203.0.113.0/25" + +remote_ip="198.51.100.254" +remote_network="203.0.113.128/25" + +ikev2 active esp \ + from $local_network to $remote_network \ + local $local_ip peer $remote_ip \ + ikesa auth hmac-sha2-256 enc aes-256 prf hmac-sha2-256 group modp4096 \ + childsa auth hmac-sha1 enc aes-256 group modp4096 \ + ikelifetime 86400 lifetime 3600 \ + psk "PKS-TO-CONFIGURE" +~~~ + +Test de la configuration : + +~~~ +# iked -nf /etc/iked.conf +configuration OK +~~~ + +Activation et démarrage de iked : + +~~~ +# rcctl enable iked +# rcctl start iked +~~~ + +Puis effectuer les mêmes actions sur l'autre passerelle. + +## Administration + +### Redémarrer les VPN + +~~~ +# ikectl reset all +# ikectl load /etc/iked.conf +~~~ + +### Consulter les logs + +~~~ +# tail -f /var/log/daemon | grep iked +~~~ + +### Voir les associations VPN + +~~~ +# ipsecctl -sa +~~~ + +### Debug + +Couper iked et le relancer : + +~~~ +# rcctl stop iked +# iked -dvvv -f /etc/iked.conf +~~~ \ No newline at end of file