인증 기관 나열

이 페이지에서는 Google Cloud 프로젝트에서 인증 기관(CA)을 나열하는 방법을 설명합니다.

루트 CA 나열

이 섹션에서는 루트 CA를 확인하는 방법을 보여줍니다.

CA 풀 전반의 루트 CA 나열

CA 풀 전반의 모든 루트 CA를 나열하려면 다음을 수행합니다.

콘솔

  1. Google Cloud 콘솔에서 Certificate Authority Service 페이지로 이동합니다.

    Certificate Authority Service로 이동

  2. CA 관리자 탭을 클릭하여 인증 기관 페이지로 이동합니다.

  3. 필터 필드의 목록에서 유형을 선택합니다.

  4. 유형 값을 루트로 설정합니다.

유형루트로 설정된 모든 CA가 나열됩니다.

gcloud

다음 명령어를 실행합니다.

gcloud privateca roots list --location LOCATION

LOCATION을 루트 CA의 위치로 바꿉니다. 전체 위치 목록은 위치를 참조하세요.

특정 CA 풀의 루트 CA 나열

특정 CA 풀의 모든 루트 CA를 나열하려면 다음 안내를 따르세요.

콘솔

  1. Certificate Authority Service 페이지로 이동합니다.

    Certificate Authority Service로 이동

  2. CA 관리자 탭을 클릭하여 인증 기관 페이지로 이동합니다.

  3. 필터 필드의 목록에서 유형을 선택합니다.

  4. 유형 값을 루트로 설정합니다.

  5. 필터 필드의 목록에서 을 선택합니다.

  6. 목록에서 CA 풀 이름을 클릭합니다.

gcloud

다음 명령어를 실행합니다.

gcloud privateca roots list --location LOCATION --pool POOL_ID

다음을 바꿉니다.

  • LOCATION: CA 풀의 위치입니다. 전체 위치 목록은 위치를 참조하세요.
  • POOL_ID: CA 풀 이름입니다.

모든 CA 풀 및 위치의 루트 CA를 나열하려면 명령어에서 --pool--location 플래그를 생략합니다.

gcloud privateca roots list 명령어에 대한 자세한 내용은 gcloud privateca roots list를 참조하세요.

하위 CA 나열

이 섹션에서는 하위 CA를 확인하는 방법을 보여줍니다.

CA 풀 전반의 하위 CA 나열

CA 풀 전반의 모든 하위 CA를 나열하려면 다음을 수행합니다.

콘솔

  1. Certificate Authority Service 페이지로 이동합니다.

    Certificate Authority Service로 이동

  2. CA 관리자 탭을 클릭하여 인증 기관 페이지로 이동합니다.

  3. 필터 필드의 목록에서 유형을 선택합니다.

  4. 유형 값을 하위로 설정합니다.

유형하위로 설정된 모든 CA가 나열됩니다.

gcloud

다음 명령어를 실행합니다.

gcloud privateca subordinates list --location LOCATION

LOCATION을 하위 CA의 위치로 바꿉니다. 전체 위치 목록은 위치를 참조하세요.

특정 CA 풀의 하위 CA 나열

특정 CA 풀의 모든 하위 CA를 나열하려면 다음을 수행합니다.

콘솔

  1. Certificate Authority Service 페이지로 이동합니다.

    Certificate Authority Service로 이동

  2. CA 관리자 탭을 클릭하여 인증 기관 페이지로 이동합니다.

  3. 필터 필드의 목록에서 유형을 선택합니다.

  4. 유형 값을 하위로 설정합니다.

  5. 필터 필드의 목록에서 을 선택합니다.

  6. 목록에서 CA 풀 이름을 클릭합니다.

gcloud

다음 명령어를 실행합니다.

gcloud privateca subordinates list --location LOCATION --pool POOL_ID

다음을 바꿉니다.

  • LOCATION: CA 풀의 위치입니다. 전체 위치 목록은 위치를 참조하세요.
  • POOL_ID: CA 풀 이름입니다.

gcloud privateca subordinates list 명령어에 대한 자세한 내용은 gcloud privateca subordinates list를 참조하세요.

모든 CA 나열

CA 풀의 모든 CA를 나열하려면 다음 안내를 따르세요.

콘솔

  1. Certificate Authority Service 페이지로 이동합니다.

    Certificate Authority Service로 이동

  2. CA 관리자 탭을 클릭하여 인증 기관 페이지로 이동합니다.

  3. 필터 필드의 목록에서 을 선택합니다.

  4. 목록에서 CA 풀 이름을 클릭합니다.

