Fortanix SDKMS
本教學將說明如何設定 KES 伺服器,以 Fortanix SDKMS 作為持久且安全的金鑰儲存庫。
Fortanix SDKMS
-
建立應用程式
註冊新的應用程式,該應用程式可以驗證並與 Fortanix SDKMS 執行個體通訊。
-
前往 Fortanix SDKMS UI 中的
Apps
區段。 -
為應用程式指定描述性名稱,例如
KES
-
選取
REST API
作為整合 -
選擇
API 金鑰
作為驗證方法
-
-
指派群組
指派的群組會作為應用程式的預設群組。新建立的金鑰會屬於此群組,除非您在 KES 組態檔中指定明確的群組 ID。
-
建立應用程式,並複製應用程式的 API 金鑰。
此金鑰是 KES 用於與 Fortanix SDKMS 通訊的存取憑證。
KES 伺服器設定
KES 伺服器需要 TLS 私密金鑰和憑證。
KES 伺服器是預設安全,且只能使用 TLS 執行。為了簡化,本教學使用自我簽署憑證。
-
為 KES 伺服器產生 TLS 私鑰和憑證
以下指令會產生新的 TLS 私鑰
server.key
和一個自簽署的 X.509 憑證server.cert
,該憑證是發給 IP 位址127.0.0.1
和 DNS 名稱localhost
(作為 SAN)。請自訂指令以符合您的設定。kes tool identity new --server --key server.key --cert server.cert --ip "127.0.0.1" --dns localhost
任何其他用於產生 X.509 憑證的工具也都可以使用。例如,您可以使用
openssl
openssl ecparam -genkey -name prime256v1 | openssl ec -out server.key openssl req -new -x509 -days 30 -key server.key -out server.cert \ -subj "/C=/ST=/L=/O=/CN=localhost" -addext "subjectAltName = IP:127.0.0.1"
-
建立私鑰和憑證
kes tool identity new --key=app.key --cert=app.cert app
您可以隨時計算
app
身分。kes tool identity of app.cert
-
建立設定檔
建立名為
server-config.yml
的設定檔address: 0.0.0.0:7373 admin: identity: disabled # We disable the admin identity since we don't need it in this guide tls: key : server.key cert: server.cert policy: my-app: allow: - /v1/key/create/my-app* - /v1/key/generate/my-app* - /v1/key/decrypt/my-app* identities: - ${APP_IDENTITY} keystore: fortanix: sdkms: endpoint: "<your-fortanix-sdkms-endpoint>" # Use your Fortanix instance endpoint. credentials: key: "<your-api-key>" # Insert the application's API key
-
在新視窗/分頁中啟動 KES 伺服器
export APP_IDENTITY=$(kes tool identity of app.cert) kes server --config=server-config.yml --auth=off
此指令使用--auth=off
,因為我們的root.cert
和app.cert
憑證是自簽署的。 -
在另一個分頁中,連線至伺服器
export KES_CLIENT_CERT=app.cert export KES_CLIENT_KEY=app.key kes key create -k my-app-key
因為我們使用自簽署憑證,所以需要-k
。 -
從先前建立的
my-app-key
衍生和解密資料金鑰kes key derive -k my-app-key { plaintext : ... ciphertext: ... }
kes key decrypt -k my-app-key <base64-ciphertext>
搭配 MinIO 伺服器使用 KES
MinIO 伺服器需要 KES 才能啟用伺服器端資料加密。
請參閱KES for MinIO 指導說明,以取得搭配 MinIO 伺服器使用您新 KES 伺服器所需的其他步驟。
組態參考
以下章節說明金鑰加密服務 (KES) 組態設定,以使用 Fortanix SDKMS 作為根 KMS 來儲存外部金鑰,例如用於 MinIO 伺服器上伺服器端加密的金鑰。