1 .\" $NetBSD: libblacklist.3,v 1.8 2017/10/22 10:31:57 abhinav 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.
40 .Nd Blacklistd notification library
45 .Ft struct blacklist *
46 .Fn blacklist_open "void"
48 .Fn blacklist_close "struct blacklist *cookie"
50 .Fn blacklist "int action" "int fd" "const char *msg"
52 .Fn blacklist_r "struct blacklist *cookie" "int action" "int fd" "const char *msg"
54 .Fn blacklist_sa "int action" "int fd" "const struct sockaddr *sa" "socklen_t salen" "const char *msg"
56 .Fn blacklist_sa_r "struct blacklist *cookie" "int action" "int fd" "const struct sockaddr *sa" "socklen_t salen" "const char *msg"
58 These functions can be used by daemons to notify
60 about successful and failed remote connections so that blacklistd can
61 block or release port access to prevent Denial of Service attacks.
65 creates the necessary state to communicate with
67 and returns a pointer to it, or
73 function frees all memory and resources used.
77 function sends a message to
81 argument specifying the type of notification,
84 specifying the accepted file descriptor connected to the client,
85 and an optional message in the
91 parameter can take these values:
92 .Bl -tag -width ".Va BLACKLIST_ABUSIVE_BEHAVIOR"
93 .It Va BLACKLIST_AUTH_FAIL
94 There was an unsuccessful authentication attempt.
95 .It Va BLACKLIST_AUTH_OK
96 A user successfully authenticated.
97 .It Va BLACKLIST_ABUSIVE_BEHAVIOR
98 The sending daemon has detected abusive behavior
99 from the remote system. The remote address should
100 be blocked as soon as possible.
101 .It Va BLACKLIST_BAD_USER
102 The sending daemon has determined the username
103 presented for authentication is invalid. The
105 daemon compares the username to a configured list of forbidden
107 blocks the address immediately if a forbidden username matches.
109 .Ar BLACKLIST_BAD_USER
110 support is not currently available.)
115 function is more efficient because it keeps the blacklist state around.
121 functions can be used with unconnected sockets, where
123 will not work, the server will pass the peer name in the message.
127 is used for message logging.
130 function can be used to create the required internal
131 state and specify a custom logging function.
135 returns a cookie on success and
139 to an appropriate value.
152 to an appropriate value.
154 .Xr blacklistd.conf 5 ,