完成数据库敏感信息的加密

This commit is contained in:
dushixiang
2021-04-17 17:34:48 +08:00
parent 11f2d8a1f4
commit bceda9a95c
25 changed files with 566 additions and 40 deletions

View File

@ -108,7 +108,7 @@ Mar 5 20:00:16.923 [DEBU] 用户「admin」密码初始化为: next-terminal
/ | \_/ __ \\ \/ /\ __\ | |_/ __ \_ __ \/ \| |/ \\__ \ | |
/ | \ ___/ > < | | | |\ ___/| | \/ Y Y \ | | \/ __ \| |__
\____|__ /\___ >__/\_ \ |__| |____| \___ >__| |__|_| /__|___| (____ /____/
\/ \/ \/ \/ \/ \/ \/ v0.3.0
\/ \/ \/ \/ \/ \/ \/ v0.4.0
当前数据库模式为mysql
Mar 5 20:00:16.923 [DEBU] 用户「admin」已重置TOTP
@ -117,3 +117,32 @@ Mar 5 20:00:16.923 [DEBU] 用户「admin」已重置TOTP
</details>
<details>
<summary>想要修改数据库敏感信息加密的key怎么办</summary>
首先需要进入程序所在目录使用docker安装的程序目录为/usr/local/next-terminal
执行命令
```shell
./next-terminal --encryption-key 旧的加密key new-encryption-key 新的的加密key
```
成功之后会输出
``` shell
_______ __ ___________ .__ .__
\ \ ____ ___ ____/ |_ \__ ___/__________ _____ |__| ____ _____ | |
/ | \_/ __ \\ \/ /\ __\ | |_/ __ \_ __ \/ \| |/ \\__ \ | |
/ | \ ___/ > < | | | |\ ___/| | \/ Y Y \ | | \/ __ \| |__
\____|__ /\___ >__/\_ \ |__| |____| \___ >__| |__|_| /__|___| (____ /____/
\/ \/ \/ \/ \/ \/ \/ v0.4.0
当前数据库模式为mysql
Mar 5 20:00:16.923 [DEBU] encryption key has being changed.
```
最后重新启动程序并且把加密key修改为新的。
</details>

View File

@ -104,6 +104,7 @@ docker run -d \
| MYSQL_PASSWORD | `mysql`数据库密码 |
| MYSQL_DATABASE | `mysql`数据库名称 |
| SERVER_ADDR | 服务器监听地址,默认`0.0.0.0:8088` |
| ENCRYPTION_KEY | 授权凭证和资产的密码密钥等敏感信息加密的key默认`next-terminal` |
## 其他

View File

@ -147,9 +147,12 @@ sqlite:
file: 'next-terminal.db'
server:
addr: 0.0.0.0:8088
# 当设置下面两个参数时会自动开启https模式
# 当设置下面两个参数时会自动开启https模式(前提是证书文件存在)
# cert: /root/next-terminal/cert.pem
# key: /root/next-terminal/key.pem
# 授权凭证和资产的密码密钥等敏感信息加密的key默认`next-terminal`
#encryption-key: next-terminal
```
启动