From 45464c00f5265cdf55cb2b2fd1728980cf36bdb2 Mon Sep 17 00:00:00 2001 From: Matthew R Kasun Date: Fri, 31 Dec 2021 16:04:25 +0000 Subject: [PATCH] use dns entry in wireguard config file; checkin temporarily disabled til figure issue with dns on checkin --- netclient/command/commands.go | 2 ++ netclient/functions/join.go | 4 ++-- netclient/ncutils/netclientutils_linux.go | 1 + netclient/wireguard/common.go | 5 ++++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/netclient/command/commands.go b/netclient/command/commands.go index e4a3aeec..baa07a3c 100644 --- a/netclient/command/commands.go +++ b/netclient/command/commands.go @@ -99,6 +99,8 @@ func RunUserspaceDaemon() { } func CheckIn(cfg config.ClientConfig) error { + log.Println("checkin --- diabled for now") + return nil var err error var errN error if cfg.Network == "" { diff --git a/netclient/functions/join.go b/netclient/functions/join.go index 905f08d7..20769d67 100644 --- a/netclient/functions/join.go +++ b/netclient/functions/join.go @@ -83,9 +83,9 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string) error { } } if ncutils.IsLinux() { - _, err := exec.LookPath("resolvectl") + _, err := exec.LookPath("resolveconf") if err != nil { - ncutils.PrintLog("resolvectl not present", 2) + ncutils.PrintLog("resolveconf not present", 2) ncutils.PrintLog("unable to configure DNS automatically, disabling automated DNS management", 2) cfg.Node.DNSOn = "no" } diff --git a/netclient/ncutils/netclientutils_linux.go b/netclient/ncutils/netclientutils_linux.go index f1147295..123ec7c2 100644 --- a/netclient/ncutils/netclientutils_linux.go +++ b/netclient/ncutils/netclientutils_linux.go @@ -35,6 +35,7 @@ func GetEmbedded() error { // CreateUserSpaceConf - creates a user space WireGuard conf func CreateUserSpaceConf(address string, privatekey string, listenPort string, mtu int32, dns string, perskeepalive int32, peers []wgtypes.PeerConfig) (string, error) { + log.Println("---------- dns passed to create conf ", dns) peersString, err := parsePeers(perskeepalive, peers) var listenPortString string if mtu <= 0 { diff --git a/netclient/wireguard/common.go b/netclient/wireguard/common.go index 53787881..f256de81 100644 --- a/netclient/wireguard/common.go +++ b/netclient/wireguard/common.go @@ -136,7 +136,10 @@ func InitWireguard(node *models.Node, privkey string, peers []wgtypes.PeerConfig log.Fatal("no address to configure") } - nameserver := servercfg.CoreDNSAddr + var nameserver string + if node.DNSOn == "yes" { + nameserver = servercfg.CoreDNSAddr + } var newConf string if node.UDPHolePunch != "yes" { newConf, _ = ncutils.CreateUserSpaceConf(node.Address, key.String(), strconv.FormatInt(int64(node.ListenPort), 10), node.MTU, nameserver, node.PersistentKeepalive, peers)