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

Plumb scanner CLI into runtime scan job #31

Merged
4 commits merged into from
Jan 20, 2023
Merged

Plumb scanner CLI into runtime scan job #31

4 commits merged into from
Jan 20, 2023

Conversation

ghost
Copy link

@ghost ghost commented Jan 16, 2023

No description provided.

@ghost ghost changed the title [Draft] Generate family config from scan config and configure vmclarity CLI flags Plumb scanner CLI into runtime scan job Jan 17, 2023
Makefile Outdated Show resolved Hide resolved
runtime_scan/pkg/cloudinit/cloudinit.go Outdated Show resolved Hide resolved
runtime_scan/pkg/provider/client.go Outdated Show resolved Hide resolved
runtime_scan/pkg/scanner/job_managment.go Outdated Show resolved Hide resolved
- Generates the families configuration for the scanner and passes it to
  the cloud-init

- Passes the server endpoint and scan result ID to the scanner CLI in
  cloud-init

- Updates the backend cloudformation to configure the scanner container
  image which is passed to the cloud-init
@ghost ghost requested review from FrimIdan and akpsgit and removed request for FrimIdan January 18, 2023 14:02
@@ -224,7 +235,20 @@ func (s *Scanner) runJob(ctx context.Context, data *scanData) (types.Job, error)
}
}

launchInstance, err = s.providerClient.RunScanningJob(ctx, launchSnapshot, s.scanConfig)
volumeMountDirectory := "/vmToBeScanned"
Copy link
Contributor

@akpsgit akpsgit Jan 18, 2023

Choose a reason for hiding this comment

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

Better to add a comment here. This is the path inside the docker that will run in the VM job where the snapshot is mapped to.

Copy link
Author

Choose a reason for hiding this comment

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

its the directory chosen by the orchestrator where the job should mount the VM's volume so that the VMClarity CLI can find it

@@ -233,6 +257,78 @@ func (s *Scanner) runJob(ctx context.Context, data *scanData) (types.Job, error)
return job, nil
}

func (s *Scanner) getFamiliesConfigurationYaml(scanRootDirectory string) (string, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe better to call it generateFamiliesConfigurationYaml?

}

func userSBOMConfigToFamiliesSbomConfig(sbomConfig *models.SBOMConfig, scanRootDirectory string) familiesSbom.Config {
if sbomConfig != nil && sbomConfig.Enabled != nil && !*sbomConfig.Enabled {
Copy link
Contributor

Choose a reason for hiding this comment

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

If the config is nil sbom will be enabled. not sure it's the required behaviour. I think that it's better to return an empty config in each of the checks or convert it to OR checks

Copy link
Author

Choose a reason for hiding this comment

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

ah yup, good catch my mistake

}

func userVulnConfigToFamiliesVulnConfig(vulnerabilitiesConfig *models.VulnerabilitiesConfig) familiesVulnerabilities.Config {
if vulnerabilitiesConfig != nil && vulnerabilitiesConfig.Enabled != nil && !*vulnerabilitiesConfig.Enabled {
Copy link
Contributor

Choose a reason for hiding this comment

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

same

// TODO(sambetts) The user needs to be able to provide this configuration
Registry: &kubeclarityConfig.Registry{},
Scanner: &kubeclarityConfig.Scanner{
GrypeConfig: kubeclarityConfig.GrypeConfig{
Copy link
Contributor

Choose a reason for hiding this comment

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

Need to add a todo to run it in a remote mode and to run Grype server

Copy link
Contributor

@fishkerez fishkerez left a comment

Choose a reason for hiding this comment

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

Looks good!

@ghost ghost requested review from fishkerez, FrimIdan and akpsgit and removed request for fishkerez, FrimIdan and akpsgit January 19, 2023 11:18
FrimIdan
FrimIdan previously approved these changes Jan 19, 2023
@ghost ghost merged commit 54d3d18 into main Jan 20, 2023
@ghost ghost deleted the scanner_cli branch January 20, 2023 09:34
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants