Skip to content
Snippets Groups Projects
Commit d67bd0fd authored by Eesaan Atluri's avatar Eesaan Atluri
Browse files

feat: Add tasks to install and config fail2ban

parent e3890884
No related merge requests found
......@@ -46,3 +46,4 @@
# ssh proxy
enable_ssh_proxy_config: false
sshpiper_dest_dir: "/opt/sshpiper"
fail2ban_cidr_list: "127.0.0.1/8"
......@@ -11,3 +11,44 @@
enabled: true
state: restarted
- name: Install firewalld
ansible.builtin.package:
name: firewalld
state: present
- name: Configure firewalld
ansible.posix.firewalld:
port: 2222/tcp
zone: public
state: enabled
permanent: true
- name: Enable and start firewalld
ansible.builtin.service:
name: firewalld
enabled: true
state: restarted
- name: Install fail2ban
ansible.builtin.package:
name: "{{ item }}"
state: present
loop:
- fail2ban
- fail2ban-firewalld
- name: Configure fail2ban
ansible.builtin.template:
src: jail.local.j2
dest: "/etc/fail2ban/jail.local"
backup: true
- name: Activate the firewall support
ansible.builtin.command:
cmd: mv /etc/fail2ban/jail.d/00-firewalld.conf /etc/fail2ban/jail.d/00-firewalld.local
- name: Enable and start fail2ban
ansible.builtin.service:
name: fail2ban
enabled: true
state: restarted
[DEFAULT]
banaction = firewalld
bantime = 1200
ignoreip = {{ fail2ban_cidr_list }}
[sshd]
enabled = true
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment