510.ipfdenied revision 117088
1105937Sthomas#!/bin/sh -
2105937Sthomas#
3105937Sthomas# Copyright (c) 2001  The FreeBSD Project
4105937Sthomas# All rights reserved.
5105937Sthomas#
6105937Sthomas# Redistribution and use in source and binary forms, with or without
7105937Sthomas# modification, are permitted provided that the following conditions
8105937Sthomas# are met:
9105937Sthomas# 1. Redistributions of source code must retain the above copyright
10105937Sthomas#    notice, this list of conditions and the following disclaimer.
11105937Sthomas# 2. Redistributions in binary form must reproduce the above copyright
12105937Sthomas#    notice, this list of conditions and the following disclaimer in the
13105937Sthomas#    documentation and/or other materials provided with the distribution.
14105937Sthomas#
15105937Sthomas# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16105937Sthomas# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17105937Sthomas# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18105937Sthomas# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19105937Sthomas# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20105937Sthomas# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21105937Sthomas# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22105937Sthomas# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23105937Sthomas# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24105937Sthomas# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25105937Sthomas# SUCH DAMAGE.
26105937Sthomas#
27105937Sthomas# $FreeBSD: head/etc/periodic/security/510.ipfdenied 117088 2003-06-30 22:06:26Z mtm $
28105937Sthomas#
29105937Sthomas
30105937Sthomas# If there is a global system configuration file, suck it in.
31105937Sthomas#
32105937Sthomasif [ -r /etc/defaults/periodic.conf ]
33105937Sthomasthen
34105937Sthomas    . /etc/defaults/periodic.conf
35105937Sthomas    source_periodic_confs
36105937Sthomasfi
37105937Sthomas
38105937Sthomas. /etc/periodic/security/security.functions
39105937Sthomas
40105937Sthomasrc=0
41105937Sthomas
42105937Sthomascase "$daily_status_security_ipfdenied_enable" in
43105937Sthomas    [Yy][Ee][Ss])
44117088Smtm	TMP=`mktemp -t security`
45105937Sthomas	if ipfstat -nhio 2>/dev/null | grep block > ${TMP}; then
46105937Sthomas	  check_diff new_only ipf ${TMP} "${host} ipf denied packets:"
47105937Sthomas	fi
48105937Sthomas	rc=$?
49105937Sthomas	rm -f ${TMP};;
50105937Sthomas    *)	rc=0;;
51105937Sthomasesac
52105937Sthomas
53105937Sthomasexit $rc
54