-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reinitiation of lost Child SAs (#21)
Lots of work went into this change, but the important part is the --enable-reinitiator part. This feature allows strong-duckling to initiate the missing connection when it's not there. To make this work the following improvements were made: * support for better examples, which are focused on testing cases * new example for reconnection * solving issues with the vici implementation * introducing multiple IKESAStatusReceivers, previously known as reporter(s)
- Loading branch information
Emil Ingerslev
authored
May 7, 2020
1 parent
d5811fe
commit c11b075
Showing
35 changed files
with
772 additions
and
246 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[supervisorctl] | ||
serverurl=unix:///var/run/supervisor.sock | ||
|
||
[include] | ||
files=/supervisord-base.conf /supervisord-strong-duckling-restarter.conf | ||
|
||
[program:charon] | ||
command=/prefix-log /usr/sbin/charon-systemd | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[program:strong-duckling] | ||
command=/prefix-log /strong-duckling --listen :8000 --enable-reinitiator --vici-socket /var/run/charon.vici | ||
autostart=false | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[program:initialize-script] | ||
command=bash -c "sleep 2; /usr/sbin/swanctl --load-all --noprompt" | ||
startsecs=0 | ||
autorestart=false | ||
startretries=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
connections { | ||
gw-gw { | ||
local_addrs = {{ .Env.IP }},{{ .Env.VPN_LOCAL_PEER }} | ||
remote_addrs = {{ .Env.VPN_REMOTE_PEER }} | ||
|
||
local { | ||
auth = psk | ||
id = {{ .Env.VPN_LOCAL_PEER }} | ||
} | ||
remote { | ||
auth = psk | ||
id = {{ .Env.VPN_REMOTE_PEER }} | ||
} | ||
children { | ||
net-net-0 { | ||
local_ts = {{ .Env.VPN_LOCAL_NETWORK }}/32 | ||
remote_ts = {{ .Env.VPN_REMOTE_NETWORK }}/32 | ||
updown = /usr/libexec/ipsec/_updown iptables | ||
|
||
rekey_time = 5400 | ||
rekey_bytes = 500000000 | ||
rekey_packets = 1000000 | ||
esp_proposals = aes256-sha256-ecp384 | ||
|
||
start_action = start | ||
close_action = start | ||
dpd_action = start | ||
} | ||
} | ||
version = 2 | ||
mobike = no | ||
reauth_time = 10800 | ||
proposals = aes256-sha256-ecp384 | ||
} | ||
} | ||
|
||
secrets { | ||
ike-1 { | ||
id-local = {{ .Env.VPN_LOCAL_PEER }} | ||
id-remote = {{ .Env.VPN_REMOTE_PEER }} | ||
secret = "123456" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
|
||
while true; do | ||
echo "starting vpn" | ||
supervisorctl start charon | ||
sleep 2 | ||
/usr/sbin/swanctl --load-all --noprompt | ||
|
||
sleep 15 | ||
|
||
echo "stopping vpn" | ||
supervisorctl stop charon | ||
sleep 120 | ||
|
||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[supervisorctl] | ||
serverurl=unix:///var/run/supervisor.sock | ||
|
||
[include] | ||
files=/supervisord-base.conf | ||
|
||
[program:charon] | ||
command=/prefix-log /usr/sbin/charon-systemd | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
autostart=false | ||
|
||
[program:periodic] | ||
command="/config/periodic.sh" | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
connections { | ||
gw-gw { | ||
local_addrs = {{ .Env.IP }},{{ .Env.VPN_LOCAL_PEER }} | ||
remote_addrs = {{ .Env.VPN_REMOTE_PEER }} | ||
|
||
local { | ||
auth = psk | ||
id = {{ .Env.VPN_LOCAL_PEER }} | ||
} | ||
remote { | ||
auth = psk | ||
id = {{ .Env.VPN_REMOTE_PEER }} | ||
} | ||
children { | ||
net-net-0 { | ||
local_ts = {{ .Env.VPN_LOCAL_NETWORK }}/32 | ||
remote_ts = {{ .Env.VPN_REMOTE_NETWORK }}/32 | ||
updown = /usr/libexec/ipsec/_updown iptables | ||
|
||
rekey_time = 5400 | ||
rekey_bytes = 500000000 | ||
rekey_packets = 1000000 | ||
esp_proposals = aes256-sha256-ecp384 | ||
|
||
start_action = none | ||
close_action = none | ||
dpd_action = none | ||
} | ||
} | ||
version = 2 | ||
mobike = no | ||
reauth_time = 10800 | ||
proposals = aes256-sha256-ecp384 | ||
} | ||
} | ||
|
||
secrets { | ||
ike-1 { | ||
id-local = {{ .Env.VPN_LOCAL_PEER }} | ||
id-remote = {{ .Env.VPN_REMOTE_PEER }} | ||
secret = "123456" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[supervisorctl] | ||
serverurl=unix:///var/run/supervisor.sock | ||
|
||
[include] | ||
files=/supervisord-base.conf /supervisord-strong-duckling-restarter.conf | ||
|
||
[program:charon] | ||
command=/prefix-log /usr/sbin/charon-systemd | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[program:http-server] | ||
command=/prefix-log node /server.js | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[program:strong-duckling] | ||
command=/prefix-log /strong-duckling --listen :8000 --tcp-checker {{ .Env.VPN_REMOTE_NETWORK }}:8080 --vici-socket /var/run/charon.vici | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[program:initialize-script] | ||
command=bash -c "sleep 2; /usr/sbin/swanctl --load-all --noprompt" | ||
startsecs=0 | ||
autorestart=false | ||
startretries=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
connections { | ||
gw-gw { | ||
local_addrs = {{ .Env.IP }},{{ .Env.VPN_LOCAL_PEER }} | ||
remote_addrs = {{ .Env.VPN_REMOTE_PEER }} | ||
|
||
local { | ||
auth = psk | ||
id = {{ .Env.VPN_LOCAL_PEER }} | ||
} | ||
remote { | ||
auth = psk | ||
id = {{ .Env.VPN_REMOTE_PEER }} | ||
} | ||
children { | ||
net-net-0 { | ||
local_ts = {{ .Env.VPN_LOCAL_NETWORK }}/32 | ||
remote_ts = {{ .Env.VPN_REMOTE_NETWORK }}/32 | ||
updown = /usr/libexec/ipsec/_updown iptables | ||
|
||
rekey_time = 5400 | ||
rekey_bytes = 500000000 | ||
rekey_packets = 1000000 | ||
esp_proposals = aes256-sha256-ecp384 | ||
|
||
start_action = start | ||
close_action = start | ||
dpd_action = start | ||
} | ||
} | ||
version = 2 | ||
mobike = no | ||
reauth_time = 10800 | ||
proposals = aes256-sha256-ecp384 | ||
} | ||
} | ||
|
||
secrets { | ||
ike-1 { | ||
id-local = {{ .Env.VPN_LOCAL_PEER }} | ||
id-remote = {{ .Env.VPN_REMOTE_PEER }} | ||
secret = "123456" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
const http = require('http'); | ||
|
||
const requestListener = function (req, res) { | ||
res.writeHead(200); | ||
res.end('Hello from ' + process.env.VPN_LOCAL_PEER + "\n"); | ||
} | ||
|
||
const server = http.createServer(requestListener); | ||
server.listen(8080); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[supervisorctl] | ||
serverurl=unix:///var/run/supervisor.sock | ||
|
||
[include] | ||
files=/supervisord-base.conf /supervisord-strong-duckling-restarter.conf | ||
|
||
[program:charon] | ||
command=/prefix-log /usr/sbin/charon-systemd | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[program:http-server] | ||
command=/prefix-log node /server.js | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[program:strong-duckling] | ||
command=/prefix-log /strong-duckling --listen :8000 --tcp-checker {{ .Env.VPN_REMOTE_NETWORK }}:8080 --vici-socket /var/run/charon.vici | ||
stdout_logfile=/dev/stdout | ||
stdout_logfile_maxbytes=0 | ||
stderr_logfile=/dev/stderr | ||
stderr_logfile_maxbytes=0 | ||
|
||
[program:initialize-script] | ||
command=bash -c "sleep 2; /usr/sbin/swanctl --load-all --noprompt" | ||
startsecs=0 | ||
autorestart=false | ||
startretries=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
connections { | ||
gw-gw { | ||
local_addrs = {{ .Env.IP }},{{ .Env.VPN_LOCAL_PEER }} | ||
remote_addrs = {{ .Env.VPN_REMOTE_PEER }} | ||
|
||
local { | ||
auth = psk | ||
id = {{ .Env.VPN_LOCAL_PEER }} | ||
} | ||
remote { | ||
auth = psk | ||
id = {{ .Env.VPN_REMOTE_PEER }} | ||
} | ||
children { | ||
net-net-0 { | ||
local_ts = {{ .Env.VPN_LOCAL_NETWORK }}/32 | ||
remote_ts = {{ .Env.VPN_REMOTE_NETWORK }}/32 | ||
updown = /usr/libexec/ipsec/_updown iptables | ||
|
||
rekey_time = 5400 | ||
rekey_bytes = 500000000 | ||
rekey_packets = 1000000 | ||
esp_proposals = aes256-sha256-ecp384 | ||
|
||
start_action = none | ||
close_action = none | ||
dpd_action = none | ||
} | ||
} | ||
version = 2 | ||
mobike = no | ||
reauth_time = 10800 | ||
proposals = aes256-sha256-ecp384 | ||
} | ||
} | ||
|
||
secrets { | ||
ike-1 { | ||
id-local = {{ .Env.VPN_LOCAL_PEER }} | ||
id-remote = {{ .Env.VPN_REMOTE_PEER }} | ||
secret = "123456" | ||
} | ||
} |
Oops, something went wrong.