From 24d51a30e14f7a0264aaeb0e87ce223a6f3ef034 Mon Sep 17 00:00:00 2001 From: Dan <7434746+wh1te909@users.noreply.github.com> Date: Thu, 16 Jun 2022 22:14:44 -0700 Subject: [PATCH 1/8] Revert "Refactor debug" --- .gitignore | 2 -- .vscode/launch.json | 18 --------------- README.md | 12 ---------- agent/agent.go | 12 +++++----- agent/agent_linux.go | 7 +++--- agent/agent_linux_test.go | 45 ------------------------------------- agent/agent_test.go | 20 ----------------- agent/agent_windows.go | 12 +--------- agent/install.go | 15 ++++--------- agent/install_linux.go | 14 +++++------- agent/install_test.go | 43 ----------------------------------- agent/install_windows.go | 11 --------- agent/rpc.go | 4 ---- agent/rpc_test.go | 10 --------- agent/testargs.json.example | 19 ---------------- shared/debug.go | 5 ----- shared/nodebug.go | 5 ----- shared/notest.go | 5 ----- shared/test.go | 5 ----- 19 files changed, 20 insertions(+), 244 deletions(-) delete mode 100644 .vscode/launch.json delete mode 100644 agent/agent_linux_test.go delete mode 100644 agent/agent_test.go delete mode 100644 agent/install_test.go delete mode 100644 agent/rpc_test.go delete mode 100644 agent/testargs.json.example delete mode 100644 shared/debug.go delete mode 100644 shared/nodebug.go delete mode 100644 shared/notest.go delete mode 100644 shared/test.go diff --git a/.gitignore b/.gitignore index ba76619..363cf4a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,3 @@ *.bmp build/Output tacticalagent-v* -tacticalagent -agent/testargs.json \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 432fcfd..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Launch file", - "type": "go", - "request": "launch", - "mode": "debug", - "env": {}, - "args": ["-m", "svc", "-log", "DEBUG", "-logto", "stdout"], - "buildFlags": "-tags=DEBUG", - "program": "${workspaceRoot}" - } - ] -} \ No newline at end of file diff --git a/README.md b/README.md index aaaeaf6..d065784 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,4 @@ https://github.com/amidaware/tacticalrmm env CGO_ENABLED=0 GOOS= GOARCH= go build -ldflags "-s -w" ``` -### tests -Navigate to agent directory -``` -go test -vet=off -``` -Add to settings.json -``` -"go.testFlags": [ - "-vet=off" -], -"go.testTags": "TEST" -``` \ No newline at end of file diff --git a/agent/agent.go b/agent/agent.go index 5d7a836..567d56a 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -52,7 +52,7 @@ type Agent struct { EXE string SystemDrive string MeshInstaller string - MeshSystemBin string + MeshSystemEXE string MeshSVC string PyBin string Headers map[string]string @@ -114,15 +114,15 @@ func New(logger *logrus.Logger, version string) *Agent { restyC.SetRootCertificate(ac.Cert) } - var MeshSysBin string + var MeshSysExe string if len(ac.CustomMeshDir) > 0 { - MeshSysBin = filepath.Join(ac.CustomMeshDir, "MeshAgent.exe") + MeshSysExe = filepath.Join(ac.CustomMeshDir, "MeshAgent.exe") } else { - MeshSysBin = filepath.Join(os.Getenv("ProgramFiles"), "Mesh Agent", "MeshAgent.exe") + MeshSysExe = filepath.Join(os.Getenv("ProgramFiles"), "Mesh Agent", "MeshAgent.exe") } if runtime.GOOS == "linux" { - MeshSysBin = "/opt/tacticalmesh/meshagent" + MeshSysExe = "/opt/tacticalmesh/meshagent" } svcConf := &service.Config{ @@ -152,7 +152,7 @@ func New(logger *logrus.Logger, version string) *Agent { EXE: exe, SystemDrive: sd, MeshInstaller: "meshagent.exe", - MeshSystemBin: MeshSysBin, + MeshSystemEXE: MeshSysExe, MeshSVC: meshSvcName, PyBin: pybin, Headers: headers, diff --git a/agent/agent_linux.go b/agent/agent_linux.go index da3b049..1027344 100644 --- a/agent/agent_linux.go +++ b/agent/agent_linux.go @@ -132,7 +132,6 @@ func NewAgentConfig() *rmm.AgentConfig { viper.SetConfigType("json") viper.AddConfigPath("/etc/") viper.AddConfigPath(".") - err := viper.ReadInConfig() if err != nil { @@ -279,14 +278,14 @@ func (a *Agent) NixMeshNodeID() string { meshSuccess := false a.Logger.Debugln("Getting mesh node id") - if !trmm.FileExists(a.MeshSystemBin) { - a.Logger.Debugln(a.MeshSystemBin, "does not exist. Skipping.") + if !trmm.FileExists(a.MeshSystemEXE) { + a.Logger.Debugln(a.MeshSystemEXE, "does not exist. Skipping.") return "" } opts := a.NewCMDOpts() opts.IsExecutable = true - opts.Shell = a.MeshSystemBin + opts.Shell = a.MeshSystemEXE opts.Command = "-nodeid" for !meshSuccess { diff --git a/agent/agent_linux_test.go b/agent/agent_linux_test.go deleted file mode 100644 index 570b881..0000000 --- a/agent/agent_linux_test.go +++ /dev/null @@ -1,45 +0,0 @@ -package agent - -import ( - "bytes" - "io" - "os" - "testing" -) - -func captureOutput(f func()) string { - old := os.Stdout - r, w, _ := os.Pipe() - os.Stdout = w - f() - w.Close() - os.Stdout = old - - var buf bytes.Buffer - io.Copy(&buf, r) - return buf.String() -} - -func TestShowStatus(t *testing.T) { - var ( - version = "2.0.4" - ) - - output := captureOutput(func() { - ShowStatus(version) - }) - - if output != (version + "\n") { - t.Errorf("ShowStatus output not equal to version defined.") - } -} - -func TestOsString(t *testing.T) { - a := New(lg, version) - osString := a.osString() - if osString == "" { - t.Errorf("Could not get OS String") - } else { - t.Logf("Got OS String: %s", osString) - } -} \ No newline at end of file diff --git a/agent/agent_test.go b/agent/agent_test.go deleted file mode 100644 index d8b745e..0000000 --- a/agent/agent_test.go +++ /dev/null @@ -1,20 +0,0 @@ -package agent - -import ( - "testing" - "github.com/sirupsen/logrus" -) - -var ( - version = "2.0.4" - lg = logrus.New() -) - -func TestAgentId(t *testing.T) { - a := New(lg, version) - if a.AgentID == "" { - t.Error("AgentID not set") - } else { - t.Logf("AgentID: %s", a.AgentID) - } -} \ No newline at end of file diff --git a/agent/agent_windows.go b/agent/agent_windows.go index 2d6d1e1..0912cd2 100644 --- a/agent/agent_windows.go +++ b/agent/agent_windows.go @@ -48,11 +48,6 @@ var ( func NewAgentConfig() *rmm.AgentConfig { k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS) - if shared.TEST { - err = nil - k, _, err := registry.OpenKey(registry.CURRENT_USER, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS) - } - if err != nil { return &rmm.AgentConfig{} } @@ -802,7 +797,7 @@ func (a *Agent) RecoverMesh() { } func (a *Agent) getMeshNodeID() (string, error) { - out, err := CMD(a.MeshSystemBin, []string{"-nodeid"}, 10, false) + out, err := CMD(a.MeshSystemEXE, []string{"-nodeid"}, 10, false) if err != nil { a.Logger.Debugln(err) return "", err @@ -840,11 +835,6 @@ func (a *Agent) InstallService() error { // skip on first call of inno setup if this is a new install _, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS) - if shared.TEST { - err = nil - k, _, err := registry.OpenKey(registry.CURRENT_USER, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS) - } - if err != nil { return nil } diff --git a/agent/install.go b/agent/install.go index 6beaefb..8614794 100644 --- a/agent/install.go +++ b/agent/install.go @@ -23,7 +23,6 @@ import ( "strings" "time" - "github.com/amidaware/rmmagent/shared" "github.com/go-resty/resty/v2" trmm "github.com/wh1te909/trmm-shared" ) @@ -147,11 +146,11 @@ func (a *Agent) Install(i *Installer) { arch = "32" } - var installerMeshSystemBin string + var installerMeshSystemEXE string if len(i.MeshDir) > 0 { - installerMeshSystemBin = filepath.Join(i.MeshDir, "MeshAgent.exe") + installerMeshSystemEXE = filepath.Join(i.MeshDir, "MeshAgent.exe") } else { - installerMeshSystemBin = a.MeshSystemBin + installerMeshSystemEXE = a.MeshSystemEXE } var meshNodeID string @@ -179,7 +178,7 @@ func (a *Agent) Install(i *Installer) { a.Logger.Debugln("Mesh agent:", mesh) time.Sleep(1 * time.Second) - meshNodeID, err = a.installMesh(mesh, installerMeshSystemBin, i.Proxy) + meshNodeID, err = a.installMesh(mesh, installerMeshSystemEXE, i.Proxy) if err != nil { a.installerMsg(fmt.Sprintf("Failed to install mesh agent: %s", err.Error()), "error", i.Silent) } @@ -252,16 +251,10 @@ func (a *Agent) Install(i *Installer) { time.Sleep(1 * time.Second) a.Logger.Infoln("Starting service...") out := a.ControlService(winSvcName, "start") - - if shared.TEST { - goto SKIPSTART; - } - if !out.Success { a.installerMsg(out.ErrorMsg, "error", i.Silent) } - SKIPSTART: a.Logger.Infoln("Skipping service start in test.") a.Logger.Infoln("Adding windows defender exclusions") a.addDefenderExlusions() diff --git a/agent/install_linux.go b/agent/install_linux.go index 7391609..b9debcc 100644 --- a/agent/install_linux.go +++ b/agent/install_linux.go @@ -13,10 +13,14 @@ package agent import ( "log" - "github.com/amidaware/rmmagent/shared" + "github.com/spf13/viper" ) +const ( + etcConfig = "/etc/tacticalagent" +) + func (a *Agent) checkExistingAndRemove(silent bool) {} func (a *Agent) installerMsg(msg, alert string, silent bool) { @@ -38,13 +42,7 @@ func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, me viper.Set("proxy", proxy) viper.Set("meshdir", meshdir) viper.SetConfigPermissions(0660) - configLocation := "/etc/tacticalagent" - if shared.TEST { - configLocation = "tacticalagent" - } - - err := viper.SafeWriteConfigAs(configLocation) - + err := viper.SafeWriteConfigAs(etcConfig) if err != nil { log.Fatalln("createAgentConfig", err) } diff --git a/agent/install_test.go b/agent/install_test.go deleted file mode 100644 index 0f07b6d..0000000 --- a/agent/install_test.go +++ /dev/null @@ -1,43 +0,0 @@ -package agent - -import ( - "testing" - "github.com/sirupsen/logrus" - "github.com/spf13/viper" -) - -func TestInstall(t *testing.T) { - var ( - version = "2.0.4" - log = logrus.New() - ) - - a := New(log, version) - - viper.SetConfigName("testargs.json") - viper.SetConfigType("json") - viper.AddConfigPath(".") - viper.ReadInConfig() - - installer := Installer { - RMM: viper.GetString("api"), - ClientID: viper.GetInt("clientid"), - SiteID: viper.GetInt("siteid"), - Description: viper.GetString("description"), - AgentType: viper.GetString("agenttype"), - Power: viper.GetBool("power"), - RDP: viper.GetBool("rdp"), - Ping: viper.GetBool("ping"), - Token: viper.GetString("token"), - LocalMesh: viper.GetString("localmesh"), - Cert: viper.GetString("cert"), - Proxy: viper.GetString("proxy"), - Timeout: viper.GetDuration("timeout"), - Silent: viper.GetBool("silent"), - NoMesh: viper.GetBool("nomesh"), - MeshDir: viper.GetString("meshdir"), - MeshNodeID: viper.GetString("meshnodeid"), - } - - a.Install(&installer) -} diff --git a/agent/install_windows.go b/agent/install_windows.go index db6467b..3f8b630 100644 --- a/agent/install_windows.go +++ b/agent/install_windows.go @@ -17,18 +17,12 @@ import ( "os" "path/filepath" - "github.com/amidaware/rmmagent/shared" "github.com/gonutz/w32/v2" "golang.org/x/sys/windows/registry" ) func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, meshdir string) { k, _, err := registry.CreateKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS) - if shared.TEST { - err = nil - k, _, err := registry.OpenKey(registry.CURRENT_USER, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS) - } - if err != nil { log.Fatalln("Error creating registry key:", err) } @@ -84,11 +78,6 @@ func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, me func (a *Agent) checkExistingAndRemove(silent bool) { hasReg := false _, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS) - if shared.TEST { - err = nil - _, err = registry.OpenKey(registry.CURRENT_USER, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS) - } - if err == nil { hasReg = true } diff --git a/agent/rpc.go b/agent/rpc.go index 2990135..7d24d0b 100644 --- a/agent/rpc.go +++ b/agent/rpc.go @@ -49,10 +49,6 @@ var ( ) func (a *Agent) RunRPC() { - if rmm.DEBUG { - a.Logger.Infoln("DEBUG BUILD STARTED") - } - a.Logger.Infoln("Agent service started") go a.RunAsService() var wg sync.WaitGroup diff --git a/agent/rpc_test.go b/agent/rpc_test.go deleted file mode 100644 index 385d3b9..0000000 --- a/agent/rpc_test.go +++ /dev/null @@ -1,10 +0,0 @@ -package agent - -import ( - "testing" -) - -func TestRunRPC(t *testing.T) { - a := New(lg, version) - a.RunRPC() -} \ No newline at end of file diff --git a/agent/testargs.json.example b/agent/testargs.json.example deleted file mode 100644 index c4ba6c8..0000000 --- a/agent/testargs.json.example +++ /dev/null @@ -1,19 +0,0 @@ -{ - "api": "", - "clientid": 1, - "siteid": 1, - "description": "", - "agenttype": "workstation", - "power": false, - "rdp": false, - "ping": false, - "token": "", - "localmesh": "", - "cert": "", - "proxy": "", - "timeout": 30, - "silent": true, - "nomesh": true, - "meshdir": "", - "meshnodeid": "" -} \ No newline at end of file diff --git a/shared/debug.go b/shared/debug.go deleted file mode 100644 index 0893720..0000000 --- a/shared/debug.go +++ /dev/null @@ -1,5 +0,0 @@ -//go:build DEBUG - -package shared - -const DEBUG = true \ No newline at end of file diff --git a/shared/nodebug.go b/shared/nodebug.go deleted file mode 100644 index e2032ee..0000000 --- a/shared/nodebug.go +++ /dev/null @@ -1,5 +0,0 @@ -//go:build !DEBUG - -package shared - -const DEBUG = false \ No newline at end of file diff --git a/shared/notest.go b/shared/notest.go deleted file mode 100644 index c79656a..0000000 --- a/shared/notest.go +++ /dev/null @@ -1,5 +0,0 @@ -//go:build !TEST - -package shared - -const TEST = false \ No newline at end of file diff --git a/shared/test.go b/shared/test.go deleted file mode 100644 index c1dbff8..0000000 --- a/shared/test.go +++ /dev/null @@ -1,5 +0,0 @@ -//go:build TEST - -package shared - -const TEST = true \ No newline at end of file From 42be72f0b43c80f721ff5f4d5a8eec4bf5d453a1 Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Thu, 16 Jun 2022 22:25:22 -0700 Subject: [PATCH 2/8] add build info to version flag --- agent/utils.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/agent/utils.go b/agent/utils.go index 6d9a851..f5916f8 100644 --- a/agent/utils.go +++ b/agent/utils.go @@ -22,6 +22,7 @@ import ( "os" "path/filepath" "runtime" + goDebug "runtime/debug" "strings" "time" @@ -138,10 +139,13 @@ func GenerateAgentID() string { func ShowVersionInfo(ver string) { fmt.Println("Tactical RMM Agent:", ver) fmt.Println("Arch:", runtime.GOARCH) - fmt.Println("Go version:", runtime.Version()) if runtime.GOOS == "windows" { fmt.Println("Program Directory:", filepath.Join(os.Getenv("ProgramFiles"), progFilesName)) } + bi, ok := goDebug.ReadBuildInfo() + if ok { + fmt.Println(bi.String()) + } } // TotalRAM returns total RAM in GB From 959a1bb8c8f061f9279884fcad1d96d12e64fda6 Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Fri, 17 Jun 2022 18:59:24 -0700 Subject: [PATCH 3/8] add workflow --- .github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cc4df2f --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: Run tests + +on: + push: + branches: + - "*" + pull_request: + branches: + - "*" + +jobs: + build: + runs-on: ubuntu-latest + name: Run tests + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-go@v3 + with: + go-version: '1.18.3' + + - name: Ensure linux agent compiles + run: | + ARCHS='amd64 386 arm64 arm' + for i in ${ARCHS}; do + env CGO_ENABLED=0 GOOS=linux GOARCH=${i} go build -ldflags "-s -w" + done + + - name: Ensure windows agent compiles + run: | + ARCHS='amd64 386' + for i in ${ARCHS}; do + env CGO_ENABLED=0 GOOS=windows GOARCH=${i} go build -ldflags "-s -w" + done From 73deda7d04e52072d55dea49e6d9cba4bbc96134 Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Mon, 20 Jun 2022 12:23:51 -0700 Subject: [PATCH 4/8] refactor goarch --- agent/agent.go | 1 - agent/install.go | 10 +--------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/agent/agent.go b/agent/agent.go index 567d56a..f299863 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -141,7 +141,6 @@ func New(logger *logrus.Logger, version string) *Agent { return &Agent{ Hostname: info.Hostname, - Arch: info.Architecture, BaseURL: ac.BaseURL, AgentID: ac.AgentID, ApiURL: ac.APIURL, diff --git a/agent/install.go b/agent/install.go index 8614794..db8fad3 100644 --- a/agent/install.go +++ b/agent/install.go @@ -138,14 +138,6 @@ func (a *Agent) Install(i *Installer) { rClient.SetProxy(i.Proxy) } - var arch string - switch a.Arch { - case "x86_64": - arch = "64" - case "x86": - arch = "32" - } - var installerMeshSystemEXE string if len(i.MeshDir) > 0 { installerMeshSystemEXE = filepath.Join(i.MeshDir, "MeshAgent.exe") @@ -159,7 +151,7 @@ func (a *Agent) Install(i *Installer) { mesh := filepath.Join(a.ProgramDir, a.MeshInstaller) if i.LocalMesh == "" { a.Logger.Infoln("Downloading mesh agent...") - payload := map[string]string{"arch": arch, "plat": a.Platform} + payload := map[string]string{"goarch": a.GoArch, "plat": a.Platform} r, err := rClient.R().SetBody(payload).SetOutput(mesh).Post(fmt.Sprintf("%s/api/v3/meshexe/", baseURL)) if err != nil { a.installerMsg(fmt.Sprintf("Failed to download mesh agent: %s", err.Error()), "error", i.Silent) From eaf74850d212d63422276f966edf057ae8ecbc90 Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Mon, 20 Jun 2022 15:22:28 -0700 Subject: [PATCH 5/8] update dev version --- build/setup.iss | 2 +- main.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/setup.iss b/build/setup.iss index 99bcd12..fd64abe 100644 --- a/build/setup.iss +++ b/build/setup.iss @@ -1,5 +1,5 @@ #define MyAppName "Tactical RMM Agent" -#define MyAppVersion "2.0.4" +#define MyAppVersion "2.1.0-dev" #define MyAppPublisher "AmidaWare LLC" #define MyAppURL "https://github.com/amidaware" #define MyAppExeName "tacticalrmm.exe" diff --git a/main.go b/main.go index 392c376..5b3b35c 100644 --- a/main.go +++ b/main.go @@ -25,7 +25,7 @@ import ( ) var ( - version = "2.0.4" + version = "2.1.0-dev" log = logrus.New() logFile *os.File ) From d8da1316230a34678ce57dfe5a3e32624aa6a406 Mon Sep 17 00:00:00 2001 From: redanthrax Date: Wed, 22 Jun 2022 13:03:45 -0700 Subject: [PATCH 6/8] added unix support/tested builds --- agent/{agent_linux.go => agent_unix.go} | 11 +---------- agent/{install_linux.go => install_unix.go} | 2 ++ 2 files changed, 3 insertions(+), 10 deletions(-) rename agent/{agent_linux.go => agent_unix.go} (97%) rename agent/{install_linux.go => install_unix.go} (98%) diff --git a/agent/agent_linux.go b/agent/agent_unix.go similarity index 97% rename from agent/agent_linux.go rename to agent/agent_unix.go index 1027344..3ae5475 100644 --- a/agent/agent_linux.go +++ b/agent/agent_unix.go @@ -1,13 +1,4 @@ -/* -Copyright 2022 AmidaWare LLC. - -Licensed under the Tactical RMM License Version 1.0 (the “License”). -You may only use the Licensed Software in accordance with the License. -A copy of the License is available at: - -https://license.tacticalrmm.com - -*/ +// +build !windows package agent diff --git a/agent/install_linux.go b/agent/install_unix.go similarity index 98% rename from agent/install_linux.go rename to agent/install_unix.go index b9debcc..3168f82 100644 --- a/agent/install_linux.go +++ b/agent/install_unix.go @@ -1,3 +1,5 @@ +// +build !windows + /* Copyright 2022 AmidaWare LLC. From d3753535d53a8cd4050f3eacdc53b314f116a70b Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Wed, 22 Jun 2022 20:20:19 +0000 Subject: [PATCH 7/8] add back license --- agent/agent_unix.go | 12 ++++++++++++ agent/install_unix.go | 1 + 2 files changed, 13 insertions(+) diff --git a/agent/agent_unix.go b/agent/agent_unix.go index 3ae5475..ddd5bac 100644 --- a/agent/agent_unix.go +++ b/agent/agent_unix.go @@ -1,5 +1,17 @@ +//go:build !windows // +build !windows +/* +Copyright 2022 AmidaWare LLC. + +Licensed under the Tactical RMM License Version 1.0 (the “License”). +You may only use the Licensed Software in accordance with the License. +A copy of the License is available at: + +https://license.tacticalrmm.com + +*/ + package agent import ( diff --git a/agent/install_unix.go b/agent/install_unix.go index 3168f82..cf6a068 100644 --- a/agent/install_unix.go +++ b/agent/install_unix.go @@ -1,3 +1,4 @@ +//go:build !windows // +build !windows /* From 1ac1ca57e2ffbbf1904ac761e4680887d804d29f Mon Sep 17 00:00:00 2001 From: wh1te909 Date: Wed, 22 Jun 2022 20:33:28 +0000 Subject: [PATCH 8/8] ensure agent compiles for mac and freebsd too --- .github/workflows/ci.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc4df2f..3c4f05a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,3 +33,17 @@ jobs: for i in ${ARCHS}; do env CGO_ENABLED=0 GOOS=windows GOARCH=${i} go build -ldflags "-s -w" done + + - name: Ensure mac agent compiles + run: | + ARCHS='amd64 arm64' + for i in ${ARCHS}; do + env CGO_ENABLED=0 GOOS=darwin GOARCH=${i} go build -ldflags "-s -w" + done + + - name: Ensure freebsd agent compiles + run: | + ARCHS='amd64 386 arm64 arm' + for i in ${ARCHS}; do + env CGO_ENABLED=0 GOOS=freebsd GOARCH=${i} go build -ldflags "-s -w" + done