Refactoring: Changed all check parameters starting with an 'o' to the new rulespec...
[check_mk.git] / agents / plugins / jar_signature
blob7e887533326eacfdc3ea025cf8c427ac770ff0db
1 #!/bin/bash
2 # +------------------------------------------------------------------+
3 # | ____ _ _ __ __ _ __ |
4 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
5 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
6 # | | |___| | | | __/ (__| < | | | | . \ |
7 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
8 # | |
9 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
10 # +------------------------------------------------------------------+
12 # This file is part of Check_MK.
13 # The official homepage is at http://mathias-kettner.de/check_mk.
15 # check_mk is free software; you can redistribute it and/or modify it
16 # under the terms of the GNU General Public License as published by
17 # the Free Software Foundation in version 2. check_mk is distributed
18 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
19 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
20 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
21 # tails. You should have received a copy of the GNU General Public
22 # License along with GNU Make; see the file COPYING. If not, write
23 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
24 # Boston, MA 02110-1301 USA.
26 # This agent uses the program "jarsigner" to read ssl certificate
27 # information of jar files and outputs the information to stdout
28 # for the Check_MK check.
29 # We assume that all files in the jar archive are signed with the
30 # same certificate. So we only deal with the last signed file here.
32 JAVA_HOME=/home/oracle/bin/jdk_latest_version
33 JAR_PATH=/home/oracle/fmw/11gR2/as_1/forms/java/*.jar
35 # Let user override these defaults in a configuration file
36 if [ -e $MK_CONFDIR/jar_signature.cfg ] ; then
37 . $MK_CONFDIR/jar_signature.cfg
40 PATH=$JAVA_HOME/bin:$PATH
42 echo "<<<jar_signature>>>"
43 for JAR in $JAR_PATH; do
44 if [ -e "$JAR" ] ; then # avoid entry for '*.jar'
45 echo "[[[${JAR##*/}]]]"
46 OUTPUT=$(jarsigner -verify -verbose -certs "$JAR")
47 LINE=$(echo "$OUTPUT" | grep -n ^s | tail -n1 | cut -d: -f1)
48 echo "$(echo "$OUTPUT" | tail -n +$LINE)"
49 echo
51 done