1 .\" $NetBSD: blacklistd.conf.5,v 1.3 2015/04/30 06:20:43 riz Exp $
3 .\" Copyright (c) 2015 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Christos Zoulas.
9 .\" Redistribution and use in source and binary forms, with or without
10 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in the
16 .\" documentation and/or other materials provided with the distribution.
18 .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
20 .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21 .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
22 .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28 .\" POSSIBILITY OF SUCH DAMAGE.
35 .Nd configuration file format for blacklistd
39 files contains configuration lines for
41 It contains one entry per line, and is similar to
43 There must be an entry for each field of the configuration file, with
44 entries for each field separated by a tab or a space.
45 Comments are denoted by a
47 at the beginning of a line.
49 There are two kinds of configuration lines,
53 By default, configuration lines are
55 i.e. the address specified refers to the addresses on the local machine.
60 configuration lines you can specify the stanzas:
71 means use the default, or wildcard match.
76 means use the values from the matched
80 The first four fields,
90 addresses, whereas the last 3 fields
95 are used to modify the filtering action.
97 The first field denotes the
99 as an address, mask, and port.
103 .Bd -literal -offset indent
104 [<address>|<interface>][/<mask>][:<port>]
109 can be an IPv4 address in numeric format, an IPv6 address
110 in numeric format and enclosed by square brackets, or an interface name.
111 Mask modifiers are not allowed on interfaces because interfaces
112 have multiple address in different protocols where the mask has a different
117 is always numeric, but the
119 can be either numeric or symbolic.
121 The second field is the socket
126 The third field is the
133 The fourth file is the effective user
135 of the daemon process reporting the event,
136 either as a username or a userid.
138 The rest of the fields are controlling the behavior of the filter.
142 field, is the name of the packet filter rule to be used.
147 then the default rulename is prepended to the given name.
152 the remaining portion of the name is interpreted as the mask to be
153 applied to the address specified in the rule, so one can block whole
154 subnets for a single rule violation.
158 field contains the number of failed attempts before access is blocked,
161 meaning never, and the last field
163 specifies the amount of time since the last access that the blocking
164 rule should be active, defaulting to
169 is seconds, but one can specify suffixes for different units, such as
177 Matching is done first by checking the
179 rules one by one, from the most specific to the least specific.
180 If a match is found, then the
182 rules are applied, and if a match is found the
187 fields can be altered by the
193 rules can be used for whitelisting specific addresses, changing the mask
194 size, or the rule that the packet filter uses, the number of failed attempts,
195 or the blocked duration.
197 .Bl -tag -width /etc/blacklistd.conf -compact
198 .It Pa /etc/blacklistd.conf
203 # Block ssh, after 3 attempts for 6 hours on the bnx0 interface
205 # location type proto owner name nfail duration
206 bnx0:ssh * * * * 3 6h
208 # Never block 1.2.3.4
209 1.2.3.4:ssh * * * * * *
210 # For addresses coming from 8.8.0.0/16 block class C networks instead
211 # individual hosts, but keep the rest of the blocking parameters the same.
212 8.8.0.0/16:ssh * * * /24 = =