blasklist hooks

This commit is contained in:
christos 2015-01-25 15:51:53 +00:00
parent 9290a995cb
commit 1bff67df9c
6 changed files with 31 additions and 7 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.8 2013/12/31 20:23:12 christos Exp $
# $NetBSD: Makefile,v 1.9 2015/01/25 15:51:53 christos Exp $
.include <bsd.own.mk>
@ -33,7 +33,9 @@ SRCS= builtin.c client.c config.c control.c controlconf.c \
lwaddr.c lwdclient.c lwderror.c \
lwdgabn.c lwdgnba.c lwdgrbn.c lwdnoop.c lwresd.c lwsearch.c \
main.c notify.c query.c server.c sortlist.c statschannel.c \
tkeyconf.c tsigconf.c \
pfilter.c tkeyconf.c tsigconf.c \
update.c xfrout.c zoneconf.c ${SRCS_UNIX}
LDADD+=-lblacklist
DPADD+=${LIBBLACKLIST}
.include <bsd.prog.mk>

View File

@ -1,4 +1,4 @@
/* $NetBSD: client.c,v 1.11 2014/12/10 04:37:51 christos Exp $ */
/* $NetBSD: client.c,v 1.12 2015/01/25 15:51:53 christos Exp $ */
/*
* Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC")
@ -65,6 +65,8 @@
#include <named/server.h>
#include <named/update.h>
#include "pfilter.h"
/***
*** Client
***/
@ -3101,6 +3103,7 @@ ns_client_checkacl(ns_client_t *client, isc_sockaddr_t *sockaddr,
result = ns_client_checkaclsilent(client, sockaddr ? &netaddr : NULL,
acl, default_allow);
pfilter_notify(result, client, opname);
if (result == ISC_R_SUCCESS)
ns_client_log(client, DNS_LOGCATEGORY_SECURITY,
NS_LOGMODULE_CLIENT, ISC_LOG_DEBUG(3),

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.15 2014/12/10 04:37:51 christos Exp $ */
/* $NetBSD: main.c,v 1.16 2015/01/25 15:51:53 christos Exp $ */
/*
* Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC")
@ -83,6 +83,9 @@
#ifdef HAVE_LIBXML2
#include <libxml/xmlversion.h>
#endif
#include "pfilter.h"
/*
* Include header files for database drivers here.
*/
@ -1206,6 +1209,8 @@ main(int argc, char *argv[]) {
parse_command_line(argc, argv);
pfilter_open();
/*
* Warn about common configuration error.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: query.c,v 1.17 2014/12/10 04:37:52 christos Exp $ */
/* $NetBSD: query.c,v 1.18 2015/01/25 15:51:53 christos Exp $ */
/*
* Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC")
@ -65,6 +65,8 @@
#include <named/sortlist.h>
#include <named/xfrout.h>
#include "pfilter.h"
#if 0
/*
* It has been recommended that DNS64 be changed to return excluded
@ -762,6 +764,8 @@ query_validatezonedb(ns_client_t *client, dns_name_t *name,
}
result = ns_client_checkaclsilent(client, NULL, queryacl, ISC_TRUE);
if (result != ISC_R_SUCCESS)
pfilter_notify(result, client, "validatezonedb");
if ((options & DNS_GETDB_NOLOG) == 0) {
char msg[NS_CLIENT_ACLMSGSIZE("query")];
if (result == ISC_R_SUCCESS) {
@ -1026,6 +1030,8 @@ query_getcachedb(ns_client_t *client, dns_name_t *name, dns_rdatatype_t qtype,
result = ns_client_checkaclsilent(client, NULL,
client->view->cacheacl,
ISC_TRUE);
if (result == ISC_R_SUCCESS)
pfilter_notify(result, client, "cachedb");
if (result == ISC_R_SUCCESS) {
/*
* We were allowed by the "allow-query-cache" ACL.

View File

@ -1,4 +1,4 @@
/* $NetBSD: update.c,v 1.9 2014/12/10 04:37:52 christos Exp $ */
/* $NetBSD: update.c,v 1.10 2015/01/25 15:51:53 christos Exp $ */
/*
* Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC")
@ -59,6 +59,8 @@
#include <named/server.h>
#include <named/update.h>
#include "pfilter.h"
/*! \file
* \brief
* This module implements dynamic update as in RFC2136.
@ -307,6 +309,7 @@ checkqueryacl(ns_client_t *client, dns_acl_t *queryacl, dns_name_t *zonename,
result = ns_client_checkaclsilent(client, NULL, queryacl, ISC_TRUE);
if (result != ISC_R_SUCCESS) {
pfilter_notify(result, client, "queryacl");
dns_name_format(zonename, namebuf, sizeof(namebuf));
dns_rdataclass_format(client->view->rdclass, classbuf,
sizeof(classbuf));
@ -324,6 +327,7 @@ checkqueryacl(ns_client_t *client, dns_acl_t *queryacl, dns_name_t *zonename,
sizeof(classbuf));
result = DNS_R_REFUSED;
pfilter_notify(result, client, "updateacl");
ns_client_log(client, NS_LOGCATEGORY_UPDATE_SECURITY,
NS_LOGMODULE_UPDATE, ISC_LOG_INFO,
"update '%s/%s' denied", namebuf, classbuf);
@ -362,6 +366,7 @@ checkupdateacl(ns_client_t *client, dns_acl_t *acl, const char *message,
msg = "disabled";
} else {
result = ns_client_checkaclsilent(client, NULL, acl, ISC_FALSE);
pfilter_notify(result, client, "updateacl");
if (result == ISC_R_SUCCESS) {
level = ISC_LOG_DEBUG(3);
msg = "approved";

View File

@ -1,4 +1,4 @@
/* $NetBSD: xfrout.c,v 1.7 2014/12/10 04:37:52 christos Exp $ */
/* $NetBSD: xfrout.c,v 1.8 2015/01/25 15:51:53 christos Exp $ */
/*
* Copyright (C) 2004-2014 Internet Systems Consortium, Inc. ("ISC")
@ -54,6 +54,8 @@
#include <named/server.h>
#include <named/xfrout.h>
#include "pfilter.h"
/*! \file
* \brief
* Outgoing AXFR and IXFR.
@ -822,6 +824,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) {
&client->peeraddr,
&db);
pfilter_notify(result, client, "zonexfr");
if (result == ISC_R_NOPERM) {
char _buf1[DNS_NAME_FORMATSIZE];
char _buf2[DNS_RDATACLASS_FORMATSIZE];