Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
192 - 1
# Fail2Ban action for sending xarf Login-Attack messages to IP owner
2
#
3
# IMPORTANT:
4
#
5
# Emailing a IP owner of abuse is a serious complain. Make sure that it is
6
# serious. Fail2ban developers and network owners recommend you only use this
7
# action for:
8
#   * The recidive where the IP has been banned multiple times
9
#   * Where maxretry has been set quite high, beyond the normal user typing
10
#     password incorrectly.
11
#   * For filters that have a low likelihood of receiving human errors
12
#
13
# DEPENDENCIES:
14
#
15
# This requires the dig command from bind-utils
16
#
17
# This uses the https://abusix.com/contactdb.html to lookup abuse contacts.
18
#
19
# XARF is a specification for sending a formatted response
20
# for non-messaging based abuse including:
21
#
22
# Login-Attack, Malware-Attack, Fraud (Phishing, etc.), Info DNSBL
23
#
24
# For details see:
25
# https://github.com/xarf/xarf-specification
26
# http://www.x-arf.org/schemata.html
27
#
28
# Author: Daniel Black
29
# Based on complain written by Russell Odom <russ@gloomytrousers.co.uk>
30
#
31
#
32
 
33
[Definition]
34
 
35
# bypass ban/unban for restored tickets
36
norestored = 1
37
 
38
actionstart =
39
 
40
actionstop =
41
 
42
actioncheck =
43
 
44
actionban = oifs=${IFS};
45
            RESOLVER_ADDR="%(addr_resolver)s"
46
            if [ "<debug>" -gt 0 ]; then echo "try to resolve $RESOLVER_ADDR"; fi
47
            ADDRESSES=$(dig +short -t txt -q $RESOLVER_ADDR | tr -d '"')
48
            IFS=,; ADDRESSES=$(echo $ADDRESSES)
49
            IFS=${oifs}
50
            IP=<ip>
51
            FROM=<sender>
52
            SERVICE=<service>
53
            FAILURES=<failures>
54
            REPORTID=<time>@<fq-hostname>
55
            TLP=<tlp>
56
            PORT=<port>
57
            DATE=`LC_ALL=C date --date=@<time> +"%%a, %%d %%h %%Y %%T %%z"`
58
            if [ ! -z "$ADDRESSES" ]; then
59
                oifs=${IFS}; IFS=,; ADDRESSES=$(echo $ADDRESSES)
60
                IFS=${oifs}
61
                (printf -- %%b "<header>\n<message>\n<report>\n\n";
62
                 date '+Note: Local timezone is %%z (%%Z)';
63
                 printf -- %%b "\n<ipmatches>\n\n<footer>") | <mailcmd> <mailargs> $ADDRESSES
64
            fi
65
 
66
actionunban =
67
 
68
# Server as resolver used in dig command
69
#
70
addr_resolver = <ip-rev>abuse-contacts.abusix.org
71
 
72
# Option: boundary
73
# Notes:  This can be overwritten to be safe for possible predictions
74
boundary = bfbb0f920793ac03cb8634bde14d8a1e
75
 
76
_boundary = Abuse<time>-<boundary>
77
 
78
# Option: header
79
# Notes:  This is really a fixed value
80
header  = Subject: abuse report about $IP - $DATE\nAuto-Submitted: auto-generated\nX-XARF: PLAIN\nContent-Transfer-Encoding: 7bit\nContent-Type: multipart/mixed; charset=utf8;\n  boundary=%(_boundary)s;\n\n--%(_boundary)s\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\nContent-Type: text/plain; charset=utf-8;\n
81
 
82
# Option: footer
83
# Notes:  This is really a fixed value and needs to match the report and header
84
#         mime delimiters
85
footer = \n\n--%(_boundary)s--
86
 
87
# Option: report
88
# Notes:  Intended to be fixed
89
report =  --%(_boundary)s\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\nContent-Type: text/plain; charset=utf-8; name=\"report.txt\";\n\n---\nReported-From: $FROM\nCategory: abuse\nReport-ID: $REPORTID\nReport-Type: login-attack\nService: $SERVICE\nVersion: 0.2\nUser-Agent: Fail2ban v0.9\nDate: $DATE\nSource-Type: ip-address\nSource: $IP\nPort: $PORT\nSchema-URL: http://www.x-arf.org/schema/abuse_login-attack_0.1.2.json\nAttachment: text/plain\nOccurances: $FAILURES\nTLP: $TLP\n\n\n--%(_boundary)s\nMIME-Version: 1.0\nContent-Transfer-Encoding: 7bit\nContent-Type: text/plain; charset=utf8; name=\"logfile.log\";
90
 
91
# Option: Message
92
# Notes:  This can be modified by the users
93
message = Dear Sir/Madam,\n\nWe have detected abuse from the IP address $IP, which according to abusix.com is on your network. We would appreciate if you would investigate and take action as appropriate.\n\nLog lines are given below, but please ask if you require any further information.\n\n(If you are not the correct person to contact about this please accept our apologies - your e-mail address was extracted from the whois record by an automated process.)\n\n This mail was generated by Fail2Ban in a X-ARF format! You can find more information about x-arf at http://www.x-arf.org/specification.html.\n\nThe recipient address of this report was provided by the Abuse Contact DB by abusix.com. abusix.com does not maintain the content of the database. All information which we pass out, derives from the RIR databases and is processed for ease of use. If you want to change or report non working abuse contacts please contact the appropriate RIR. If you have any further question, contact abusix.com directly via email (info@abusix.com). Information about the Abuse Contact Database can be found here: https://abusix.com/global-reporting/abuse-contact-db\nabusix.com is neither responsible nor liable for the content or accuracy of this message.\n
94
 
95
# Option:  loglines
96
# Notes.:  The number of log lines to search for the IP for the report
97
loglines = 9000
98
 
99
# Option:  mailcmd
100
# Notes.:  Your system mail command. It is passed the recipient
101
# Values:  CMD
102
#
103
mailcmd =  /usr/sbin/sendmail
104
 
105
# Option:  mailargs
106
# Notes.:  Additional arguments to mail command. e.g. for standard Unix mail:
107
#          CC reports to another address:
108
#              -c me@example.com
109
#          Appear to come from a different address - the '--' indicates
110
#          arguments to be passed to Sendmail:
111
#              -- -f me@example.com
112
# Values:  [ STRING ]
113
#
114
mailargs = -f <sender>
115
 
116
# Option:  tlp
117
# Notes.:  Traffic light protocol defining the sharing of this information.
118
#          http://www.trusted-introducer.org/ISTLPv11.pdf
119
#          green is share to those involved in network security but it is not
120
#          to be released to the public.
121
tlp = green
122
 
123
# ALL of the following parameters should be set so the report contains
124
# meaningful information
125
 
126
# Option: service
127
# Notes.: This is the service type that was attacked. e.g. ssh, pop3
128
service = unspecified
129
 
130
# Option:  logpath
131
# Notes:   Path to the log files which contain relevant lines for the abuser IP
132
# Values:  Filename(s) space separated and can contain wildcards (these are
133
#          greped for the IP so make sure these aren't too long
134
logpath = /dev/null
135
 
136
# Option:  sender
137
# Notes.:  This is the sender that is included in the XARF report
138
sender = fail2ban@<fq-hostname>
139
 
140
# Option:  port
141
# Notes.:  This is the port number that received the login-attack
142
port = 0
143