30 Commits

Author SHA1 Message Date
wh1te909
e9fd05bd91 Release 2.4.3 2022-12-04 15:10:28 -08:00
wh1te909
63fe3bcd73 bump versions 2022-12-04 15:09:48 -08:00
wh1te909
524837627f add env for script checks 2022-12-03 02:00:10 -08:00
wh1te909
3cb6b92a80 tidy 2022-12-02 23:34:09 -08:00
wh1te909
ec6ea9aded add local config 2022-12-02 23:22:14 -08:00
wh1te909
de01fa5d80 change logging levels 2022-11-30 17:13:55 -08:00
wh1te909
c71e495184 update deps 2022-11-30 16:28:06 -08:00
wh1te909
8d7dfeef25 fix unix 2022-11-29 19:50:52 +00:00
wh1te909
3ff004afa0 add more nats debug 2022-11-29 11:38:17 -08:00
wh1te909
36e9065474 change logging level 2022-11-28 23:19:58 -08:00
wh1te909
7358907b3c add env 2022-11-28 23:19:12 -08:00
wh1te909
6ac14b6d64 add env to scripts 2022-11-25 00:23:31 -08:00
wh1te909
9565fea27c update deps 2022-11-25 00:22:28 -08:00
wh1te909
79dba2f84c add some debug callbacks 2022-11-24 23:48:27 -08:00
wh1te909
f1db416d56 make checkin intervals configurable and remove extra nats conn 2022-11-24 23:45:59 -08:00
wh1te909
b3e0c3e3f8 Release 2.4.2 2022-11-12 16:50:11 -08:00
wh1te909
9ccb95449e bump version 2022-11-12 16:49:47 -08:00
wh1te909
d3bcb10f93 tidy 2022-11-12 16:17:18 -08:00
wh1te909
bcfae9dc66 update nats 2022-11-12 15:30:39 -08:00
wh1te909
f200862b1a remove unused funcs 2022-11-12 15:28:19 -08:00
wh1te909
7a75d4d5a3 update viper 2022-11-11 17:46:28 -08:00
wh1te909
db5cd5b0e0 dev 2022-11-11 17:46:10 -08:00
wh1te909
44c63d00b6 update ci 2022-11-09 23:47:00 -08:00
wh1te909
bf5258eb78 bump version 2022-11-08 23:02:17 -08:00
wh1te909
93f4de35fe update psutil 2022-11-08 21:37:54 -08:00
wh1te909
337c519b99 update deps 2022-11-07 10:18:12 -08:00
wh1te909
473cfd3ced add more cleanup #25 2022-11-06 22:20:49 -08:00
wh1te909
a057c65a02 moving this somewhere else 2022-11-06 22:18:56 -08:00
wh1te909
e11c38dd49 fix race condition in windows agent update amidaware/tacticalrmm#1250 2022-11-06 21:49:26 -08:00
wh1te909
eddafb873b remove stale inno temp files 2022-10-29 16:02:08 -07:00
17 changed files with 294 additions and 171 deletions

View File

@@ -18,7 +18,7 @@ jobs:
- uses: actions/setup-go@v3 - uses: actions/setup-go@v3
with: with:
go-version: '1.18.3' go-version: '1.19.3'
- name: Ensure linux agent compiles - name: Ensure linux agent compiles
run: | run: |
@@ -40,10 +40,3 @@ jobs:
for i in ${ARCHS}; do for i in ${ARCHS}; do
env CGO_ENABLED=0 GOOS=darwin GOARCH=${i} go build -ldflags "-s -w" env CGO_ENABLED=0 GOOS=darwin GOARCH=${i} go build -ldflags "-s -w"
done 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

View File

