fix typo, format file

Signed-off-by: Pascal Sthamer <10992664+P4sca1@users.noreply.github.com>
This commit is contained in:
Pascal Sthamer
2025-02-18 16:32:36 +01:00
parent e554943c8d
commit ead70439be
2 changed files with 21 additions and 23 deletions
+14 -16
View File
@@ -1082,7 +1082,7 @@ func deployK8sWorker(image string, identifier string, env []string) error {
"app.kubernetes.io/name": "shuffle-worker", "app.kubernetes.io/name": "shuffle-worker",
"app.kubernetes.io/instance": identifier, "app.kubernetes.io/instance": identifier,
// "app.kubernetes.io/version": "", // "app.kubernetes.io/version": "",
"app.kuvernetes.io/part-of": "shuffle", "app.kubernetes.io/part-of": "shuffle",
"app.kubernetes.io/managed-by": "shuffle-orborus", "app.kubernetes.io/managed-by": "shuffle-orborus",
} }
@@ -2237,7 +2237,7 @@ func main() {
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
err := handlePipeline(incRequest) err := handlePipeline(incRequest)
@@ -2262,7 +2262,7 @@ func main() {
} else if incRequest.Type == "CATEGORY_UPDATE" { } else if incRequest.Type == "CATEGORY_UPDATE" {
os.Setenv("SHUFFLE_SKIP_PIPELINES", "false") os.Setenv("SHUFFLE_SKIP_PIPELINES", "false")
tenzirDisabled = false tenzirDisabled = false
err = handleFileCategoryChange() err = handleFileCategoryChange()
if err != nil { if err != nil {
@@ -2307,7 +2307,7 @@ func main() {
// 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
toBeRemoved.Data = append(toBeRemoved.Data, incRequest) toBeRemoved.Data = append(toBeRemoved.Data, incRequest)
@@ -2317,7 +2317,7 @@ func main() {
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)
err = shuffle.CreateOrgNotification( err = shuffle.CreateOrgNotification(
@@ -2636,7 +2636,7 @@ func deployTenzirNode() error {
// return errors.New("Pipelines are disabled by user with SHUFFLE_SKIP_PIPELINES") // return errors.New("Pipelines are disabled by user with SHUFFLE_SKIP_PIPELINES")
//log.Printf("[INFO] Pipelines are enabled by user") //log.Printf("[INFO] Pipelines are enabled by user")
} else { } else {
return errors.New("Pipelines are disabled by user with SHUFFLE_SKIP_PIPELINES") return errors.New("Pipelines are disabled by user with SHUFFLE_SKIP_PIPELINES")
} }
if isKubernetes == "true" { if isKubernetes == "true" {
@@ -2836,12 +2836,12 @@ func createAndStartTenzirNode(ctx context.Context, containerName, imageName stri
}, },
} }
// FIXME: Is this necessary? Seems to screw up networking: // FIXME: Is this necessary? Seems to screw up networking:
// conflicting options: hostname and the network mode // conflicting options: hostname and the network mode
/* /*
if isKubernetes != "true" && os.Getenv("SHUFFLE_SWARM_CONFIG") != "run" { if isKubernetes != "true" && os.Getenv("SHUFFLE_SWARM_CONFIG") != "run" {
hostConfig.NetworkMode = container.NetworkMode(fmt.Sprintf("container:%s", containerId)) hostConfig.NetworkMode = container.NetworkMode(fmt.Sprintf("container:%s", containerId))
} }
*/ */
resp, err := dockercli.ContainerCreate(ctx, config, hostConfig, networkingConfig, nil, containerName) resp, err := dockercli.ContainerCreate(ctx, config, hostConfig, networkingConfig, nil, containerName)
@@ -3049,7 +3049,6 @@ func createPipeline(command, identifier string) (string, error) {
return "", err return "", err
} }
body, err := ioutil.ReadAll(resp.Body) body, err := ioutil.ReadAll(resp.Body)
if err != nil { if err != nil {
log.Printf("[ERROR] Failed reading response body: %s", err) log.Printf("[ERROR] Failed reading response body: %s", err)
@@ -3067,8 +3066,8 @@ func createPipeline(command, identifier string) (string, error) {
} }
type PipelineResponse struct { type PipelineResponse struct {
ID string `json:"id"` ID string `json:"id"`
Message string `json:"message"` Message string `json:"message"`
Severity string `json:"severity"` Severity string `json:"severity"`
} }
@@ -3291,7 +3290,7 @@ func handleFileCategoryChange() error {
tenzirStorageFolder = "/tmp/" tenzirStorageFolder = "/tmp/"
} }
tenzirStorageFolder = strings.TrimRight(tenzirStorageFolder, "/") tenzirStorageFolder = strings.TrimRight(tenzirStorageFolder, "/")
sigmaPath := fmt.Sprintf("%s/sigma_rules", tenzirStorageFolder) sigmaPath := fmt.Sprintf("%s/sigma_rules", tenzirStorageFolder)
err = extractZIP("files.zip", sigmaPath) err = extractZIP("files.zip", sigmaPath)
if err != nil { if err != nil {
@@ -3299,7 +3298,6 @@ func handleFileCategoryChange() error {
return err return err
} }
log.Printf("[DEBUG] Detection files copied to '%s' successfully.", sigmaPath) log.Printf("[DEBUG] Detection files copied to '%s' successfully.", sigmaPath)
return nil return nil
@@ -3383,7 +3381,7 @@ func removeFileCategory() error {
tenzirStorageFolder = "/tmp/" tenzirStorageFolder = "/tmp/"
} }
tenzirStorageFolder = strings.TrimRight(tenzirStorageFolder, "/") tenzirStorageFolder = strings.TrimRight(tenzirStorageFolder, "/")
//sigmaPath := "/var/lib/tenzir/sigma_rules/*" //sigmaPath := "/var/lib/tenzir/sigma_rules/*"
sigmaPath := fmt.Sprintf("%s/sigma_rules", tenzirStorageFolder) sigmaPath := fmt.Sprintf("%s/sigma_rules", tenzirStorageFolder)
+7 -7
View File
@@ -23,8 +23,8 @@ import (
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/container" "github.com/docker/docker/api/types/container"
"github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/mount"
"github.com/docker/docker/api/types/image" "github.com/docker/docker/api/types/image"
"github.com/docker/docker/api/types/mount"
dockerclient "github.com/docker/docker/client" dockerclient "github.com/docker/docker/client"
// This is for automatic removal of certain code :) // This is for automatic removal of certain code :)
@@ -105,11 +105,11 @@ var window = shuffle.NewTimeWindow(10 * time.Second)
// Images to be autodeployed in the latest version of Shuffle. // Images to be autodeployed in the latest version of Shuffle.
var autoDeploy = map[string]string{ var autoDeploy = map[string]string{
"http:1.4.0": "frikky/shuffle:http_1.4.0", "http:1.4.0": "frikky/shuffle:http_1.4.0",
"http:1.3.0": "frikky/shuffle:http_1.3.0", "http:1.3.0": "frikky/shuffle:http_1.3.0",
"shuffle-tools:1.2.0": "frikky/shuffle:shuffle-tools_1.2.0", "shuffle-tools:1.2.0": "frikky/shuffle:shuffle-tools_1.2.0",
"shuffle-subflow:1.0.0": "frikky/shuffle:shuffle-subflow_1.0.0", "shuffle-subflow:1.0.0": "frikky/shuffle:shuffle-subflow_1.0.0",
"shuffle-subflow:1.1.0": "frikky/shuffle:shuffle-subflow_1.1.0", "shuffle-subflow:1.1.0": "frikky/shuffle:shuffle-subflow_1.1.0",
// "shuffle-tools-fork:1.0.0": "frikky/shuffle:shuffle-tools-fork_1.0.0", // "shuffle-tools-fork:1.0.0": "frikky/shuffle:shuffle-tools-fork_1.0.0",
} }
@@ -495,7 +495,7 @@ func deployk8sApp(image string, identifier string, env []string) error {
"app.kubernetes.io/name": "shuffle-app", "app.kubernetes.io/name": "shuffle-app",
"app.kubernetes.io/instance": name, "app.kubernetes.io/instance": name,
// "app.kubernetes.io/version": "", // "app.kubernetes.io/version": "",
"app.kuvernetes.io/part-of": "shuffle", "app.kubernetes.io/part-of": "shuffle",
"app.kubernetes.io/managed-by": "shuffle-worker", "app.kubernetes.io/managed-by": "shuffle-worker",
} }