1 .\" $NetBSD: blacklistd.conf.5,v 1.7 2017/06/07 13:50:57 wiz 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 file contains configuration entries for
41 in a fashion similar to
43 Only one entry per line is permitted.
44 Every entry must have all fields populated.
45 Each field can be separated by a tab or a space.
46 Comments are denoted by a
48 at the beginning of a line.
50 There are two kinds of configuration lines,
54 By default, configuration lines are
56 i.e. the address specified refers to the addresses on the local machine.
61 configuration lines you can specify the stanzas:
72 means use the default, or wildcard match.
77 means use the values from the matched
81 The first four fields,
91 addresses, whereas the last 3 fields
96 are used to modify the filtering action.
98 The first field denotes the
100 as an address, mask, and port.
104 .Bd -literal -offset indent
105 [<address>|<interface>][/<mask>][:<port>]
110 can be an IPv4 address in numeric format, an IPv6 address
111 in numeric format and enclosed by square brackets, or an interface name.
112 Mask modifiers are not allowed on interfaces because interfaces
113 can have multiple addresses in different protocols where the mask has a different
118 is always numeric, but the
120 can be either numeric or symbolic.
122 The second field is the socket
127 The third field is the
134 The fourth file is the effective user
136 of the daemon process reporting the event,
137 either as a username or a userid.
139 The rest of the fields are controlling the behavior of the filter.
143 field, is the name of the packet filter rule to be used.
148 then the default rulename is prepended to the given name.
153 the remaining portion of the name is interpreted as the mask to be
154 applied to the address specified in the rule, causing a single rule violation to
155 block the entire subnet for the configured prefix.
159 field contains the number of failed attempts before access is blocked,
162 meaning never, and the last field
164 specifies the amount of time since the last access that the blocking
165 rule should be active, defaulting to
170 is seconds, but one can specify suffixes for different units, such as
178 Matching is done first by checking the
180 rules individually, in the order of the most specific to the least specific.
181 If a match is found, then the
189 fields can be altered by the
195 rules can be used for whitelisting specific addresses, changing the mask
196 size, the rule that the packet filter uses, the number of failed attempts,
197 or the block duration.
199 .Bl -tag -width /etc/blacklistd.conf -compact
200 .It Pa /etc/blacklistd.conf
204 .Bd -literal -offset 8n
205 # Block ssh, after 3 attempts for 6 hours on the bnx0 interface
207 # location type proto owner name nfail duration
208 bnx0:ssh * * * * 3 6h
210 # Never block 1.2.3.4
211 1.2.3.4:ssh * * * * * *
212 # For addresses coming from 8.8.0.0/16 block class C networks instead
213 # individual hosts, but keep the rest of the blocking parameters the same.
214 8.8.0.0/16:ssh * * * /24 = =