@@ -40,35 +40,37 @@ import (
// Agent struct // Agent struct
type Agent struct { type Agent struct {
Hostname string Hostname string
Arch string Arch string
AgentID string AgentID string
BaseURL string BaseURL string
ApiURL string ApiURL string
Token string Token string
AgentPK int AgentPK int
Cert string Cert string
ProgramDir string ProgramDir string
EXE string EXE string
SystemDrive string SystemDrive string
MeshInstaller string MeshInstaller string
MeshSystemEXE string MeshSystemEXE string
MeshSVC string MeshSVC string
PyBin string PyBin string
Headers map[string]string Headers map[string]string
Logger *logrus.Logger Logger *logrus.Logger
Version string Version string
Debug bool Debug bool
rClient *resty.Client rClient *resty.Client
Proxy string Proxy string
LogTo string LogTo string
LogFile *os.File LogFile *os.File
Platform string Platform string
GoArch string GoArch string
ServiceConfig *service.Config ServiceConfig *service.Config
NatsServer string NatsServer string
NatsProxyPath string NatsProxyPath string
NatsProxyPort string NatsProxyPort string
NatsPingInterval int
NatsWSCompression bool
} }
const ( const (
@@ -89,6 +91,7 @@ const (
var winTempDir = filepath.Join(os.Getenv("PROGRAMDATA"), "TacticalRMM") var winTempDir = filepath.Join(os.Getenv("PROGRAMDATA"), "TacticalRMM")
var winMeshDir = filepath.Join(os.Getenv("PROGRAMFILES"), "Mesh Agent") var winMeshDir = filepath.Join(os.Getenv("PROGRAMFILES"), "Mesh Agent")
var natsCheckin = []string{"agent-hello", "agent-agentinfo", "agent-disks", "agent-winsvc", "agent-publicip", "agent-wmi"} var natsCheckin = []string{"agent-hello", "agent-agentinfo", "agent-disks", "agent-winsvc", "agent-publicip", "agent-wmi"}
var limitNatsData = []string{"agent-winsvc", "agent-wmi"}
func New(logger *logrus.Logger, version string) *Agent { func New(logger *logrus.Logger, version string) *Agent {
host, _ := ps.Host() host, _ := ps.Host()
@@ -154,7 +157,7 @@ func New(logger *logrus.Logger, version string) *Agent {
Option: service.KeyValue{ Option: service.KeyValue{
"StartType": "automatic", "StartType": "automatic",
"OnFailure": "restart", "OnFailure": "restart",
"OnFailureDelayDuration": "5s", "OnFailureDelayDuration": "12s",
"OnFailureResetPeriod": 10, "OnFailureResetPeriod": 10,
}, },
} }
@@ -170,39 +173,50 @@ func New(logger *logrus.Logger, version string) *Agent {
// check if using nats standard tcp, otherwise use nats websockets by default // check if using nats standard tcp, otherwise use nats websockets by default
var natsServer string var natsServer string
var natsWsCompression bool
if ac.NatsStandardPort != "" { if ac.NatsStandardPort != "" {
natsServer = fmt.Sprintf("tls://%s:%s", ac.APIURL, ac.NatsStandardPort) natsServer = fmt.Sprintf("tls://%s:%s", ac.APIURL, ac.NatsStandardPort)
} else { } else {
natsServer = fmt.Sprintf("wss://%s:%s", ac.APIURL, natsProxyPort) natsServer = fmt.Sprintf("wss://%s:%s", ac.APIURL, natsProxyPort)
natsWsCompression = true
}
var natsPingInterval int
if ac.NatsPingInterval == 0 {
natsPingInterval = randRange(35, 45)
} else {
natsPingInterval = ac.NatsPingInterval
} }
return &Agent{ return &Agent{
Hostname: info.Hostname, Hostname: info.Hostname,
BaseURL: ac.BaseURL, BaseURL: ac.BaseURL,
AgentID: ac.AgentID, AgentID: ac.AgentID,
ApiURL: ac.APIURL, ApiURL: ac.APIURL,
Token: ac.Token, Token: ac.Token,
AgentPK: ac.PK, AgentPK: ac.PK,
Cert: ac.Cert, Cert: ac.Cert,
ProgramDir: pd, ProgramDir: pd,
EXE: exe, EXE: exe,
SystemDrive: sd, SystemDrive: sd,
MeshInstaller: "meshagent.exe", MeshInstaller: "meshagent.exe",
MeshSystemEXE: MeshSysExe, MeshSystemEXE: MeshSysExe,
MeshSVC: meshSvcName, MeshSVC: meshSvcName,
PyBin: pybin, PyBin: pybin,
Headers: headers, Headers: headers,
Logger: logger, Logger: logger,
Version: version, Version: version,
Debug: logger.IsLevelEnabled(logrus.DebugLevel), Debug: logger.IsLevelEnabled(logrus.DebugLevel),
rClient: restyC, rClient: restyC,
Proxy: ac.Proxy, Proxy: ac.Proxy,
Platform: runtime.GOOS, Platform: runtime.GOOS,
GoArch: runtime.GOARCH, GoArch: runtime.GOARCH,
ServiceConfig: svcConf, ServiceConfig: svcConf,
NatsServer: natsServer, NatsServer: natsServer,
NatsProxyPath: natsProxyPath, NatsProxyPath: natsProxyPath,
NatsProxyPort: natsProxyPort, NatsProxyPort: natsProxyPort,
NatsPingInterval: natsPingInterval,
NatsWSCompression: natsWsCompression,
} }
} }
@@ -220,7 +234,7 @@ type CmdOptions struct {
IsScript bool IsScript bool
IsExecutable bool IsExecutable bool
Detached bool Detached bool
Env []string EnvVars []string
} }
func (a *Agent) NewCMDOpts() *CmdOptions { func (a *Agent) NewCMDOpts() *CmdOptions {
@@ -249,10 +263,10 @@ func (a *Agent) CmdV2(c *CmdOptions) CmdStatus {
}) })
} }
if len(c.Env) > 0 { if len(c.EnvVars) > 0 {
cmdOptions.BeforeExec = append(cmdOptions.BeforeExec, func(cmd *exec.Cmd) { cmdOptions.BeforeExec = append(cmdOptions.BeforeExec, func(cmd *exec.Cmd) {
cmd.Env = os.Environ() cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, c.Env...) cmd.Env = append(cmd.Env, c.EnvVars...)
}) })
} }
@@ -398,14 +412,30 @@ func (a *Agent) SyncMeshNodeID() {
} }
func (a *Agent) setupNatsOptions() []nats.Option { func (a *Agent) setupNatsOptions() []nats.Option {
reconnectWait := randRange(2, 8)
opts := make([]nats.Option, 0) opts := make([]nats.Option, 0)
opts = append(opts, nats.Name("TacticalRMM")) opts = append(opts, nats.Name(a.AgentID))
opts = append(opts, nats.UserInfo(a.AgentID, a.Token)) opts = append(opts, nats.UserInfo(a.AgentID, a.Token))
opts = append(opts, nats.ReconnectWait(time.Second*5)) opts = append(opts, nats.ReconnectWait(time.Duration(reconnectWait)*time.Second))
opts = append(opts, nats.RetryOnFailedConnect(true)) opts = append(opts, nats.RetryOnFailedConnect(true))
opts = append(opts, nats.PingInterval(time.Duration(a.NatsPingInterval)*time.Second))
opts = append(opts, nats.Compression(a.NatsWSCompression))
opts = append(opts, nats.MaxReconnects(-1)) opts = append(opts, nats.MaxReconnects(-1))
opts = append(opts, nats.ReconnectBufSize(-1)) opts = append(opts, nats.ReconnectBufSize(-1))
opts = append(opts, nats.ProxyPath(a.NatsProxyPath)) opts = append(opts, nats.ProxyPath(a.NatsProxyPath))
opts = append(opts, nats.ReconnectJitter(500*time.Millisecond, 4*time.Second))
opts = append(opts, nats.DisconnectErrHandler(func(nc *nats.Conn, err error) {
a.Logger.Debugln("NATS disconnected:", err)
a.Logger.Debugf("%+v\n", nc.Statistics)
}))
opts = append(opts, nats.ReconnectHandler(func(nc *nats.Conn) {
a.Logger.Debugln("NATS reconnected")
a.Logger.Debugf("%+v\n", nc.Statistics)
}))
opts = append(opts, nats.ErrorHandler(func(nc *nats.Conn, sub *nats.Subscription, err error) {
a.Logger.Errorln("NATS error:", err)
a.Logger.Errorf("%+v\n", sub)
}))
return opts return opts
} }
@@ -426,7 +456,7 @@ func (a *Agent) GetUninstallExe() string {
func (a *Agent) CleanupAgentUpdates() { func (a *Agent) CleanupAgentUpdates() {
// TODO remove a.ProgramDir, updates are now in winTempDir // TODO remove a.ProgramDir, updates are now in winTempDir
dirs := [2]string{winTempDir, a.ProgramDir} dirs := [3]string{winTempDir, os.Getenv("TMP"), a.ProgramDir}
for _, dir := range dirs { for _, dir := range dirs {
err := os.Chdir(dir) err := os.Chdir(dir)
if err != nil { if err != nil {
@@ -435,7 +465,7 @@ func (a *Agent) CleanupAgentUpdates() {
} }
// TODO winagent-v* is deprecated // TODO winagent-v* is deprecated
globs := [2]string{"tacticalagent-v*", "winagent-v*"} globs := [3]string{"tacticalagent-v*", "is-*.tmp", "winagent-v*"}
for _, glob := range globs { for _, glob := range globs {
files, err := filepath.Glob(glob) files, err := filepath.Glob(glob)
if err == nil { if err == nil {

View File

@@ -158,11 +158,12 @@ func NewAgentConfig() *rmm.AgentConfig {
NatsProxyPath: viper.GetString("natsproxypath"), NatsProxyPath: viper.GetString("natsproxypath"),
NatsProxyPort: viper.GetString("natsproxyport"), NatsProxyPort: viper.GetString("natsproxyport"),
NatsStandardPort: viper.GetString("natsstandardport"), NatsStandardPort: viper.GetString("natsstandardport"),
NatsPingInterval: viper.GetInt("natspinginterval"),
} }
return ret return ret
} }
func (a *Agent) RunScript(code string, shell string, args []string, timeout int, runasuser bool) (stdout, stderr string, exitcode int, e error) { func (a *Agent) RunScript(code string, shell string, args []string, timeout int, runasuser bool, envVars []string) (stdout, stderr string, exitcode int, e error) {
code = removeWinNewLines(code) code = removeWinNewLines(code)
content := []byte(code) content := []byte(code)
@@ -192,6 +193,7 @@ func (a *Agent) RunScript(code string, shell string, args []string, timeout int,
opts.IsScript = true opts.IsScript = true
opts.Shell = f.Name() opts.Shell = f.Name()
opts.Args = args opts.Args = args
opts.EnvVars = envVars
opts.Timeout = time.Duration(timeout) opts.Timeout = time.Duration(timeout)
out := a.CmdV2(opts) out := a.CmdV2(opts)
retError := "" retError := ""
@@ -491,6 +493,9 @@ func (a *Agent) GetWMIInfo() map[string]interface{} {
} }
// windows only below TODO add into stub file // windows only below TODO add into stub file
func (a *Agent) GetAgentCheckInConfig(ret AgentCheckInConfig) AgentCheckInConfig {
return ret
}
func (a *Agent) PlatVer() (string, error) { return "", nil } func (a *Agent) PlatVer() (string, error) { return "", nil }

View File

@@ -65,6 +65,8 @@ func NewAgentConfig() *rmm.AgentConfig {
natsProxyPath, _, _ := k.GetStringValue("NatsProxyPath") natsProxyPath, _, _ := k.GetStringValue("NatsProxyPath")
natsProxyPort, _, _ := k.GetStringValue("NatsProxyPort") natsProxyPort, _, _ := k.GetStringValue("NatsProxyPort")
natsStandardPort, _, _ := k.GetStringValue("NatsStandardPort") natsStandardPort, _, _ := k.GetStringValue("NatsStandardPort")
natsPingInterval, _, _ := k.GetStringValue("NatsPingInterval")
npi, _ := strconv.Atoi(natsPingInterval)
return &rmm.AgentConfig{ return &rmm.AgentConfig{
BaseURL: baseurl, BaseURL: baseurl,
@@ -79,10 +81,11 @@ func NewAgentConfig() *rmm.AgentConfig {
NatsProxyPath: natsProxyPath, NatsProxyPath: natsProxyPath,
NatsProxyPort: natsProxyPort, NatsProxyPort: natsProxyPort,
NatsStandardPort: natsStandardPort, NatsStandardPort: natsStandardPort,
NatsPingInterval: npi,
} }
} }
func (a *Agent) RunScript(code string, shell string, args []string, timeout int, runasuser bool) (stdout, stderr string, exitcode int, e error) { func (a *Agent) RunScript(code string, shell string, args []string, timeout int, runasuser bool, envVars []string) (stdout, stderr string, exitcode int, e error) {
content := []byte(code) content := []byte(code)
@@ -158,6 +161,11 @@ func (a *Agent) RunScript(code string, shell string, args []string, timeout int,
cmd.Stdout = &outb cmd.Stdout = &outb
cmd.Stderr = &errb cmd.Stderr = &errb
if len(envVars) > 0 {
cmd.Env = os.Environ()
cmd.Env = append(cmd.Env, envVars...)
}
if cmdErr := cmd.Start(); cmdErr != nil { if cmdErr := cmd.Start(); cmdErr != nil {
a.Logger.Debugln(cmdErr) a.Logger.Debugln(cmdErr)
return "", cmdErr.Error(), 65, cmdErr return "", cmdErr.Error(), 65, cmdErr
@@ -855,6 +863,43 @@ func (a *Agent) InstallService() error {
return service.Control(s, "install") return service.Control(s, "install")
} }
func (a *Agent) GetAgentCheckInConfig(ret AgentCheckInConfig) AgentCheckInConfig {
// if local config present, overwrite
k, err := registry.OpenKey(registry.LOCAL_MACHINE, `SOFTWARE\TacticalRMM`, registry.ALL_ACCESS)
if err == nil {
if checkInHello, _, err := k.GetStringValue("CheckInHello"); err == nil {
ret.Hello = regRangeToInt(checkInHello)
}
if checkInAgentInfo, _, err := k.GetStringValue("CheckInAgentInfo"); err == nil {
ret.AgentInfo = regRangeToInt(checkInAgentInfo)
}
if checkInWinSvc, _, err := k.GetStringValue("CheckInWinSvc"); err == nil {
ret.WinSvc = regRangeToInt(checkInWinSvc)
}
if checkInPubIP, _, err := k.GetStringValue("CheckInPubIP"); err == nil {
ret.PubIP = regRangeToInt(checkInPubIP)
}
if checkInDisks, _, err := k.GetStringValue("CheckInDisks"); err == nil {
ret.Disks = regRangeToInt(checkInDisks)
}
if checkInSW, _, err := k.GetStringValue("CheckInSW"); err == nil {
ret.SW = regRangeToInt(checkInSW)
}
if checkInWMI, _, err := k.GetStringValue("CheckInWMI"); err == nil {
ret.WMI = regRangeToInt(checkInWMI)
}
if checkInSyncMesh, _, err := k.GetStringValue("CheckInSyncMesh"); err == nil {
ret.SyncMesh = regRangeToInt(checkInSyncMesh)
}
if checkInLimitData, _, err := k.GetStringValue("CheckInLimitData"); err == nil {
if checkInLimitData == "true" {
ret.LimitData = true
}
}
}
return ret
}
// TODO add to stub // TODO add to stub
func (a *Agent) NixMeshNodeID() string { func (a *Agent) NixMeshNodeID() string {
return "not implemented" return "not implemented"

View File

@@ -169,7 +169,7 @@ type ScriptCheckResult struct {
// ScriptCheck runs either bat, powershell or python script // ScriptCheck runs either bat, powershell or python script
func (a *Agent) ScriptCheck(data rmm.Check, r *resty.Client) { func (a *Agent) ScriptCheck(data rmm.Check, r *resty.Client) {
start := time.Now() start := time.Now()
stdout, stderr, retcode, _ := a.RunScript(data.Script.Code, data.Script.Shell, data.ScriptArgs, data.Timeout, data.Script.RunAsUser) stdout, stderr, retcode, _ := a.RunScript(data.Script.Code, data.Script.Shell, data.ScriptArgs, data.Timeout, data.Script.RunAsUser, data.EnvVars)
payload := ScriptCheckResult{ payload := ScriptCheckResult{
ID: data.CheckPK, ID: data.CheckPK,

View File

@@ -42,7 +42,7 @@ func (a *Agent) InstallChoco() {
return return
} }
_, _, exitcode, err := a.RunScript(string(r.Body()), "powershell", []string{}, 900, false) _, _, exitcode, err := a.RunScript(string(r.Body()), "powershell", []string{}, 900, false, []string{})
if err != nil { if err != nil {
a.Logger.Debugln(err) a.Logger.Debugln(err)
a.rClient.R().SetBody(result).Post(url) a.rClient.R().SetBody(result).Post(url)

View File

@@ -41,6 +41,7 @@ type NatsMsg struct {
ID int `json:"id"` ID int `json:"id"`
Code string `json:"code"` Code string `json:"code"`
RunAsUser bool `json:"run_as_user"` RunAsUser bool `json:"run_as_user"`
EnvVars []string `json:"env_vars"`
} }
var ( var (
@@ -51,15 +52,20 @@ var (
func (a *Agent) RunRPC() { func (a *Agent) RunRPC() {
a.Logger.Infoln("Agent service started") a.Logger.Infoln("Agent service started")
go a.RunAsService()
var wg sync.WaitGroup
wg.Add(1)
opts := a.setupNatsOptions() opts := a.setupNatsOptions()
nc, err := nats.Connect(a.NatsServer, opts...) nc, err := nats.Connect(a.NatsServer, opts...)
a.Logger.Debugf("%+v\n", nc)
a.Logger.Debugf("%+v\n", nc.Opts)
if err != nil { if err != nil {
a.Logger.Fatalln("RunRPC() nats.Connect()", err) a.Logger.Fatalln("RunRPC() nats.Connect()", err)
} }
go a.RunAsService(nc)
var wg sync.WaitGroup
wg.Add(1)
nc.Subscribe(a.AgentID, func(msg *nats.Msg) { nc.Subscribe(a.AgentID, func(msg *nats.Msg) {
var payload *NatsMsg var payload *NatsMsg
var mh codec.MsgpackHandle var mh codec.MsgpackHandle
@@ -258,7 +264,7 @@ func (a *Agent) RunRPC() {
var resultData rmm.RunScriptResp var resultData rmm.RunScriptResp
ret := codec.NewEncoderBytes(&resp, new(codec.MsgpackHandle)) ret := codec.NewEncoderBytes(&resp, new(codec.MsgpackHandle))
start := time.Now() start := time.Now()
stdout, stderr, retcode, err := a.RunScript(p.Data["code"], p.Data["shell"], p.ScriptArgs, p.Timeout, p.RunAsUser) stdout, stderr, retcode, err := a.RunScript(p.Data["code"], p.Data["shell"], p.ScriptArgs, p.Timeout, p.RunAsUser, p.EnvVars)
resultData.ExecTime = time.Since(start).Seconds() resultData.ExecTime = time.Since(start).Seconds()
resultData.ID = p.ID resultData.ID = p.ID
@@ -288,7 +294,7 @@ func (a *Agent) RunRPC() {
var retData rmm.RunScriptResp var retData rmm.RunScriptResp
ret := codec.NewEncoderBytes(&resp, new(codec.MsgpackHandle)) ret := codec.NewEncoderBytes(&resp, new(codec.MsgpackHandle))
start := time.Now() start := time.Now()
stdout, stderr, retcode, err := a.RunScript(p.Data["code"], p.Data["shell"], p.ScriptArgs, p.Timeout, p.RunAsUser) stdout, stderr, retcode, err := a.RunScript(p.Data["code"], p.Data["shell"], p.ScriptArgs, p.Timeout, p.RunAsUser, p.EnvVars)
retData.ExecTime = time.Since(start).Seconds() retData.ExecTime = time.Since(start).Seconds()
if err != nil { if err != nil {
@@ -479,6 +485,7 @@ func (a *Agent) RunRPC() {
atomic.StoreUint32(&agentUpdateLocker, 0) atomic.StoreUint32(&agentUpdateLocker, 0)
nc.Flush() nc.Flush()
nc.Close() nc.Close()
a.ControlService(winSvcName, "stop")
os.Exit(0) os.Exit(0)
} }
}(payload) }(payload)

View File

@@ -12,6 +12,7 @@ https://license.tacticalrmm.com
package agent package agent
import ( import (
"fmt"
"runtime" "runtime"
"sync" "sync"
"time" "time"
@@ -19,15 +20,27 @@ import (
nats "github.com/nats-io/nats.go" nats "github.com/nats-io/nats.go"
) )
func (a *Agent) RunAsService() { func (a *Agent) RunAsService(nc *nats.Conn) {
var wg sync.WaitGroup var wg sync.WaitGroup
wg.Add(1) wg.Add(1)
go a.AgentSvc() go a.AgentSvc(nc)
go a.CheckRunner() go a.CheckRunner()
wg.Wait() wg.Wait()
} }
func (a *Agent) AgentSvc() { type AgentCheckInConfig struct {
Hello int `json:"checkin_hello"`
AgentInfo int `json:"checkin_agentinfo"`
WinSvc int `json:"checkin_winsvc"`
PubIP int `json:"checkin_pubip"`
Disks int `json:"checkin_disks"`
SW int `json:"checkin_sw"`
WMI int `json:"checkin_wmi"`
SyncMesh int `json:"checkin_syncmesh"`
LimitData bool `json:"limit_data"`
}
func (a *Agent) AgentSvc(nc *nats.Conn) {
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
go a.GetPython(false) go a.GetPython(false)
@@ -38,37 +51,37 @@ func (a *Agent) AgentSvc() {
} }
a.RunMigrations() a.RunMigrations()
sleepDelay := randRange(14, 22) sleepDelay := randRange(7, 25)
a.Logger.Debugf("AgentSvc() sleeping for %v seconds", sleepDelay) a.Logger.Debugf("AgentSvc() sleeping for %v seconds", sleepDelay)
time.Sleep(time.Duration(sleepDelay) * time.Second) time.Sleep(time.Duration(sleepDelay) * time.Second)
opts := a.setupNatsOptions() conf := a.GetAgentCheckInConfig(a.GetCheckInConfFromAPI())
nc, err := nats.Connect(a.NatsServer, opts...) a.Logger.Debugf("+%v\n", conf)
if err != nil {
a.Logger.Fatalln("AgentSvc() nats.Connect()", err)
}
for _, s := range natsCheckin { for _, s := range natsCheckin {
a.NatsMessage(nc, s) if conf.LimitData && stringInSlice(s, limitNatsData) {
time.Sleep(time.Duration(randRange(100, 400)) * time.Millisecond) continue
} else {
a.NatsMessage(nc, s)
time.Sleep(time.Duration(randRange(100, 400)) * time.Millisecond)
}
} }
go a.SyncMeshNodeID() go a.SyncMeshNodeID()
time.Sleep(time.Duration(randRange(1, 3)) * time.Second) time.Sleep(time.Duration(randRange(1, 3)) * time.Second)
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" && !conf.LimitData {
a.AgentStartup() a.AgentStartup()
a.SendSoftware() a.SendSoftware()
} }
checkInHelloTicker := time.NewTicker(time.Duration(randRange(30, 60)) * time.Second) checkInHelloTicker := time.NewTicker(time.Duration(conf.Hello) * time.Second)
checkInAgentInfoTicker := time.NewTicker(time.Duration(randRange(200, 400)) * time.Second) checkInAgentInfoTicker := time.NewTicker(time.Duration(conf.AgentInfo) * time.Second)
checkInWinSvcTicker := time.NewTicker(time.Duration(randRange(2400, 3000)) * time.Second) checkInWinSvcTicker := time.NewTicker(time.Duration(conf.WinSvc) * time.Second)
checkInPubIPTicker := time.NewTicker(time.Duration(randRange(300, 500)) * time.Second) checkInPubIPTicker := time.NewTicker(time.Duration(conf.PubIP) * time.Second)
checkInDisksTicker := time.NewTicker(time.Duration(randRange(1000, 2000)) * time.Second) checkInDisksTicker := time.NewTicker(time.Duration(conf.Disks) * time.Second)
checkInSWTicker := time.NewTicker(time.Duration(randRange(2800, 3500)) * time.Second) checkInSWTicker := time.NewTicker(time.Duration(conf.SW) * time.Second)
checkInWMITicker := time.NewTicker(time.Duration(randRange(3000, 4000)) * time.Second) checkInWMITicker := time.NewTicker(time.Duration(conf.WMI) * time.Second)
syncMeshTicker := time.NewTicker(time.Duration(randRange(800, 1200)) * time.Second) syncMeshTicker := time.NewTicker(time.Duration(conf.SyncMesh) * time.Second)
for { for {
select { select {
@@ -100,3 +113,32 @@ func (a *Agent) AgentStartup() {
a.Logger.Debugln("AgentStartup()", err) a.Logger.Debugln("AgentStartup()", err)
} }
} }
func (a *Agent) GetCheckInConfFromAPI() AgentCheckInConfig {
ret := AgentCheckInConfig{}
url := fmt.Sprintf("/api/v3/%s/config/", a.AgentID)
r, err := a.rClient.R().SetResult(&AgentCheckInConfig{}).Get(url)
if err != nil {
a.Logger.Debugln("GetAgentCheckInConfig()", err)
ret.Hello = randRange(30, 60)
ret.AgentInfo = randRange(200, 400)
ret.WinSvc = randRange(2400, 3000)
ret.PubIP = randRange(300, 500)
ret.Disks = randRange(1000, 2000)
ret.SW = randRange(2800, 3500)
ret.WMI = randRange(3000, 4000)
ret.SyncMesh = randRange(800, 1200)
ret.LimitData = false
} else {
ret.Hello = r.Result().(*AgentCheckInConfig).Hello
ret.AgentInfo = r.Result().(*AgentCheckInConfig).AgentInfo
ret.WinSvc = r.Result().(*AgentCheckInConfig).WinSvc
ret.PubIP = r.Result().(*AgentCheckInConfig).PubIP
ret.Disks = r.Result().(*AgentCheckInConfig).Disks
ret.SW = r.Result().(*AgentCheckInConfig).SW
ret.WMI = r.Result().(*AgentCheckInConfig).WMI
ret.SyncMesh = r.Result().(*AgentCheckInConfig).SyncMesh
ret.LimitData = r.Result().(*AgentCheckInConfig).LimitData
}
return ret
}

View File

@@ -59,7 +59,7 @@ func (a *Agent) RunTask(id int) error {
action_start := time.Now() action_start := time.Now()
if action.ActionType == "script" { if action.ActionType == "script" {
stdout, stderr, retcode, err := a.RunScript(action.Code, action.Shell, action.Args, action.Timeout, action.RunAsUser) stdout, stderr, retcode, err := a.RunScript(action.Code, action.Shell, action.Args, action.Timeout, action.RunAsUser, action.EnvVars)
if err != nil { if err != nil {
a.Logger.Debugln(err) a.Logger.Debugln(err)

View File

@@ -23,6 +23,7 @@ import (
"path/filepath" "path/filepath"
"runtime" "runtime"
goDebug "runtime/debug" goDebug "runtime/debug"
"strconv"
"strings" "strings"
"time" "time"
@@ -322,3 +323,19 @@ func createTmpFile() (*os.File, error) {
} }
return f, nil return f, nil
} }
func stringInSlice(a string, list []string) bool {
for _, b := range list {
if b == a {
return true
}
}
return false
}
func regRangeToInt(s string) int {
split := strings.Split(s, ",")
min, _ := strconv.Atoi(split[0])
max, _ := strconv.Atoi(split[1])
return randRange(min, max)
}

View File

@@ -3,7 +3,7 @@
<assemblyIdentity <assemblyIdentity
type="win32" type="win32"
name="TacticalRMM" name="TacticalRMM"
version="2.4.1.0" version="2.4.3.0"
processorArchitecture="*"/> processorArchitecture="*"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security> <security>

View File

@@ -1,5 +1,5 @@
#define MyAppName "Tactical RMM Agent" #define MyAppName "Tactical RMM Agent"
#define MyAppVersion "2.4.1" #define MyAppVersion "2.4.3"
#define MyAppPublisher "AmidaWare LLC" #define MyAppPublisher "AmidaWare LLC"
#define MyAppURL "https://github.com/amidaware" #define MyAppURL "https://github.com/amidaware"
#define MyAppExeName "tacticalrmm.exe" #define MyAppExeName "tacticalrmm.exe"

24
go.mod
View File

@@ -1,24 +1,24 @@
module github.com/amidaware/rmmagent module github.com/amidaware/rmmagent
go 1.18 go 1.19
require ( require (
github.com/StackExchange/wmi v1.2.1 github.com/StackExchange/wmi v1.2.1
github.com/elastic/go-sysinfo v1.8.1 github.com/elastic/go-sysinfo v1.9.0
github.com/go-ole/go-ole v1.2.6 github.com/go-ole/go-ole v1.2.6
github.com/go-ping/ping v1.1.0 github.com/go-ping/ping v1.1.0
github.com/go-resty/resty/v2 v2.7.0 github.com/go-resty/resty/v2 v2.7.0
github.com/gonutz/w32/v2 v2.4.0 github.com/gonutz/w32/v2 v2.4.0
github.com/iamacarpet/go-win64api v0.0.0-20220531131246-e84054eb584d github.com/iamacarpet/go-win64api v0.0.0-20220531131246-e84054eb584d
github.com/nats-io/nats-server/v2 v2.9.3 // indirect github.com/nats-io/nats-server/v2 v2.9.8 // indirect
github.com/nats-io/nats.go v1.18.0 github.com/nats-io/nats.go v1.20.0
github.com/rickb777/date v1.19.1 github.com/rickb777/date v1.19.1
github.com/shirou/gopsutil/v3 v3.22.9 github.com/shirou/gopsutil/v3 v3.22.10
github.com/sirupsen/logrus v1.9.0 github.com/sirupsen/logrus v1.9.0
github.com/ugorji/go/codec v1.2.7 github.com/ugorji/go/codec v1.2.7
github.com/wh1te909/go-win64api v0.0.0-20210906074314-ab23795a6ae5 github.com/wh1te909/go-win64api v0.0.0-20210906074314-ab23795a6ae5
github.com/wh1te909/trmm-shared v0.0.0-20220227075846-f9f757361139 github.com/wh1te909/trmm-shared v0.0.0-20220227075846-f9f757361139
golang.org/x/net v0.0.0-20220706163947-c90051bbdb60 // indirect golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec
) )
@@ -31,12 +31,12 @@ require (
github.com/fourcorelabs/wintoken v1.0.0 github.com/fourcorelabs/wintoken v1.0.0
github.com/jaypipes/ghw v0.9.0 github.com/jaypipes/ghw v0.9.0
github.com/kardianos/service v1.2.2 github.com/kardianos/service v1.2.2
github.com/spf13/viper v1.13.0 github.com/spf13/viper v1.14.0
) )
require ( require (
github.com/elastic/go-windows v1.0.1 // indirect github.com/elastic/go-windows v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect github.com/ghodss/yaml v1.0.0 // indirect
github.com/google/cabbie v1.0.3 // indirect github.com/google/cabbie v1.0.3 // indirect
github.com/google/glazier v0.0.0-20220520121753-83447cca4ea7 // indirect github.com/google/glazier v0.0.0-20220520121753-83447cca4ea7 // indirect
@@ -55,11 +55,11 @@ require (
github.com/pelletier/go-toml/v2 v2.0.5 // indirect github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c // indirect
github.com/prometheus/procfs v0.7.3 // indirect github.com/prometheus/procfs v0.8.0 // indirect
github.com/rickb777/plural v1.4.1 // indirect github.com/rickb777/plural v1.4.1 // indirect
github.com/rogpeppe/go-internal v1.8.1 // indirect github.com/rogpeppe/go-internal v1.8.1 // indirect
github.com/scjalliance/comshim v0.0.0-20190308082608-cf06d2532c4e // indirect github.com/scjalliance/comshim v0.0.0-20190308082608-cf06d2532c4e // indirect
github.com/spf13/afero v1.8.2 // indirect github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/cast v1.5.0 // indirect github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/pflag v1.0.5 // indirect
@@ -68,8 +68,8 @@ require (
github.com/tklauser/numcpus v0.5.0 // indirect github.com/tklauser/numcpus v0.5.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect github.com/yusufpapurcu/wmi v1.2.2 // indirect
golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be // indirect golang.org/x/crypto v0.0.0-20220926161630-eccd6366d1be // indirect
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f // indirect golang.org/x/sync v0.1.0 // indirect
golang.org/x/text v0.3.7 // indirect golang.org/x/text v0.4.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2 // indirect gopkg.in/toast.v1 v1.0.0-20180812000517-0a84660828b2 // indirect

53
go.sum
View File

@@ -57,8 +57,8 @@ github.com/creachadair/staticfile v0.1.3/go.mod h1:a3qySzCIXEprDGxk6tSxSI+dBBdLz
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/elastic/go-sysinfo v1.8.1 h1:4Yhj+HdV6WjbCRgGdZpPJ8lZQlXZLKDAeIkmQ/VRvi4= github.com/elastic/go-sysinfo v1.9.0 h1:usICqY/Nw4Mpn9f4LdtpFrKxXroJDe81GaxxUlCckIo=
github.com/elastic/go-sysinfo v1.8.1/go.mod h1:JfllUnzoQV/JRYymbH3dO1yggI3mV2oTKSXsDHM+uIM= github.com/elastic/go-sysinfo v1.9.0/go.mod h1:eBD1wEGVaRnRLGecc9iG1z8eOv5HnEdz9+nWd8UAxcE=
github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUtJm0= github.com/elastic/go-windows v1.0.1 h1:AlYZOldA+UJ0/2nBuqWdo90GFCgG9xuyw9SYzGUtJm0=
github.com/elastic/go-windows v1.0.1/go.mod h1:FoVvqWSun28vaDQPbj2Elfc0JahhPB7WQEGa3c814Ss= github.com/elastic/go-windows v1.0.1/go.mod h1:FoVvqWSun28vaDQPbj2Elfc0JahhPB7WQEGa3c814Ss=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
@@ -72,8 +72,8 @@ github.com/fourcorelabs/wintoken v1.0.0/go.mod h1:jKyXHt079W09KwEMbUC9g+R2KDs5kV
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-cmd/cmd v1.4.1 h1:JUcEIE84v8DSy02XTZpUDeGKExk2oW3DA10hTjbQwmc= github.com/go-cmd/cmd v1.4.1 h1:JUcEIE84v8DSy02XTZpUDeGKExk2oW3DA10hTjbQwmc=
@@ -212,10 +212,10 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/nats-io/jwt/v2 v2.3.0 h1:z2mA1a7tIf5ShggOFlR1oBPgd6hGqcDYsISxZByUzdI= github.com/nats-io/jwt/v2 v2.3.0 h1:z2mA1a7tIf5ShggOFlR1oBPgd6hGqcDYsISxZByUzdI=
github.com/nats-io/nats-server/v2 v2.9.3 h1:HrfzA7G9LNetKkm1z+jU/e9kuAe+E6uaBuuq9EB5sQQ= github.com/nats-io/nats-server/v2 v2.9.8 h1:jgxZsv+A3Reb3MgwxaINcNq/za8xZInKhDg9Q0cGN1o=
github.com/nats-io/nats-server/v2 v2.9.3/go.mod h1:4sq8wvrpbvSzL1n3ZfEYnH4qeUuIl5W990j3kw13rRk= github.com/nats-io/nats-server/v2 v2.9.8/go.mod h1:AB6hAnGZDlYfqb7CTAm66ZKMZy9DpfierY1/PbpvI2g=
github.com/nats-io/nats.go v1.18.0 h1:o480Ao6kuSSFyJO75rGTXCEPj7LGkY84C1Ye+Uhm4c0= github.com/nats-io/nats.go v1.20.0 h1:T8JJnQfVSdh1CzGiwAOv5hEobYCBho/0EupGznYw0oM=
github.com/nats-io/nats.go v1.18.0/go.mod h1:BPko4oXsySz4aSWeFgOHLZs3G4Jq4ZAyE6/zMCxRT6w= github.com/nats-io/nats.go v1.20.0/go.mod h1:tLqubohF7t4z3du1QDPYJIQQyhb4wl6DhjxEajSI7UA=
github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8= github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8=
github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4= github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw= github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=
@@ -243,8 +243,8 @@ github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c/go.mod h1:Om
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c h1:NRoLoZvkBTKvR5gQLgA3e0hqjkY9u1wm+iOL45VN/qI= github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c h1:NRoLoZvkBTKvR5gQLgA3e0hqjkY9u1wm+iOL45VN/qI=
github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= github.com/power-devops/perfstat v0.0.0-20220216144756-c35f1ee13d7c/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU= github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo=
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
github.com/rickb777/date v1.14.2/go.mod h1:swmf05C+hN+m8/Xh7gEq3uB6QJDNc5pQBWojKdHetOs= github.com/rickb777/date v1.14.2/go.mod h1:swmf05C+hN+m8/Xh7gEq3uB6QJDNc5pQBWojKdHetOs=
github.com/rickb777/date v1.19.1 h1:IMcFlWY3PagAcc274tJAag84+dh4ihusPxhu4jaHMwY= github.com/rickb777/date v1.19.1 h1:IMcFlWY3PagAcc274tJAag84+dh4ihusPxhu4jaHMwY=
github.com/rickb777/date v1.19.1/go.mod h1:NxzFOW9ZWNeOWWE2kUXLDN59GSuGMsu3E4YVVk+GcVU= github.com/rickb777/date v1.19.1/go.mod h1:NxzFOW9ZWNeOWWE2kUXLDN59GSuGMsu3E4YVVk+GcVU=
@@ -257,12 +257,12 @@ github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XF
github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
github.com/scjalliance/comshim v0.0.0-20190308082608-cf06d2532c4e h1:+/AzLkOdIXEPrAQtwAeWOBnPQ0BnYlBW0aCZmSb47u4= github.com/scjalliance/comshim v0.0.0-20190308082608-cf06d2532c4e h1:+/AzLkOdIXEPrAQtwAeWOBnPQ0BnYlBW0aCZmSb47u4=
github.com/scjalliance/comshim v0.0.0-20190308082608-cf06d2532c4e/go.mod h1:9Tc1SKnfACJb9N7cw2eyuI6xzy845G7uZONBsi5uPEA= github.com/scjalliance/comshim v0.0.0-20190308082608-cf06d2532c4e/go.mod h1:9Tc1SKnfACJb9N7cw2eyuI6xzy845G7uZONBsi5uPEA=
github.com/shirou/gopsutil/v3 v3.22.9 h1:yibtJhIVEMcdw+tCTbOPiF1VcsuDeTE4utJ8Dm4c5eA= github.com/shirou/gopsutil/v3 v3.22.10 h1:4KMHdfBRYXGF9skjDWiL4RA2N+E8dRdodU/bOZpPoVg=
github.com/shirou/gopsutil/v3 v3.22.9/go.mod h1:bBYl1kjgEJpWpxeHmLI+dVHWtyAwfcmSBLDsp2TNT8A= github.com/shirou/gopsutil/v3 v3.22.10/go.mod h1:QNza6r4YQoydyCfo6rH0blGfKahgibh4dQmV5xdFkQk=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw=
github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ=
@@ -271,18 +271,20 @@ github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0
github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/spf13/viper v1.13.0 h1:BWSJ/M+f+3nmdz9bxB+bWX28kkALN2ok11D0rSo8EJU= github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU=
github.com/spf13/viper v1.13.0/go.mod h1:Icm2xNL3/8uyh/wFuB1jI7TiTNKp8632Nwegu+zgdYw= github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs=
github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw= github.com/tklauser/go-sysconf v0.3.10 h1:IJ1AZGZRWbY8T5Vfk04D9WOA5WSejdflXxP03OUqALw=
@@ -389,8 +391,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220706163947-c90051bbdb60 h1:8NSylCMxLW4JvserAndSgFL7aPli6A68yf0bYFTcWCM= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU=
golang.org/x/net v0.0.0-20220706163947-c90051bbdb60/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -411,8 +413,8 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f h1:Ax0t5p6N38Ga0dThY21weqDEyz2oklo4IvDkpigvkD8= golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -453,7 +455,6 @@ golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201204225414-ed752295db88/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -465,10 +466,10 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211107104306-e0b2ad06fe42/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211107104306-e0b2ad06fe42/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI= golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec h1:BkDtF2Ih9xZ7le9ndzTA7KJow28VbQW3odyk/8drmuI=
golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220928140112-f11e5e49a4ec/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -479,8 +480,8 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -624,7 +625,7 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw= google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=

23
main.go
View File

@@ -25,7 +25,7 @@ import (
) )
var ( var (
version = "2.4.1" version = "2.4.3"
log = logrus.New() log = logrus.New()
logFile *os.File logFile *os.File
) )
@@ -51,9 +51,6 @@ func main() {
meshDir := flag.String("meshdir", "", "Path to custom meshcentral dir") meshDir := flag.String("meshdir", "", "Path to custom meshcentral dir")
meshNodeID := flag.String("meshnodeid", "", "Mesh Node ID") meshNodeID := flag.String("meshnodeid", "", "Mesh Node ID")
cert := flag.String("cert", "", "Path to domain CA .pem") cert := flag.String("cert", "", "Path to domain CA .pem")
updateurl := flag.String("updateurl", "", "Download link to updater")
inno := flag.String("inno", "", "Inno setup file")
updatever := flag.String("updatever", "", "Update version")
silent := flag.Bool("silent", false, "Do not popup any message boxes during installation") silent := flag.Bool("silent", false, "Do not popup any message boxes during installation")
proxy := flag.String("proxy", "", "Use a http proxy") proxy := flag.String("proxy", "", "Use a http proxy")
flag.Parse() flag.Parse()
@@ -127,12 +124,6 @@ func main() {
return return
} }
a.RunTask(*taskPK) a.RunTask(*taskPK)
case "update":
if *updateurl == "" || *inno == "" || *updatever == "" {
updateUsage()
return
}
a.AgentUpdate(*updateurl, *inno, *updatever)
case "install": case "install":
if runtime.GOOS != "windows" { if runtime.GOOS != "windows" {
u, err := user.Current() u, err := user.Current()
@@ -145,7 +136,6 @@ func main() {
} }
if *api == "" || *clientID == 0 || *siteID == 0 || *token == "" { if *api == "" || *clientID == 0 || *siteID == 0 || *token == "" {
installUsage()
return return
} }
a.Install(&agent.Installer{ a.Install(&agent.Installer{
@@ -191,14 +181,3 @@ func setupLogging(level, to *string) {
log.SetOutput(logFile) log.SetOutput(logFile)
} }
} }
func installUsage() {
exe, _ := os.Executable()
u := fmt.Sprintf(`Usage: %s -m install -api <https://api.example.com> -client-id X -site-id X -auth <TOKEN>`, exe)
fmt.Println(u)
}
func updateUsage() {
u := `Usage: tacticalrmm.exe -m update -updateurl https://example.com/tacticalagent-vX.X.X.exe -inno tacticalagent-vX.X.X.exe -updatever 1.1.1`
fmt.Println(u)
}

View File

@@ -45,6 +45,7 @@ type AgentConfig struct {
NatsProxyPath string NatsProxyPath string
NatsProxyPort string NatsProxyPort string
NatsStandardPort string NatsStandardPort string
NatsPingInterval int
} }
type RunScriptResp struct { type RunScriptResp struct {
@@ -141,9 +142,10 @@ type AssignedTask struct {
} }
type Script struct { type Script struct {
Shell string `json:"shell"` Shell string `json:"shell"`
Code string `json:"code"` Code string `json:"code"`
RunAsUser bool `json:"run_as_user"` RunAsUser bool `json:"run_as_user"`
EnvVars []string `json:"env_vars"`
} }
type CheckInfo struct { type CheckInfo struct {
@@ -161,6 +163,7 @@ type Check struct {
Disk string `json:"disk"` Disk string `json:"disk"`
IP string `json:"ip"` IP string `json:"ip"`
ScriptArgs []string `json:"script_args"` ScriptArgs []string `json:"script_args"`
EnvVars []string `json:"env_vars"`
Timeout int `json:"timeout"` Timeout int `json:"timeout"`
ServiceName string `json:"svc_name"` ServiceName string `json:"svc_name"`
PassStartPending bool `json:"pass_if_start_pending"` PassStartPending bool `json:"pass_if_start_pending"`
@@ -190,6 +193,7 @@ type TaskAction struct {
Args []string `json:"script_args"` Args []string `json:"script_args"`
Timeout int `json:"timeout"` Timeout int `json:"timeout"`
RunAsUser bool `json:"run_as_user"` RunAsUser bool `json:"run_as_user"`
EnvVars []string `json:"env_vars"`
} }
type AutomatedTask struct { type AutomatedTask struct {

View File

@@ -3,13 +3,13 @@
"FileVersion": { "FileVersion": {
"Major": 2, "Major": 2,
"Minor": 4, "Minor": 4,
"Patch": 1, "Patch": 3,
"Build": 0 "Build": 0
}, },
"ProductVersion": { "ProductVersion": {
"Major": 2, "Major": 2,
"Minor": 4, "Minor": 4,
"Patch": 1, "Patch": 3,
"Build": 0 "Build": 0
}, },
"FileFlagsMask": "3f", "FileFlagsMask": "3f",
@@ -22,14 +22,14 @@
"Comments": "", "Comments": "",
"CompanyName": "AmidaWare LLC", "CompanyName": "AmidaWare LLC",
"FileDescription": "Tactical RMM Agent", "FileDescription": "Tactical RMM Agent",
"FileVersion": "v2.4.1.0", "FileVersion": "v2.4.3.0",
"InternalName": "tacticalrmm.exe", "InternalName": "tacticalrmm.exe",
"LegalCopyright": "Copyright (c) 2022 AmidaWare LLC", "LegalCopyright": "Copyright (c) 2022 AmidaWare LLC",
"LegalTrademarks": "", "LegalTrademarks": "",
"OriginalFilename": "tacticalrmm.exe", "OriginalFilename": "tacticalrmm.exe",
"PrivateBuild": "", "PrivateBuild": "",
"ProductName": "Tactical RMM Agent", "ProductName": "Tactical RMM Agent",
"ProductVersion": "v2.4.1.0", "ProductVersion": "v2.4.3.0",
"SpecialBuild": "" "SpecialBuild": ""
}, },
"VarFileInfo": { "VarFileInfo": {