Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Update feature parsing for app checks and secure_light #22

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 40 additions & 8 deletions filter_plugins/dragent.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,15 @@ def __init__(self, config):
features=config["features"].get("monitoring", {}))

def generate(self) -> dict:
ret = self._get_config(["app_checks", "jmx", "prometheus", "statsd"])
if not self.config.is_enabled():
ret = {"app_checks_enabled": False}
ret.update({feature: {"enabled": False} for feature in [
"app_checks",
"jmx",
"prometheus",
"statsd"
]})
return ret
return self._get_config(["app_checks", "jmx", "prometheus", "statsd"])
return ret


class DragentSecureSettings(DragentSettings):
Expand All @@ -180,17 +180,30 @@ def __init__(self, config):
features=config["features"].get("security", {}))

def generate(self) -> dict:
disabled_features = []
if not self.config.is_enabled():
return {feature: {"enabled": False} for feature in [
disabled_features.extend([
"commandlines_capture",
"drift_control",
"drift_killer",
"falcobaseline",
"memdump",
"network_topology",
"secure_audit_streams"
]}
return self._get_config(["commandlines_capture", "drift_detection",
"falcobaseline", "memdumper", "secure_audit_streams"])
])
if self.config.type() == "light":
disabled_features.extend([
"drift_control",
"drift_killer",
"falcobaseline",
"memdump",
"network_topology"
])

res = self._get_config(["commandlines_capture", "drift_detection",
"falcobaseline", "memdumper", "secure_audit_streams"])
res.update({feature: {"enabled": False} for feature in disabled_features})
return res


class DragentExtraSettings(DragentSettings):
Expand All @@ -217,11 +230,30 @@ def __init__(self, config: dict):
DragentExtraSettings(config=config)
]

@staticmethod
def _patch_configuration(config: dict) -> dict:
if not config.get("app_checks"):
return config

if "enabled" in config["app_checks"]:
config.update({"app_checks_enabled": config["app_checks"]["enabled"]})

if not config["app_checks"]["enabled"]:
del config["app_checks"]
else:
del config["app_checks"]["enabled"]

if config.get("app_checks", {}).get("applications"):
config["app_checks"] = config["app_checks"]["applications"]

return config

def generate(self) -> dict:
ret = {}
for config_type in self._config_types:
ret.update(config_type.generate())
return ret

return self._patch_configuration(ret)


def to_dragent_configuration(data):
Expand Down
11 changes: 10 additions & 1 deletion meta/argument_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,15 @@ argument_specs:
type: dict
required: false
description: "Legacy Sysdig App Check configuration."
options:
enabled:
type: bool
required: false
description: "Enable or disable legacy App Checks"
applications:
type: list
required: false
description: "Configurations for App Check modules"
jmx:
type: dict
required: false
Expand Down Expand Up @@ -164,7 +173,7 @@ argument_specs:
type: dict
required: false
description: "Sysdig Secure Falco Baseliner configuration"
memdumper:
memdump:
type: dict
required: false
description: "Sysdig Secure Memdumper configuration"