Merge remote-tracking branch 'origin/RefactorDebug' into BigRefactor
This commit is contained in:
commit
d6cd817133
5 changed files with 6 additions and 30 deletions
|
|
@ -1,11 +1,16 @@
|
||||||
### Tactical RMM Agent
|
### Tactical RMM Agent
|
||||||
https://github.com/amidaware/tacticalrmm
|
https://github.com/amidaware/tacticalrmm
|
||||||
|
|
||||||
#### building the agent
|
#### building the agent - linux
|
||||||
```
|
```
|
||||||
env CGO_ENABLED=0 GOOS=<GOOS> GOARCH=<GOARCH> go build -ldflags "-s -w"
|
env CGO_ENABLED=0 GOOS=<GOOS> GOARCH=<GOARCH> go build -ldflags "-s -w"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### building the agent - windows
|
||||||
|
```
|
||||||
|
$env:CGO_ENABLED="0";$env:GOOS="windows";$env:GOARCH="amd64"; go build -ldflags "-s -w"
|
||||||
|
```
|
||||||
|
|
||||||
### tests
|
### tests
|
||||||
Navigate to repo directory
|
Navigate to repo directory
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -48,10 +48,6 @@ var (
|
||||||
|
|
||||||
func NewAgentConfig() *rmm.AgentConfig {
|
func NewAgentConfig() *rmm.AgentConfig {
|
||||||
k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS)
|
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 {
|
if err != nil {
|
||||||
return &rmm.AgentConfig{}
|
return &rmm.AgentConfig{}
|
||||||
|
|
@ -840,11 +836,6 @@ func (a *Agent) InstallService() error {
|
||||||
|
|
||||||
// skip on first call of inno setup if this is a new install
|
// skip on first call of inno setup if this is a new install
|
||||||
_, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS)
|
_, 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 {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/amidaware/rmmagent/shared"
|
|
||||||
"github.com/go-resty/resty/v2"
|
"github.com/go-resty/resty/v2"
|
||||||
trmm "github.com/wh1te909/trmm-shared"
|
trmm "github.com/wh1te909/trmm-shared"
|
||||||
)
|
)
|
||||||
|
|
@ -253,15 +252,10 @@ func (a *Agent) Install(i *Installer) {
|
||||||
a.Logger.Infoln("Starting service...")
|
a.Logger.Infoln("Starting service...")
|
||||||
out := a.ControlService(winSvcName, "start")
|
out := a.ControlService(winSvcName, "start")
|
||||||
|
|
||||||
if shared.TEST {
|
|
||||||
goto SKIPSTART;
|
|
||||||
}
|
|
||||||
|
|
||||||
if !out.Success {
|
if !out.Success {
|
||||||
a.installerMsg(out.ErrorMsg, "error", i.Silent)
|
a.installerMsg(out.ErrorMsg, "error", i.Silent)
|
||||||
}
|
}
|
||||||
|
|
||||||
SKIPSTART: a.Logger.Infoln("Skipping service start in test.")
|
|
||||||
a.Logger.Infoln("Adding windows defender exclusions")
|
a.Logger.Infoln("Adding windows defender exclusions")
|
||||||
a.addDefenderExlusions()
|
a.addDefenderExlusions()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,6 @@ package agent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
"github.com/amidaware/rmmagent/shared"
|
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -39,9 +38,6 @@ func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, me
|
||||||
viper.Set("meshdir", meshdir)
|
viper.Set("meshdir", meshdir)
|
||||||
viper.SetConfigPermissions(0660)
|
viper.SetConfigPermissions(0660)
|
||||||
configLocation := "/etc/tacticalagent"
|
configLocation := "/etc/tacticalagent"
|
||||||
if shared.TEST {
|
|
||||||
configLocation = "tacticalagent"
|
|
||||||
}
|
|
||||||
|
|
||||||
err := viper.SafeWriteConfigAs(configLocation)
|
err := viper.SafeWriteConfigAs(configLocation)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,18 +17,12 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
"github.com/amidaware/rmmagent/shared"
|
|
||||||
"github.com/gonutz/w32/v2"
|
"github.com/gonutz/w32/v2"
|
||||||
"golang.org/x/sys/windows/registry"
|
"golang.org/x/sys/windows/registry"
|
||||||
)
|
)
|
||||||
|
|
||||||
func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, meshdir string) {
|
func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, meshdir string) {
|
||||||
k, _, err := registry.CreateKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS)
|
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 {
|
if err != nil {
|
||||||
log.Fatalln("Error creating registry key:", err)
|
log.Fatalln("Error creating registry key:", err)
|
||||||
}
|
}
|
||||||
|
|
@ -84,10 +78,6 @@ func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, me
|
||||||
func (a *Agent) checkExistingAndRemove(silent bool) {
|
func (a *Agent) checkExistingAndRemove(silent bool) {
|
||||||
hasReg := false
|
hasReg := false
|
||||||
_, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS)
|
_, 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 {
|
if err == nil {
|
||||||
hasReg = true
|
hasReg = true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue