Verificar pacotes do SO manualmente

Neste guia de início rápido, mostramos como extrair uma imagem de contêiner, verificar manualmente se há vulnerabilidades no sistema operacional com a API On-Demand Scanning e recuperar as vulnerabilidades identificadas. Para seguir este guia de início rápido, você vai usar o Cloud Shell e uma imagem de exemplo do Ubuntu.

Antes de começar

  1. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Enable the On-Demand Scanning API.

    Enable the API

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  6. Make sure that billing is enabled for your Google Cloud project.

  7. Enable the On-Demand Scanning API.

    Enable the API

Baixar e verificar uma imagem

  1. Abra um Cloud Shell no projeto.

    Abra o Cloud Shell

    Isso abre um terminal com todas as ferramentas necessárias para seguir este guia.

  2. Use o Docker para extrair a imagem mais recente do Ubuntu.

    docker pull ubuntu:latest
    
  3. Execute a verificação.

    gcloud artifacts docker images scan ubuntu:latest
    

    Isso aciona o processo de verificação e retorna o nome da verificação quando ela termina:

    ✓ Scanning container image
      ✓ Locally extracting packages and versions from local container image
      ✓ Remotely initiating analysis of packages and versions
      ✓ Waiting for analysis operation to complete [projects/my-project/locations/us/operations/1a6fd941-b997-4e5f-ba4f-6351f30e7dad]
    Done.
    
    done: true
    metadata:
      '@type': type.googleapis.com/google.cloud.ondemandscanning.v1.AnalyzePackagesMetadata
      createTime: '2021-01-26T13:43:53.112123Z'
      resourceUri: ubuntu:latest
    name: projects/my-project/locations/us/operations/1a6fd941-b99f-4eaf-ba4f-6e5af30e7dad
    response:
      '@type': type.googleapis.com/google.cloud.ondemandscanning.v1.AnalyzePackagesResponse
      scan: projects/my-project/locations/us/scans/893c91ce-7fe6-4f1a-a69a-d6ca1b465160
    
  4. Use o nome da verificação e o valor de scan da saída para buscar os resultados.

    gcloud artifacts docker images list-vulnerabilities \
    projects/my-project/locations/us/scans/893c91ce-7fe6-4f1a-a69a-d6ca1b465160
    

Limpar

Para evitar cobranças na sua conta do Google Cloud pelos recursos usados nesta página, siga estas etapas.

Se você criou um novo projeto para este guia, agora é possível excluí-lo.

A seguir