From 0b486d5d271cdf972bef0e18cd730c3cf3238d74 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Fri, 1 Sep 2023 16:45:21 +0200 Subject: [PATCH] Allow setting tun name in daemon config --- AppDir/etc/daemon.yml | 4 ++++ default.nix | 2 +- go/cmd/entrypoint/nebula_util.go | 2 +- go/daemon/config.go | 5 +++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/AppDir/etc/daemon.yml b/AppDir/etc/daemon.yml index ecf6433..1baf983 100644 --- a/AppDir/etc/daemon.yml +++ b/AppDir/etc/daemon.yml @@ -52,6 +52,10 @@ vpn: # That's it. + tun: + # Name of the tun network device which will route VPN traffic. + device: isle-tun + storage: # Allocations defined here are used to store data in the distributed storage diff --git a/default.nix b/default.nix index b04bef3..c5913f0 100644 --- a/default.nix +++ b/default.nix @@ -165,7 +165,7 @@ in rec { }; tests = pkgs.writeShellScript "isle-tests" '' - export PATH=$PATH:${appImage}/bin + export PATH=${appImage}/bin:$PATH test_dir=${./tests} exec $SHELL $test_dir/entrypoint.sh "$@" ''; diff --git a/go/cmd/entrypoint/nebula_util.go b/go/cmd/entrypoint/nebula_util.go index 82a80e9..47f7557 100644 --- a/go/cmd/entrypoint/nebula_util.go +++ b/go/cmd/entrypoint/nebula_util.go @@ -68,7 +68,7 @@ func nebulaPmuxProcConfig( "respond": true, }, "tun": map[string]interface{}{ - "dev": "isle-tun", + "dev": daemonConfig.VPN.Tun.Device, }, "firewall": daemonConfig.VPN.Firewall, } diff --git a/go/daemon/config.go b/go/daemon/config.go index 51d78e3..363b8bf 100644 --- a/go/daemon/config.go +++ b/go/daemon/config.go @@ -2,6 +2,10 @@ package daemon import "strconv" +type ConfigTun struct { + Device string `yaml:"device"` +} + type ConfigFirewall struct { Conntrack ConfigConntrack `yaml:"conntrack"` Outbound []ConfigFirewallRule `yaml:"outbound"` @@ -50,6 +54,7 @@ type Config struct { VPN struct { PublicAddr string `yaml:"public_addr"` Firewall ConfigFirewall `yaml:"firewall"` + Tun ConfigTun `yaml:"tun"` } `yaml:"vpn"` Storage struct { Allocations []ConfigStorageAllocation