IPsec Manual Keying
Installation/Vorraussetzungen
Für diese Art der Verbindung wird das Programm "setkey" benötigt, dass im Paket "ipsec-tools" vorhanden ist
- apt-get install ipsec-tools
Konfigurationsdatei erstellen
- In einem beliebigen Verzeichnis eine Datei mit folgendem Inhalt erstellen
#!/usr/sbin/setkey -f flush; spdflush; # ESP add 192.168.244.2 192.168.242.1 esp 15701 -m tunnel -E 3des-cbc "123456789012123456789012" -A hmac-sha1 "this is the test key"; add 192.168.242.1 192.168.244.2 esp 24501 -m tunnel -E 3des-cbc "123456789012123456789012" -A hmac-sha1 "this is the test key"; spdadd 10.88.88.0/24 10.44.44.0/24 any -P out ipsec esp/tunnel/192.168.242.1-192.168.244.2/require; spdadd 10.44.44.0/24 10.88.88.0/24 any -P in ipsec esp/tunnel/192.168.244.2-192.168.242.1/require;
- Auf der Gegenseite muss die selbe Datei erstellt werden, lediglich die IP-Addressen müssen vertauscht werden
Starten
- chmod + x /usr/local/sbin/tunnel.sh
- ./ /usr/local/sbin/tunnel.sh
Überprüfung des Tunnels
- setkey -D
192.168.242.1 192.168.244.2 esp mode=tunnel spi=24501(0x00005fb5) reqid=0(0x00000000) E: 3des-cbc 31323334 35363738 39303132 31323334 35363738 39303132 A: hmac-sha1 74686973 20697320 74686520 74657374 206b6579 seq=0x00000000 replay=0 flags=0x00000000 state=mature created: Oct 5 09:31:55 2016 current: Oct 5 09:32:01 2016 diff: 6(s) hard: 0(s) soft: 0(s) last: hard: 0(s) soft: 0(s) current: 0(bytes) hard: 0(bytes) soft: 0(bytes) allocated: 0 hard: 0 soft: 0 sadb_seq=1 pid=15756 refcnt=0 192.168.244.2 192.168.242.1 esp mode=tunnel spi=15701(0x00003d55) reqid=0(0x00000000) E: 3des-cbc 31323334 35363738 39303132 31323334 35363738 39303132 A: hmac-sha1 74686973 20697320 74686520 74657374 206b6579 seq=0x00000000 replay=0 flags=0x00000000 state=mature created: Oct 5 09:31:55 2016 current: Oct 5 09:32:01 2016 diff: 6(s) hard: 0(s) soft: 0(s) last: hard: 0(s) soft: 0(s) current: 0(bytes) hard: 0(bytes) soft: 0(bytes) allocated: 0 hard: 0 soft: 0 sadb_seq=0 pid=15756 refcnt=0
Anmerkung
Diese Konfiguration ist aus Sicherheitstechnischer Sicht bedenklich und sollte in der praktischen Anwendung nicht verwendet werden. Sie kann jedoch zu Demonstrationszwecken eingesetzt werden, etwa um vorzuführen wie eine VPN gehackt und entschlüsselt werden kann.
Siehe hierzu: Wireshark VPN entschlüsseln