הצגת אישורים שהונפקו

בדף הזה מוסבר איך אפשר לראות את האישורים שהונפקו באמצעותGoogle Cloud המסוף, Google Cloud CLI וספריות הלקוח של Cloud.

אפשר לראות רק אישורים שהונפקו על ידי רשויות אישורים (CA) במהדורת Enterprise.

הצגת אישורים שהונפקו

המסוף

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

    כניסה אל Certificate Authority Service

  2. לוחצים על הכרטיסייה מנהל רשויות אישורים.

  3. בדף Certificate authorities, לוחצים על השם של רשות האישורים.

  4. בתחתית דף הפרטים של רשות האישורים, לוחצים על הצגת האישורים שהונפקו כדי לראות את רשימת האישורים שהונפקו על ידי רשות האישורים.

    רשימת האישורים מופיעה בדף All certificates (כל האישורים). הפרטים שמוצגים כוללים את הסטטוס של האישור, את רשות האישורים שהנפיקה אותו, את מאגר רשויות האישורים שמכיל את רשות האישורים, את תאריך התפוגה של האישור ועוד.

gcloud

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

gcloud privateca certificates list --issuer-pool ISSUER_POOL --issuer-location ISSUER_LOCATION --ca CA_NAME

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

כדי לראות את כל האישורים בכל רשויות האישורים במיקום מסוים, משתמשים בפקודה gcloud הבאה:

gcloud privateca certificates list --location LOCATION

המשך

כדי לבצע אימות ב-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 Certificates present in the given CA pool.
func listCertificates(
	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 CA Pool id in which the certificate exists.

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

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

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

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

		fmt.Fprintf(w, " - %s (common name: %s)", resp.Name,
			resp.CertificateDescription.SubjectDescription.Subject.CommonName)
	}

	return nil
}

Java

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


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

public class ListCertificates {

  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: Id of the CA pool which contains the certificates to be listed.
    String project = "your-project-id";
    String location = "ca-location";
    String poolId = "ca-pool-id";
    listCertificates(project, location, poolId);
  }

  // List Certificates present in the given CA pool.
  public static void listCertificates(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()) {

      CaPoolName caPool =
          CaPoolName.newBuilder()
              .setProject(project)
              .setLocation(location)
              .setCaPool(poolId)
              .build();

      // Retrieve and print the certificate names.
      System.out.println("Available certificates: ");
      for (Certificate certificate :
          certificateAuthorityServiceClient.listCertificates(caPool).iterateAll()) {
        System.out.println(certificate.getName());
      }
    }
  }
}

Python

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


import google.cloud.security.privateca_v1 as privateca_v1


def list_certificates(
    project_id: str,
    location: str,
    ca_pool_name: str,
) -> None:
    """
    List Certificates 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: name of the CA pool which contains the certificates to be listed.
    """

    caServiceClient = privateca_v1.CertificateAuthorityServiceClient()

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

    # Retrieve and print the certificate names.
    print(f"Available certificates in CA pool {ca_pool_name}:")
    for certificate in caServiceClient.list_certificates(parent=ca_pool_path):
        print(certificate.name)

הצגת כל האישורים שהונפקו בפרויקט

המסוף

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

    כניסה אל Certificate Authority Service

  2. לוחצים על הכרטיסייה ניהול אישורים פרטיים.

    רשימת האישורים מופיעה בדף All certificates (כל האישורים).

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

הצגת פרטים של אישור יחיד

המסוף

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

    כניסה אל Certificate Authority Service

  2. בוחרים את רשות האישורים הרצויה בכרטיסייה CA Manager (ניהול רשויות אישורים).

  3. לוחצים על שם רשות האישורים.

  4. בתחתית דף הפרטים של רשות האישורים, לוחצים על הצגת האישורים שהונפקו כדי לראות את רשימת האישורים שהונפקו.

  5. לוחצים על בעמודה פעולות ליד האישור שרוצים להוריד.

  6. בקטע הורדה, לוחצים על אישור. כדי להוריד את שרשרת האישורים, לוחצים על שרשרת האישורים.

gcloud

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

gcloud privateca certificates describe CERT_NAME --issuer-pool POOL_ID --issuer-location ISSUER_LOCATION

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

כדי לייצא את שרשרת אישורי X.509 בהצפנת PEM לקובץ, מריצים את הפקודה הבאה:

gcloud privateca certificates export CERT_NAME \
    --issuer-pool POOL_ID \
    --issuer-location ISSUER_LOCATION \
    --include-chain \
    --output-file certificate-file

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

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

כדי להציג ברשימה את כל האישורים בכל מאגרי ה-CA בפרויקט PROJECT_ID ובמיקום LOCATION מסוימים כשמבצעים קריאה ל-API, צריך לציין את שם משאב ה-CA עם התו הכללי -.

לדוגמה: projects/PROJECT_ID/locations/LOCATION/caPools/-

הוכחת בעלות על אישורים

הוכחת בעלות על המפתח הפרטי מבטיחה שמגיש הבקשה לאישור מחזיק במפתח הפרטי של האישור הזה. CA Service בודק את הוכחת הבעלות רק אם המבקש מספק בקשת חתימה על אישור (CSR) מסוג PKCS #10 בהתאם ל-RFC 2986. לא נדרש אימות בעלות על סוגים אחרים של בקשות לאישור, כמו בקשות של CertificateConfig.

באחריות אפליקציות הלקוח שמקבלות אישורים לוודא שלבעל האישור יש את המפתח הפרטי של האישור הזה. אכיפת בדיקות הוכחת בעלות במהלך הנפקת אישורים היא סוג של הגנה לעומק שמטרתה להגן מפני התנהגות לא תקינה של לקוחות. הקיום של לקוחות כאלה, בלי קשר לשאלה אם רשות האישורים בודקת הוכחת בעלות, עלול להוות פגיעות אבטחתית.

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