2009-12-05 21:24:24 +01:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Plugin to monitor the number of hosts in /etc/hosts.deny
|
|
|
|
# that are deined access to sshd
|
2018-08-02 02:03:42 +02:00
|
|
|
#
|
2009-12-05 21:24:24 +01:00
|
|
|
# Based on denyhosts plugin by tjansson (2009)
|
|
|
|
#
|
|
|
|
# Copyright (C) 2009 KÃ¥re Hartvig Jensen (kaare.hartvig.jensen@gmail.com)
|
|
|
|
#
|
|
|
|
# This program is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
2018-08-02 02:03:42 +02:00
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2009-12-05 21:24:24 +01:00
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
|
|
|
if [ -r "$LOG" ]; then
|
|
|
|
echo yes
|
|
|
|
exit 0
|
|
|
|
else
|
|
|
|
echo no
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "config" ]; then
|
|
|
|
|
|
|
|
echo 'graph_title Hosts denied sshd access in /etc/hosts.deny'
|
|
|
|
echo 'graph_args --base 1000 -l 0'
|
|
|
|
echo 'graph_vlabel Hosts denied '
|
|
|
|
echo 'graph_category system'
|
|
|
|
echo 'HostsDenied.label Hosts denied'
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo HostsDenied.value `cat /etc/hosts.deny | grep sshd | wc -l`
|