node-exporter pprof漏洞处理(ansible批量修复)

pprof漏洞

访问node-exporter, IP:9100/debug/pprof

node-exporter版本,1.8.2

出现下边的页面就说明有漏洞

重新编译生成可执行文件

Bash 复制代码
git clone [https://github.com/prometheus/node_exporter.git](https://github.com/prometheus/node_exporter.git)
cd node_exporter
git checkout v1.8.2
vim node_exporter.go

make build

替换

然后会在当前目录下生成 node_exporter,替换原先二进制文件,再重启服务即可

ansible批量替换

复制代码
[root@deye-ops-monitor-test-001 node-exporter]# tree .
.
├── deploy.yml
└── file
    ├── node-exporter
    └── node-exporter.service
bash 复制代码
# deploy.yml
- name: Deploy node-exporter
  hosts: "*:!win"
  tasks:
    - name: Copy node-exporter binary
      copy:
        src: ./file/node-exporter
        dest: /opt/node-exporter
        mode: 0755
    - name: Copy node-exporter service file
      copy:
        src: ./file/node-exporter.service
        dest: /usr/lib/systemd/system/node-exporter.service
    - name: Reload systemd daemon
      shell: systemctl daemon-reload
    - name: Start and enable node-exporter service
      service:
        name: node-exporter
        state: restarted
        enabled: yes
bash 复制代码
# vim file/node-exporter.service 
[Unit]
Description=Node Exporter
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
ExecReload=/bin/kill -HUP $MAINPID
ExecStart=/opt/node-exporter --web.listen-address=:9100 --collector.supervisord --collector.supervisord.url=unix:///var/run/supervisor/supervisor.sock
KillMode=process
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

file/node-exporter 就是放到新编译的,然后执行即可

bash 复制代码
ansible-playbook deploy.yml

恢复

相关推荐
IT成长日记7 小时前
【自动化运维神器Ansible】Ansible常用模块之File模块详解
运维·自动化·ansible·file·常用模块
IT成长日记1 天前
【自动化运维神器Ansible】Ansible常用模块之Copy模块详解
运维·自动化·ansible·copy·常用模块、
五岁小孩1 天前
Golang 性能分析神器 pprof 详解与实践(图文教程)
性能优化·golang·pprof
IT成长日记2 天前
【自动化运维神器Ansible】Ansible常用模块之shell模块详解
运维·自动化·ansible·shell·常用模块
菜萝卜子3 天前
【Ansible】Ansible 管理 Elasticsearch 集群启停
elasticsearch·ansible
Neng_Miao4 天前
Ansible命令
ansible
朱包林5 天前
ansible批量部署zabbix客户端
linux·运维·服务器·云计算·ansible·zabbix
有想法的py工程师7 天前
Ansible 查看PostgreSQL的版本
数据库·postgresql·ansible
有想法的py工程师8 天前
Rocky9安装Ansible
linux·运维·ansible
庸子9 天前
Ansible & AWX 自动化运维
运维·自动化·ansible