Skip to content

Commit

Permalink
Merge 81b510b into 653d3ae
Browse files Browse the repository at this point in the history
  • Loading branch information
Voronenko committed Jun 26, 2015
2 parents 653d3ae + 81b510b commit 89e1cf1
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
19 changes: 19 additions & 0 deletions prudentia/files/file2ban/jail.local.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[ssh]

enabled = true

port = ssh

filter = sshd

logpath = /var/log/auth.log

action = hostsdeny[file=/etc/hosts.deny]

maxretry = 3

ignoreip = 127.0.0.1/8 {% if whitelistedips is defined %} {% for host in whitelistedips %} {{host}} {% endfor %} {% endif %}

findtime = 300

bantime = -1
24 changes: 24 additions & 0 deletions prudentia/tasks/fail2ban.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# Parameters:
# prudentia_dir (provided)
# whitelistedips (optional) list of ips for /etc/hosts.allow

- name: Fail2Ban | Install fail2ban
apt: pkg=fail2ban state=installed update-cache=yes
sudo: yes
tags:
- fail2ban

- name: Fail2Ban | local fail2ban jail config
template: src={{prudentia_dir}}/files/file2ban/jail.local.j2 dest=/etc/fail2ban/jail.local
sudo: yes
tags:
- fail2ban

- name: Fail2Ban | reload fail2ban
service: name=fail2ban state=reloaded
sudo: yes
tags:
- fail2ban


0 comments on commit 89e1cf1

Please sign in to comment.