Prometheus涉及pprof go信息泄露漏洞整改
本文記錄一下對(duì)系統(tǒng)滲透測(cè)試后反饋Prometheus涉及pprof go信息泄露,驗(yàn)證方法為http://ip:port/debug/pprof。為防止未經(jīng)授權(quán)用戶訪問(wèn),現(xiàn)決定在Prometheus層面使用basic_auth加密整改。
環(huán)境配置
軟件 | 版本 |
---|---|
Kylin | V10 |
Docker | 20.10.22 |
Prometheus | 2.19.0 |
1.生成basic_auth密鑰
安裝工具包并生成加密后密碼
#安裝工具包
yum install -y httpd-tools
#生成加密密碼
htpasswd -nBC 12 '' | tr -d ':\n'
New password: # 這里設(shè)置密碼為Prometheus,實(shí)際使用請(qǐng)按照自己的集群需求定義密碼
Re-type new password:
#生成的密碼信息
$2y$12$SiMWc.Avsx4BE59PT88GcefVkJGBYduzMP5kXeV2EyDxgKvODGhBW
2.將密鑰文件寫入config.yml文件內(nèi)
新建配置文件(暫時(shí)不使用TLS,使用TLS加密后Grafana獲取不到數(shù)據(jù),還需修改數(shù)據(jù)源配置)
cat > /usr/prometheus/config.yml<<EOF
basic_auth_users:
# 當(dāng)前設(shè)置的用戶名為admin, 可以設(shè)置多個(gè)
admin: $2y$12$SiMWc.Avsx4BE59PT88GcefVkJGBYduzMP5kXeV2EyDxgKvODGhBW
EOF
3.修改prometheus配置
新增basic_auth配置
scrape_configs:
- job_name: 'prometheus'
basic_auth:
username: admin
password: prometheus
static_configs:
- targets: ['prometheus:9090']
4.啟動(dòng)服務(wù)
4.1 service模式
修改/usr/lib/systemd/system/prometheus.service文件,在ExecStart后面追加-web.config.file=/usr/prometheus/config.yml
4.2 docker模式
修改鏡像版本(≥2.40),在服務(wù)啟動(dòng)腳本命令內(nèi)增加 --web.config.file配置文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-784973.html
docker run -d --restart=unless-stopped --name=prometheus -p 9090:9090 -v /usr/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml -v /usr/prometheus/config.yml:/etc/prometheus/config.yml prom/prometheus:v2.24.0 --config.file=/etc/prometheus/prometheus.yml --web.config.file=/etc/prometheus/config.yml
5.訪問(wèn)測(cè)試
返回Unauthorized即整改完成文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-784973.html
[root@localhost ~]# curl http://127.0.0.1:9090/debug/pprof/
Unauthorized
到了這里,關(guān)于prometheus涉及pprof go信息泄露漏洞整改的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!