initial commit
This commit is contained in:
parent
98722ebc6f
commit
04d63c93f2
7
files/defaults.conf
Normal file
7
files/defaults.conf
Normal file
@ -0,0 +1,7 @@
|
||||
[DEFAULT]
|
||||
bantime= 3600
|
||||
findtime= 10
|
||||
maxretry= 3
|
||||
|
||||
ignoreip= 127.0.0.1/8
|
||||
|
2
files/sshd.conf
Normal file
2
files/sshd.conf
Normal file
@ -0,0 +1,2 @@
|
||||
[sshd]
|
||||
enabled = true
|
6
handlers/main.yml
Normal file
6
handlers/main.yml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
- name: 'fail2ban | restart fail2ban'
|
||||
systemd:
|
||||
name: fail2ban
|
||||
state: restarted
|
||||
tags: ['fail2ban']
|
44
tasks/main.yml
Normal file
44
tasks/main.yml
Normal file
@ -0,0 +1,44 @@
|
||||
---
|
||||
- name: 'fail2ban | apt update cache'
|
||||
apt:
|
||||
update_cache: yes
|
||||
cache_valid_time: 86400 #One day
|
||||
tags: ['fail2ban']
|
||||
|
||||
- name: 'fail2ban | install iptables packages'
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
update_cache: true
|
||||
state: present
|
||||
with_items:
|
||||
- fail2ban
|
||||
tags: ['fail2ban']
|
||||
|
||||
- name: 'fail2ban | delete default config'
|
||||
file:
|
||||
path: "/etc/fail2ban/jail.d/defaults-debian.conf"
|
||||
state: absent
|
||||
notify:
|
||||
- 'fail2ban | restart fail2ban'
|
||||
tags: ['fail2ban']
|
||||
|
||||
- name: 'fail2ban | configuring fail2ban'
|
||||
copy:
|
||||
src: defaults.conf
|
||||
dest: /etc/fail2ban/jail.d/defaults.conf
|
||||
mode: 0644
|
||||
force: yes
|
||||
notify:
|
||||
- 'fail2ban | restart fail2ban'
|
||||
tags: ['fail2ban']
|
||||
|
||||
- name: 'fail2ban | enable sshd jail'
|
||||
copy:
|
||||
src: sshd.conf
|
||||
dest: /etc/fail2ban/jail.d/sshd.conf
|
||||
mode: 0644
|
||||
force: yes
|
||||
notify:
|
||||
- 'fail2ban | restart fail2ban'
|
||||
tags: ['fail2ban']
|
||||
|
Loading…
Reference in New Issue
Block a user