From 7b8db7cd23be93017eda2be19e6556d8573735c3 Mon Sep 17 00:00:00 2001 From: Victor Date: Fri, 28 Aug 2020 18:32:43 +0100 Subject: [PATCH] fix #42: exclude private IPs from Wireguard profile --- wireguard/profile.go | 3 +-- wireguard/profile_test.go | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/wireguard/profile.go b/wireguard/profile.go index ec672e0c..ac0f8a5c 100644 --- a/wireguard/profile.go +++ b/wireguard/profile.go @@ -14,8 +14,7 @@ DNS = 1.1.1.1 MTU = 1280 [Peer] PublicKey = {{ .PublicKey }} -AllowedIPs = 0.0.0.0/0 -AllowedIPs = ::/0 +AllowedIPs = 0.0.0.0/5, 8.0.0.0/7, 11.0.0.0/8, 12.0.0.0/6, 16.0.0.0/4, 32.0.0.0/3, 64.0.0.0/2, 128.0.0.0/3, 160.0.0.0/5, 168.0.0.0/6, 172.0.0.0/12, 172.32.0.0/11, 172.64.0.0/10, 172.128.0.0/9, 173.0.0.0/8, 174.0.0.0/7, 176.0.0.0/4, 192.0.0.0/9, 192.128.0.0/11, 192.160.0.0/13, 192.169.0.0/16, 192.170.0.0/15, 192.172.0.0/14, 192.176.0.0/12, 192.192.0.0/10, 193.0.0.0/8, 194.0.0.0/7, 196.0.0.0/6, 200.0.0.0/5, 208.0.0.0/4, ::/0, 193.138.218.74/32 Endpoint = {{ .Endpoint }}` type Profile struct { diff --git a/wireguard/profile_test.go b/wireguard/profile_test.go index 54b6fede..b3a5cb02 100644 --- a/wireguard/profile_test.go +++ b/wireguard/profile_test.go @@ -11,8 +11,7 @@ DNS = 1.1.1.1 MTU = 1280 [Peer] PublicKey = 4 -AllowedIPs = 0.0.0.0/0 -AllowedIPs = ::/0 +AllowedIPs = 0.0.0.0/5, 8.0.0.0/7, 11.0.0.0/8, 12.0.0.0/6, 16.0.0.0/4, 32.0.0.0/3, 64.0.0.0/2, 128.0.0.0/3, 160.0.0.0/5, 168.0.0.0/6, 172.0.0.0/12, 172.32.0.0/11, 172.64.0.0/10, 172.128.0.0/9, 173.0.0.0/8, 174.0.0.0/7, 176.0.0.0/4, 192.0.0.0/9, 192.128.0.0/11, 192.160.0.0/13, 192.169.0.0/16, 192.170.0.0/15, 192.172.0.0/14, 192.176.0.0/12, 192.192.0.0/10, 193.0.0.0/8, 194.0.0.0/7, 196.0.0.0/6, 200.0.0.0/5, 208.0.0.0/4, ::/0, 193.138.218.74/32 Endpoint = 5` result, err := generateProfile(&ProfileData{