CloudHSM 管理实用程序 (CMU) 入门 - AWS CloudHSM

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

CloudHSM 管理实用程序 (CMU) 入门

CloudHSM 管理实用程序 (CMU) 可帮助您管理硬件安全模块 (HSM) 用户。使用本主题开始执行基础 HSM 用户管理任务,例如创建用户、列出用户以及将 CMU 连接至集群。

  1. 若要使用 CMU,必须先使用配置工具,更新本地 CMU 配置中的 --cmu 参数和集群 HSM 中的其中一项 IP 地址。当您使用 CMU 完成此操作,确保您在管理集群所有 HSM 的 HSM 用户。

    Linux
    $ sudo /opt/cloudhsm/bin/configure --cmu <IP address>
    Windows
    C:\Program Files\Amazon\CloudHSM\bin\ configure.exe --cmu <IP address>
  2. 使用以下命令以交互模式启动 CLI。

    Linux
    $ /opt/cloudhsm/bin/cloudhsm_mgmt_util /opt/cloudhsm/etc/cloudhsm_mgmt_util.cfg
    Windows
    C:\Program Files\Amazon\CloudHSM> .\cloudhsm_mgmt_util.exe C:\ProgramData\Amazon\CloudHSM\data\cloudhsm_mgmt_util.cfg

    输出应与以下内容类似,具体取决于您拥有的 HSM 的数量。

    Connecting to the server(s), it may take time depending on the server(s) load, please wait... Connecting to server '10.0.2.9': hostname '10.0.2.9', port 2225... Connected to server '10.0.2.9': hostname '10.0.2.9', port 2225. Connecting to server '10.0.3.11': hostname '10.0.3.11', port 2225... Connected to server '10.0.3.11': hostname '10.0.3.11', port 2225. Connecting to server '10.0.1.12': hostname '10.0.1.12', port 2225... Connected to server '10.0.1.12': hostname '10.0.1.12', port 2225.

    当 cloudhsm_mgmt_util 运行时,提示符将变为 aws-cloudhsm>

  3. 使用 loginHSM 命令登录到集群。任何类型的任何用户均可使用此命令登录集群。

    以下示例日志中的命令将登录 admin,即默认加密员 (CO)。您在激活集群时设置该用户的密码。您可以使用 -hpswd 参数隐藏您的密码。

    aws-cloudhsm>loginHSM CO admin -hpswd

    系统将会提示您输入密码。您输入密码后,系统隐藏密码,输出显示命令成功,且您已连接至集群上的所有 HSM。

    Enter password: loginHSM success on server 0(10.0.2.9) loginHSM success on server 1(10.0.3.11) loginHSM success on server 2(10.0.1.12)
  4. 使用 listUsers 列出集群上的所有用户。

    aws-cloudhsm>listUsers

    CMU 会列出集群上的所有用户。

    Users on server 0(10.0.2.9): Number of users found:2 User Id User Type User Name MofnPubKey LoginFailureCnt 2FA 1 CO admin NO 0 NO 2 AU app_user NO 0 NO Users on server 1(10.0.3.11): Number of users found:2 User Id User Type User Name MofnPubKey LoginFailureCnt 2FA 1 CO admin NO 0 NO 2 AU app_user NO 0 NO Users on server 2(10.0.1.12): Number of users found:2 User Id User Type User Name MofnPubKey LoginFailureCnt 2FA 1 CO admin NO 0 NO 2 AU app_user NO 0 NO
  5. 使用 createUser 创建名为 example_user 的 CU 用户,密码为 password1

    您通过应用程序中的 CU 用户执行加密和密钥管理操作。由于您在第 3 步中以 CO 用户身份登录,因此您可以创建 CU 用户。只有 CO 用户可通过 CMU 执行用户管理任务,例如创建和删除用户以及更改其他用户密码。

    aws-cloudhsm>createUser CU example_user password1

    CMU 会提示您关于创建用户操作的信息。

    *************************CAUTION******************************** This is a CRITICAL operation, should be done on all nodes in the cluster. AWS does NOT synchronize these changes automatically with the nodes on which this operation is not executed or failed, please ensure this operation is executed on all nodes in the cluster. **************************************************************** Do you want to continue(y/n)?
  6. 若要创建 CU 用户example_user,请键入 y

  7. 使用 listUsers 列出集群上的所有用户。

    aws-cloudhsm>listUsers

    CMU 列出了集群中的所有用户,包括您刚创建的新 CU 用户。

    Users on server 0(10.0.2.9): Number of users found:3 User Id User Type User Name MofnPubKey LoginFailureCnt 2FA 1 CO admin NO 0 NO 2 AU app_user NO 0 NO 3 CU example_user NO 0 NO Users on server 1(10.0.3.11): Number of users found:3 User Id User Type User Name MofnPubKey LoginFailureCnt 2FA 1 CO admin NO 0 NO 2 AU app_user NO 0 NO 3 CU example_user NO 0 NO Users on server 2(10.0.1.12): Number of users found:3 User Id User Type User Name MofnPubKey LoginFailureCnt 2FA 1 CO admin NO 0 NO 2 AU app_user NO 0 NO 3 CU example_user NO 0 NO
  8. 使用 logoutHSM 命令可从 HSM 退出。

    aws-cloudhsm>logoutHSM logoutHSM success on server 0(10.0.2.9) logoutHSM success on server 1(10.0.3.11) logoutHSM success on server 2(10.0.1.12)
  9. 使用 quit 命令停止 cloudhsm_mgmt_util。

    aws-cloudhsm>quit disconnecting from servers, please wait...