87 |
- |
1 |
# Fail2Ban configuration file
|
|
|
2 |
#
|
|
|
3 |
# Author: Donald Yandt
|
|
|
4 |
#
|
|
|
5 |
# Because of the rich rule commands requires firewalld-0.3.1+
|
|
|
6 |
# This action uses firewalld rich-rules which gives you a cleaner iptables since it stores rules according to zones and not
|
|
|
7 |
# by chain. So for an example all deny rules will be listed under <zone>_deny.
|
|
|
8 |
#
|
|
|
9 |
# If you use the --permanent rule you get a xml file in /etc/firewalld/zones/<zone>.xml that can be shared and parsed easliy
|
|
|
10 |
#
|
|
|
11 |
# Example commands to view rules:
|
|
|
12 |
# firewall-cmd [--zone=<zone>] --list-rich-rules
|
|
|
13 |
# firewall-cmd [--zone=<zone>] --list-all
|
|
|
14 |
# firewall-cmd [--zone=zone] --query-rich-rule='rule'
|
|
|
15 |
|
|
|
16 |
[Definition]
|
|
|
17 |
|
|
|
18 |
actionstart =
|
|
|
19 |
|
|
|
20 |
actionstop =
|
|
|
21 |
|
|
|
22 |
actioncheck =
|
|
|
23 |
|
|
|
24 |
#you can also use zones and/or service names.
|
|
|
25 |
#
|
|
|
26 |
# zone example:
|
|
|
27 |
# firewall-cmd --zone=<zone> --add-rich-rule="rule family='ipv4' source address='<ip>' port port='<port>' protocol='<protocol>' <blocktype>"
|
|
|
28 |
# service name example:
|
|
|
29 |
# firewall-cmd --zone=<zone> --add-rich-rule="rule family='ipv4' source address='<ip>' service name='<service>' <blocktype>"
|
|
|
30 |
# Because rich rules can only handle single or a range of ports we must split ports and execute the command for each port. Ports can be single and ranges seperated by a comma or space for an example: http, https, 22-60, 18 smtp
|
|
|
31 |
|
|
|
32 |
actionban = ports="<port>"; for p in $(echo $ports | tr ", " " "); do firewall-cmd --add-rich-rule="rule family='ipv4' source address='<ip>' port port='$p' protocol='<protocol>' <blocktype>"; done
|
|
|
33 |
|
|
|
34 |
actionunban = ports="<port>"; for p in $(echo $ports | tr ", " " "); do firewall-cmd --remove-rich-rule="rule family='ipv4' source address='<ip>' port port='$p' protocol='<protocol>' <blocktype>"; done
|
|
|
35 |
|
|
|
36 |
[Init]
|
|
|
37 |
|
|
|
38 |
name = default
|
|
|
39 |
|
|
|
40 |
zone = public
|
|
|
41 |
|
|
|
42 |
# use command firewall-cmd --get-services to see a list of services available
|
|
|
43 |
#
|
|
|
44 |
# Examples:
|
|
|
45 |
#
|
|
|
46 |
# amanda-client amanda-k5-client bacula bacula-client dhcp dhcpv6 dhcpv6-client dns freeipa-ldap freeipa-ldaps
|
|
|
47 |
# freeipa-replication ftp high-availability http https imaps ipp ipp-client ipsec iscsi-target kadmin kerberos
|
|
|
48 |
# kpasswd ldap ldaps libvirt libvirt-tls mdns mosh mountd ms-wbt mysql nfs ntp openvpn pmcd pmproxy pmwebapi pmwebapis pop3s
|
|
|
49 |
# postgresql privoxy proxy-dhcp puppetmaster radius rpc-bind rsyncd samba samba-client sane smtp squid ssh synergy
|
|
|
50 |
# telnet tftp tftp-client tinc tor-socks transmission-client vdsm vnc-server wbem-https xmpp-bosh xmpp-client xmpp-local xmpp-server
|
|
|
51 |
|
|
|
52 |
service = ssh
|
|
|
53 |
|
|
|
54 |
# reject types: 'icmp-net-unreachable', 'icmp-host-unreachable', 'icmp-port-unreachable', 'icmp-proto-unreachable',
|
|
|
55 |
# 'icmp-net-prohibited', 'icmp-host-prohibited', 'icmp-admin-prohibited' or 'tcp-reset'
|
|
|
56 |
|
|
|
57 |
blocktype = reject type='icmp-port-unreachable'
|