使用 CACLI 进行恢复演练
适用场景
我们建议 Admin 定期进行 Unseal Keys 检查,如每间隔 6 个月进行一次检查,检查 Unseal keys 备份是否可以正常恢复以及是否正确。CA 提供了 verify 功能支持恢复演练。
准备工作
| 准备项 | 准备结果示例 |
| 确认参与演练的管理员 | Admin1、Admin2、Admin3 |
| 确认运维人员 | 确认由运维人员 OP 协助完成演练 |
操作步骤
操作步骤概述
1、OP 准备 CACLI 机器和环境
2、Admin 合作完成 CA verify
3、OP 进行资源清理收尾工作
OP 准备 CACLI 机器和环境
1、OP 准备 CACLI1 、CACLI2、CACLI3 三台机器,分别用于 Admin1、Admin2、Admin3 执行 CACLI 命令,每个 Admin 使用各自的机器执行命令;OP 在所有机器上准备好 Docker 环境、smn-ca Docker 镜像
2、OP 根据《SMN CACLI 部署》文档分别在 CACLI1、CACLI2、CACLI3 机器上部署好 CACLI,并执行下面命令验证 CACLI 可正常使用,其中 CA_ADDR 环境变量中的 IP 设置为 CA Server1 的主机 IP,需要注意,镜像仓库地址 registry.docker.com/smn/smn-ca 应该修改为开发者内网仓库地址,smn-ca 版本 X.Y.Z 修改为当前使用或者最新的 ca 版本
$ docker run \
-it \
--rm \
--name mpcca-cli \
-e "CA_ADDR=http://CA Server1's IP:8090" \
-v /etc/sgx_default_qcnl.conf:/etc/sgx_default_qcnl.conf \
registry.gitlab.com/safeheron-mpc-node/smn/smn-ca:X.Y.Z \
cacli status
-------------------- Output Example --------------------
CA Status: Authorized
Seal Type: Shamir
Total Shares: 3
Threshold: 2
Version: 1.1.0
Root Key Hash: 1b06962e****5af01edf
MRENCLAVE: a9408284******23f5643
MRENCLAVE_SIG: business******de1003、OP 准备必要的信息分别发送给三位 Admin,信息包括:
- 如何连接和使用 CACLI1、CACLI2、CACLI3 服务器,SSH 凭证或者云服务厂商凭证
- 通过 Docker 使用 CACLI 的命令,写好环境变量、镜像地址、镜像版本、需要执行的命令等,减少 Admin 操作步骤和复杂度,比如准备好以下信息,只需要管理员复制粘贴即可:
docker run \
-it \
--rm \
--name mpcca-cli \
-e "CA_ADDR=http://192.168.0.100:8090" \
-v /etc/sgx_default_qcnl.conf:/etc/sgx_default_qcnl.conf \
registry.docker.com/smn/smn-ca:1.1.0 \
cacli admin verify --participant 3
docker run \
-it \
--rm \
--name mpcca-cli \
-e "CA_ADDR=http://192.168.0.100:8090" \
-v /etc/sgx_default_qcnl.conf:/etc/sgx_default_qcnl.conf \
registry.docker.com/smn/smn-ca:1.1.0 \
cacli admin verify --input --nonce=replace-me- 整理一份适合内部使用的操作文档,供 Admin 参考使用
Admin 合作完成 CA verify
1、Admin1 登录 CACLI1 执行以下命令,启动 CA 恢复演练任务,执行命令后在提示处输入备份的授权密钥分片并回车,验证完成后把命令输出的 CA Verify Operation Nonce: 0d32f407-e5e9-41b0-87b8-3ab3e64f41c8发送给 Admin2 和 Admin3,并通知 Admin2 和 Admin3 可以进行演练操作。
$ docker run \
-it \
--rm \
--name mpcca-cli \
-e "CA_ADDR=http://192.168.0.100:8090" \
-v /etc/sgx_default_qcnl.conf:/etc/sgx_default_qcnl.conf \
registry.gitlab.com/safeheron-mpc-node/smn/smn-ca:1.1.0 \
cacli admin verify --participant 3
-------------------- Input Tips ------------------------
Please input your unseal key(Input will be hidden, and type Enter to confirm input. The nonce of the current operation is '0d32f407-e5e9-41b0-87b8-3ab3e64f41c8'): <Unseal Key>
-------------------- Output Example --------------------
Seal Type: Shamir
CA Verify Operation Nonce: 0d32f407-e5e9-41b0-87b8-3ab3e64f41c8
Total Shares: 3
Threshold: 2
Verify Progress: 1/3
Verify Success: unfinished
...2、Admin2 登录 CACLI2 执行以下命令,并根据提示输入授权密钥分片Unseal Key进行验证。命令参数--nonce 的值为 Admin1 提供的 CA Verify Operation Nonce
$ docker run \
-it \
--rm \
--name mpcca-cli \
-e "CA_ADDR=http://192.168.0.100:8090" \
-v /etc/sgx_default_qcnl.conf:/etc/sgx_default_qcnl.conf \
registry.gitlab.com/safeheron-mpc-node/smn/smn-ca:1.1.0 \
cacli admin verify --input --nonce=0d32f407-e5e9-41b0-87b8-3ab3e64f41c8
-------------------- Input Tips ------------------------
Please input your unseal key(Input will be hidden, and type Enter to confirm input. The nonce of the current operation is '0d32f407-e5e9-41b0-87b8-3ab3e64f41c8'): <Unseal Key>
-------------------- Output Example --------------------
Seal Type: Shamir
CA Verify Operation Nonce: 0d32f407-e5e9-41b0-87b8-3ab3e64f41c8
Total Shares: 3
Threshold: 2
Verify Progress: 2/3
Verify Success: unfinished
...3、Admin3 登录 CACLI3 执行以下命令,并根据提示输入授权密钥分片Unseal Key进行验证,并确保输出的Verify status为 true。命令参数--nonce 的值为 Admin1 提供的 CA Verify Operation Nonce
$ docker run \
-it \
--rm \
--name mpcca-cli \
-e "CA_ADDR=http://192.168.0.100:8090" \
-v /etc/sgx_default_qcnl.conf:/etc/sgx_default_qcnl.conf \
registry.gitlab.com/safeheron-mpc-node/smn/smn-ca:1.0.0 \
cacli admin verify --input --nonce=0d32f407-e5e9-41b0-87b8-3ab3e64f41c8
-------------------- Input Tips ------------------------
Please input your unseal key(Input will be hidden, and type Enter to confirm input. The nonce of the current operation is 'e88c97d6-cc6f-4356-9cd1-89d9b40b2839'): <Unseal Key>
-------------------- Output Example --------------------
Seal Type: Shamir
CA Verify Operation Nonce: 0d32f407-e5e9-41b0-87b8-3ab3e64f41c8
Total Shares: 3
Threshold: 2
Verify Progress: 3/3
Verify Success: true
...4、三位 Admin 验证各自的 Unseal Keys 之后,如果Verify Success为 true,标识验证成功,整个演练完成,通知 OP 进入下个步骤。
OP 进行资源清理收尾工作
CACLI1、 CACLI2、CACLI3 主机中不保存任何数据,在以上所有操作执行完成后,即可释放主机资源。后续在需要时按需提供主机部署 CACLI 即可。