使用 CloudHSM 管理公用程式 (CMU) 來管理使用者。 - AWS CloudHSM

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

使用 CloudHSM 管理公用程式 (CMU) 來管理使用者。

本主題提供有關使用 CloudHSM 管理公用程式 (CMU) (用戶端 SDK 隨附的命令列工具) 管理硬體安全性模組 (HSM) 使用者的 step-by-step 指示。如需 CMU 或 HSM 使用者的詳細資訊,請參閱 CloudHSM 管理公用程式了解 HSM 使用者

使用 CMU 了解 HSM 使用者管理

如要管理 HSM 使用者,您須以加密管理員 (CO) 的使用者名稱和密碼登入 HSM。只有 CO 可以管理使用者。HSM 包含名為 admin 的預設 CO。您可以在啟用叢集時設定 admin 管理員的密碼。

如要使用 CMU,您必須使用設定工具來更新本機組態。CMU 會建立自己的與叢集的連接,且該連接支援叢集。為追蹤叢集資訊,CMU 會維護本機組態檔案。這表示每次使用 CMU 時,您都應先透過執行帶有 --cmu 參數的設定命令列工具來更新組態檔案。如果您使用的是用戶端 SDK 3.2.1 或更早版本,則必須將 --cmu 換成其他參數。如需詳細資訊,請參閱 將 CMU 與用戶端 SDK 3.2.1 及更早版本搭配使用

--cmu 參數需要在叢集中新增 HSM 的 IP 地址。如果您有多個 HSM,則可以使用任何 IP 地址。這可確保 CMU 可在整個叢集中傳播您所做的任何變更。請記住,CMU 會使用其本機檔案來追蹤叢集資訊。如果自上次從特定主機使用 CMU 後叢集已發生變更,則必須將這些變更新增至儲存在該主機上的本機組態檔案中。切勿在使用 CMU 時新增或移除 HSM。

取得 HSM (主控台) 的 IP 位址
  1. 開啟主 AWS CloudHSM 控台,網址為 https://console.aws.amazon.com/cloudhsm/home

  2. 若要變更 AWS 區域,請使用頁面右上角的區域選擇器。

  3. 若要開啟叢集詳細資訊頁面,請在叢集表格中選擇叢集 ID。

  4. 若要取得 IP 地址,請在 HSM 索引標籤上,選擇 ENI IP 地址下列出的其中一個 IP 地址。

