lucab85.ansible_role_log4shell
lucab85.ansible_role_log4shell
这是一个 Ansible 角色,用于使用红帽官方的 Log4j 检测脚本 RHSB-2021-009 扫描目标 Linux 主机以检测 Log4Shell 漏洞(CVE-2021-44228)。
已通过 红帽版本 1.3 检测器 2022-01-10 进行测试。
Ansible Playbook
代码也可以作为 Ansible Playbook 使用 lucab85/log4j-cve-2021-44228。
要求
ansible 2.9+
角色变量
默认变量值 - defaults/main.yml
:
sh_detector: "cve-2021-44228--2022-01-10-1242.sh"
sh_signature: 'cve-2021-44228--2022-01-10-1242.sh.asc'
detector_baseurl: 'https://access.redhat.com/sites/default/files/'
detector_path: "/var/"
detector_dir: "/opt/cve-2021-44228/"
detector_run_dir: 'tmp'
detector_options: '-n -d --no-progress --scan {{ detector_path }}'
gpg_keyid: '7514F77D8366B0D9'
gpg_server: "pgp.mit.edu"
clean_run_before: true
delete_after: true
verify_gpg: false
sh_detector
: 检测器 bash 脚本文件名sh_signature
: 检测器 GPG 签名文件名detector_baseurl
: 下载上述文件的基本 URLdetector_path
: 要检查的路径(默认/var/
)detector_dir
: 检测器的下载路径(默认/opt/cve-2021-44228/
) 注意:这个路径需要执行权限!detector_run_dir
: 运行前要创建的子目录(默认tmp
)detector_options
: 检测器脚本的命令行选项(默认-n -d --no-progress --scan {{ detector_path }}
)gpg_keyid
: 用于下载验证的 GPG 公钥(默认是红帽产品安全7514F77D8366B0D9
)gpg_server
: 下载 GPG 公钥的 GPG 服务器(默认pgp.mit.edu
)clean_run_before
: 执行前删除运行目录并重新创建 - 检测器需要一个空目录(默认true
)delete_after
: 执行后删除 detector_dir (默认false
)verify_gpg
: 执行 GPG 签名下载和验证(默认false
)
依赖
无。
下载
首先下载最新版本的 Ansible 角色 lucab85.ansible_role_log4shell 在 Ansible Galaxy:
ansible-galaxy install lucab85.ansible_role_log4shell
示例 Playbook
以下是如何使用 lucab85.ansible_role_log4shell
角色的示例(通过参数传递变量):
---
- name: 运行检测器
hosts: all
become: true
roles:
- role: lucab85.ansible_role_log4shell
detector_path: "/var/www"
许可证
MIT / BSD
作者信息
该角色由 Luca Berton 于 2021 年创建,Luca 是 Ansible Pilot 的作者。
Ansible Pilot
更多信息:
捐赠
感谢您的支持:
关于项目
Ansible playbook to verify target Linux hosts using the official Red Hat Log4j detector script RHSB-2021-009 version 1.2 2021-12-20 for Log4Shell (CVE-2021-44228).
安装
ansible-galaxy install lucab85.ansible_role_log4shell
许可证
mit
下载
289
拥有者
Ansible Automation Engineer with Open Source passion: (Ansible, Progressive Web Applications, Cloud Computing, IoT, GNU/Linux)