Skip to content

Commit

Permalink
Merge pull request #22 from sysdiglabs/feature_fixes
Browse files Browse the repository at this point in the history
fix: Update feature parsing for app checks and secure_light
  • Loading branch information
aroberts87 authored May 25, 2023
2 parents c28b377 + 1c401bf commit c149084
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 9 deletions.
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"

0 comments on commit c149084

Please sign in to comment.