File tree Expand file tree Collapse file tree 7 files changed +56
-0
lines changed
Expand file tree Collapse file tree 7 files changed +56
-0
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ - name : Install and configure fail2ban
3+ hosts : ' {{ variable_host | default("null") }}'
4+ serial : " {{ variable_serial | default(1) }}"
5+ gather_facts : false
6+ become : true
7+ become_user : root
8+ roles :
9+ - fail2ban
Original file line number Diff line number Diff line change 1+ ---
2+ fail2ban_sshd_maxretry : 5
3+ fail2ban_sshd_findtime : 600
4+ fail2ban_sshd_bantime : 3600
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Restart fail2ban
3+ ansible.builtin.systemd :
4+ name : fail2ban
5+ state : restarted
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Deploy fail2ban jail.local
3+ ansible.builtin.template :
4+ src : jail.local.j2
5+ dest : /etc/fail2ban/jail.local
6+ owner : root
7+ group : root
8+ mode : " 0644"
9+ notify : Restart fail2ban
10+
11+ - name : Enable and start fail2ban
12+ ansible.builtin.systemd :
13+ name : fail2ban
14+ enabled : true
15+ state : started
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Install fail2ban via apt
3+ ansible.builtin.apt :
4+ name : fail2ban
5+ state : present
6+ update_cache : true
7+ cache_valid_time : 3600
Original file line number Diff line number Diff line change 1+ ---
2+ - name : Install fail2ban
3+ ansible.builtin.import_tasks : install.yml
4+
5+ - name : Configure fail2ban
6+ ansible.builtin.import_tasks : configure.yml
Original file line number Diff line number Diff line change 1+ [DEFAULT]
2+ banaction = iptables-multiport
3+
4+ [sshd]
5+ enabled = true
6+ port = ssh
7+ filter = sshd
8+ maxretry = {{ fail2ban_sshd_maxretry }}
9+ findtime = {{ fail2ban_sshd_findtime }}
10+ bantime = {{ fail2ban_sshd_bantime }}
You can’t perform that action at this time.
0 commit comments