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

Add agentless-scanner software #23484

Closed
wants to merge 42 commits into from

Conversation

0intro
Copy link
Member

@0intro 0intro commented Mar 6, 2024

What does this PR do?

This change adds the agentless-scanner software.

The agentless-scanner fetches software package data from cloud resources, which is forwarded to Datadog for vulnerability scans.

The cmd/agentless-scanner and pkg/agentless code is based on the jinroh/side-scanner branch.

Motivation

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

@0intro 0intro added this to the 7.53.0 milestone Mar 6, 2024
@0intro 0intro requested review from a team as code owners March 6, 2024 13:09
@0intro 0intro force-pushed the ducolombier/agentless-scanner-software branch from dfb109a to 0b81296 Compare March 6, 2024 13:12
@0intro 0intro requested a review from a team as a code owner March 6, 2024 13:12
@0intro 0intro force-pushed the ducolombier/agentless-scanner-software branch from 0b81296 to cf6c7ef Compare March 6, 2024 13:16
@pr-commenter
Copy link

pr-commenter bot commented Mar 6, 2024

Bloop Bleep... Dogbot Here

Regression Detector Results

Run ID: 3c1210c8-6fdc-4859-a10a-9cf9db0ff617
Baseline: 9923959
Comparison: 6d17889

Performance changes are noted in the perf column of each table:

  • ✅ = significantly better comparison variant performance
  • ❌ = significantly worse comparison variant performance
  • ➖ = no significant change in performance

No significant changes in experiment optimization goals

Confidence level: 90.00%
Effect size tolerance: |Δ mean %| ≥ 5.00%

There were no significant changes in experiment optimization goals at this confidence level and effect size tolerance.

Experiments ignored for regressions

Regressions in experiments with settings containing erratic: true are ignored.

perf experiment goal Δ mean % Δ mean % CI
file_to_blackhole % cpu utilization +0.64 [-5.96, +7.25]

Fine details of change detection per experiment

perf experiment goal Δ mean % Δ mean % CI
basic_py_check % cpu utilization +1.36 [-0.90, +3.63]
file_to_blackhole % cpu utilization +0.64 [-5.96, +7.25]
tcp_syslog_to_blackhole ingress throughput +0.05 [-0.01, +0.10]
trace_agent_json ingress throughput +0.01 [-0.02, +0.03]
trace_agent_msgpack ingress throughput +0.01 [-0.01, +0.02]
tcp_dd_logs_filter_exclude ingress throughput +0.00 [-0.00, +0.00]
uds_dogstatsd_to_api ingress throughput -0.00 [-0.00, +0.00]
otel_to_otel_logs ingress throughput -0.09 [-0.72, +0.54]
process_agent_standard_check_with_stats memory utilization -0.13 [-0.16, -0.09]
file_tree memory utilization -0.18 [-0.25, -0.10]
idle memory utilization -0.25 [-0.29, -0.22]
process_agent_standard_check memory utilization -0.65 [-0.68, -0.61]
process_agent_real_time_mode memory utilization -0.66 [-0.70, -0.63]
uds_dogstatsd_to_api_cpu % cpu utilization -0.79 [-2.21, +0.64]

Explanation

A regression test is an A/B test of target performance in a repeatable rig, where "performance" is measured as "comparison variant minus baseline variant" for an optimization goal (e.g., ingress throughput). Due to intrinsic variability in measuring that goal, we can only estimate its mean value for each experiment; we report uncertainty in that value as a 90.00% confidence interval denoted "Δ mean % CI".

For each experiment, we decide whether a change in performance is a "regression" -- a change worth investigating further -- if all of the following criteria are true:

  1. Its estimated |Δ mean %| ≥ 5.00%, indicating the change is big enough to merit a closer look.

  2. Its 90.00% confidence interval "Δ mean % CI" does not contain zero, indicating that if our statistical model is accurate, there is at least a 90.00% chance there is a difference in performance between baseline and comparison variants.

  3. Its configuration does not mark it "erratic".

@0intro 0intro force-pushed the ducolombier/agentless-scanner-software branch from cf6c7ef to 8cc0e8c Compare March 6, 2024 15:20
---
features:
- |
Introduce the agentless-scanner.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Introduce the agentless-scanner.
Introduce the Agentless scanner.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@0intro 0intro force-pushed the ducolombier/agentless-scanner-software branch 2 times, most recently from 47bf711 to 9c5b8f3 Compare March 7, 2024 08:32
Copy link
Contributor

