Skip to content

Commit

Permalink
Merge pull request #755 from gravitl/v0.10.0
Browse files Browse the repository at this point in the history
V0.10.0
  • Loading branch information
0xdcarns authored Feb 12, 2022
2 parents 3ce6d1a + b710802 commit 59b1225
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
load: true
platforms: linux/amd64
tags: ${{ env.TAG }}
build-args: version=${{ env.TAG }}
-
name: Test x86
run: |
Expand All @@ -61,6 +62,7 @@ jobs:
load: true
platforms: linux/arm64
tags: ${{ env.TAG }}
build-args: version=${{ env.TAG }}
-
name: Test arm
run: |
Expand All @@ -75,3 +77,4 @@ jobs:
platforms: linux/amd64, linux/arm64
push: true
tags: ${{ github.repository }}:${{ env.TAG }}
build-args: version=${{ env.TAG }}
7 changes: 5 additions & 2 deletions .github/workflows/publish-netclient-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ jobs:
context: .
load: true
platforms: linux/amd64
file: docker/Dockerfile-netclient-multiarch
file: ./docker/Dockerfile-netclient-multiarch
tags: ${{ env.TAG }}
build-args: version=${{ env.TAG }}
-
name: Test x86
run: |
Expand All @@ -61,8 +62,9 @@ jobs:
context: .
load: true
platforms: linux/arm64
file: docker/Dockerfile-netclient-multiarch
file: ./docker/Dockerfile-netclient-multiarch
tags: ${{ env.TAG }}
build-args: version=${{ env.TAG }}
-
name: Test arm
run: |
Expand All @@ -77,3 +79,4 @@ jobs:
platforms: linux/amd64, linux/arm64
push: true
tags: gravitl/netclient:${{ env.TAG }}
build-args: version=${{ env.TAG }}
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#first stage - builder
FROM golang:1.17-alpine as builder
ARG version
ARG version
RUN apk add build-base
WORKDIR /app
COPY . .
ENV GO111MODULE=auto

# RUN GOOS=linux CGO_ENABLED=1 go build -tags debug -ldflags="-s -X 'main.version=$version'" -o netmaker main.go
RUN GOOS=linux CGO_ENABLED=1 go build -ldflags="-s -X 'main.version=$VERSION'" -o netmaker main.go
RUN GOOS=linux CGO_ENABLED=1 go build -ldflags="-s -X 'main.version=${version}'" -o netmaker main.go
FROM alpine:3.14.3

# add a c lib
Expand Down
12 changes: 12 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Security Policy

Netmaker is reliant on secure networking. If you find a vulnerability or bug please report it.
Depending on complexity or severity, the Gravitl team may compensate (aka. bug bounty) the reporter.
However, there is no official bug bounty program up yet for the Netmaker project.

## Supported Versions
- We currently are only able to support work on the latest version(s)

## Reporting a Vulnerability

Please report security issues to `[email protected]`
57 changes: 29 additions & 28 deletions netclient/functions/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,35 +181,8 @@ func MessageQueue(ctx context.Context, network string) {
ncutils.Log("netclient go routine started for " + network)
var cfg config.ClientConfig
cfg.Network = network
/*
var configPath = fmt.Sprintf("%snetconfig-%s", ncutils.GetNetclientPathSpecific(), network)
fileInfo, err := os.Stat(configPath)
if err != nil {
ncutils.Log("could not stat config file: " + configPath)
}
// speed up UDP rest
if time.Now().After(fileInfo.ModTime().Add(time.Minute)) {
sleepTime := 2
ncutils.Log("pulling latest config for " + cfg.Network)
for {
_, err := Pull(network, true)
if err == nil {
break
} else {
ncutils.PrintLog("error pulling config for "+network+": "+err.Error(), 1)
}
if sleepTime > 3600 {
sleepTime = 3600
}
ncutils.Log("failed to pull for network " + network)
ncutils.Log(fmt.Sprintf("waiting %d seconds to retry...", sleepTime))
time.Sleep(time.Second * time.Duration(sleepTime))
sleepTime = sleepTime * 2
}
}
initialPull(cfg.Network)

time.Sleep(time.Second << 1)
*/
cfg.ReadConfig()
ncutils.Log("daemon started for network: " + network)
client := SetupMQTT(&cfg, false)
Expand Down Expand Up @@ -538,6 +511,34 @@ func Hello(cfg *config.ClientConfig, network string) {

// == Private ==

func initialPull(network string) {
ncutils.Log("pulling latest config for " + network)
var configPath = fmt.Sprintf("%snetconfig-%s", ncutils.GetNetclientPathSpecific(), network)
fileInfo, err := os.Stat(configPath)
if err != nil {
ncutils.Log("could not stat config file: " + configPath)
return
}
// speed up UDP rest
if !fileInfo.ModTime().IsZero() && time.Now().After(fileInfo.ModTime().Add(time.Minute)) {
sleepTime := 2
for {
_, err := Pull(network, true)
if err == nil {
break
}
if sleepTime > 3600 {
sleepTime = 3600
}
ncutils.Log("failed to pull for network " + network)
ncutils.Log(fmt.Sprintf("waiting %d seconds to retry...", sleepTime))
time.Sleep(time.Second * time.Duration(sleepTime))
sleepTime = sleepTime * 2
}
time.Sleep(time.Second << 1)
}
}

func publish(cfg *config.ClientConfig, dest string, msg []byte) error {
// setup the keys
trafficPrivKey, err := auth.RetrieveTrafficKey(cfg.Node.Network)
Expand Down

0 comments on commit 59b1225

Please sign in to comment.