浏览代码

fail2ban support for Trusty

Marius Voila 10 年前
父节点
当前提交
e62bd7c71a
共有 2 个文件被更改,包括 39 次插入0 次删除
  1. 5
    0
      roles/common/tasks/security.yml
  2. 34
    0
      roles/common/templates/etc_trusty_fail2ban_jail.local.j2

+ 5
- 0
roles/common/tasks/security.yml 查看文件

@@ -9,6 +9,11 @@
9 9
   template: src=etc_fail2ban_jail.local.j2 dest=/etc/fail2ban/jail.local
10 10
   notify: restart fail2ban
11 11
 
12
+- name: Copy fail2ban configuration into place for Ubuntu Trusty
13
+  template: src=etc_trusty_fail2ban_jail.local.j2 dest=/etc/fail2ban/jail.local
14
+  when: ansible_sistributon_release == 'trusty'
15
+  notify: restart fail2ban
16
+
12 17
 - name: Copy fail2ban dovecot configuration into place
13 18
   copy: src=etc_fail2ban_filter.d_dovecot-pop3imap.conf dest=/etc/fail2ban/filter.d/dovecot-pop3imap.conf
14 19
   notify: restart fail2ban

+ 34
- 0
roles/common/templates/etc_trusty_fail2ban_jail.local.j2 查看文件

@@ -0,0 +1,34 @@
1
+[DEFAULT]
2
+ignoreip  = 127.0.0.1 {{ ansible_default_ipv4.address }} {{ ' '.join(friendly_networks) }}
3
+bantime   = 86400
4
+destemail = {{ admin_email }}
5
+banaction = iptables-multiport
6
+action    = %(action_)s
7
+
8
+# JAILS
9
+[ssh]
10
+enabled   = true
11
+maxretry  = 3
12
+
13
+[pam-generic]
14
+enabled   = true
15
+banaction = iptables-allports
16
+
17
+[ssh-ddos]
18
+enabled   = true
19
+
20
+[apache]
21
+enabled = true
22
+
23
+[postfix]
24
+enabled  = true
25
+maxretry = 1
26
+
27
+[dovecot-pop3imap]
28
+enabled = true
29
+filter = dovecot-pop3imap
30
+action = iptables-multiport[name=dovecot-pop3imap, port="pop3,imap,993,995", protocol=tcp]
31
+logpath = /var/log/maillog
32
+maxretry = 20
33
+findtime = 1200
34
+bantime = 1200

正在加载...
取消
保存