Java 패키지 수동 검사
이 빠른 시작에서는 컨테이너 이미지를 가져오고, 주문형 검사로 수동 검사하고, 시스템 및 Maven 패키지에 대해 식별된 취약점을 가져오는 방법을 보여줍니다. 이 빠른 시작을 따르려면 Cloud Shell과 Alpine 이미지 예시를 사용합니다.
시작하기 전에
- 계정에 로그인합니다. Google Cloud 를 처음 사용하는 경우 Google Cloud 계정을 만들어 실제 시나리오에서 제품이 어떻게 작동하는지 평가하세요. 신규 고객에게는 워크로드를 실행, 테스트, 배포하는 데 사용할 수 있는 $300의 무료 크레딧이 제공됩니다.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the On-Demand Scanning API.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
Verify that billing is enabled for your Google Cloud project.
Enable the On-Demand Scanning API.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.
이미지 다운로드 및 검사
프로젝트에서 Cloud Shell을 엽니다.
이렇게 하면 이 가이드를 따르는 데 필요한 모든 도구가 포함된 터미널이 열립니다.
docker를 사용하여 컨테이너 이미지를 가져옵니다.
docker pull jenkins:2.60.3-alpine검사를 실행합니다.
gcloud artifacts docker images scan jenkins:2.60.3-alpine --additional-package-types=MAVEN이렇게 하면 검사 프로세스가 트리거되고 완료되면 검사 이름이 반환됩니다.
✓ 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: jenkins:2.60.3-alpine 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
출력에서
scan의 값인 검사 이름을 사용하여 검사 결과를 가져옵니다.gcloud artifacts docker images list-vulnerabilities \ projects/my-project/locations/us/scans/893c91ce-7fe6-4f1a-a69a-d6ca1b465160출력에는 Maven 및 Linux 패키지 취약점 목록이 포함됩니다. Maven 패키지 취약점은
packageType:MAVEN필드로 식별할 수 있습니다.
삭제
이 페이지에서 사용한 리소스 비용이 Google Cloud 계정에 청구되지 않도록 하려면 다음 단계를 수행합니다.
이 가이드에 새 프로젝트를 만든 경우 이제 프로젝트를 삭제할 수 있습니다.콘솔에서 설정 페이지 (IAM 및 관리자 아래에 있음)를 엽니다. Google Cloud
프로젝트 선택을 클릭합니다.
삭제할 프로젝트를 선택한 후 열기를 클릭합니다.
종료를 클릭합니다.
프로젝트 ID를 입력한 후 종료 를 클릭합니다.