또는 CA 풀 관리자 페이지에서 다음을 수행하여 특정 CA 풀의 CA를 확인할 수 있습니다.

  1. CA 풀 관리자 탭을 클릭합니다.
  2. CA 풀 페이지에서 CA를 확인할 CA 풀 이름을 클릭합니다.

CA 풀 세부정보 페이지에서 풀의 인증 기관에 나열된 CA를 확인할 수 있습니다. 유형, 등급, 위치, 상태 등을 기준으로 CA를 필터링할 수 있습니다.

Go

CA Service에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

import (
	"context"
	"fmt"
	"io"

	privateca "cloud.google.com/go/security/privateca/apiv1"
	"cloud.google.com/go/security/privateca/apiv1/privatecapb"
	"google.golang.org/api/iterator"
)

// List all Certificate Authorities present in the given CA Pool.
func listCas(w io.Writer, projectId string, location string, caPoolId string) error {
	// projectId := "your_project_id"
	// location := "us-central1"	// For a list of locations, see: https://cloud.google.com/certificate-authority-service/docs/locations.
	// caPoolId := "ca-pool-id"		// The id of the CA pool under which the CAs to be listed are present.

	ctx := context.Background()
	caClient, err := privateca.NewCertificateAuthorityClient(ctx)
	if err != nil {
		return fmt.Errorf("NewCertificateAuthorityClient creation failed: %w", err)
	}
	defer caClient.Close()

	fullCaPoolName := fmt.Sprintf("projects/%s/locations/%s/caPools/%s", projectId, location, caPoolId)

	// Create the ListCertificateAuthorities.
	// See https://pkg.go.dev/cloud.google.com/go/security/privateca/apiv1/privatecapb#ListCertificateAuthoritiesRequest.
	req := &privatecapb.ListCertificateAuthoritiesRequest{Parent: fullCaPoolName}

	it := caClient.ListCertificateAuthorities(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			return fmt.Errorf("unable to get the list of cerficate authorities: %w", err)
		}

		fmt.Fprintf(w, " - %s (state: %s)", resp.Name, resp.State.String())
	}

	return nil
}

Java

CA Service에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


import com.google.cloud.security.privateca.v1.CaPoolName;
import com.google.cloud.security.privateca.v1.CertificateAuthority;
import com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClient;
import java.io.IOException;

public class ListCertificateAuthorities {

  public static void main(String[] args) throws IOException {
    // TODO(developer): Replace these variables before running the sample.
    // location: For a list of locations, see:
    // https://cloud.google.com/certificate-authority-service/docs/locations
    // poolId: The id of the CA pool under which the CAs to be listed are present.
    String project = "your-project-id";
    String location = "ca-location";
    String poolId = "ca-pool-id";
    listCertificateAuthority(project, location, poolId);
  }

  // List all Certificate authorities present in the given CA Pool.
  public static void listCertificateAuthority(String project, String location, String poolId)
      throws IOException {
    // Initialize client that will be used to send requests. This client only needs to be created
    // once, and can be reused for multiple requests. After completing all of your requests, call
    // the `certificateAuthorityServiceClient.close()` method on the client to safely
    // clean up any remaining background resources.
    try (CertificateAuthorityServiceClient certificateAuthorityServiceClient =
        CertificateAuthorityServiceClient.create()) {

      // Create CA pool name comprising of project, location and the pool name.
      CaPoolName parent =
          CaPoolName.newBuilder()
              .setProject(project)
              .setLocation(location)
              .setCaPool(poolId)
              .build();

      // List the CA name and its corresponding state.
      for (CertificateAuthority certificateAuthority :
          certificateAuthorityServiceClient.listCertificateAuthorities(parent).iterateAll()) {
        System.out.println(
            certificateAuthority.getName() + " is " + certificateAuthority.getState());
      }
    }
  }
}

Python

CA Service에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

import google.cloud.security.privateca_v1 as privateca_v1

def list_certificate_authorities(
    project_id: str, location: str, ca_pool_name: str
) -> None:
    """
    List all Certificate authorities present in the given CA Pool.

    Args:
        project_id: project ID or project number of the Cloud project you want to use.
        location: location you want to use. For a list of locations, see: https://cloud.google.com/certificate-authority-service/docs/locations.
        ca_pool_name: the name of the CA pool under which the CAs to be listed are present.
    """

    caServiceClient = privateca_v1.CertificateAuthorityServiceClient()

    ca_pool_path = caServiceClient.ca_pool_path(project_id, location, ca_pool_name)

    # List the CA name and its corresponding state.
    for ca in caServiceClient.list_certificate_authorities(parent=ca_pool_path):
        print(ca.name, "is", ca.state)

다음 단계