取得 HSM 的 IP 位址 ()AWS CLI
  • 使用 AWS CLI中的 describe-clusters 命令取得 HSM 的 IP 地址。在命令輸出中,HSM 的 IP 地址是 EniIp 的值。

    $ aws cloudhsmv2 describe-clusters { "Clusters": [ { ... } "Hsms": [ { ... "EniIp": "10.0.0.9", ... }, { ... "EniIp": "10.0.1.6", ...

將 CMU 與用戶端 SDK 3.2.1 及更早版本搭配使用

透過用戶端 SDK 3.3.0, AWS CloudHSM 增加了對--cmu參數的支援,簡化了更新 CMU 組態檔的程序。如果您使用的是用戶端 SDK 3.2.1 或更早版本的 CMU,您必須繼續使用 -a-m 參數來更新組態檔案。如需這些參數的詳細資訊,請參閱設定工具

下載 CloudHSM 管理公用程式

無論您使用的是用戶端 SDK 5 還是用戶端 SDK 3,HSM 使用者管理任務均可使用最新版本的 CMU。

如要下載並安裝 CMU
  • 下載並安裝 CMU。

    Amazon Linux
    $ wget https://s3.amazonaws.com/cloudhsmv2-software/CloudHsmClient/EL6/cloudhsm-mgmt-util-latest.el6.x86_64.rpm
    $ sudo yum install ./cloudhsm-mgmt-util-latest.el6.x86_64.rpm
    Amazon Linux 2
    $ wget https://s3.amazonaws.com/cloudhsmv2-software/CloudHsmClient/EL7/cloudhsm-mgmt-util-latest.el7.x86_64.rpm
    $ sudo yum install ./cloudhsm-mgmt-util-latest.el7.x86_64.rpm
    CentOS 7.8+
    $ wget https://s3.amazonaws.com/cloudhsmv2-software/CloudHsmClient/EL7/cloudhsm-mgmt-util-latest.el7.x86_64.rpm
    $ sudo yum install ./cloudhsm-mgmt-util-latest.el7.x86_64.rpm
    CentOS 8.3+
    $ wget https://s3.amazonaws.com/cloudhsmv2-software/CloudHsmClient/EL8/cloudhsm-mgmt-util-latest.el8.x86_64.rpm
    $ sudo yum install ./cloudhsm-mgmt-util-latest.el8.x86_64.rpm
    RHEL 7 (7.8+)
    $ wget https://s3.amazonaws.com/cloudhsmv2-software/CloudHsmClient/EL7/cloudhsm-mgmt-util-latest.el7.x86_64.rpm
    $ sudo yum install ./cloudhsm-mgmt-util-latest.el7.x86_64.rpm
    RHEL 8 (8.3+)
    $ wget https://s3.amazonaws.com/cloudhsmv2-software/CloudHsmClient/EL8/cloudhsm-mgmt-util-latest.el8.x86_64.rpm
    $ sudo yum install ./cloudhsm-mgmt-util-latest.el8.x86_64.rpm
    Ubuntu 16.04 LTS
    $ wget https://s3.amazonaws.com/cloudhsmv2-software/CloudHsmClient/Xenial/cloudhsm-mgmt-util_latest_amd64.deb
    $ sudo apt install ./cloudhsm-mgmt-util_latest_amd64.deb
    Ubuntu 18.04 LTS
    $ wget https://s3.amazonaws.com/cloudhsmv2-software/CloudHsmClient/Bionic/cloudhsm-mgmt-util_latest_u18.04_amd64.deb
    $ sudo apt install ./cloudhsm-mgmt-util_latest_u18.04_amd64.deb
    Windows Server 2012
    1. 下載 CloudHSM 管理公用程式

    2. 以視窗系統管理權限執行 CMU 安裝程式 (AWSCloudHSMManagementUtil-latest.msi)。

    Windows Server 2012 R2
    1. 下載 CloudHSM 管理公用程式

    2. 以視窗系統管理權限執行 CMU 安裝程式 (AWSCloudHSMManagementUtil-latest.msi)。

    Windows Server 2016
    1. 下載 CloudHSM 管理公用程式

    2. 以視窗系統管理權限執行 CMU 安裝程式 (AWSCloudHSMManagementUtil-latest.msi)。

如何使用 CMU 管理 HSM 使用者

本節介紹了使用 CMU 管理 HSM 使用者的基本命令。

使用 createUser 在 HSM 上建立新使用者。您必須以 CO 的身份登入才能建立使用者。

如要建立新的 CO 使用者
  1. 使用設定工具來更新 CMU 組態。

    Linux
    $ sudo /opt/cloudhsm/bin/configure --cmu <IP address>
    Windows
    C:\Program Files\Amazon\CloudHSM\bin\ configure.exe --cmu <IP address>
  2. 啟動 CMU。

    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
  3. 以 CO 使用者身分登入 HSM。

    aws-cloudhsm>loginHSM CO admin co12345

    請確定連線 CMU 清單的數目與叢集中的 HSM 數目相符。如不符,請登出並重新啟動。

  4. 使用 createUser 來建立名為 example_officer 的 CO 使用者,密碼為 password1

    aws-cloudhsm>createUser CO example_officer 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)?
  5. 輸入 y

如要建立新的 CU 使用者
  1. 使用設定工具來更新 CMU 組態。

    Linux
    $ sudo /opt/cloudhsm/bin/configure --cmu <IP address>
    Windows
    C:\Program Files\Amazon\CloudHSM\bin\ configure.exe --cmu <IP address>
  2. 啟動 CMU。

    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
  3. 以 CO 使用者身分登入 HSM。

    aws-cloudhsm>loginHSM CO admin co12345

    請確定連線 CMU 清單的數目與叢集中的 HSM 數目相符。如不符,請登出並重新啟動。

  4. 使用 createUser 來建立名為 example_user 的 CU 使用者,密碼為 password1

    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)?
  5. 輸入 y

如需 createUser 的詳細資訊,請參閱 createUser

使用 listUsers 命令列出叢集上的所有使用者。您無需登入即可執行 listUsers 且所有使用者類型都可以列出使用者。

如要列出叢集中的所有使用者
  1. 使用設定工具來更新 CMU 組態。

    Linux
    $ sudo /opt/cloudhsm/bin/configure --cmu <IP address>
    Windows
    C:\Program Files\Amazon\CloudHSM\bin\ configure.exe --cmu <IP address>
  2. 啟動 CMU。

    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
  3. listUsers 來列出叢集上的所有使用者。

    aws-cloudhsm>listUsers

    CMU 列出了叢集上的所有使用者。

    Users on server 0(10.0.2.9): Number of users found:4 User Id User Type User Name MofnPubKey LoginFailureCnt 2FA 1 AU app_user NO 0 NO 2 CO example_officer NO 0 NO 3 CU example_user NO 0 NO Users on server 1(10.0.3.11): Number of users found:4 User Id User Type User Name MofnPubKey LoginFailureCnt 2FA 1 AU app_user NO 0 NO 2 CO example_officer NO 0 NO 3 CU example_user NO 0 NO Users on server 2(10.0.1.12): Number of users found:4 User Id User Type User Name MofnPubKey LoginFailureCnt 2FA 1 AU app_user NO 0 NO 2 CO example_officer NO 0 NO 3 CU example_user NO 0 NO

如需 listUsers 的詳細資訊,請參閱 listUsers

使用 changePswd 變更密碼。

使用者類型和密碼需區分大小寫,但使用者名稱不區分大小寫。

管理員、加密使用者 (CU) 和設備使用者 (AU) 只能變更自己的密碼。如要變更其他使用者的密碼,您必須以 CO 身分登入。您無法變更目前已登入使用者的密碼。

如要變更您自己的密碼
  1. 使用設定工具來更新 CMU 組態。

    Linux
    $ sudo /opt/cloudhsm/bin/configure --cmu <IP address>
    Windows
    C:\Program Files\Amazon\CloudHSM\bin\ configure.exe --cmu <IP address>
  2. 啟動 CMU。

    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
  3. 登入 HSM。

    aws-cloudhsm>loginHSM CO admin co12345

    請確定連線 CMU 清單的數目與叢集中的 HSM 數目相符。如不符,請登出並重新啟動。

  4. 使用 changePswd 變更您自己的密碼。

    aws-cloudhsm>changePswd CO example_officer <new password>

    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)?
  5. 輸入 y

    CMU 會提示您變更密碼的操作。

    Changing password for example_officer(CO) on 3 nodes
如要變更其他使用者的密碼
  1. 使用設定工具來更新 CMU 組態。

    Linux
    $ sudo /opt/cloudhsm/bin/configure --cmu <IP address>
    Windows
    C:\Program Files\Amazon\CloudHSM\bin\ configure.exe --cmu <IP address>
  2. 啟動 CMU。

    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
  3. 以 CO 使用者身分登入 HSM。

    aws-cloudhsm>loginHSM CO admin co12345

    請確定連線 CMU 清單的數目與叢集中的 HSM 數目相符。如不符,請登出並重新啟動。

  4. 使用 changePswd 變更其他使用者的密碼。

    aws-cloudhsm>changePswd CU example_user <new password>

    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)?
  5. 輸入 y

    CMU 會提示您變更密碼的操作。

    Changing password for example_user(CU) on 3 nodes

如需 changePswd 的詳細資訊,請參閱 changePswd

使用 deleteUser 刪除使用者。您必須以 CO 身分登入才能刪除其他使用者。

提示

您無法刪除擁有金鑰的加密使用者 (CU)。

如要刪除使用者
  1. 使用設定工具來更新 CMU 組態。

    Linux
    $ sudo /opt/cloudhsm/bin/configure --cmu <IP address>
    Windows
    C:\Program Files\Amazon\CloudHSM\bin\ configure.exe --cmu <IP address>
  2. 啟動 CMU。

    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
  3. 以 CO 使用者身分登入 HSM。

    aws-cloudhsm>loginHSM CO admin co12345

    請確定連線 CMU 清單的數目與叢集中的 HSM 數目相符。如不符,請登出並重新啟動。

  4. 使用 deleteUser 刪除使用者。

    aws-cloudhsm>deleteUser CO example_officer

    CMU 會刪除使用者。

    Deleting user example_officer(CO) on 3 nodes deleteUser success on server 0(10.0.2.9) deleteUser success on server 1(10.0.3.11) deleteUser success on server 2(10.0.1.12)

如需 deleteUser 的詳細資訊,請參閱 deleteUser