-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #580 from CrowdStrike/mhyson/auto-sensor-update
feat: automatic sensor updates
- Loading branch information
Showing
33 changed files
with
1,068 additions
and
110 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
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 |
---|---|---|
@@ -1,10 +1,53 @@ | ||
package v1alpha1 | ||
|
||
import "strings" | ||
|
||
const ( | ||
Force = "force" | ||
Normal = "normal" | ||
Off = "off" | ||
) | ||
|
||
// FalconUnsafe configures various options that go against industry practices or are otherwise not recommended for use. | ||
// Adjusting these settings may result in incorrect or undesirable behavior. Proceed at your own risk. | ||
// For more information, please see https://github.com/CrowdStrike/falcon-operator/blob/main/UNSAFE.md. | ||
type FalconUnsafe struct { | ||
// UpdatePolicy is the name of a sensor update policy configured and enabled in Falcon UI. It is ignored when Image and/or Version are set. | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Falcon Sensor Update Policy",order=1 | ||
UpdatePolicy *string `json:"updatePolicy,omitempty"` | ||
|
||
// AutoUpdate determines whether to install new versions of the sensor as they become available. Defaults to "off" and is ignored if FalconAPI is not set. | ||
// Setting this to "force" causes the reconciler to run on every polling cycle, even if a new sensor version is not available. | ||
// Setting it to "normal" only reconciles when a new version is detected. | ||
// +kubebuilder:validation:Enum=off;normal;force | ||
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Falcon Sensor Automatic Updates",order=2 | ||
AutoUpdate *string `json:"autoUpdate,omitempty"` | ||
} | ||
|
||
func (notSafe FalconUnsafe) GetUpdatePolicy() string { | ||
if notSafe.UpdatePolicy == nil { | ||
return "" | ||
} | ||
|
||
return strings.TrimSpace(*notSafe.UpdatePolicy) | ||
} | ||
|
||
func (notSafe FalconUnsafe) HasUpdatePolicy() bool { | ||
return notSafe.GetUpdatePolicy() != "" | ||
} | ||
|
||
func (notSafe FalconUnsafe) IsAutoUpdating() bool { | ||
if notSafe.AutoUpdate == nil { | ||
return false | ||
} | ||
|
||
return *notSafe.AutoUpdate != "off" | ||
} | ||
|
||
func (notSafe FalconUnsafe) IsAutoUpdatingForced() bool { | ||
if notSafe.AutoUpdate == nil { | ||
return false | ||
} | ||
|
||
return *notSafe.AutoUpdate == "force" | ||
} |
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
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
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
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
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
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
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,29 @@ | ||
# Unsafe Settings | ||
|
||
Some of the operator's configurable settings involve features that conflict with established industry norms. These options are disabled by default as they carry a certain amount of risk, but they can be enabled in the `unsafe` section of each resource spec. What follows is a brief overview of the issues surrounding their use. | ||
|
||
## The Golden Rule of Kubernetes | ||
|
||
A fundamental principle underlying all Kubernetes operation is repeatability. Any given configuration should always produce the same result regardless of when or where it is applied or by whom. Another way of saying this is that a cluster should only ever do something because somebody explicitly called for it to happen. Anything that has variable behavior introduces uncertainty into the environment, and this can lead to problems that are difficult to diagnose. | ||
|
||
A common example is the use of image tags. These operate like pointers with many of the same concerns. The image they refer to can change without warning, and that can cause trouble. | ||
|
||
Consider a container spec that uses `nginx:latest`. What exactly will this deploy? Some version of nginx, presumably, but which version? What if it's not the version expected by the rest of the system? What if it's incompatible with other things in the cluster? Maybe everything works fine today, but what if tomorrow the container is moved to a different node? This tears down the old one and launches a new one. What if `latest` has changed to something new that breaks everything? There's no way to detect this beforehand. | ||
|
||
It is for these reasons and others that such practices are discouraged. A better approach given the above scenario is to use explicit image hashes. Instead of `nginx:latest`, one could use `nginx@sha256:447a8665...`. This uniquely identifies a particular version and package of nginx. It will never be anything else. All of the questions raised above become irrelevant. It is known what version will be deployed. It is known it will be the expected version. It is known new containers won't use anything else. It is safe. | ||
|
||
## Falcon's Unsafe Options | ||
|
||
Only some of the resources provided by the operator have unsafe properties. Each keeps them in slightly different places: | ||
|
||
* `spec.unsafe` for FalconContainer | ||
* `spec.node.unsafe` for FalconNodeSensor | ||
|
||
Any options that go against recommended practices can be found here. Presently, that includes settings that affect the selection of Falcon sensor versions, which brings all of the issues of image tags described above. Details on these settings can be found in the respective resource documents. | ||
|
||
## More Information | ||
|
||
The issues around unsafe settings can be quite involved. The following are other resources that go into greater depth: | ||
|
||
* [Attack of the Mutant Tags! Or Why Tag Mutability is a Real Security Threat](https://sysdig.com/blog/toctou-tag-mutability/) | ||
* [How to Ensure Consistent Kubernetes Container Versions](https://www.gremlin.com/blog/kubernetes-container-image-version-uniformity) |
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
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
Oops, something went wrong.