Commit Graph

7 Commits

Author SHA1 Message Date
Kurt Lidl
549f31e459 Update blacklist-helper to not emit messages from pf during operation.
Use 'pfctl -k' when blocking a site to kill active tcp connections
from the blocked address.

Fix 'purge' operation for pf, which must dynamically determine which
filters have been created, so the filters can be flushed by name.

MFC after:	2 weeks
2018-02-04 19:43:51 +00:00
Kurt Lidl
40935b566b Merge latest version of blacklist sources from NetBSD (@ 20170503)
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2017-05-04 19:07:37 +00:00
Kurt Lidl
ea3431376e Improve ipfw rule creation for blacklist-helper script
When blocking an address, the blacklist-helper script
needs to do the following things for the ipfw packet
filter:

 - create a table to hold the addresses to be blocked,
   so lookups can be done quickly, and place the address
   to be blocked in that table
 - create rule that does the lookup in the table and
   blocks the packet

The ipfw system allows multiple rules to be inserted for
a given rule number.  There only needs to be one rule
to do the lookup per port.  Modify the script to probe
for the existence of the rule before attempting to create
it, so only one rule is inserted, rather than one rule per
blocked address.

PR:		214980
Reported by:	azhegalov (at) gmail.com
Reviewed by:	emaste
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D9681
2017-02-22 21:50:37 +00:00
Kurt Lidl
30f7128157 Make blacklist-helper commands emit a message when successful
The blacklistd daemon expects to see a message on stdout, instead
of just relying on the exit value from any invoked programs.

Change the pf filtering to create multiple filters, attached under
a the "blacklist/*" anchor point.  This prevents the filtering for
each port's filtering rule from overwriting the previously installed
filtering rule.  Check for an existing filtering rule for each port,
so the installation of a given filtering rule only happens once.
Reinstalling the same rule resets the counters for the pf rule, and
we don't want that.

Reported by:	David Horn (dhorn2000 at gmail.com)
Reviewed by:	emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8081
2016-10-04 23:10:43 +00:00
Kurt Lidl
74bc093c1c Add ipfilter support to blacklistd-helper
In addition to adding initial support for the ipfilter
packet filtering system, wrap a few long lines, perform
whitespace cleanup and sync with upstream changes made
in NetBSD.

Submitted by:	cy
Reviewed by:	cy
Approved by:	re (hrs)
Relnotes:	YES
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6823
2016-06-12 23:34:48 +00:00
Kurt Lidl
5cc0844d4b Add IPFW support to blacklistd-helper
Relnotes:	YES
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D6753
2016-06-09 15:19:48 +00:00
Kurt Lidl
12017ca883 Import NetBSD's blacklist source from vendor tree
This import includes The basic blacklist library and utility programs,
to add a system-wide packet filtering notification mechanism to
FreeBSD.

The rational behind the daemon was given by Christos Zoulas in a
presentation at vBSDcon 2015: https://youtu.be/fuuf8G28mjs

Reviewed by:	rpaulo
Approved by:	rpaulo
Obtained from:	NetBSD
Relnotes:	YES
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D5912
2016-06-01 22:04:10 +00:00