Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:StarterSquad/prudentia into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
TizianoPerrucci committed Jul 2, 2015
2 parents b3682bc + 34dc4b4 commit ea1bb26
Show file tree
Hide file tree
Showing 2 changed files with 38 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 whitelisted_ips is defined %} {% for host in whitelisted_ips %} {{host}} {% endfor %} {% endif %}

findtime = 300

bantime = -1
19 changes: 19 additions & 0 deletions prudentia/tasks/fail2ban.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
# Parameters:
# prudentia_dir (provided)
# whitelisted_ips (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 | Configure local fail2ban jail
template: src={{prudentia_dir}}/files/file2ban/jail.local.j2 dest=/etc/fail2ban/jail.local
sudo: yes
tags: fail2ban

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

0 comments on commit ea1bb26

Please sign in to comment.