diff --git a/functions/onprem/orborus/go.mod b/functions/onprem/orborus/go.mod index b11dc0bb..543568b8 100644 --- a/functions/onprem/orborus/go.mod +++ b/functions/onprem/orborus/go.mod @@ -10,7 +10,7 @@ require ( github.com/docker/docker v28.3.3+incompatible github.com/docker/go-connections v0.5.0 github.com/satori/go.uuid v1.2.0 - github.com/shuffle/shuffle-shared v0.9.58 + github.com/shuffle/shuffle-shared v0.9.59 k8s.io/api v0.33.1 k8s.io/apimachinery v0.33.1 ) diff --git a/functions/onprem/orborus/orborus.go b/functions/onprem/orborus/orborus.go index 3f0fffaf..a1cda9a2 100755 --- a/functions/onprem/orborus/orborus.go +++ b/functions/onprem/orborus/orborus.go @@ -142,6 +142,28 @@ func init() { log.Printf("Unable to create docker client: %s", err) } + if os.Getenv("SHUFFLE_EC2_INSTANCE") == "true" { + log.Printf("[INFO] Detected AWS EC2 instance. Setting up Docker Swarm with AWS optimizations.") + containers, err := dockercli.ContainerList(context.Background(), container.ListOptions{}) + if err == nil { + for _, container := range containers { + if strings.Contains(container.Image, "shuffle-orborus") { + if len(container.Names) != 0 { + if strings.Contains(container.Names[0], "shuffle-orborus") { + containerName = container.Names[0] + containerName = strings.TrimPrefix(containerName, "/") + os.Setenv("ORBORUS_CONTAINER_NAME", containerName) + log.Printf("[DEBUG] Found orborus container name: %s", containerName) + break + } + } + } + } + } else { + log.Printf("[ERROR] Failed to find orborus container: %s", err) + } + } + getThisContainerId() if len(pipelineApikey) == 0 { @@ -2416,6 +2438,7 @@ func main() { } if swarmConfig == "run" || swarmConfig == "swarm" || isKubernetes == "true" { + if isKubernetes != "true" { checkSwarmService(ctx) } @@ -2750,6 +2773,8 @@ func main() { fmt.Sprintf("/detections/Sigma"), org, true, + "LOW", + "TENZIR_START", ) if err != nil {