Promethues 添加访问密码
问题: promethues默认设置安全验证,可能造成安全问题
#1,安装软件生成http访问密码
[root@test1 prometheus-3.2.1.linux-arm64]# yum -y install httpd-tools
[root@test1 prometheus-3.2.1.linux-arm64]# htpasswd -nBbC 12 admin pass123
#htpasswd -nb[mBdps] [-C cost] username password
# -n Don't update file; display results on stdout.
# -B Force bcrypt encryption of the password (very secure).
# -b Use the password from the command line rather than prompting for it.
# -C Set the computing time used for the bcrypt algorithm (higher is more secure but slower, default: 5, valid: 4 to 17).
admin:$2y$12$Hytvc26EHNEavtPZ4LrYf.Aj2SBvnlQG.RGGH8vzvaicrIdHUoE6W
#2,设置并验证账号密码文件
[root@test1 prometheus-3.2.1.linux-arm64]# vim web-auth.yml
basic_auth_users:
admin: $2y$12$Hytvc26EHNEavtPZ4LrYf.Aj2SBvnlQG.RGGH8vzvaicrIdHUoE6W
[root@test1 prometheus-3.2.1.linux-arm64]# ./promtool check web-config web-auth.yml
web-auth.yml SUCCESS
#3,重启promethues: 登录页面 IP:9090 ,用户名密码:admin pass123
[root@test1 prometheus-3.2.1.linux-arm64]# ./prometheus --web.config.file=web-auth.yml