Skip to content

ROX-9280: Scan image with local Scanner#517

Merged
RTann merged 165 commits intomasterfrom
ROX-8401-interactions
Feb 24, 2022
Merged

ROX-9280: Scan image with local Scanner#517
RTann merged 165 commits intomasterfrom
ROX-8401-interactions

Conversation

@RTann
Copy link
Contributor

@RTann RTann commented Feb 1, 2022

Description

Followup to #416. This PR implements the Sensor-side functionality of Scanning:

  1. Attempt to scan via the normal route (Central)
  2. If Central could not find metadata, then try to get the metadata via an internal registry
  3. If this succeeds, then scan the image with a local scanner with the credentials retrieved in ROX-8401, ROX-8465: Store internal registries + credentials #416

Checklist

  • Investigated and inspected CI test results
  • Unit test and regression tests added
  • Evaluated and added CHANGELOG entry if required
  • [ ] Determined and documented upgrade steps

Testing Performed

The full pipeline is still incomplete, so there are no E2E tests at this time, and there is no particular part that would benefit from a unit test.

Manual testing:

  1. Deploy and OpenShift cluster (3.11 and/or 4.x)
  2. Deploy ACS
  3. Add Sensor to Scanner's NetworkPolicy
  4. Set ROX_SKIP_PEER_VALIDATION=true in Scanner and wait for it to come back up.
  5. Set ROX_LOCAL_IMAGE_SCANNING=true, ROX_SCANNER_GRPC_ENDPOINT=scanner.stackrox.svc.8443, LOGLEVEL=debug in Sensor.
  6. Push an image to the internal registry (be sure to create the project you push it in before pushing).
  7. Create a deployment which uses this image.
  8. View Sensor's logs to ensure it says Retrieved metadata for image <image> in namespace <namespace>: <metadata> and Got image components from local Scanner for image <image> in namespace <namespace>.
  9. View Scanner's logs to confirm the images have been analyzed.

Example deployment YAML for OpenShift 4.x:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-deployment
  namespace: ross-test
  labels:
    app: nginx
spec:
  replicas: 3
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: image-registry.openshift-image-registry.svc:5000/ross-test/nginx:1.14.2
        ports:
        - containerPort: 80

@RTann RTann merged commit 24d7324 into master Feb 24, 2022
@RTann RTann deleted the ROX-8401-interactions branch February 24, 2022 02:00
RTann added a commit that referenced this pull request Feb 24, 2022
RTann added a commit that referenced this pull request Feb 24, 2022
RTann added a commit that referenced this pull request Feb 24, 2022
RTann added a commit that referenced this pull request Apr 6, 2022
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.

3 participants