-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add upload container uri for image assessment - Add sensor image download uri
- Loading branch information
1 parent
2a94fe7
commit 94a4b36
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package falcon | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
type SensorType string | ||
|
||
const ( | ||
SidecarSensor SensorType = "falcon-container" | ||
KacSensor SensorType = "falcon-kac" | ||
NodeSensor SensorType = "falcon-sensor" | ||
) | ||
|
||
// FalconContainerUploadURI parses cloud string (example: us-1, us-2, eu-1, us-gov-1, etc) and returns a URI for uploading a container image for ImageAssessment. | ||
func FalconContainerUploadURI(falconCloud CloudType) string { | ||
switch falconCloud { | ||
default: | ||
fallthrough | ||
case CloudUs1: | ||
return "container-upload.us-1.crowdstrike.com" | ||
case CloudUs2: | ||
return "container-upload.us-2.crowdstrike.com" | ||
case CloudEu1: | ||
return "container-upload.eu-1.crowdstrike.com" | ||
case CloudUsGov1: | ||
return "container-upload.laggar.gcw.crowdstrike.com" | ||
} | ||
} | ||
|
||
// FalconContainerSensorImageURI returns a URI for downloading a container sensor image. Defaults to the falcon-sensor image. | ||
func FalconContainerSensorImageURI(falconCloud CloudType, sensorType SensorType) string { | ||
switch sensorType { | ||
case SidecarSensor: | ||
return fmt.Sprintf("%s/falcon-container/%s/release/falcon-sensor", registryFQDN(falconCloud), registryCloud(falconCloud)) | ||
case KacSensor: | ||
return fmt.Sprintf("%s/falcon-kac/%s/release/falcon-kac", registryFQDN(falconCloud), registryCloud(falconCloud)) | ||
case NodeSensor: | ||
return fmt.Sprintf("%s/falcon-sensor/%s/release/falcon-sensor", registryFQDN(falconCloud), registryCloud(falconCloud)) | ||
default: | ||
return fmt.Sprintf("%s/falcon-sensor/%s/release/falcon-sensor", registryFQDN(falconCloud), registryCloud(falconCloud)) | ||
} | ||
} | ||
|
||
func registryFQDN(cloud CloudType) string { | ||
switch cloud { | ||
case CloudUsGov1: | ||
return "registry.laggar.gcw.crowdstrike.com" | ||
default: | ||
return "registry.crowdstrike.com" | ||
} | ||
} | ||
|
||
func registryCloud(cloud CloudType) string { | ||
switch cloud { | ||
case CloudUsGov1: | ||
return "gov1" | ||
default: | ||
return cloud.String() | ||
} | ||
} |