check_client_cert.pl
changeset 4 14408207746e
parent 2 e6a93f3c4bd5
child 5 9041108a535b
equal deleted inserted replaced
3:6aa194e51250 4:14408207746e
    15 #    You should have received a copy of the GNU General Public License
    15 #    You should have received a copy of the GNU General Public License
    16 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    16 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
    17 #
    17 #
    18 #    Christian Arnold <arnold@schlittermann.de>
    18 #    Christian Arnold <arnold@schlittermann.de>
    19 
    19 
    20 use 5.010;
       
    21 use warnings;
    20 use warnings;
    22 use strict;
    21 use strict;
    23 use if $ENV{DEBUG} => "Smart::Comments";
    22 use if $ENV{DEBUG} => "Smart::Comments";
    24 use File::Basename;
    23 use File::Basename;
    25 use Pod::Usage;
    24 use Pod::Usage;
    33     UNKNOWN   => 3,
    32     UNKNOWN   => 3,
    34     DEPENDENT => 4
    33     DEPENDENT => 4
    35 );
    34 );
    36 
    35 
    37 my $ME      = basename $0;
    36 my $ME      = basename $0;
    38 my $VERSION = "0.1.1";
    37 my $VERSION = "0.1.2";
    39 
    38 
    40 sub get_status($);
    39 sub get_status($);
    41 sub report($);
    40 sub report($);
    42 sub version($$);
    41 sub version($$);
    43 
    42 
    70     my $c_time = DateCalc( "today", "+ $opt{critical}" );
    69     my $c_time = DateCalc( "today", "+ $opt{critical}" );
    71     my $rc     = 0;
    70     my $rc     = 0;
    72 
    71 
    73     open( FILE, $file )
    72     open( FILE, $file )
    74       or do {
    73       or do {
    75         say "CERT CRITICAL: $file $!";
    74         print "CERT CRITICAL: $file $!\n";
    76         exit $ERRORS{CRITICAL};
    75         exit $ERRORS{CRITICAL};
    77       };
    76       };
    78 
    77 
    79     while (<FILE>) {
    78     while (<FILE>) {
    80         next if /^#/;
    79         next if /^#/;
   122     ### @critical
   121     ### @critical
   123     ### @warning
   122     ### @warning
   124     ### @ok
   123     ### @ok
   125 
   124 
   126     if (@critical) {
   125     if (@critical) {
   127         say "CERT CRITICAL: " . join( " ", @critical );
   126         print "CERT CRITICAL: " . join( " ", @critical );
   128         exit $ERRORS{"CRITICAL"};
   127         exit $ERRORS{"CRITICAL"};
   129     }
   128     }
   130     elsif (@warning) {
   129     elsif (@warning) {
   131         say "CERT WARNING: " . join( " ", @warning );
   130         print "CERT WARNING: " . join( " ", @warning );
   132         exit $ERRORS{"WARNING"};
   131         exit $ERRORS{"WARNING"};
   133     }
   132     }
   134     else {
   133     else {
   135         say "CERT OK: " . join( " ", @ok );
   134         print "CERT OK: " . join( " ", @ok );
   136         exit $ERRORS{"OK"};
   135         exit $ERRORS{"OK"};
   137     }
   136     }
   138 }
   137 }
   139 
   138 
   140 sub version($$) {
   139 sub version($$) {
   215 
   214 
   216 =back
   215 =back
   217 
   216 
   218 =head1 VERSION
   217 =head1 VERSION
   219 
   218 
   220 This man page is current for version 0.1.1 of check_client_cert.
   219 This man page is current for version 0.1.2 of check_client_cert.
   221 
   220 
   222 =head1 AUTHOR
   221 =head1 AUTHOR
   223 
   222 
   224 Written by Christian Arnold L<arnold@schlittermann.de>
   223 Written by Christian Arnold L<arnold@schlittermann.de>
   225 
   224