使用恢复加密单元初始化服务实例
在可以使用 Hyper Protect Crypto Services 实例之前,需要首先通过装入主密钥来初始化服务实例。 本主题指导您完成通过 IBM Cloud TKE CLI 插件使用恢复加密单元来初始化服务实例的步骤。
有关服务实例初始化方法和相关基本概念的简介,请参阅 初始化服务实例 和 引入服务实例初始化方法。
目前,eu-es
区域中的服务实例不支持恢复加密单元。 在其他受支持区域中供应服务实例时,缺省情况下,将启用用于在灾难恢复区域中的恢复加密单元中备份主密钥的选项。 有关受支持区域的更多信息,请参阅 区域和位置。
如果使用智能卡来初始化服务实例,那么恢复加密单元不适用并且可以忽略。 在这种情况下,主密钥的备份依赖于智能卡的备份。
您可以使用 Terraform 通过恢复加密单元自动执行实例初始化。 有关更多信息,请参阅 为 Hyper Protect Crypto Services。
您负责保护用于初始化 Hyper Protect Crypto Services 实例的资产。 有关最佳实践,请参阅 常见问题。
初始化服务实例
要使用恢复加密单元初始化服务实例,请完成以下步骤:
-
完成必备步骤。
-
运行以下命令:
ibmcloud tke auto-init
遵循以下过程来初始化服务实例。 通过遵循提示完成步骤:
-
选择要初始化的实例。
如果您在当前资源组中有多个服务实例,那么此命令将列出所有可用实例,其中包含与每个实例关联的数字。 输入 INSTANCE NUM 以选择要初始化的实例,然后按 Enter 键以继续。
以下输出是显示的示例:
More than one service instance is assigned to the current resource group. INSTANCE NUM INSTANCE ID 1 0a08af7e-02d0-4122-9146-4179b15f9bfb 2 0f130264-12f5-45bf-9bac-975cdb605804 3 bc712c1b-8ff5-4ea0-9cf4-fd74233ceaaf Enter the INSTANCE NUM of the service instance you want to initialize. > 3
选择服务实例后,将选择服务实例的所有加密单元 (包括故障转移加密单元 (如果有))。 这些加密单元必须处于零化状态,也称为 印记方式。 如果没有,那么将报告错误并结束该命令。 如果发生这种情况,您可以使用
ibmcloud tke cryptounit-compare
命令来查看如何配置加密单元。 如果未设置当前主密钥寄存器,那么可以使用ibmcloud tke cryptounit-zeroize
命令将加密单元归零,然后重新运行ibmcloud tke auto-init
命令。如果服务实例的密钥存储器包含数据,那么不得将加密单元归零。 否则,密钥存储器中的所有数据都将丢失,并且您将无法访问服务实例中的任何密钥或数据。
-
设置两个 签名阈值 的值: 签名阈值和撤销签名阈值。
提示时,请先输入签名阈值的数字,然后输入撤销签名阈值的数字。 数字必须在 1 到 8 之间。 两个阈值数字可以不同。 将签名阈值设置为大于 1 的值是对敏感操作实施 定额认证 的一种方法。
以下输出是显示的示例:
ENTER SIGNATURE THRESHOLD VALUES Enter the number of signatures to be required on commands sent to the service instance. This must be a number between 1 and 8. To enforce dual control, this must be at least 2: > 1 Enter the number of signatures to be required on commands to remove an administrator. This must be a number between 1 and 8. To enforce dual control, this must be at least 2: > 1
-
添加 加密单元管理员。
提示时,输入要添加到加密单元的管理员数量。 该数字需要等于或大于您在上一步中设置的签名阈值。
然后,该命令将列出工作站上可用的现有签名密钥文件。 您可以通过选择现有签名密钥文件或生成新的签名密钥来创建管理员。 新的签名密钥文件也保存在您使用本地工作站上的
CLOUDTKEFILES
环境变量指定的目录中。以下输出是显示的示例:
ENTER NUMBER OF ADMINISTRATORS TO INSTALL To initialize and maintain your crypto units, administrators must be installed. Each administrator has an associated signature key. Signature keys are stored in files protected by a password. To use the signature key, you must supply the password. To enforce dual control, each signature key file needs to be assigned to a different user and only that user needs to know the password. You can install up to eight administrators in a crypto unit. To set a signature threshold value of 1 and a revocation signature threshold of 1, you must install at least 1 administrator. Enter the number of administrators you want to install: > 1 SELECT EXISTING SIGNATURE KEY FILES TO USE The following signature key files were found on this workstation: KEYNUM DESCRIPTION SUBJECT KEY IDENTIFIER 1 admin1 665527ed7e97c2a083dab035f40c65... 2 admin2 741a60c0a875cd91195b71f6db3cb5... Enter the KEYNUM of any existing signature key files you want to use to create administrators. If you don't want to use existing signature key files, press enter without entering any KEYNUM values. If you want to use a combination of existing and new signature keys, enter the KEYNUM values of the existing signature key files you want to use. You will be prompted to enter information for any new signature key files after that. Enter the KEYNUM of the existing signature key files you want to use to create administrators: > 1 Enter the password for the signature key identified by: admin1 (665527ed7e97c2a083dab035f40c65...) >
签名密钥文件受密码保护。 您需要记住在创建新的签名密钥文件时输入的密码,并确保不会从工作站中除去这些文件。 否则,您无法执行需要签名的未来管理操作,例如 轮换主密钥。
-
将主密钥装入到加密单元。
随机主密钥值在恢复加密单元中生成,然后传输到服务实例中的所有其他加密单元。
以下输出是显示的示例:
You asked to install one administrator and selected one existing signature key to use. No new signature key files will be created. Installing 1 of 1 administrators.... Setting signature thresholds.... Generating a random master key value.... Transferring the master key value to 1 of 3 crypto units.... Transferring the master key value to 2 of 3 crypto units.... Transferring the master key value to 3 of 3 crypto units.... OK The selected service instance has been initialized. To see what administrators are installed and what signature threshold and master key register values are set, use the 'ibmcloud tke cryptounit-compare' command.
-
-
(可选) 使用以下命令来检查加密单元的状态,以确保所有当前主密钥寄存器都处于
VALID
状态:ibmcloud tke cryptounit-compare
有关完整的主密钥装入过程,请参阅 了解主密钥。
下一步
- 将主密钥装入到服务实例后,可以根据需要轮换主密钥以满足行业标准和加密最佳实践。 有关详细指示信息,请参阅 使用恢复加密单元旋转主密钥。
- 恢复加密单元包含可用于恢复主密钥的主密钥值的备份副本。 有关详细指示信息,请参阅 从恢复加密单元恢复主密钥。
- 有关完整的 TKE CLI 插件命令参考,请参阅 IBM Cloud TKE CLI。