Key Manager安装
sudo apt-get install libprocps-dev curl libcurl4-openssl-dev
git clone https://github.com/FISCO-BCOS/key-manager.git
cd key-manager && mkdir build && cd build
cmake .. #后面有两个 . 注意!!
make
#The execution: "key-manager" generated.
./key-manager 8150 123xyz # key-manager <port> <superkeyString>
配置dataKey
cd key-manager/scripts
bash gen_data_secure_key.sh 127.0.0.1 8150 123456
CiherDataKey generated: ed157f4588b86d61a2e1745efe71e6ea
Append these into config.ini to enable disk encryption:
[storage_security]
enable=true
key_manager_ip=127.0.0.1
key_manager_port=8150
cipher_data_key=ed157f4588b86d61a2e1745efe71e6ea
然后修改节点的config.ini
文件,如果需要修改的为node0 nodes/127.0.0.1/node0/config.ini
vim nodes/127.0.0.1/node0/config.ini
修改[storage_security]
中的字段如下:(就是刚刚生成的)
[storage_security]
enable=true
key_manager_ip=127.0.0.1
key_manager_port=8150
cipher_data_key=ed157f4588b86d61a2e1745efe71e6ea
如有多个节点需要加密,每个节点的[storage_security]
的都需要修改。
加密节点私钥
加密节点私钥cd key-manager/scripts
# 参数:ip port 节点私钥文件 cipherDataKey
bash encrypt_node_key.sh 127.0.0.1 8150 ../../nodes/127.0.0.1/node0/conf/node.key ed157f4588b86d61a2e1745efe71e6ea
执行完后
[INFO] File backup to "nodes/127.0.0.1/node0/conf/node.key.bak.1546502474"
[INFO] "nodes/127.0.0.1/node0/conf/node.key" encrypted!
节点运行
cd nodes/127.0.0.1/node0/
./start.sh
正确性判断
1. 节点正常运行,正常共识,不断输出共识打包信息。注意:节点启动之前 先启动 Key Manager
tail -f nodes/127.0.0.1/node0/log/* | grep +++
- Key Manager在节点每次启动时,都会打印一条日志。
[1546504272699][TRACE][Dec]Respond
{
"dataKey" : "313233343536",
"error" : 0,
"info" : "success"
}
标签:127.0,Key,0.1,Manager,manager,key,node0,安装,节点
From: https://blog.csdn.net/Pollsp/article/details/142422305