הצגת רשימה של רשויות אישורים

בדף הזה מוסבר איך להציג רשימה של רשויות אישורים (CA) בGoogle Cloud פרויקט.

הצגת רשימה של אישורי CA בסיסיים

בקטע הזה מוסבר איך לראות את רשויות האישורים הבסיסיות.

הצגת רשימה של רשויות אישורים (CA) עליונות בכל מאגרי הרשויות שמנפיקות את האישורים

כדי להציג ברשימה את כל רשויות האישורים הבסיסיות בכל מאגרי רשויות האישורים:

המסוף

  1. נכנסים לדף Certificate authorities במסוף Google Cloud .

    מעבר אל 'רשויות אישורים'

  2. בשדה Filter, בוחרים באפשרות Type מהרשימה.

  3. מגדירים את הערך של Type כ-Root.

מוצגת רשימה של כל רשויות האישורים שהסוג שלהן מוגדר כבסיס.

gcloud

מריצים את הפקודה הבאה:

gcloud privateca roots list --location LOCATION

מחליפים את LOCATION במיקום של רשויות האישורים הבסיסיות. רשימת המיקומים המלאה

הצגת רשויות אישורים (CA) עליונות במאגר מסוים של רשויות אישורים

כדי להציג ברשימה את כל רשויות האישורים הבסיסיות במאגר מסוים של רשויות אישורים, פועלים לפי ההוראות הבאות:

המסוף

  1. עוברים לדף רשויות אישורים.

    מעבר אל 'רשויות אישורים'

  2. בשדה Filter, בוחרים באפשרות Type מהרשימה.

  3. מגדירים את הערך של Type כ-Root.

  4. בשדה Filter, בוחרים באפשרות Pool מהרשימה.

  5. לוחצים על השם של מאגר אישורי ה-CA ברשימה.

gcloud

מריצים את הפקודה הבאה:

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

מחליפים את מה שכתוב בשדות הבאים:

  • POOL_ID: השם של מאגר רשות האישורים
  • LOCATION: המיקום של מאגר אישורי ה-CA. כאן מפורטת רשימת המיקומים המלאה.

כדי להציג רשימה של רשויות אישורים בסיסיות בכל מאגרי רשויות האישורים ובכל המיקומים, משמיטים את הדגלים --pool ו---location מהפקודה.

מידע נוסף על הפקודה gcloud privateca roots list זמין במאמר gcloud privateca roots list.

הצגת רשימה של רשויות אישורים משניות

בקטע הזה מוסבר איך לצפות ב-CA המשני.

רשימת רשויות CA משניות במאגרי CA

כדי להציג ברשימה את כל רשויות האישורים המשניות בכל מאגרי רשויות האישורים:

המסוף

  1. עוברים לדף רשויות אישורים.

    מעבר אל 'רשויות אישורים'

  2. בשדה Filter, בוחרים באפשרות Type מהרשימה.

  3. מגדירים את הערך של Type כ-Subordinate.

מוצגים כל רשויות האישורים שהסוג שלהן מוגדר כמשני.

gcloud

מריצים את הפקודה הבאה:

gcloud privateca subordinates list --location LOCATION

מחליפים את LOCATION במיקום של רשויות האישורים המשניות. רשימת המיקומים המלאה מופיעה בקטע מיקומים.

הצגת רשויות CA משניות במאגר מסוים של רשויות CA

כדי להציג ברשימה את כל רשויות האישורים המשניות במאגר מסוים של רשויות אישורים:

המסוף

  1. עוברים לדף רשויות אישורים.

    מעבר אל 'רשויות אישורים'

  2. בשדה Filter, בוחרים באפשרות Type מהרשימה.

  3. מגדירים את הערך של Type כ-Subordinate.

  4. בשדה Filter, בוחרים באפשרות Pool מהרשימה.

  5. לוחצים על השם של מאגר אישורי ה-CA ברשימה.

gcloud

מריצים את הפקודה הבאה:

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

מחליפים את מה שכתוב בשדות הבאים:

  • POOL_ID: השם של מאגר רשות האישורים
  • LOCATION: המיקום של מאגר אישורי ה-CA. כאן מפורטת רשימת המיקומים המלאה.

מידע נוסף על הפקודה gcloud privateca subordinates list זמין במאמר gcloud privateca subordinates list.

הצגת רשימה של כל אישורי ה-CA

כדי להציג רשימה של כל רשויות האישורים במאגר רשויות אישורים, פועלים לפי ההוראות הבאות:

המסוף

  1. עוברים לדף רשויות אישורים.

    מעבר אל 'רשויות אישורים'

  2. בשדה Filter, בוחרים באפשרות Pool מהרשימה.

  3. לוחצים על השם של מאגר אישורי ה-CA ברשימה.

אפשרות אחרת היא להציג את רשויות האישורים במאגר מסוים של רשויות אישורים דרך הדף ניהול מאגר רשויות אישורים. כך עושים את זה:

  1. לוחצים על הכרטיסייה CA pool manager (ניהול מאגרים של רשויות אישורים).
  2. בדף מאגרי רשויות אישורים, לוחצים על השם של מאגר רשויות האישורים שרוצים לראות את רשויות האישורים שלו.

בדף הפרטים של מאגר CA, רשויות ה-CA מופיעות בקטע רשויות אישורים במאגר. אפשר לסנן את הרשויות המנפיקות לפי סוג, רמה, מיקום, מדינה ועוד.

המשך

כדי לבצע אימות ב-CA Service, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.


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, צריך להגדיר את Application Default Credentials. מידע נוסף זמין במאמר הגדרת אימות לסביבת פיתוח מקומית.

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)

המאמרים הבאים