使用 Google Cloud 控制台签发证书

本快速入门指南介绍了如何使用 Google Cloud 控制台通过 Certificate Authority Service 生成或颁发证书。

了解如何在不预配或维护基础架构的情况下安全地管理私有证书授权机构 (CA)。

准备工作

  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.

    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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. 如果您要使用现有项目来完成本指南,请验证您是否拥有完成本指南所需的权限。如果您创建了新项目,则您已拥有所需的权限。

  4. Verify that billing is enabled for your Google Cloud project.

  5. Enable the Certificate Authority Service API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  6. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  7. 如果您要使用现有项目来完成本指南,请验证您是否拥有完成本指南所需的权限。如果您创建了新项目,则您已拥有所需的权限。

  8. Verify that billing is enabled for your Google Cloud project.

  9. Enable the Certificate Authority Service API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  10. 所需的角色

    如需获得完成本快速入门所需的权限,请让您的管理员为您授予项目的以下 IAM 角色:

    如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限

    您也可以通过自定义角色或其他预定义角色来获取所需的权限。

    创建 CA 池

    CA 池是包含多个 CA 的集合。CA 池能够轮替信任链,而不会中断或停止工作负载。CA 池位于单个Google Cloud 位置,创建后便无法更改。

    如需使用默认设置创建 CA 池,请执行以下操作:

    1. 前往 Google Cloud 控制台中的 Certificate Authority Service 页面。

      前往 Certificate Authority Service

    2. CA 池管理器标签页下,点击 创建池

    3. 创建 CA 池页面上,为 CA 池添加名称。

    4. 点击区域,然后选择 us-east1(南卡罗来纳)作为 CA 池的区域。

    5. 在每个步骤中,点击下一步

    6. 点击完成

    您可以在 CA 池管理器标签页下的 CA 池列表中看到此 CA 池。

    创建根 CA

    CA 池在创建时为空。您必须向 CA 池添加 CA 才能请求证书。

    根 CA 具有位于客户端的受信任证书存储区中的自签名证书。本部分介绍了如何向您创建的 CA 池添加根 CA。

    如需向 CA 池添加根 CA,请执行以下操作:

    1. Certificate Authority Service 页面上,点击 CA 管理器
    2. 点击创建 CA 展开箭头,然后选择在现有 CA 池中创建 CA
    3. 选择您创建的 CA 池。
    4. 点击继续
    5. 选择 CA 类型 部分,点击继续
    6. 组织 (O) 字段中,输入您组织的名称。
    7. CA 通用名称 (CN) 字段中,输入 CA 的名称。请记下 CA 名称,因为您在申请证书时需要用到该名称。
    8. 点击每个步骤中的继续
    9. 查看 CA 的详细信息,然后点击完成

    可选:创建从属 CA 池

    借助从属 CA 池,您可以组织和管理多个从属 CA。根 CA 会验证并签署从属 CA 池中的所有 CA。

    如需使用默认设置创建从属 CA 池,请执行以下操作:

    1. Certificate Authority Service 页面上,点击 CA 池管理器
    2. 点击 Create pool(创建池)。
    3. 创建 CA 池 页面上,为从属 CA 池添加名称。

    4. 点击区域,然后选择 us-east1(南卡罗来纳)作为下级 CA 池的区域。

    5. 在每个步骤中,点击下一步

    6. 点击完成

    确保从属 CA 池在 CA 池管理器标签页下的 CA 池列表中可用。

    可选:创建由根 CA 签名的从属 CA

    下级 CA 负责向需要证书的实体(例如 Web 服务器、用户和设备)分发证书。从属 CA 在高度敏感的根 CA 与日常证书颁发之间创建了一个隔离层。

    如需生成由您之前创建的根 CA 签名的从属 CA,请执行以下操作:

    1. Certificate Authority Service 页面上,点击 CA 管理器
    2. 点击创建 CA 展开箭头,然后选择在现有 CA 池中创建 CA
    3. 选择您创建的从属 CA 池。
    4. 点击继续
    5. 点击从属 CA
    6. 点击 Root CA is in Google Cloud
    7. 签名证书授权机构字段中,点击浏览
    8. 选择 CA 对话框中,选择在创建根 CA 部分中创建的根 CA。
    9. 点击确认
    10. 有效期字段中,输入您希望下级 CA 证书的有效期。
    11. 点击继续
    12. 组织 (O) 字段中,输入您组织的名称。
    13. CA 通用名称 (CN) 字段中,输入下级 CA 的名称。 请记下从属 CA 名称,因为您需要使用它来请求证书。
    14. 点击每个步骤中的继续
    15. 查看下级 CA 的详细信息,然后点击完成

    请求证书

    如需使用 CA 请求证书,请执行以下操作:

    1. 证书授权机构页面上,点击申请证书
    2. 点击输入详细信息

       Google Cloud 控制台中的“申请证书”页面,其中突出显示了“输入详细信息”选项。

    3. 添加域名下,输入您要使用此证书保护的网站的完全限定域名。

    4. 点击下一步

    5. 配置密钥大小和算法下,点击继续

      您会看到生成的证书,您可以复制或下载该证书。如需复制证书,请点击

       Google Cloud 控制台中显示的生成的证书,其中包含复制或下载选项。

    6. 点击完成

    清理

    撤消证书并删除您为本快速入门创建的 CA 池、CA 和项目,以进行清理。

    1. 撤消证书。

      1. 点击专用证书管理器标签页。
      2. 在证书列表中,点击要删除的证书所在行中的 查看更多
      3. 点击撤消
      4. 在随即打开的对话框中,点击确认
    2. 删除 CA。

      您只能在撤消 CA 颁发的所有证书后才能删除该 CA。

      撤消证书后,请执行以下操作:

      1. 在 CA 列表中,选择要删除的 CA。
      2. 点击 删除。系统会显示删除证书授权机构对话框。
      3. 可选:如果符合以下条件,请选中一个或两个复选框:
        • 删除此 CA(即使存在有效证书)

          此选项可让您删除具有有效证书的 CA。删除具有有效证书的 CA 可能会导致依赖这些证书的网站、应用或系统出现故障。我们建议您先撤消 CA 颁发的所有有效证书,然后再删除该 CA。

        • 跳过 30 天的宽限期,立即删除此 CA

          30 天的宽限期让您有时间撤消此 CA 颁发的所有证书,并验证是否没有系统依赖于此 CA。我们建议在非生产或测试环境中使用此选项,以防止可能出现的中断和数据丢失。

      4. 点击确认

      CA 状态更改为 Deleted。CA 会在您发起删除操作 30 天后永久删除。

    3. 删除 CA 池。

      只有在 CA Service 永久删除 CA 后,您才能删除 CA 池。

      删除 CA 池中的 CA 后,请执行以下操作:

      1. 点击 CA 池管理器标签页。
      2. 在 CA 池列表中,选择要删除的 CA 池。
      3. 点击 删除
      4. 永久删除 CA 池。
      5. 在随即打开的对话框中,点击确认
    4. 如需删除项目,请执行以下操作:

      1. In the Google Cloud console, go to the Manage resources page.

        Go to Manage resources

      2. In the project list, select the project that you want to delete, and then click Delete.
      3. In the dialog, type the project ID, and then click Shut down to delete the project.

    后续步骤