LIBBLACKLIST(3)
hey bestie π welcome to LIBBLACKLIST(3), aka the Library Functions Manual page for the Blacklistd notification library. buckle up, we're doing Unix lore.
πΈ NAME πΈ
blacklist_open, blacklist_open2, blacklist_close, blacklist_r, blacklist, blacklist_sa, blacklist_sa_r β Blacklistd notification library
π LIBRARY π
library βlibblacklistβ
β¨ SYNOPSIS β¨
#include <blacklist.h>
struct blacklist *
blacklist_open(void);
struct blacklist *
blacklist_open2(void (*logger)(int, struct syslog_data *, va_list));
void
blacklist_close(struct blacklist *cookie);
int
blacklist(int action, int fd, const char *msg);
int
blacklist_r(struct blacklist *cookie, int action, int fd,
const char *msg);
int
blacklist_sa(int action, int fd, const struct sockaddr *sa,
socklen_t salen, const char *msg);
int
blacklist_sa_r(struct blacklist *cookie, int action, int fd,
const struct sockaddr *sa, socklen_t salen, const char *msg);
π¦ DESCRIPTION π¦
okay so these functions are the little messenger besties that daemons use to tell blacklistd(8) about successful and failed remote connections so blacklistd can block or release port access and prevent Denial of Service attacks. very main character energy for the daemon, honestly.
The function blacklist_open() creates the necessary state to communicate with blacklistd(8) and returns a pointer to it, or NULL on failure.
The function blacklist_open2() is similar to blacklist_open() but allows a logger to be specified. If the logger is NULL, then no logging is performed.
The blacklist_close() function frees all memory and resources used.
The blacklist() function sends a message to blacklistd(8), with an integer action argument specifying the type of notification, a file descriptor fd specifying the accepted file descriptor connected to the client, and an optional message in the msg argument.
The action parameter can take these values:
BLACKLIST_AUTH_FAILβ There was an unsuccessful authentication attempt.BLACKLIST_AUTH_OKβ A user successfully authenticated.BLACKLIST_ABUSIVE_BEHAVIORβ The sending daemon has detected abusive behavior from the remote system. The remote address should be blocked as soon as possible.BLACKLIST_BAD_USERβ The sending daemon has determined the username presented for authentication is invalid. Theblacklistd(8)daemon compares the username to a configured list of forbidden usernames and blocks the address immediately if a forbidden username matches. (TheBLACKLIST_BAD_USERsupport is not currently available.)
The blacklist_r() function is more efficient because it keeps the blacklist state around.
The blacklist_sa() and blacklist_sa_r() functions can be used with unconnected sockets, where getpeername(2) will not work, the server will pass the peer name in the message.
In all cases the file descriptor passed in the fd argument must be pointing to a valid socket so that blacklistd(8) can establish ownership of the local endpoint using getsockname(2).
By default, syslogd(8) is used for message logging. The internal bl_create() function can be used to create the required internal state and specify a custom logging function.
π RETURN VALUES π
The function blacklist_open() returns a cookie on success and NULL on failure setting errno to an appropriate value.
The functions blacklist(), blacklist_sa(), and blacklist_sa_r() return 0 on success and -1 on failure setting errno to an appropriate value.
π§ NOTES π§
Real talk, bestie: the library βlibblacklistβ has been renamed to libblocklist(3).
π SEE ALSO π
blacklistd.conf(5), blacklistd(8)
π AUTHORS π
Christos Zoulas
made with π on Debian Β· February 5, 2025 Β· LIBBLACKLIST(3) β signing off, bestie π«Ά
π¦ where this page comes from
- freebsd 15.1: base 15.1
- Copyright (c) 2015 The NetBSD Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms