mirror of
https://github.com/dragonheim/gagent.git
synced 2025-01-18 09:36:28 -08:00
Started moving to a chainDB for tracking history.
This commit is contained in:
parent
749bd6557e
commit
458214aaa9
6 changed files with 31 additions and 18 deletions
|
@ -30,7 +30,7 @@ import (
|
|||
)
|
||||
|
||||
var (
|
||||
semVER = "0.0.3"
|
||||
semVER = "0.0.4"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
|
@ -2,26 +2,30 @@
|
|||
|
||||
IGNORED: We are not using the SSH features of golang.org/x/crypto
|
||||
```
|
||||
2021-08-30T07:10:13.085-0700 INFO Detected OS: unknown
|
||||
2021-08-30T07:10:13.085-0700 INFO Number of PL dependency files: 1
|
||||
2021-08-30T07:10:13.085-0700 INFO Detecting gomod vulnerabilities...
|
||||
2021-11-13T10:25:13.188-0800 INFO Need to update DB
|
||||
2021-11-13T10:25:13.188-0800 INFO Downloading DB...
|
||||
24.70 MiB / 24.70 MiB [----------------------------------------------------------------------------------------------------------------------------------------------------------------------------] 100.00% 6.04 MiB p/s 4s
|
||||
2021-11-13T10:25:18.570-0800 INFO Detected OS: unknown
|
||||
2021-11-13T10:25:18.570-0800 INFO Number of PL dependency files: 2
|
||||
2021-11-13T10:25:18.570-0800 INFO Detecting gobinary vulnerabilities...
|
||||
2021-11-13T10:25:18.571-0800 INFO Detecting gomod vulnerabilities...
|
||||
|
||||
bin/gagent
|
||||
==========
|
||||
Total: 0 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 0, CRITICAL: 0)
|
||||
|
||||
|
||||
go.sum
|
||||
======
|
||||
Total: 2 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 2, CRITICAL: 0)
|
||||
Total: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 0, HIGH: 1, CRITICAL: 0)
|
||||
|
||||
+---------------------+------------------+----------+-----------------------------------+------------------------------------+---------------------------------------+
|
||||
| LIBRARY | VULNERABILITY ID | SEVERITY | INSTALLED VERSION | FIXED VERSION | TITLE |
|
||||
+---------------------+------------------+----------+-----------------------------------+------------------------------------+---------------------------------------+
|
||||
| golang.org/x/crypto | CVE-2020-29652 | HIGH | 0.0.0-20190426145343-a29dc8fdc734 | v0.0.0-20201216223049-8b5274cf687f | golang: crypto/ssh: crafted |
|
||||
| golang.org/x/crypto | CVE-2020-29652 | HIGH | 0.0.0-20200622213623-75b288015ac9 | v0.0.0-20201216223049-8b5274cf687f | golang: crypto/ssh: crafted |
|
||||
| | | | | | authentication request can |
|
||||
| | | | | | lead to nil pointer dereference |
|
||||
| | | | | | -->avd.aquasec.com/nvd/cve-2020-29652 |
|
||||
+ +------------------+ + +------------------------------------+---------------------------------------+
|
||||
| | CVE-2020-9283 | | | v0.0.0-20200220183623-bac4c82f6975 | golang.org/x/crypto: Processing |
|
||||
| | | | | | of crafted ssh-ed25519 |
|
||||
| | | | | | public keys allows for panic |
|
||||
| | | | | | -->avd.aquasec.com/nvd/cve-2020-9283 |
|
||||
+---------------------+------------------+----------+-----------------------------------+------------------------------------+---------------------------------------+
|
||||
```
|
||||
---
|
||||
|
|
|
@ -39,7 +39,7 @@ func Main(wg *sync.WaitGroup, config gstructs.GagentConfig) {
|
|||
log.Printf("[DEBUG] Agent file contents: \n----- -----\n%s\n----- -----\n", agent.ScriptCode)
|
||||
}
|
||||
agent.Client = config.UUID
|
||||
agent.Shasum = fmt.Sprintf("%x", sha.Sum256(agent.ScriptCode))
|
||||
agent.Shasum = fmt.Sprintf("%s", sha.Sum256(agent.ScriptCode))
|
||||
log.Printf("[INFO] SHA256 of Agent file: %s", agent.Shasum)
|
||||
agent.Status = "loaded"
|
||||
agent.Hints = getTagsFromHints(agent)
|
||||
|
@ -86,10 +86,10 @@ func sendAgent(wg *sync.WaitGroup, uuid string, connectString string, agent gstr
|
|||
sock, _ := zmq.NewSocket(zmq.REQ)
|
||||
defer sock.Close()
|
||||
|
||||
err := sock.SetIdentity(uuid)
|
||||
_ = sock.SetIdentity(uuid)
|
||||
|
||||
log.Printf("[DEBUG] Attempting to connect to %s\n", connectString)
|
||||
err = sock.Connect(connectString)
|
||||
err := sock.Connect(connectString)
|
||||
if err != nil {
|
||||
log.Printf("[ERROR] Failed to connect to %s\n", connectString)
|
||||
os.Exit(10)
|
||||
|
|
|
@ -10,6 +10,7 @@ type GagentConfig struct {
|
|||
ClientPort int64 `hcl:"clientport,optional"`
|
||||
RouterPort int64 `hcl:"routerport,optional"`
|
||||
WorkerPort int64 `hcl:"workerport,optional"`
|
||||
ChainDBPath string `hcl:"chaindbpath,optional"`
|
||||
Clients []*ClientDetails `hcl:"client,block"`
|
||||
Routers []*RouterDetails `hcl:"router,block"`
|
||||
Workers []*WorkerDetails `hcl:"worker,block"`
|
||||
|
@ -119,10 +120,6 @@ type WorkerDetails struct {
|
|||
WorkerTags []string `hcl:"tags,optional"`
|
||||
}
|
||||
|
||||
type BlockChainDB struct {
|
||||
DBName string `hcl:"chainid,optional"`
|
||||
Agents []*AgentDetails `hcl:"agent,block"`
|
||||
}
|
||||
type AgentDetails struct {
|
||||
Client string `hcl:"client"`
|
||||
Shasum string `hcl:"shasum"`
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
http "net/http"
|
||||
sync "sync"
|
||||
|
||||
gcdb "git.dragonheim.net/dragonheim/gagent/internal/chaindb"
|
||||
gstructs "git.dragonheim.net/dragonheim/gagent/internal/gstructs"
|
||||
|
||||
prometheus "github.com/prometheus/client_golang/prometheus"
|
||||
|
@ -18,6 +19,8 @@ var (
|
|||
opsProcessed = promauto.NewCounter(prometheus.CounterOpts{
|
||||
Name: "client_requests_recieved",
|
||||
})
|
||||
|
||||
db gcdb.GagentDb
|
||||
)
|
||||
|
||||
/*
|
||||
|
@ -38,6 +41,8 @@ func Main(wg *sync.WaitGroup, config gstructs.GagentConfig) {
|
|||
workerSock, _ := zmq.NewSocket(zmq.DEALER)
|
||||
defer workerSock.Close()
|
||||
|
||||
db.Init()
|
||||
|
||||
workerListener := fmt.Sprintf("tcp://%s:%d", config.ListenAddr, config.WorkerPort)
|
||||
_ = workerSock.Bind(workerListener)
|
||||
|
||||
|
|
|
@ -28,6 +28,13 @@ func Main(wg *sync.WaitGroup, config gs.GagentConfig) {
|
|||
|
||||
clientBlock1 := rootBody.AppendNewBlock("client", []string{config.Name})
|
||||
clientBody1 := clientBlock1.Body()
|
||||
// clientBody1.AppendUnstructuredTokens(
|
||||
// hclwrite.TokensForTraversal(hcl.Traversal{
|
||||
// hcl.TraverseRoot{
|
||||
// Name: hcl.CommentGenerator("comment"),
|
||||
// },
|
||||
// },
|
||||
// ))
|
||||
clientBody1.SetAttributeValue("clientid", cty.StringVal(config.UUID))
|
||||
rootBody.AppendNewline()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue