Release 2.5.0
This commit is contained in:
commit
2cf0f06601
14
LICENSE.md
14
LICENSE.md
@ -1,11 +1,11 @@
|
|||||||
### Tactical RMM License Version 1.0
|
### Tactical RMM License Version 1.0
|
||||||
|
|
||||||
Text of license:   Copyright © 2022 AmidaWare LLC. All rights reserved.<br>
|
Text of license:   Copyright © 2023 AmidaWare Inc. All rights reserved.<br>
|
||||||
          Amending the text of this license is not permitted.
|
          Amending the text of this license is not permitted.
|
||||||
|
|
||||||
Trade Mark:    "Tactical RMM" is a trade mark of AmidaWare LLC.
|
Trade Mark:    "Tactical RMM" is a trade mark of AmidaWare Inc.
|
||||||
|
|
||||||
Licensor:      AmidaWare LLC of 1968 S Coast Hwy PMB 3847 Laguna Beach, CA, USA.
|
Licensor:      AmidaWare Inc. of 1968 S Coast Hwy PMB 3847 Laguna Beach, CA, USA.
|
||||||
|
|
||||||
Licensed Software:  The software known as Tactical RMM Version v0.12.0 (and all subsequent releases and versions) and the Tactical RMM Agent v2.0.0 (and all subsequent releases and versions).
|
Licensed Software:  The software known as Tactical RMM Version v0.12.0 (and all subsequent releases and versions) and the Tactical RMM Agent v2.0.0 (and all subsequent releases and versions).
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ This license does not allow the functionality of the Licensed Software (whether
|
|||||||
* the offering of installation and/or configuration services;
|
* the offering of installation and/or configuration services;
|
||||||
* the offer for sale, distribution or sale of any service or product (whether or not branded as Tactical RMM).
|
* the offer for sale, distribution or sale of any service or product (whether or not branded as Tactical RMM).
|
||||||
|
|
||||||
The prior written approval of AmidaWare LLC must be obtained for all commercial use and/or for-profit service use of the (i) Licensed Software (whether in whole or in part), (ii) a modified version of the Licensed Software and/or (iii) a derivative work.
|
The prior written approval of AmidaWare Inc. must be obtained for all commercial use and/or for-profit service use of the (i) Licensed Software (whether in whole or in part), (ii) a modified version of the Licensed Software and/or (iii) a derivative work.
|
||||||
|
|
||||||
The terms of this license apply to all copies of the Licensed Software (including modified versions) and derivative works.
|
The terms of this license apply to all copies of the Licensed Software (including modified versions) and derivative works.
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ If a derivative work is created which is based on or otherwise incorporates all
|
|||||||
### 4. Copyright Notice
|
### 4. Copyright Notice
|
||||||
The following copyright notice shall be included in all copies of the Licensed Software:
|
The following copyright notice shall be included in all copies of the Licensed Software:
|
||||||
|
|
||||||
   Copyright © 2022 AmidaWare LLC.
|
   Copyright © 2023 AmidaWare Inc.
|
||||||
|
|
||||||
   Licensed under the Tactical RMM License Version 1.0 (the “License”).<br>
|
   Licensed under the Tactical RMM License Version 1.0 (the “License”).<br>
|
||||||
   You may only use the Licensed Software in accordance with the License.<br>
|
   You may only use the Licensed Software in accordance with the License.<br>
|
||||||
@ -54,13 +54,13 @@ THE FOLLOWING EXCLUSIONS SHALL APPLY TO THE FULLEST EXTENT PERMISSIBLE AT LAW.
|
|||||||
This license shall terminate with immediate effect if there is a material breach of any of its terms.
|
This license shall terminate with immediate effect if there is a material breach of any of its terms.
|
||||||
|
|
||||||
### 8. No partnership, agency or joint venture
|
### 8. No partnership, agency or joint venture
|
||||||
Nothing in this license agreement is intended to, or shall be deemed to, establish any partnership or joint venture or any relationship of agency between AmidaWare LLC and any other person.
|
Nothing in this license agreement is intended to, or shall be deemed to, establish any partnership or joint venture or any relationship of agency between AmidaWare Inc. and any other person.
|
||||||
|
|
||||||
### 9. No endorsement
|
### 9. No endorsement
|
||||||
The names of the authors and/or the copyright holders must not be used to promote or endorse any products or services which are in any way derived from the Licensed Software without prior written consent.
|
The names of the authors and/or the copyright holders must not be used to promote or endorse any products or services which are in any way derived from the Licensed Software without prior written consent.
|
||||||
|
|
||||||
### 10. Trademarks
|
### 10. Trademarks
|
||||||
No permission is granted to use the trademark “Tactical RMM” or any other trade name, trademark, service mark or product name of AmidaWare LLC except to the extent necessary to comply with the notice requirements in Section 4 (Copyright Notice).
|
No permission is granted to use the trademark “Tactical RMM” or any other trade name, trademark, service mark or product name of AmidaWare Inc. except to the extent necessary to comply with the notice requirements in Section 4 (Copyright Notice).
|
||||||
|
|
||||||
### 11. Entire agreement
|
### 11. Entire agreement
|
||||||
This license contains the whole agreement relating to its subject matter.
|
This license contains the whole agreement relating to its subject matter.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
@ -14,6 +14,7 @@ package agent
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/tls"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
@ -73,6 +74,7 @@ type Agent struct {
|
|||||||
NatsProxyPort string
|
NatsProxyPort string
|
||||||
NatsPingInterval int
|
NatsPingInterval int
|
||||||
NatsWSCompression bool
|
NatsWSCompression bool
|
||||||
|
Insecure bool
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -125,12 +127,20 @@ func New(logger *logrus.Logger, version string) *Agent {
|
|||||||
headers["Authorization"] = fmt.Sprintf("Token %s", ac.Token)
|
headers["Authorization"] = fmt.Sprintf("Token %s", ac.Token)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
insecure := ac.Insecure == "true"
|
||||||
|
|
||||||
restyC := resty.New()
|
restyC := resty.New()
|
||||||
restyC.SetBaseURL(ac.BaseURL)
|
restyC.SetBaseURL(ac.BaseURL)
|
||||||
restyC.SetCloseConnection(true)
|
restyC.SetCloseConnection(true)
|
||||||
restyC.SetHeaders(headers)
|
restyC.SetHeaders(headers)
|
||||||
restyC.SetTimeout(15 * time.Second)
|
restyC.SetTimeout(15 * time.Second)
|
||||||
restyC.SetDebug(logger.IsLevelEnabled(logrus.DebugLevel))
|
restyC.SetDebug(logger.IsLevelEnabled(logrus.DebugLevel))
|
||||||
|
if insecure {
|
||||||
|
insecureConf := &tls.Config{
|
||||||
|
InsecureSkipVerify: true,
|
||||||
|
}
|
||||||
|
restyC.SetTLSClientConfig(insecureConf)
|
||||||
|
}
|
||||||
|
|
||||||
if len(ac.Proxy) > 0 {
|
if len(ac.Proxy) > 0 {
|
||||||
restyC.SetProxy(ac.Proxy)
|
restyC.SetProxy(ac.Proxy)
|
||||||
@ -236,6 +246,7 @@ func New(logger *logrus.Logger, version string) *Agent {
|
|||||||
NatsProxyPort: natsProxyPort,
|
NatsProxyPort: natsProxyPort,
|
||||||
NatsPingInterval: natsPingInterval,
|
NatsPingInterval: natsPingInterval,
|
||||||
NatsWSCompression: natsWsCompression,
|
NatsWSCompression: natsWsCompression,
|
||||||
|
Insecure: insecure,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -477,6 +488,12 @@ func (a *Agent) setupNatsOptions() []nats.Option {
|
|||||||
a.Logger.Errorln("NATS error:", err)
|
a.Logger.Errorln("NATS error:", err)
|
||||||
a.Logger.Errorf("%+v\n", sub)
|
a.Logger.Errorf("%+v\n", sub)
|
||||||
}))
|
}))
|
||||||
|
if a.Insecure {
|
||||||
|
insecureConf := &tls.Config{
|
||||||
|
InsecureSkipVerify: true,
|
||||||
|
}
|
||||||
|
opts = append(opts, nats.Secure(insecureConf))
|
||||||
|
}
|
||||||
return opts
|
return opts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// +build !windows
|
// +build !windows
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
@ -16,6 +16,7 @@ package agent
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
|
"crypto/tls"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
@ -160,6 +161,7 @@ func NewAgentConfig() *rmm.AgentConfig {
|
|||||||
NatsProxyPort: viper.GetString("natsproxyport"),
|
NatsProxyPort: viper.GetString("natsproxyport"),
|
||||||
NatsStandardPort: viper.GetString("natsstandardport"),
|
NatsStandardPort: viper.GetString("natsstandardport"),
|
||||||
NatsPingInterval: viper.GetInt("natspinginterval"),
|
NatsPingInterval: viper.GetInt("natspinginterval"),
|
||||||
|
Insecure: viper.GetString("insecure"),
|
||||||
}
|
}
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
@ -248,6 +250,12 @@ func (a *Agent) AgentUpdate(url, inno, version string) error {
|
|||||||
if len(a.Proxy) > 0 {
|
if len(a.Proxy) > 0 {
|
||||||
rClient.SetProxy(a.Proxy)
|
rClient.SetProxy(a.Proxy)
|
||||||
}
|
}
|
||||||
|
if a.Insecure {
|
||||||
|
insecureConf := &tls.Config{
|
||||||
|
InsecureSkipVerify: true,
|
||||||
|
}
|
||||||
|
rClient.SetTLSClientConfig(insecureConf)
|
||||||
|
}
|
||||||
|
|
||||||
r, err := rClient.R().SetOutput(f.Name()).Get(url)
|
r, err := rClient.R().SetOutput(f.Name()).Get(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
@ -14,6 +14,7 @@ package agent
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"crypto/tls"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
@ -68,6 +69,7 @@ func NewAgentConfig() *rmm.AgentConfig {
|
|||||||
natsStandardPort, _, _ := k.GetStringValue("NatsStandardPort")
|
natsStandardPort, _, _ := k.GetStringValue("NatsStandardPort")
|
||||||
natsPingInterval, _, _ := k.GetStringValue("NatsPingInterval")
|
natsPingInterval, _, _ := k.GetStringValue("NatsPingInterval")
|
||||||
npi, _ := strconv.Atoi(natsPingInterval)
|
npi, _ := strconv.Atoi(natsPingInterval)
|
||||||
|
insecure, _, _ := k.GetStringValue("Insecure")
|
||||||
|
|
||||||
return &rmm.AgentConfig{
|
return &rmm.AgentConfig{
|
||||||
BaseURL: baseurl,
|
BaseURL: baseurl,
|
||||||
@ -85,6 +87,7 @@ func NewAgentConfig() *rmm.AgentConfig {
|
|||||||
NatsProxyPort: natsProxyPort,
|
NatsProxyPort: natsProxyPort,
|
||||||
NatsStandardPort: natsStandardPort,
|
NatsStandardPort: natsStandardPort,
|
||||||
NatsPingInterval: npi,
|
NatsPingInterval: npi,
|
||||||
|
Insecure: insecure,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,22 +161,37 @@ func (a *Agent) RunScript(code string, shell string, args []string, timeout int,
|
|||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
var timedOut = false
|
var timedOut = false
|
||||||
|
var token *wintoken.Token
|
||||||
|
var envBlock *uint16
|
||||||
|
usingEnvVars := len(envVars) > 0
|
||||||
cmd := exec.Command(exe, cmdArgs...)
|
cmd := exec.Command(exe, cmdArgs...)
|
||||||
if runasuser {
|
if runasuser {
|
||||||
token, err := wintoken.GetInteractiveToken(wintoken.TokenImpersonation)
|
token, err = wintoken.GetInteractiveToken(wintoken.TokenImpersonation)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
defer token.Close()
|
defer token.Close()
|
||||||
cmd.SysProcAttr = &syscall.SysProcAttr{Token: syscall.Token(token.Token()), HideWindow: true}
|
cmd.SysProcAttr = &syscall.SysProcAttr{Token: syscall.Token(token.Token()), HideWindow: true}
|
||||||
|
|
||||||
|
if usingEnvVars {
|
||||||
|
envBlock, err = CreateEnvironmentBlock(syscall.Token(token.Token()))
|
||||||
|
if err == nil {
|
||||||
|
defer DestroyEnvironmentBlock(envBlock)
|
||||||
|
userEnv := EnvironmentBlockToSlice(envBlock)
|
||||||
|
cmd.Env = userEnv
|
||||||
|
} else {
|
||||||
|
cmd.Env = os.Environ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} else if usingEnvVars {
|
||||||
|
cmd.Env = os.Environ()
|
||||||
|
}
|
||||||
|
|
||||||
|
if usingEnvVars {
|
||||||
|
cmd.Env = append(cmd.Env, envVars...)
|
||||||
|
}
|
||||||
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
|
||||||
@ -615,6 +633,12 @@ func (a *Agent) AgentUpdate(url, inno, version string) error {
|
|||||||
if len(a.Proxy) > 0 {
|
if len(a.Proxy) > 0 {
|
||||||
rClient.SetProxy(a.Proxy)
|
rClient.SetProxy(a.Proxy)
|
||||||
}
|
}
|
||||||
|
if a.Insecure {
|
||||||
|
insecureConf := &tls.Config{
|
||||||
|
InsecureSkipVerify: true,
|
||||||
|
}
|
||||||
|
rClient.SetTLSClientConfig(insecureConf)
|
||||||
|
}
|
||||||
r, err := rClient.R().SetOutput(updater).Get(url)
|
r, err := rClient.R().SetOutput(updater).Get(url)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
a.Logger.Errorln(err)
|
a.Logger.Errorln(err)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
@ -12,6 +12,7 @@ https://license.tacticalrmm.com
|
|||||||
package agent
|
package agent
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/tls"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/url"
|
"net/url"
|
||||||
@ -47,6 +48,8 @@ type Installer struct {
|
|||||||
NoMesh bool
|
NoMesh bool
|
||||||
MeshDir string
|
MeshDir string
|
||||||
MeshNodeID string
|
MeshNodeID string
|
||||||
|
Insecure bool
|
||||||
|
NatsStandardPort string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Agent) Install(i *Installer) {
|
func (a *Agent) Install(i *Installer) {
|
||||||
@ -97,6 +100,14 @@ func (a *Agent) Install(i *Installer) {
|
|||||||
iClient.SetProxy(i.Proxy)
|
iClient.SetProxy(i.Proxy)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
insecureConf := &tls.Config{
|
||||||
|
InsecureSkipVerify: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
if i.Insecure {
|
||||||
|
iClient.SetTLSClientConfig(insecureConf)
|
||||||
|
}
|
||||||
|
|
||||||
creds, cerr := iClient.R().Get(fmt.Sprintf("%s/api/v3/installer/", baseURL))
|
creds, cerr := iClient.R().Get(fmt.Sprintf("%s/api/v3/installer/", baseURL))
|
||||||
if cerr != nil {
|
if cerr != nil {
|
||||||
a.installerMsg(cerr.Error(), "error", i.Silent)
|
a.installerMsg(cerr.Error(), "error", i.Silent)
|
||||||
@ -133,6 +144,10 @@ func (a *Agent) Install(i *Installer) {
|
|||||||
rClient.SetProxy(i.Proxy)
|
rClient.SetProxy(i.Proxy)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if i.Insecure {
|
||||||
|
rClient.SetTLSClientConfig(insecureConf)
|
||||||
|
}
|
||||||
|
|
||||||
var installerMeshSystemEXE string
|
var installerMeshSystemEXE string
|
||||||
if len(i.MeshDir) > 0 {
|
if len(i.MeshDir) > 0 {
|
||||||
installerMeshSystemEXE = filepath.Join(i.MeshDir, "MeshAgent.exe")
|
installerMeshSystemEXE = filepath.Join(i.MeshDir, "MeshAgent.exe")
|
||||||
@ -230,7 +245,7 @@ func (a *Agent) Install(i *Installer) {
|
|||||||
a.Logger.Debugln("Agent token:", agentToken)
|
a.Logger.Debugln("Agent token:", agentToken)
|
||||||
a.Logger.Debugln("Agent PK:", agentPK)
|
a.Logger.Debugln("Agent PK:", agentPK)
|
||||||
|
|
||||||
createAgentConfig(baseURL, a.AgentID, i.SaltMaster, agentToken, strconv.Itoa(agentPK), i.Cert, i.Proxy, i.MeshDir)
|
createAgentConfig(baseURL, a.AgentID, i.SaltMaster, agentToken, strconv.Itoa(agentPK), i.Cert, i.Proxy, i.MeshDir, i.NatsStandardPort, i.Insecure)
|
||||||
time.Sleep(1 * time.Second)
|
time.Sleep(1 * time.Second)
|
||||||
// refresh our agent with new values
|
// refresh our agent with new values
|
||||||
a = New(a.Logger, a.Version)
|
a = New(a.Logger, a.Version)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
// +build !windows
|
// +build !windows
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
@ -33,7 +33,7 @@ func (a *Agent) installerMsg(msg, alert string, silent bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, meshdir string) {
|
func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, meshdir, natsport string, insecure bool) {
|
||||||
viper.SetConfigType("json")
|
viper.SetConfigType("json")
|
||||||
viper.Set("baseurl", baseurl)
|
viper.Set("baseurl", baseurl)
|
||||||
viper.Set("agentid", agentid)
|
viper.Set("agentid", agentid)
|
||||||
@ -43,6 +43,10 @@ func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, me
|
|||||||
viper.Set("cert", cert)
|
viper.Set("cert", cert)
|
||||||
viper.Set("proxy", proxy)
|
viper.Set("proxy", proxy)
|
||||||
viper.Set("meshdir", meshdir)
|
viper.Set("meshdir", meshdir)
|
||||||
|
viper.Set("natsstandardport", natsport)
|
||||||
|
if insecure {
|
||||||
|
viper.Set("insecure", "true")
|
||||||
|
}
|
||||||
viper.SetConfigPermissions(0660)
|
viper.SetConfigPermissions(0660)
|
||||||
err := viper.SafeWriteConfigAs(etcConfig)
|
err := viper.SafeWriteConfigAs(etcConfig)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
@ -21,7 +21,7 @@ import (
|
|||||||
"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, natsport string, insecure bool) {
|
||||||
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 err != nil {
|
if err != nil {
|
||||||
log.Fatalln("Error creating registry key:", err)
|
log.Fatalln("Error creating registry key:", err)
|
||||||
@ -73,6 +73,20 @@ func createAgentConfig(baseurl, agentid, apiurl, token, agentpk, cert, proxy, me
|
|||||||
log.Fatalln("Error creating MeshDir registry key:", err)
|
log.Fatalln("Error creating MeshDir registry key:", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(natsport) > 0 {
|
||||||
|
err = k.SetStringValue("NatsStandardPort", natsport)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln("Error creating NatsStandardPort registry key:", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if insecure {
|
||||||
|
err = k.SetStringValue("Insecure", "true")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalln("Error creating Insecure registry key:", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Agent) checkExistingAndRemove(silent bool) {
|
func (a *Agent) checkExistingAndRemove(silent bool) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
@ -24,11 +24,14 @@ var _ unsafe.Pointer
|
|||||||
var (
|
var (
|
||||||
modadvapi32 = windows.NewLazySystemDLL("advapi32.dll")
|
modadvapi32 = windows.NewLazySystemDLL("advapi32.dll")
|
||||||
modkernel32 = windows.NewLazySystemDLL("kernel32.dll")
|
modkernel32 = windows.NewLazySystemDLL("kernel32.dll")
|
||||||
|
userenv = windows.NewLazyDLL("userenv.dll")
|
||||||
|
|
||||||
procFormatMessageW = modkernel32.NewProc("FormatMessageW")
|
procFormatMessageW = modkernel32.NewProc("FormatMessageW")
|
||||||
procGetOldestEventLogRecord = modadvapi32.NewProc("GetOldestEventLogRecord")
|
procGetOldestEventLogRecord = modadvapi32.NewProc("GetOldestEventLogRecord")
|
||||||
procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW")
|
procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW")
|
||||||
procReadEventLogW = modadvapi32.NewProc("ReadEventLogW")
|
procReadEventLogW = modadvapi32.NewProc("ReadEventLogW")
|
||||||
|
procCreateEnvironmentBlock = userenv.NewProc("CreateEnvironmentBlock")
|
||||||
|
procDestroyEnvironmentBlock = userenv.NewProc("DestroyEnvironmentBlock")
|
||||||
)
|
)
|
||||||
|
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-eventlogrecord
|
// https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-eventlogrecord
|
||||||
@ -114,3 +117,47 @@ func ReadEventLog(eventLog w32.HANDLE, readFlags ReadFlag, recordOffset uint32,
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func CreateEnvironmentBlock(token syscall.Token) (*uint16, error) {
|
||||||
|
var envBlock *uint16
|
||||||
|
|
||||||
|
ret, _, err := procCreateEnvironmentBlock.Call(
|
||||||
|
uintptr(unsafe.Pointer(&envBlock)),
|
||||||
|
uintptr(token),
|
||||||
|
0,
|
||||||
|
)
|
||||||
|
if ret == 0 {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return envBlock, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func DestroyEnvironmentBlock(envBlock *uint16) error {
|
||||||
|
ret, _, err := procDestroyEnvironmentBlock.Call(uintptr(unsafe.Pointer(envBlock)))
|
||||||
|
if ret == 0 {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func EnvironmentBlockToSlice(envBlock *uint16) []string {
|
||||||
|
var envs []string
|
||||||
|
|
||||||
|
for {
|
||||||
|
len := 0
|
||||||
|
for *(*uint16)(unsafe.Pointer(uintptr(unsafe.Pointer(envBlock)) + uintptr(len*2))) != 0 {
|
||||||
|
len++
|
||||||
|
}
|
||||||
|
|
||||||
|
if len == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
env := syscall.UTF16ToString((*[1 << 29]uint16)(unsafe.Pointer(envBlock))[:len])
|
||||||
|
envs = append(envs, env)
|
||||||
|
envBlock = (*uint16)(unsafe.Pointer(uintptr(unsafe.Pointer(envBlock)) + uintptr((len+1)*2)))
|
||||||
|
}
|
||||||
|
|
||||||
|
return envs
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<assemblyIdentity
|
<assemblyIdentity
|
||||||
type="win32"
|
type="win32"
|
||||||
name="TacticalRMM"
|
name="TacticalRMM"
|
||||||
version="2.4.11.0"
|
version="2.5.0.0"
|
||||||
processorArchitecture="*"/>
|
processorArchitecture="*"/>
|
||||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
<security>
|
<security>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#define MyAppName "Tactical RMM Agent"
|
#define MyAppName "Tactical RMM Agent"
|
||||||
#define MyAppVersion "2.4.11"
|
#define MyAppVersion "2.5.0"
|
||||||
#define MyAppPublisher "AmidaWare LLC"
|
#define MyAppPublisher "AmidaWare Inc"
|
||||||
#define MyAppURL "https://github.com/amidaware"
|
#define MyAppURL "https://github.com/amidaware"
|
||||||
#define MyAppExeName "tacticalrmm.exe"
|
#define MyAppExeName "tacticalrmm.exe"
|
||||||
#define MESHEXE "meshagent.exe"
|
#define MESHEXE "meshagent.exe"
|
||||||
|
2
go.mod
2
go.mod
@ -4,7 +4,7 @@ go 1.20
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/StackExchange/wmi v1.2.1
|
github.com/StackExchange/wmi v1.2.1
|
||||||
github.com/elastic/go-sysinfo v1.11.0
|
github.com/elastic/go-sysinfo v1.11.1
|
||||||
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
|
||||||
|
2
go.sum
2
go.sum
@ -64,6 +64,8 @@ github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh
|
|||||||
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
|
github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4=
|
||||||
github.com/elastic/go-sysinfo v1.11.0 h1:QW+6BF1oxBoAprH3w2yephF7xLkrrSXj7gl2xC2BM4w=
|
github.com/elastic/go-sysinfo v1.11.0 h1:QW+6BF1oxBoAprH3w2yephF7xLkrrSXj7gl2xC2BM4w=
|
||||||
github.com/elastic/go-sysinfo v1.11.0/go.mod h1:6KQb31j0QeWBDF88jIdWSxE8cwoOB9tO4Y4osN7Q70E=
|
github.com/elastic/go-sysinfo v1.11.0/go.mod h1:6KQb31j0QeWBDF88jIdWSxE8cwoOB9tO4Y4osN7Q70E=
|
||||||
|
github.com/elastic/go-sysinfo v1.11.1 h1:g9mwl05njS4r69TisC+vwHWTSKywZFYYUu3so3T/Lao=
|
||||||
|
github.com/elastic/go-sysinfo v1.11.1/go.mod h1:6KQb31j0QeWBDF88jIdWSxE8cwoOB9tO4Y4osN7Q70E=
|
||||||
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=
|
||||||
|
8
main.go
8
main.go
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
@ -25,7 +25,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
version = "2.4.11"
|
version = "2.5.0"
|
||||||
log = logrus.New()
|
log = logrus.New()
|
||||||
logFile *os.File
|
logFile *os.File
|
||||||
)
|
)
|
||||||
@ -53,6 +53,8 @@ func main() {
|
|||||||
cert := flag.String("cert", "", "Path to domain CA .pem")
|
cert := flag.String("cert", "", "Path to domain CA .pem")
|
||||||
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")
|
||||||
|
insecure := flag.Bool("insecure", false, "Insecure for testing only")
|
||||||
|
natsport := flag.String("natsport", "", "nats standard port")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
if *ver {
|
if *ver {
|
||||||
@ -158,6 +160,8 @@ func main() {
|
|||||||
NoMesh: *noMesh,
|
NoMesh: *noMesh,
|
||||||
MeshDir: *meshDir,
|
MeshDir: *meshDir,
|
||||||
MeshNodeID: *meshNodeID,
|
MeshNodeID: *meshNodeID,
|
||||||
|
Insecure: *insecure,
|
||||||
|
NatsStandardPort: *natsport,
|
||||||
})
|
})
|
||||||
default:
|
default:
|
||||||
agent.ShowStatus(version)
|
agent.ShowStatus(version)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2022 AmidaWare LLC.
|
Copyright 2023 AmidaWare Inc.
|
||||||
|
|
||||||
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
Licensed under the Tactical RMM License Version 1.0 (the “License”).
|
||||||
You may only use the Licensed Software in accordance with the License.
|
You may only use the Licensed Software in accordance with the License.
|
||||||
@ -48,6 +48,7 @@ type AgentConfig struct {
|
|||||||
NatsProxyPort string
|
NatsProxyPort string
|
||||||
NatsStandardPort string
|
NatsStandardPort string
|
||||||
NatsPingInterval int
|
NatsPingInterval int
|
||||||
|
Insecure string
|
||||||
}
|
}
|
||||||
|
|
||||||
type RunScriptResp struct {
|
type RunScriptResp struct {
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
"FixedFileInfo": {
|
"FixedFileInfo": {
|
||||||
"FileVersion": {
|
"FileVersion": {
|
||||||
"Major": 2,
|
"Major": 2,
|
||||||
"Minor": 4,
|
"Minor": 5,
|
||||||
"Patch": 11,
|
"Patch": 0,
|
||||||
"Build": 0
|
"Build": 0
|
||||||
},
|
},
|
||||||
"ProductVersion": {
|
"ProductVersion": {
|
||||||
"Major": 2,
|
"Major": 2,
|
||||||
"Minor": 4,
|
"Minor": 5,
|
||||||
"Patch": 11,
|
"Patch": 0,
|
||||||
"Build": 0
|
"Build": 0
|
||||||
},
|
},
|
||||||
"FileFlagsMask": "3f",
|
"FileFlagsMask": "3f",
|
||||||
@ -20,16 +20,16 @@
|
|||||||
},
|
},
|
||||||
"StringFileInfo": {
|
"StringFileInfo": {
|
||||||
"Comments": "",
|
"Comments": "",
|
||||||
"CompanyName": "AmidaWare LLC",
|
"CompanyName": "AmidaWare Inc",
|
||||||
"FileDescription": "Tactical RMM Agent",
|
"FileDescription": "Tactical RMM Agent",
|
||||||
"FileVersion": "v2.4.11.0",
|
"FileVersion": "v2.5.0.0",
|
||||||
"InternalName": "tacticalrmm.exe",
|
"InternalName": "tacticalrmm.exe",
|
||||||
"LegalCopyright": "Copyright (c) 2023 AmidaWare LLC",
|
"LegalCopyright": "Copyright (c) 2023 AmidaWare Inc",
|
||||||
"LegalTrademarks": "",
|
"LegalTrademarks": "",
|
||||||
"OriginalFilename": "tacticalrmm.exe",
|
"OriginalFilename": "tacticalrmm.exe",
|
||||||
"PrivateBuild": "",
|
"PrivateBuild": "",
|
||||||
"ProductName": "Tactical RMM Agent",
|
"ProductName": "Tactical RMM Agent",
|
||||||
"ProductVersion": "v2.4.11.0",
|
"ProductVersion": "v2.5.0.0",
|
||||||
"SpecialBuild": ""
|
"SpecialBuild": ""
|
||||||
},
|
},
|
||||||
"VarFileInfo": {
|
"VarFileInfo": {
|
||||||
|
Loading…
Reference in New Issue
Block a user