robsd-exec: timeout 3600s + . /usr/local/libexec/robsd/util-regress.sh + config_load + << "EOF" + _err=0 + _env=REGRESS_FAIL_EARLY=no + config_value regress-sys/net/wg-env + 2> /dev/null + _env=REGRESS_FAIL_EARLY=no GOCACHE=/tmp TUNNEL4_SRC=29 TUNNEL4_DST=30 TUNNEL6_SRC=31 TUNNEL6_DST=32 + _make=make -C /home/src/regress/sys/net/wg REGRESS_FAIL_EARLY=no GOCACHE=/tmp TUNNEL4_SRC=29 TUNNEL4_DST=30 TUNNEL6_SRC=31 TUNNEL6_DST=32 + config_value regress-sys/net/wg-targets + regress_root sys/net/wg + export SUDO + unpriv -c staff build exec make -C /home/src/regress/sys/net/wg REGRESS_FAIL_EARLY=no GOCACHE=/tmp TUNNEL4_SRC=29 TUNNEL4_DST=30 TUNNEL6_SRC=31 TUNNEL6_DST=32 regress ==== ifconfig ==== openssl rand -base64 32 -out 29.key rm -f 29.pub.tmp doas -n ifconfig wg29 create || true doas -n ifconfig wg29 wgkey "`cat 29.key`" doas -n ifconfig wg29 | awk '/wgpubkey/{print $2}' >29.pub.tmp mv 29.pub.tmp 29.pub openssl rand -base64 32 -out 30.key rm -f 30.pub.tmp doas -n ifconfig wg30 create || true doas -n ifconfig wg30 wgkey "`cat 30.key`" doas -n ifconfig wg30 | awk '/wgpubkey/{print $2}' >30.pub.tmp mv 30.pub.tmp 30.pub openssl rand -base64 32 -out 31.key rm -f 31.pub.tmp doas -n ifconfig wg31 create || true doas -n ifconfig wg31 wgkey "`cat 31.key`" doas -n ifconfig wg31 | awk '/wgpubkey/{print $2}' >31.pub.tmp mv 31.pub.tmp 31.pub openssl rand -base64 32 -out 32.key rm -f 32.pub.tmp doas -n ifconfig wg32 create || true doas -n ifconfig wg32 wgkey "`cat 32.key`" doas -n ifconfig wg32 | awk '/wgpubkey/{print $2}' >32.pub.tmp mv 32.pub.tmp 32.pub # destroy WireGuard and routing domain loopback interfaces doas -n ifconfig wg29 destroy doas -n ifconfig lo29 destroy ifconfig: lo29: SIOCIFDESTROY: Device not configured *** Error 1 in target 'unconfig' (ignored) doas -n ifconfig wg30 destroy doas -n ifconfig lo30 destroy ifconfig: lo30: SIOCIFDESTROY: Device not configured *** Error 1 in target 'unconfig' (ignored) doas -n ifconfig wg31 destroy doas -n ifconfig lo31 destroy ifconfig: lo31: SIOCIFDESTROY: Device not configured *** Error 1 in target 'unconfig' (ignored) doas -n ifconfig wg32 destroy doas -n ifconfig lo32 destroy ifconfig: lo32: SIOCIFDESTROY: Device not configured *** Error 1 in target 'unconfig' (ignored) # create and configure WireGuard interfaces doas -n ifconfig wg29 create wgport 229 wgkey "`cat 29.key`" rdomain 29 doas -n ifconfig wg30 create wgport 230 wgkey "`cat 30.key`" rdomain 30 doas -n ifconfig wg31 create wgport 231 wgkey "`cat 31.key`" rdomain 31 doas -n ifconfig wg32 create wgport 232 wgkey "`cat 32.key`" rdomain 32 # local SRC, foreign DST, tunnel 4 doas -n ifconfig wg29 wgpeer "`cat 30.pub`" wgendpoint 127.0.0.1 230 wgaip 10.188.44.2/32 wgaip fdd7:e83e:66bc:46::2/128 # local SRC, foreign DST, tunnel 6 doas -n ifconfig wg31 wgpeer "`cat 32.pub`" wgendpoint ::1 232 wgaip 10.188.64.2/32 wgaip fdd7:e83e:66bc:66::2/128 # local SRC, foreign DST, tunnel 4 doas -n ifconfig wg29 inet 10.188.44.1/24 alias doas -n ifconfig wg29 inet6 fdd7:e83e:66bc:46::1/64 alias # local SRC, foreign DST, tunnel 6 doas -n ifconfig wg31 inet 10.188.64.1/24 alias doas -n ifconfig wg31 inet6 fdd7:e83e:66bc:66::1/64 alias # local DST, foreign SRC, tunnel 4 doas -n ifconfig wg30 wgpeer "`cat 29.pub`" wgendpoint 127.0.0.1 229 wgaip 10.188.44.1/32 wgaip fdd7:e83e:66bc:46::1/128 # local DST, foreign SRC, tunnel 6 doas -n ifconfig wg32 wgpeer "`cat 31.pub`" wgendpoint ::1 231 wgaip 10.188.64.1/32 wgaip fdd7:e83e:66bc:66::1/128 # local DST, foreign SRC, tunnel 4 doas -n ifconfig wg30 inet 10.188.44.2/24 alias doas -n ifconfig wg30 inet6 fdd7:e83e:66bc:46::2/64 alias # local DST, foreign SRC, tunnel 6 doas -n ifconfig wg32 inet 10.188.64.2/24 alias doas -n ifconfig wg32 inet6 fdd7:e83e:66bc:66::2/64 alias sleep 1 # Wait until DAD for inet6 tunnel addresses has finished. ==== run-route-tunnel4-addr4-src-dst ==== # Get route to local address. /sbin/route -n -T 29 get 10.188.44.1 | grep 'interface: wg29$' interface: wg29 /sbin/route -n -T 29 get 10.188.44.1 | grep 'flags: .*,LOCAL' flags: # Get route to foreign address. /sbin/route -n -T 29 get 10.188.44.2 | grep 'interface: wg29$' interface: wg29 /sbin/route -n -T 29 get 10.188.44.2 | grep 'flags: .*,CLON' flags: ==== run-ping-tunnel4-addr4-src-dst ==== # Ping local address. /sbin/ping -n -w 1 -c 1 -V 29 10.188.44.1 PING 10.188.44.1 (10.188.44.1): 56 data bytes 64 bytes from 10.188.44.1: icmp_seq=0 ttl=255 time=0.115 ms --- 10.188.44.1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.115/0.115/0.115/0.000 ms # Ping foreign address. doas -n tcpdump -ni lo0 -w wg.pcap ip and udp port 229 or 230 or 231 or 232 or 0 & sleep 1 # Wait until tcpdump is up. tcpdump: listening on lo0, link-type LOOP /sbin/ping -n -w 1 -c 1 -V 29 10.188.44.2 PING 10.188.44.2 (10.188.44.2): 56 data bytes 64 bytes from 10.188.44.2: icmp_seq=0 ttl=255 time=5.275 ms --- 10.188.44.2 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 5.275/5.275/5.275/0.000 ms sleep 1 # Wait until tcpdump has captured traffic. doas -n pkill -xf 'tcpdump -ni lo0 -w wg.pcap .*' 5 packets received by filter 0 packets dropped by kernel # Check WireGuard encrypted traffic /usr/sbin/tcpdump -n -r wg.pcap | fgrep ': [wg] data ' 02:53:39.233217 127.0.0.1.229 > 127.0.0.1.230: [wg] data length 96 to 0xbc5e7e9e nonce 0 02:53:39.233388 127.0.0.1.230 > 127.0.0.1.229: [wg] data length 96 to 0xf550f19c nonce 1 ==== run-badkey-tunnel4-addr4-src-dst ==== openssl rand -base64 32 -out bad.key # Ping foreign address with bad key. doas -n ifconfig wg29 wgkey "`cat bad.key`" ! /sbin/ping -n -w 1 -c 1 -V 29 10.188.44.2 PING 10.188.44.2 (10.188.44.2): 56 data bytes --- 10.188.44.2 ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss # Restore key and test it. doas -n ifconfig wg29 wgkey "`cat 29.key`" /sbin/ping -n -w 1 -c 1 -V 29 10.188.44.2 PING 10.188.44.2 (10.188.44.2): 56 data bytes 64 bytes from 10.188.44.2: icmp_seq=0 ttl=255 time=3.005 ms --- 10.188.44.2 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 3.005/3.005/3.005/0.000 ms ==== run-route-tunnel4-addr4-dst-src ==== # Get route to local address. /sbin/route -n -T 30 get 10.188.44.2 | grep 'interface: wg30$' interface: wg30 /sbin/route -n -T 30 get 10.188.44.2 | grep 'flags: .*,LOCAL' flags: # Get route to foreign address. /sbin/route -n -T 30 get 10.188.44.1 | grep 'interface: wg30$' interface: wg30 /sbin/route -n -T 30 get 10.188.44.1 | grep 'flags: .*,CLON' flags: ==== run-ping-tunnel4-addr4-dst-src ==== # Ping local address. /sbin/ping -n -w 1 -c 1 -V 30 10.188.44.2 PING 10.188.44.2 (10.188.44.2): 56 data bytes 64 bytes from 10.188.44.2: icmp_seq=0 ttl=255 time=0.094 ms --- 10.188.44.2 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.094/0.094/0.094/0.000 ms # Ping foreign address. doas -n tcpdump -ni lo0 -w wg.pcap ip and udp port 229 or 230 or 231 or 232 or 0 & sleep 1 # Wait until tcpdump is up. tcpdump: listening on lo0, link-type LOOP /sbin/ping -n -w 1 -c 1 -V 30 10.188.44.1 PING 10.188.44.1 (10.188.44.1): 56 data bytes 64 bytes from 10.188.44.1: icmp_seq=0 ttl=255 time=0.377 ms --- 10.188.44.1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.377/0.377/0.377/0.000 ms sleep 1 # Wait until tcpdump has captured traffic. doas -n pkill -xf 'tcpdump -ni lo0 -w wg.pcap .*' 2 packets received by filter 0 packets dropped by kernel # Check WireGuard encrypted traffic /usr/sbin/tcpdump -n -r wg.pcap | fgrep ': [wg] data ' 02:53:43.578661 127.0.0.1.230 > 127.0.0.1.229: [wg] data length 96 to 0x0433614d nonce 3 02:53:43.578824 127.0.0.1.229 > 127.0.0.1.230: [wg] data length 96 to 0xfbb539ca nonce 2 ==== run-badkey-tunnel4-addr4-dst-src ==== # Ping foreign address with bad key. doas -n ifconfig wg30 wgkey "`cat bad.key`" ! /sbin/ping -n -w 1 -c 1 -V 30 10.188.44.1 PING 10.188.44.1 (10.188.44.1): 56 data bytes --- 10.188.44.1 ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss # Restore key and test it. doas -n ifconfig wg30 wgkey "`cat 30.key`" /sbin/ping -n -w 1 -c 1 -V 30 10.188.44.1 PING 10.188.44.1 (10.188.44.1): 56 data bytes 64 bytes from 10.188.44.1: icmp_seq=0 ttl=255 time=5.970 ms --- 10.188.44.1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 5.970/5.970/5.970/0.000 ms ==== run-route-tunnel4-addr6-src-dst ==== # Get route to local address. /sbin/route -n -T 29 get fdd7:e83e:66bc:46::1 | grep 'interface: wg29$' interface: wg29 /sbin/route -n -T 29 get fdd7:e83e:66bc:46::1 | grep 'flags: .*,LOCAL' flags: # Get route to foreign address. /sbin/route -n -T 29 get fdd7:e83e:66bc:46::2 | grep 'interface: wg29$' interface: wg29 /sbin/route -n -T 29 get fdd7:e83e:66bc:46::2 | grep 'flags: .*,CLON' flags: ==== run-ping-tunnel4-addr6-src-dst ==== # Ping local address. /sbin/ping6 -n -w 1 -c 1 -V 29 fdd7:e83e:66bc:46::1 PING fdd7:e83e:66bc:46::1 (fdd7:e83e:66bc:46::1): 56 data bytes 64 bytes from fdd7:e83e:66bc:46::1: icmp_seq=0 hlim=64 time=0.243 ms --- fdd7:e83e:66bc:46::1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.243/0.243/0.243/0.000 ms # Ping foreign address. doas -n tcpdump -ni lo0 -w wg.pcap ip and udp port 229 or 230 or 231 or 232 or 0 & sleep 1 # Wait until tcpdump is up. tcpdump: listening on lo0, link-type LOOP /sbin/ping6 -n -w 1 -c 1 -V 29 fdd7:e83e:66bc:46::2 PING fdd7:e83e:66bc:46::2 (fdd7:e83e:66bc:46::2): 56 data bytes 64 bytes from fdd7:e83e:66bc:46::2: icmp_seq=0 hlim=64 time=0.461 ms --- fdd7:e83e:66bc:46::2 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.461/0.461/0.461/0.000 ms sleep 1 # Wait until tcpdump has captured traffic. doas -n pkill -xf 'tcpdump -ni lo0 -w wg.pcap .*' 2 packets received by filter 0 packets dropped by kernel # Check WireGuard encrypted traffic /usr/sbin/tcpdump -n -r wg.pcap | fgrep ': [wg] data ' 02:53:48.082401 127.0.0.1.229 > 127.0.0.1.230: [wg] data length 112 to 0xba95bc80 nonce 3 02:53:48.082615 127.0.0.1.230 > 127.0.0.1.229: [wg] data length 112 to 0x4e58cb27 nonce 2 ==== run-badkey-tunnel4-addr6-src-dst ==== # Ping foreign address with bad key. doas -n ifconfig wg29 wgkey "`cat bad.key`" ! /sbin/ping6 -n -w 1 -c 1 -V 29 fdd7:e83e:66bc:46::2 PING fdd7:e83e:66bc:46::2 (fdd7:e83e:66bc:46::2): 56 data bytes --- fdd7:e83e:66bc:46::2 ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss # Restore key and test it. doas -n ifconfig wg29 wgkey "`cat 29.key`" /sbin/ping6 -n -w 1 -c 1 -V 29 fdd7:e83e:66bc:46::2 PING fdd7:e83e:66bc:46::2 (fdd7:e83e:66bc:46::2): 56 data bytes 64 bytes from fdd7:e83e:66bc:46::2: icmp_seq=0 hlim=64 time=5.612 ms --- fdd7:e83e:66bc:46::2 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 5.612/5.612/5.612/0.000 ms ==== run-route-tunnel4-addr6-dst-src ==== # Get route to local address. /sbin/route -n -T 30 get fdd7:e83e:66bc:46::2 | grep 'interface: wg30$' interface: wg30 /sbin/route -n -T 30 get fdd7:e83e:66bc:46::2 | grep 'flags: .*,LOCAL' flags: # Get route to foreign address. /sbin/route -n -T 30 get fdd7:e83e:66bc:46::1 | grep 'interface: wg30$' interface: wg30 /sbin/route -n -T 30 get fdd7:e83e:66bc:46::1 | grep 'flags: .*,CLON' flags: ==== run-ping-tunnel4-addr6-dst-src ==== # Ping local address. /sbin/ping6 -n -w 1 -c 1 -V 30 fdd7:e83e:66bc:46::2 PING fdd7:e83e:66bc:46::2 (fdd7:e83e:66bc:46::2): 56 data bytes 64 bytes from fdd7:e83e:66bc:46::2: icmp_seq=0 hlim=64 time=0.170 ms --- fdd7:e83e:66bc:46::2 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.170/0.170/0.170/0.000 ms # Ping foreign address. doas -n tcpdump -ni lo0 -w wg.pcap ip and udp port 229 or 230 or 231 or 232 or 0 & sleep 1 # Wait until tcpdump is up. tcpdump: listening on lo0, link-type LOOP /sbin/ping6 -n -w 1 -c 1 -V 30 fdd7:e83e:66bc:46::1 PING fdd7:e83e:66bc:46::1 (fdd7:e83e:66bc:46::1): 56 data bytes 64 bytes from fdd7:e83e:66bc:46::1: icmp_seq=0 hlim=64 time=0.440 ms --- fdd7:e83e:66bc:46::1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.440/0.440/0.440/0.000 ms sleep 1 # Wait until tcpdump has captured traffic. doas -n pkill -xf 'tcpdump -ni lo0 -w wg.pcap .*' 2 packets received by filter 0 packets dropped by kernel # Check WireGuard encrypted traffic /usr/sbin/tcpdump -n -r wg.pcap | fgrep ': [wg] data ' 02:53:52.555542 127.0.0.1.230 > 127.0.0.1.229: [wg] data length 112 to 0xff21c209 nonce 3 02:53:52.555733 127.0.0.1.229 > 127.0.0.1.230: [wg] data length 112 to 0x211af3a3 nonce 2 ==== run-badkey-tunnel4-addr6-dst-src ==== # Ping foreign address with bad key. doas -n ifconfig wg30 wgkey "`cat bad.key`" ! /sbin/ping6 -n -w 1 -c 1 -V 30 fdd7:e83e:66bc:46::1 PING fdd7:e83e:66bc:46::1 (fdd7:e83e:66bc:46::1): 56 data bytes --- fdd7:e83e:66bc:46::1 ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss # Restore key and test it. doas -n ifconfig wg30 wgkey "`cat 30.key`" /sbin/ping6 -n -w 1 -c 1 -V 30 fdd7:e83e:66bc:46::1 PING fdd7:e83e:66bc:46::1 (fdd7:e83e:66bc:46::1): 56 data bytes 64 bytes from fdd7:e83e:66bc:46::1: icmp_seq=0 hlim=64 time=5.818 ms --- fdd7:e83e:66bc:46::1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 5.818/5.818/5.818/0.000 ms ==== run-route-tunnel6-addr4-src-dst ==== # Get route to local address. /sbin/route -n -T 31 get 10.188.64.1 | grep 'interface: wg31$' interface: wg31 /sbin/route -n -T 31 get 10.188.64.1 | grep 'flags: .*,LOCAL' flags: # Get route to foreign address. /sbin/route -n -T 31 get 10.188.64.2 | grep 'interface: wg31$' interface: wg31 /sbin/route -n -T 31 get 10.188.64.2 | grep 'flags: .*,CLON' flags: ==== run-ping-tunnel6-addr4-src-dst ==== # Ping local address. /sbin/ping -n -w 1 -c 1 -V 31 10.188.64.1 PING 10.188.64.1 (10.188.64.1): 56 data bytes 64 bytes from 10.188.64.1: icmp_seq=0 ttl=255 time=0.162 ms --- 10.188.64.1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.162/0.162/0.162/0.000 ms # Ping foreign address. doas -n tcpdump -ni lo0 -w wg.pcap ip6 and udp port 229 or 230 or 231 or 232 or 0 & sleep 1 # Wait until tcpdump is up. tcpdump: listening on lo0, link-type LOOP /sbin/ping -n -w 1 -c 1 -V 31 10.188.64.2 PING 10.188.64.2 (10.188.64.2): 56 data bytes 64 bytes from 10.188.64.2: icmp_seq=0 ttl=255 time=5.647 ms --- 10.188.64.2 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 5.647/5.647/5.647/0.000 ms sleep 1 # Wait until tcpdump has captured traffic. doas -n pkill -xf 'tcpdump -ni lo0 -w wg.pcap .*' 5 packets received by filter 0 packets dropped by kernel # Check WireGuard encrypted traffic /usr/sbin/tcpdump -n -r wg.pcap | fgrep ': [wg] data ' 02:53:57.063768 ::1.231 > ::1.232: [wg] data length 96 to 0xacafbdf5 nonce 0 02:53:57.063997 ::1.232 > ::1.231: [wg] data length 96 to 0x129b65c1 nonce 1 ==== run-badkey-tunnel6-addr4-src-dst ==== # Ping foreign address with bad key. doas -n ifconfig wg31 wgkey "`cat bad.key`" ! /sbin/ping -n -w 1 -c 1 -V 31 10.188.64.2 PING 10.188.64.2 (10.188.64.2): 56 data bytes --- 10.188.64.2 ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss # Restore key and test it. doas -n ifconfig wg31 wgkey "`cat 31.key`" /sbin/ping -n -w 1 -c 1 -V 31 10.188.64.2 PING 10.188.64.2 (10.188.64.2): 56 data bytes 64 bytes from 10.188.64.2: icmp_seq=0 ttl=255 time=5.897 ms --- 10.188.64.2 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 5.897/5.897/5.897/0.000 ms ==== run-route-tunnel6-addr4-dst-src ==== # Get route to local address. /sbin/route -n -T 32 get 10.188.64.2 | grep 'interface: wg32$' interface: wg32 /sbin/route -n -T 32 get 10.188.64.2 | grep 'flags: .*,LOCAL' flags: # Get route to foreign address. /sbin/route -n -T 32 get 10.188.64.1 | grep 'interface: wg32$' interface: wg32 /sbin/route -n -T 32 get 10.188.64.1 | grep 'flags: .*,CLON' flags: ==== run-ping-tunnel6-addr4-dst-src ==== # Ping local address. /sbin/ping -n -w 1 -c 1 -V 32 10.188.64.2 PING 10.188.64.2 (10.188.64.2): 56 data bytes 64 bytes from 10.188.64.2: icmp_seq=0 ttl=255 time=0.161 ms --- 10.188.64.2 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.161/0.161/0.161/0.000 ms # Ping foreign address. doas -n tcpdump -ni lo0 -w wg.pcap ip6 and udp port 229 or 230 or 231 or 232 or 0 & sleep 1 # Wait until tcpdump is up. tcpdump: listening on lo0, link-type LOOP /sbin/ping -n -w 1 -c 1 -V 32 10.188.64.1 PING 10.188.64.1 (10.188.64.1): 56 data bytes 64 bytes from 10.188.64.1: icmp_seq=0 ttl=255 time=0.518 ms --- 10.188.64.1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.518/0.518/0.518/0.000 ms sleep 1 # Wait until tcpdump has captured traffic. doas -n pkill -xf 'tcpdump -ni lo0 -w wg.pcap .*' 2 packets received by filter 0 packets dropped by kernel # Check WireGuard encrypted traffic /usr/sbin/tcpdump -n -r wg.pcap | fgrep ': [wg] data ' 02:54:01.898594 ::1.232 > ::1.231: [wg] data length 96 to 0x3f7c8a60 nonce 3 02:54:01.898757 ::1.231 > ::1.232: [wg] data length 96 to 0xd99e5700 nonce 2 ==== run-badkey-tunnel6-addr4-dst-src ==== # Ping foreign address with bad key. doas -n ifconfig wg32 wgkey "`cat bad.key`" ! /sbin/ping -n -w 1 -c 1 -V 32 10.188.64.1 PING 10.188.64.1 (10.188.64.1): 56 data bytes --- 10.188.64.1 ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss # Restore key and test it. doas -n ifconfig wg32 wgkey "`cat 32.key`" /sbin/ping -n -w 1 -c 1 -V 32 10.188.64.1 PING 10.188.64.1 (10.188.64.1): 56 data bytes 64 bytes from 10.188.64.1: icmp_seq=0 ttl=255 time=5.890 ms --- 10.188.64.1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 5.890/5.890/5.890/0.000 ms ==== run-route-tunnel6-addr6-src-dst ==== # Get route to local address. /sbin/route -n -T 31 get fdd7:e83e:66bc:66::1 | grep 'interface: wg31$' interface: wg31 /sbin/route -n -T 31 get fdd7:e83e:66bc:66::1 | grep 'flags: .*,LOCAL' flags: # Get route to foreign address. /sbin/route -n -T 31 get fdd7:e83e:66bc:66::2 | grep 'interface: wg31$' interface: wg31 /sbin/route -n -T 31 get fdd7:e83e:66bc:66::2 | grep 'flags: .*,CLON' flags: ==== run-ping-tunnel6-addr6-src-dst ==== # Ping local address. /sbin/ping6 -n -w 1 -c 1 -V 31 fdd7:e83e:66bc:66::1 PING fdd7:e83e:66bc:66::1 (fdd7:e83e:66bc:66::1): 56 data bytes 64 bytes from fdd7:e83e:66bc:66::1: icmp_seq=0 hlim=64 time=0.181 ms --- fdd7:e83e:66bc:66::1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.181/0.181/0.181/0.000 ms # Ping foreign address. doas -n tcpdump -ni lo0 -w wg.pcap ip6 and udp port 229 or 230 or 231 or 232 or 0 & sleep 1 # Wait until tcpdump is up. tcpdump: listening on lo0, link-type LOOP /sbin/ping6 -n -w 1 -c 1 -V 31 fdd7:e83e:66bc:66::2 PING fdd7:e83e:66bc:66::2 (fdd7:e83e:66bc:66::2): 56 data bytes 64 bytes from fdd7:e83e:66bc:66::2: icmp_seq=0 hlim=64 time=0.558 ms --- fdd7:e83e:66bc:66::2 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.558/0.558/0.558/0.000 ms sleep 1 # Wait until tcpdump has captured traffic. doas -n pkill -xf 'tcpdump -ni lo0 -w wg.pcap .*' 3 packets received by filter 0 packets dropped by kernel # Check WireGuard encrypted traffic /usr/sbin/tcpdump -n -r wg.pcap | fgrep ': [wg] data ' 02:54:06.382387 ::1.231 > ::1.232: [wg] data length 112 to 0x8ea58516 nonce 3 02:54:06.382616 ::1.232 > ::1.231: [wg] data length 112 to 0x48e21216 nonce 2 ==== run-badkey-tunnel6-addr6-src-dst ==== # Ping foreign address with bad key. doas -n ifconfig wg31 wgkey "`cat bad.key`" ! /sbin/ping6 -n -w 1 -c 1 -V 31 fdd7:e83e:66bc:66::2 PING fdd7:e83e:66bc:66::2 (fdd7:e83e:66bc:66::2): 56 data bytes --- fdd7:e83e:66bc:66::2 ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss # Restore key and test it. doas -n ifconfig wg31 wgkey "`cat 31.key`" /sbin/ping6 -n -w 1 -c 1 -V 31 fdd7:e83e:66bc:66::2 PING fdd7:e83e:66bc:66::2 (fdd7:e83e:66bc:66::2): 56 data bytes 64 bytes from fdd7:e83e:66bc:66::2: icmp_seq=0 hlim=64 time=5.778 ms --- fdd7:e83e:66bc:66::2 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 5.778/5.778/5.778/0.000 ms ==== run-route-tunnel6-addr6-dst-src ==== # Get route to local address. /sbin/route -n -T 32 get fdd7:e83e:66bc:66::2 | grep 'interface: wg32$' interface: wg32 /sbin/route -n -T 32 get fdd7:e83e:66bc:66::2 | grep 'flags: .*,LOCAL' flags: # Get route to foreign address. /sbin/route -n -T 32 get fdd7:e83e:66bc:66::1 | grep 'interface: wg32$' interface: wg32 /sbin/route -n -T 32 get fdd7:e83e:66bc:66::1 | grep 'flags: .*,CLON' flags: ==== run-ping-tunnel6-addr6-dst-src ==== # Ping local address. /sbin/ping6 -n -w 1 -c 1 -V 32 fdd7:e83e:66bc:66::2 PING fdd7:e83e:66bc:66::2 (fdd7:e83e:66bc:66::2): 56 data bytes 64 bytes from fdd7:e83e:66bc:66::2: icmp_seq=0 hlim=64 time=0.265 ms --- fdd7:e83e:66bc:66::2 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.265/0.265/0.265/0.000 ms # Ping foreign address. doas -n tcpdump -ni lo0 -w wg.pcap ip6 and udp port 229 or 230 or 231 or 232 or 0 & sleep 1 # Wait until tcpdump is up. tcpdump: listening on lo0, link-type LOOP /sbin/ping6 -n -w 1 -c 1 -V 32 fdd7:e83e:66bc:66::1 PING fdd7:e83e:66bc:66::1 (fdd7:e83e:66bc:66::1): 56 data bytes 64 bytes from fdd7:e83e:66bc:66::1: icmp_seq=0 hlim=64 time=0.666 ms --- fdd7:e83e:66bc:66::1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.666/0.666/0.666/0.000 ms sleep 1 # Wait until tcpdump has captured traffic. doas -n pkill -xf 'tcpdump -ni lo0 -w wg.pcap .*' 2 packets received by filter 0 packets dropped by kernel # Check WireGuard encrypted traffic /usr/sbin/tcpdump -n -r wg.pcap | fgrep ': [wg] data ' 02:54:10.882609 ::1.232 > ::1.231: [wg] data length 112 to 0x42b40cee nonce 3 02:54:10.882886 ::1.231 > ::1.232: [wg] data length 112 to 0xa3373843 nonce 2 ==== run-badkey-tunnel6-addr6-dst-src ==== # Ping foreign address with bad key. doas -n ifconfig wg32 wgkey "`cat bad.key`" ! /sbin/ping6 -n -w 1 -c 1 -V 32 fdd7:e83e:66bc:66::1 PING fdd7:e83e:66bc:66::1 (fdd7:e83e:66bc:66::1): 56 data bytes --- fdd7:e83e:66bc:66::1 ping statistics --- 1 packets transmitted, 0 packets received, 100.0% packet loss # Restore key and test it. doas -n ifconfig wg32 wgkey "`cat 32.key`" /sbin/ping6 -n -w 1 -c 1 -V 32 fdd7:e83e:66bc:66::1 PING fdd7:e83e:66bc:66::1 (fdd7:e83e:66bc:66::1): 56 data bytes 64 bytes from fdd7:e83e:66bc:66::1: icmp_seq=0 hlim=64 time=5.765 ms --- fdd7:e83e:66bc:66::1 ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 5.765/5.765/5.765/0.000 ms ==== unconfig ==== # destroy WireGuard and routing domain loopback interfaces doas -n ifconfig wg29 destroy doas -n ifconfig lo29 destroy doas -n ifconfig wg30 destroy doas -n ifconfig lo30 destroy doas -n ifconfig wg31 destroy doas -n ifconfig lo31 destroy doas -n ifconfig wg32 destroy doas -n ifconfig lo32 destroy