181ea85a8SBrad Davis#!/bin/sh - 281ea85a8SBrad Davis# 381ea85a8SBrad Davis# Copyright (c) 2004 The FreeBSD Project 481ea85a8SBrad Davis# All rights reserved. 581ea85a8SBrad Davis# 681ea85a8SBrad Davis# Redistribution and use in source and binary forms, with or without 781ea85a8SBrad Davis# modification, are permitted provided that the following conditions 881ea85a8SBrad Davis# are met: 981ea85a8SBrad Davis# 1. Redistributions of source code must retain the above copyright 1081ea85a8SBrad Davis# notice, this list of conditions and the following disclaimer. 1181ea85a8SBrad Davis# 2. Redistributions in binary form must reproduce the above copyright 1281ea85a8SBrad Davis# notice, this list of conditions and the following disclaimer in the 1381ea85a8SBrad Davis# documentation and/or other materials provided with the distribution. 1481ea85a8SBrad Davis# 1581ea85a8SBrad Davis# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1681ea85a8SBrad Davis# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1781ea85a8SBrad Davis# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1881ea85a8SBrad Davis# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1981ea85a8SBrad Davis# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2081ea85a8SBrad Davis# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2181ea85a8SBrad Davis# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2281ea85a8SBrad Davis# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2381ea85a8SBrad Davis# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2481ea85a8SBrad Davis# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2581ea85a8SBrad Davis# SUCH DAMAGE. 2681ea85a8SBrad Davis# 2781ea85a8SBrad Davis# $FreeBSD$ 2881ea85a8SBrad Davis# 2981ea85a8SBrad Davis 3081ea85a8SBrad Davis# If there is a global system configuration file, suck it in. 3181ea85a8SBrad Davis# 3281ea85a8SBrad Davisif [ -r /etc/defaults/periodic.conf ] 3381ea85a8SBrad Davisthen 3481ea85a8SBrad Davis . /etc/defaults/periodic.conf 3581ea85a8SBrad Davis source_periodic_confs 3681ea85a8SBrad Davisfi 3781ea85a8SBrad Davis 3881ea85a8SBrad Davis. /etc/periodic/security/security.functions 3981ea85a8SBrad Davis 4081ea85a8SBrad Davissecurity_daily_compat_var security_status_pfdenied_enable 4181ea85a8SBrad Davis 4281ea85a8SBrad Davisrc=0 4381ea85a8SBrad Davis 4481ea85a8SBrad Davisif check_yesno_period security_status_pfdenied_enable 4581ea85a8SBrad Davisthen 4681ea85a8SBrad Davis TMP=`mktemp -t security` 47*a33ead9cSMatteo Riondato for _a in "" $(pfctl -a "blacklistd" -sA 2>/dev/null) ${security_status_pfdenied_additionalanchors} 4881ea85a8SBrad Davis do 49d8ffc21cSKristof Provost pfctl -a "${_a}" -sr -v -z 2>/dev/null | \ 5081ea85a8SBrad Davis nawk '{if (/^block/) {buf=$0; getline; gsub(" +"," ",$0); if ($5 > 0) print buf$0;} }' >> ${TMP} 5181ea85a8SBrad Davis done 5281ea85a8SBrad Davis if [ -s ${TMP} ]; then 5381ea85a8SBrad Davis check_diff new_only pf ${TMP} "${host} pf denied packets:" 5481ea85a8SBrad Davis fi 5581ea85a8SBrad Davis rc=$? 5681ea85a8SBrad Davis rm -f ${TMP} 5781ea85a8SBrad Davisfi 5881ea85a8SBrad Davis 5981ea85a8SBrad Davisexit $rc 60