More Orborus tweaks for Tenzir
This commit is contained in:
@@ -2121,6 +2121,12 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Auto enables pipelines IF they are not mentioned
|
||||||
|
if len(os.Getenv("SHUFFLE_SKIP_PIPELINES")) == 0 {
|
||||||
|
os.Setenv("SHUFFLE_SKIP_PIPELINES", "false")
|
||||||
|
os.Setenv("SHUFFLE_PIPELINE_ENABLED", "true")
|
||||||
|
}
|
||||||
|
|
||||||
log.Println("[INFO] Setting up execution environment")
|
log.Println("[INFO] Setting up execution environment")
|
||||||
|
|
||||||
// //FIXME
|
// //FIXME
|
||||||
@@ -2490,8 +2496,7 @@ func main() {
|
|||||||
|
|
||||||
// Looking for specific jobs
|
// Looking for specific jobs
|
||||||
if incRequest.Type == "PIPELINE_CREATE" || incRequest.Type == "PIPELINE_START" || incRequest.Type == "PIPELINE_STOP" || incRequest.Type == "PIPELINE_DELETE" {
|
if incRequest.Type == "PIPELINE_CREATE" || incRequest.Type == "PIPELINE_START" || incRequest.Type == "PIPELINE_STOP" || incRequest.Type == "PIPELINE_DELETE" {
|
||||||
|
//os.Setenv("SHUFFLE_SKIP_PIPELINES", "false")
|
||||||
os.Setenv("SHUFFLE_SKIP_PIPELINES", "false")
|
|
||||||
tenzirDisabled = false
|
tenzirDisabled = false
|
||||||
|
|
||||||
// Running NEW or editing pipelines
|
// Running NEW or editing pipelines
|
||||||
@@ -2558,7 +2563,7 @@ func main() {
|
|||||||
log.Printf("[INFO] Got job to start tenzir")
|
log.Printf("[INFO] Got job to start tenzir")
|
||||||
|
|
||||||
// Manual command = overrides to allow starting of Tenzir from the frontend anyway.
|
// Manual command = overrides to allow starting of Tenzir from the frontend anyway.
|
||||||
os.Setenv("SHUFFLE_SKIP_PIPELINES", "false")
|
//os.Setenv("SHUFFLE_SKIP_PIPELINES", "false")
|
||||||
tenzirDisabled = false
|
tenzirDisabled = false
|
||||||
|
|
||||||
// Removed either way
|
// Removed either way
|
||||||
@@ -2568,7 +2573,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if strings.Contains(fmt.Sprintf("%s", err), "node available") {
|
if strings.Contains(fmt.Sprintf("%s", err), "node available") {
|
||||||
// Disabling until UI is updated
|
// Disabling until UI is updated
|
||||||
os.Setenv("SHUFFLE_SKIP_PIPELINES", "true")
|
//os.Setenv("SHUFFLE_SKIP_PIPELINES", "true")
|
||||||
tenzirDisabled = true
|
tenzirDisabled = true
|
||||||
|
|
||||||
log.Printf("[ERROR] Failed to start tenzir, reason: %s", err)
|
log.Printf("[ERROR] Failed to start tenzir, reason: %s", err)
|
||||||
@@ -3284,8 +3289,9 @@ func createPipeline(command, identifier string) (string, error) {
|
|||||||
"definition": command,
|
"definition": command,
|
||||||
"name": identifier,
|
"name": identifier,
|
||||||
"hidden": false,
|
"hidden": false,
|
||||||
|
"retry_delay": "500.0ms",
|
||||||
"autostart": map[string]bool{
|
"autostart": map[string]bool{
|
||||||
"created": true,
|
//"created": true,
|
||||||
"completed": false,
|
"completed": false,
|
||||||
"failed": false,
|
"failed": false,
|
||||||
},
|
},
|
||||||
@@ -3294,7 +3300,6 @@ func createPipeline(command, identifier string) (string, error) {
|
|||||||
"failed": false,
|
"failed": false,
|
||||||
"stopped": false,
|
"stopped": false,
|
||||||
},
|
},
|
||||||
"retry_delay": "500.0ms",
|
|
||||||
}
|
}
|
||||||
|
|
||||||
requestBodyJSON, err := json.Marshal(requestBody)
|
requestBodyJSON, err := json.Marshal(requestBody)
|
||||||
@@ -3304,18 +3309,18 @@ func createPipeline(command, identifier string) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
forwardData := bytes.NewBuffer(requestBodyJSON)
|
forwardData := bytes.NewBuffer(requestBodyJSON)
|
||||||
|
|
||||||
req, err := http.NewRequest(
|
req, err := http.NewRequest(
|
||||||
forwardMethod,
|
forwardMethod,
|
||||||
url,
|
url,
|
||||||
forwardData,
|
forwardData,
|
||||||
)
|
)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("[ERROR] Failed to create HTTP request: %s", err)
|
log.Printf("[ERROR] Failed to create HTTP request: %s", err)
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
req.Header.Set("Content-Type", "application/json")
|
|
||||||
|
|
||||||
|
req.Header.Set("Content-Type", "application/json")
|
||||||
client := &http.Client{Timeout: 10 * time.Second}
|
client := &http.Client{Timeout: 10 * time.Second}
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -3700,6 +3705,7 @@ func removeFileCategory() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// curl https://get.tenzir.app | sh
|
||||||
func removeFile(fileName string) error {
|
func removeFile(fileName string) error {
|
||||||
containerName := "tenzir-node"
|
containerName := "tenzir-node"
|
||||||
srcPath := fmt.Sprintf("/var/lib/tenzir/sigma_rules/%s", fileName)
|
srcPath := fmt.Sprintf("/var/lib/tenzir/sigma_rules/%s", fileName)
|
||||||
|
|||||||
Reference in New Issue
Block a user