Tutorial Tutorial Application Services Application Services ~21 phút ~21 min Đồng bộ 2026-06-10 Synced 2026-06-10

AWS cloud HSM AWS cloud HSM

Hướng dẫn chi tiết đồng bộ từ docs Cloudflare — mỗi section có backlink tới đúng vị trí trên trang gốc. Detailed guide synced from Cloudflare docs — each section links to the matching anchor on the official page.

← Danh mục ← Catalog

Giải thích nhanh Quick context

Thuộc nhóm Application Services — tập trung bảo vệ, tăng tốc và vận hành ứng dụng/web phía trước origin. Tutorial «AWS cloud HSM» giúp bạn làm quen luồng triển khai thật — phù hợp đọc trước khi mở tài liệu gốc tiếng Anh. Docs gốc chia khoảng 2 bước chính; bản tóm tắt dưới đây giúp bạn nắm khung trước khi làm theo từng lệnh.

Learn how to use Keyless SSL with AWS CloudHSM.

Lưu ý trước khi làm Notes before you start

  • Đây là bản tóm tắt trên Orange Cloud Learning Hub — không thay thế tài liệu chính thức. This is a summary on Orange Cloud Learning Hub — it does not replace the official documentation.
  • Luôn mở liên kết «Tài liệu gốc» bên dưới khi cần lệnh CLI, snippet code và ảnh minh họa đầy đủ. Open the Official docs link below for CLI commands, code snippets, and full screenshots.
  • Yêu cầu trước (từ docs): Provisioned an AWS CloudHSM cluster ↗ . · Cài đặted the appropriate software library for PKCS#11 ↗. Prerequisites (from docs): Provisioned an AWS CloudHSM cluster ↗ . · Installed the appropriate software library for PKCS#11 ↗.
  • Docs Cloudflare cập nhật thường xuyên — đối chiếu ngày «Rà soát lần cuối» trên trang gốc khi triển khai production. Cloudflare docs change frequently — verify the Last reviewed date on the official page before production use.

Tổng quan Overview

Phần «Tổng quan» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Overview" section below — open the official docs link for full screenshots and configuration tabs.

Mở section docs gốc ↗ Open source section ↗

This example imports an existing key pair, but you may prefer to generate your key on the HSM ↗.

---

Trước khi bắt đầu Before you start

Phần «Trước khi bắt đầu» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "Before you start" section below — open the official docs link for full screenshots and configuration tabs.

Mở section docs gốc ↗ Open source section ↗

Make sure you have:

---

1. Import public và private key to HSM 1. Import the public and private key to the HSM

Phần «Import public và private key to HSM» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "1. Import the public and private key to the HSM" section below — open the official docs link for full screenshots and configuration tabs.

Mở section docs gốc ↗ Open source section ↗

Before importing the public key, extract it from the certificate provided by your CA. Place the contents of your private key in privkey.pem and then run the following (replacing certificate.pem with your actual certificate) to populate pubkey.pm.

text
keyserver$ openssl x509 -pubkey -noout -in certificate.pem > pubkey.pem

Log in to the CloudHSM using a previously created crypto user ↗ (CU) account and generate a key encryption key that will be used to import your private key.

text
keyserver$ /opt/cloudhsm/bin/key_mgmt_util

Command: loginHSM -u CU -s patrick -p donahue

Command: genSymKey -t 31 -s 16 -sess -l import-wrapping-key

...

Symmetric Key Created.  Key Handle: 658

...

Referencing the key handle returned above, import the private and public key and then log out of the HSM:

text
Command: importPrivateKey -f privkey.pem -l mykey -id 1 -w 658

...

Cfm3WrapHostKey returned: 0x00 : HSM Return: SUCCESS

Cfm3CreateUnwrapTemplate returned: 0x00 : HSM Return: SUCCESS

Cfm3UnWrapKey returned: 0x00 : HSM Return: SUCCESS

...

Private Key Unwrapped.  Key Handle: 658


Command: importPubKey -f pubkey.pem -l mykey -id 1

Cfm3CreatePublicKey returned: 0x00 : HSM Return: SUCCESS

...

Public Key Handle: 941


Command: logoutHSM

Command: exit

---

2. Modify gokeyless config file và restart service 2. Modify the gokeyless config file and restart the service

Phần «Modify gokeyless config file và restart service» — đọc hướng dẫn bên dưới, dùng liên kết docs gốc để xem ảnh minh họa và tab cấu hình đầy đủ.

Read the "2. Modify the gokeyless config file and restart the service" section below — open the official docs link for full screenshots and configuration tabs.

Mở section docs gốc ↗ Open source section ↗

Now that the keys are in place, we need to modify the configuration file that the key server will read on startup. Change the object=mykey and pin-value=username:password values to match the key label you provided and CU user you created.

Open /etc/keyless/gokeyless.yaml and immediately after:

YAML

text
private_key_stores:

  - dir: /etc/keyless/keys

add:

YAML

text
- uri: pkcs11:token=cavium;object=mykey?module-path=/opt/cloudhsm/lib/libcloudhsm_pkcs11_standard.so&pin-value=patrick:donahue&max-sessions=1

With the config file saved, restart gokeyless and verify it started successfully.

Terminal window

text
sudo systemctl restart gokeyless.service

sudo systemctl status gokeyless.service -l
json
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"/directory/","name":"Directory"}},{"@type":"ListItem","position":2,"item":{"@id":"/ssl/","name":"SSL/TLS"}},{"@type":"ListItem","position":3,"item":{"@id":"/ssl/keyless-ssl/","name":"Keyless SSL"}},{"@type":"ListItem","position":4,"item":{"@id":"/ssl/keyless-ssl/hardware-security-modules/","name":"Hardware security modules"}},{"@type":"ListItem","position":5,"item":{"@id":"/ssl/keyless-ssl/hardware-security-modules/aws-cloud-hsm/","name":"AWS cloud HSM"}}]}

Xem bản đầy đủ trên developers.cloudflare.com (ảnh, tab cấu hình). View the full guide on developers.cloudflare.com (images, config tabs).

Tài liệu gốc ↗ Official docs ↗