生成自签名证书
参考文档: openssl教程
mkdir certs;cd certs
openssl req \
-newkey rsa:2048 -nodes -keyout domain.key \
-x509 -days 365 -out domain.crt
生成基础验证密钥
-
使用htpasswd生成
(1)安装htpasswd命令
sudo apt install apache2-utils
(2)显示加密后的用户名和密码
htpasswd -n admin
-
使用python生成
(1)安装python3-bcrypt模块
sudo apt install python3-bcrypt
(2)保存到gen-pass.py文件
import getpass
import bcrypt
password = getpass.getpass("password: ")
hashed_password = bcrypt.hashpw(password.encode("utf-8"), bcrypt.gensalt())
print(hashed_password.decode())
(3)运行gen-pass.py文件
python3 gen-pass.py