robertdebock.fail2ban

Ansible角色 fail2ban

在你的系统上安装和配置fail2ban。

GitHub GitLab 下载量 版本
github gitlab downloads 版本

示例剧本

这个示例来自molecule/default/converge.yml,并在每次推送、提取请求和发布时进行测试。

---
- name: 汇聚
  hosts: all
  become: true
  gather_facts: true

  roles:
    - role: robertdebock.fail2ban

机器需要准备。在CI中,这通过molecule/default/prepare.yml来完成:

---
- name: 准备
  hosts: all
  become: true
  gather_facts: false

  roles:
    - role: robertdebock.bootstrap
    - role: robertdebock.epel

有关如何使用这些角色的完整解释和示例

角色变量

变量的默认值在defaults/main.yml中设置:

---
# fail2ban的默认文件

fail2ban_loglevel: INFO
fail2ban_logtarget: /var/log/fail2ban.log

fail2ban_ignoreself: "true"
fail2ban_ignoreips:
  - "127.0.0.1/8 ::1"

# 以秒为单位
fail2ban_bantime: 600
fail2ban_findtime: 600

fail2ban_maxretry: 5
fail2ban_destemail: root@localhost
fail2ban_sender: root@{{ ansible_fqdn }}

fail2ban_configuration: []
#  - 选项: loglevel
#    值: "INFO"
#    部分: Definition

fail2ban_jail_configuration: []
#  - 选项: ignoreself
#    值: "true"
#    部分: DEFAULT

# 包含要复制到filter.d的过滤器的目录路径
# fail2ban_filterd_path:

要求

使用的角色状态

以下角色用于准备系统。你可以用其他方式准备你的系统。

要求 GitHub GitLab
robertdebock.bootstrap Build Status GitHub Build Status GitLab
robertdebock.epel Build Status GitHub Build Status GitLab

上下文

这个角色是许多兼容角色的一部分。有关更多信息,可以查看这些角色的文档

以下是相关角色的概述: 依赖关系

兼容性

这个角色已经在这些容器镜像上进行测试:

容器 标签
EL 9
Debian 所有
Fedora 所有
Ubuntu 所有

所需的最低Ansible版本为2.12,测试已在以下版本中进行:

  • 之前的版本。
  • 当前版本。
  • 开发版本。

如果发现问题,请在GitHub上记录。

许可证

Apache-2.0

作者信息

robertdebock

请考虑赞助我

关于项目

Install and configure fail2ban on your system.

安装
ansible-galaxy install robertdebock.fail2ban
许可证
apache-2.0
下载
219.8k
拥有者
I know my way around (Linux) infrastructure, have a passion for automation, Docker, Ansible, Molecule and ci/cd.