Skip to content

Commit

Permalink
Merge pull request #7 from redhatrises/fixes
Browse files Browse the repository at this point in the history
fix ProvWaitTime arg and default value handling
  • Loading branch information
redhatrises authored Sep 5, 2024
2 parents f289f62 + 65d054d commit 16657a0
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ Usage of falcon-installer:
--provisioning-token string
The provisioning token to use for installing the sensor
--quiet
Supress all log output
Suppress all log output
--sensor-update-policy string
The sensor update policy name to use for sensor installation
--tags string
A comma seperated list of tags for sensor grouping.
A comma separated list of tags for sensor grouping.
--tmpdir string
Temporary directory for downloading files (default "/tmp/falcon")
--user-agent string
Expand Down
13 changes: 7 additions & 6 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func main() {
// Falcon sensor flags
falconCID := flag.String("cid", os.Getenv("FALCON_CID"), "Falcon Customer ID")
falconToken := flag.String("provisioning-token", os.Getenv("FALCON_PROVISIONING_TOKEN"), "The provisioning token to use for installing the sensor. If not provided, the API will attempt to retrieve a token")
falconTags := flag.String("tags", os.Getenv("FALCON_TAGS"), "A comma seperated list of tags for sensor grouping")
falconTags := flag.String("tags", os.Getenv("FALCON_TAGS"), "A comma separated list of tags for sensor grouping")
falconAPD := flag.String("apd", os.Getenv("FALCON_APD"), "Configures if the proxy should be enabled or disabled. By default, the proxy is enabled")
falconAPH := flag.String("aph", os.Getenv("FALCON_APH"), "The proxy host for the sensor to use when communicating with CrowdStrike")
falconAPP := flag.String("app", os.Getenv("FALCON_APP"), "The proxy port for the sensor to use when communicating with CrowdStrike")
Expand All @@ -80,7 +80,7 @@ func main() {
userAgentAdd := flag.String("user-agent", "", "User agent string to add to use for API requests in addition to the default")
tmpDir := flag.String("tmpdir", defaultTmpDir, "Temporary directory for downloading files")
verbose := flag.Bool("verbose", false, "Enable verbose output")
quiet := flag.Bool("quiet", false, "Supress all log output")
quiet := flag.Bool("quiet", false, "Suppress all log output")
enableLogging := flag.Bool("enable-logging", false, fmt.Sprintf("Output logs to file %s", logFile))
versionFlag := flag.Bool("version", false, "Print version information and exit")

Expand Down Expand Up @@ -159,6 +159,11 @@ func main() {
APH: *falconAPH,
APP: *falconAPP,
}

if targetOS == "windows" {
fc.ProvisioningWaitTime = *falconProvisionWait
}

slog.Debug("Falcon sensor CLI options", "CID", fc.CID, "ProvisioningToken", fc.ProvisioningToken, "Tags", fc.Tags, "APD", fc.APD, "APH", fc.APH, "APP", fc.APP)

fi := installer.FalconInstaller{
Expand All @@ -182,10 +187,6 @@ func main() {
fi.GpgKeyFile = *gpgKeyFile
}

if isFlag("provisioning-wait-time") {
fc.ProvisioningWaitTime = *falconProvisionWait
}

slog.Debug("Falcon installer options", "Cloud", fi.Cloud, "MemberCID", fi.MemberCID, "SensorUpdatePolicyName", fi.SensorUpdatePolicyName, "GpgKeyFile", fi.GpgKeyFile, "TmpDir", fi.TmpDir, "OsName", fi.OsName, "OsVersion", fi.OsVersion, "OS", fi.OS, "Arch", fi.Arch, "UserAgent", fi.UserAgent)

installer.Run(fi)
Expand Down
4 changes: 4 additions & 0 deletions pkg/installer/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,10 @@ func (fi FalconInstaller) falconArgs() []string {
falconArgs = []string{"-sf"}
case "windows":
falconArgs = []string{"/install", "/quiet"}

if fi.SensorConfig.ProvisioningWaitTime != 0 {
falconArgs = append(falconArgs, fmt.Sprintf(" ProvWaitTime=%d", fi.SensorConfig.ProvisioningWaitTime))
}
}

if fi.SensorConfig.CID != "" {
Expand Down

0 comments on commit 16657a0

Please sign in to comment.