-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.yml
36 lines (31 loc) · 908 Bytes
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
---
- name: install fail2ban
apt: name=fail2ban state=present
- name: Copy jail configuration
command: cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
args:
creates: '/etc/fail2ban/jail.local'
notify: 'restart fail2ban'
- name: copy in drachtio stanza into jail.local
blockinfile:
path: /etc/fail2ban/jail.local
block: |
[drachtio-tcp]
maxretry = 1
bantime = 86400
enabled = true
filter = drachtio
port = {{drachtio_ports}}
protocol = tcp
logpath = /var/log/drachtio/drachtio.log
[drachtio-udp]
maxretry = 1
bantime = 86400
enabled = true
filter = drachtio
port = {{drachtio_ports}}
protocol = udp
logpath = /var/log/drachtio/drachtio.log
- name: copy drachtio filter
copy: src=drachtio.conf dest=/etc/fail2ban/filter.d/drachtio.conf
notify: 'restart fail2ban'