Merge pull request #370 from gravitl/hotfix_v0.8.4_netclient_dns

Hotfix v0.8.4 netclient dns
This commit is contained in:
Alex 2021-10-20 11:09:54 -04:00 committed by GitHub
commit 44d4972a05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 56 additions and 7 deletions

View file

@ -37,6 +37,7 @@
# Get Started in 5 Minutes
**For production-grade installations, visit the [Install Docs](https://netmaker.readthedocs.io/en/develop/install.html).**
**For an HA install using helm on k8s, visit the [Helm Repo](https://github.com/gravitl/netmaker-helm/).**
1. Get a cloud VM with Ubuntu 20.04 and a public IP.
2. Open ports 443, 53, and 51821-51830/udp on the VM firewall and in cloud security settings.
3. Run the script:

View file

@ -94,8 +94,12 @@ func CreateNode(node models.Node, networkName string) (models.Node, error) {
if node.Name == models.NODE_SERVER_NAME {
node.IsServer = "yes"
}
if servercfg.IsDNSMode() && node.DNSOn == "" {
if node.DNSOn == "" {
if servercfg.IsDNSMode() {
node.DNSOn = "yes"
} else {
node.DNSOn = "no"
}
}
node.SetDefaults()
node.Address, err = functions.UniqueAddress(networkName)

View file

@ -6,7 +6,7 @@ import (
"errors"
"fmt"
"log"
"os/exec"
nodepb "github.com/gravitl/netmaker/grpc"
"github.com/gravitl/netmaker/models"
"github.com/gravitl/netmaker/netclient/auth"
@ -81,6 +81,20 @@ func JoinNetwork(cfg config.ClientConfig, privateKey string) error {
cfg.Node.MacAddress = macs[0]
}
}
if ncutils.IsLinux() {
log.Println("deleteme looking for resolvectl")
path, err := exec.LookPath("resolvectl")
if err != nil {
log.Println("deleteme whoops its not there")
ncutils.PrintLog("resolvectl not present",2)
ncutils.PrintLog("unable to configure DNS automatically, disabling automated DNS management",2)
cfg.Node.DNSOn = "no"
} else {
log.Println("nice we gucci")
log.Println("path -->", path)
}
}
// differentiate between client/server here
var node models.Node // fill this node with appropriate calls

View file

@ -1,14 +1,44 @@
#!/bin/sh
#!/bin/bash
set -e
if [[ $EUID -ne 0 ]]; then
if [ "$EUID" -ne 0 ]; then
echo "This script must be run as root"
exit 1
fi
[ -z "$KEY" ] && KEY=nokey;
[ -z "$VERSION" ] && echo "no \$VERSION provided, fallback to latest" && VERSION=latest;
wget -O netclient https://github.com/gravitl/netmaker/releases/download/latest/netclient
dist=netclient
echo "OS Version = $OSTYPE"
echo "Netclient Version = $VERSION"
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
arch=$(uname -i)
echo "CPU ARCH = $arch"
if [ "$arch" == 'x86_64' ];
then
dist=netclient
fi
if [ "$arch" == 'x86_32' ];
then
dist=netclient-32
fi
if [ "$arch" == 'armv*' ];
then
dist=netclient-arm64
fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
dist=netclient-darwin
else
echo "This OS is not currently supported via automated install"
exit 1
fi
echo "Binary = $dist"
wget -O netclient https://github.com/gravitl/netmaker/releases/download/$VERSION/netclient
chmod +x netclient
sudo ./netclient join -t $KEY
rm -f netclient