@chouquette chouquette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for the only agent-platform/barx owned file

@0intro 0intro force-pushed the ducolombier/agentless-scanner-software branch 2 times, most recently from 6eba266 to e85d448 Compare March 7, 2024 20:37
@0intro 0intro force-pushed the ducolombier/agentless-scanner-software branch 2 times, most recently from 29d7e05 to f784b62 Compare March 8, 2024 11:36
@0intro
Copy link
Member Author

0intro commented Mar 8, 2024

Hi @DataDog/documentation.
I've updated the release notes to add a description of the agentless-scanner. Could you please take another look and let me know if it looks good to you?
Thanks.

@0intro 0intro requested a review from cswatt March 8, 2024 11:37
Comment on lines 18 to 21
"github.com/DataDog/datadog-agent/cmd/agentless-scanner/awsutils"
"github.com/DataDog/datadog-agent/cmd/agentless-scanner/devices"
"github.com/DataDog/datadog-agent/cmd/agentless-scanner/runner"
"github.com/DataDog/datadog-agent/cmd/agentless-scanner/types"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually try to have only the CLI in cmd folder and the core logic for the product in comp if it has a state or pkg if it's pure helpers functions.
Could we split the agentless to follow this pattern ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've moved the agentless packages to the pkg/agentless directory.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You seems to have internal state which point toward comp folder instead. We aim for the pkg folder to be stateless at some point.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which internal state are you referring to?


scanner, err := runner.New(runner.Options{
ScannerID: scannerID,
DdEnv: pkgconfig.Datadog.GetString("env"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configuration need to be setup/loaded correctly before being used. We also deprecated using the config package directly in favor of the component project (see comp folder`).
If you reuse existing code you should migrate the agentless logic to component. ASC team is happy to help with this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: In this case it should be easy to use config.Component instead of pkgconfig.Datadog.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

ec2types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
"github.com/aws/aws-sdk-go-v2/service/lambda"

"github.com/DataDog/datadog-agent/pkg/util/log"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for log, is needs to be setup/configured correctly before being use (to take into account the configuration). Using component will also solve this for you.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

cmd/agentless-scanner/awsutils/ebs.go Outdated Show resolved Hide resolved
Copy link
Member

@hush-hush hush-hush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, side question: this looks like a code import from another repo (8k new lines in a single commit).

If' it's the case, could we keep the code history from the original repo ?

@0intro
Copy link
Member Author

0intro commented Mar 11, 2024

Also, side question: this looks like a code import from another repo (8k new lines in a single commit).

If' it's the case, could we keep the code history from the original repo ?

This is an import from the following branch: jinroh/side-scanner (based on 7.51.x branch).

I'd love to import the commit history into this PR (or rather a cleaned-up history), however it will be unfortunately squashed into a single commit by the now mandatory /merge command.

Of course, we plan to keep the development history in a branch called ducolombier/agentless-scanner-7.51 or something like that.

@hush-hush
Copy link
Member

Also, side question: this looks like a code import from another repo (8k new lines in a single commit).
If' it's the case, could we keep the code history from the original repo ?

This is an import from the following branch: jinroh/side-scanner (based on 7.51.x branch).

I'd love to import the commit history into this PR (or rather a cleaned-up history), however it will be unfortunately squashed into a single commit by the now mandatory /merge command.

Of course, we plan to keep the keep the developement history in a branch called ducolombier/agentless-scanner-7.51 or something like that.

You can use /merge -c rebase to use the merge queue with a rebase strategy.

@0intro
Copy link
Member Author

0intro commented Mar 11, 2024

I'd like to clarify that the agentless-scanner command is a bit different than the other existing commands, because it's autonomous and very independent from the rest of the agent:

  • It only depends on the config, log and remoteconfig components from the agent.
  • It's packaged independently from the other commands, in its own datadog-agentless-scanner RPM or DEB package.
  • Technically, it could live in its own repository, but we chose to integrate into the datadog-agent repository, so we could reuse the existing CI and release management process.

@0intro 0intro requested a review from hush-hush March 11, 2024 16:49
diogocp and others added 27 commits April 3, 2024 17:24
We need a default value to avoid a warning "Unknown key in config file".
Copy link

Go Package Import Differences

This comment was omitted because it was over 65,536 characters. Please check the Gitlab Job logs to see its output.

@jinroh jinroh closed this Apr 9, 2024
@jinroh jinroh deleted the ducolombier/agentless-scanner-software branch April 9, 2024 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants