[Nagiosplug-devel] check_gpgsig
Harold Naparst
harold at alum.mit.edu
Mon Jan 29 18:13:08 CET 2007
I wrote this shell script to check if a file,
such as one of your web pages, has been altered.
I use it to monitor whether my home page has been
hacked.
#!/bin/sh
# ------------------------------------------------------------------------------
# check_gpgsig.sh - verify gpg signature of a file.
# usage:
# ./check_gpgsig.sh your_file
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# 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, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# ------------------------------------------------------------------------------
FC=3
STAT="UNKNOWN"
if [ ! -e "$1" ]; then
RW=$1" is missing."
STAT="WARNING"
FC=1
else
RW=`gpg --verify $1`
FC=$?
if [ "$FC" == "1" ]; then
STAT="CRITICAL"
RW="Dude. Someone hacked you."
FC=2
else
STAT="OK"
RW="Good."
FC=0
fi
fi
echo $STAT": "$RW
exit $FC
- Harold Naparst (hnaparst)
-----------------------
The mailing list archive is found here:
http://www.nagiosexchange.org/nagiosplug-devel.31.0.html
More information about the Devel
mailing list