30 "openssl", "x509", "-noout", "-text", |
30 "openssl", "x509", "-noout", "-text", |
31 "-certopt", $no_print, "-subject", "-enddate" |
31 "-certopt", $no_print, "-subject", "-enddate" |
32 ); |
32 ); |
33 |
33 |
34 my ( |
34 my ( |
35 $opt_debug, $opt_init, $opt_signature, |
35 $opt_debug, $opt_init, $opt_signature, $opt_version, |
36 $opt_version, $opt_help, $opt_warning, $opt_directory, |
36 $opt_help, $opt_warning, $opt_directory, $opt_critical, |
37 $opt_critical, $opt_binary, @opt_exclude |
37 $opt_binary, @opt_exclude |
38 ); |
38 ); |
39 my ($file, $w_time, $c_time); |
39 my ($file, $w_time, $c_time); |
40 |
40 |
41 my (@critical, @warning); |
41 my (@critical, @warning); |
42 |
42 |
43 $opt_binary = "/usr/bin/openssl"; |
43 $opt_binary = "/usr/bin/openssl"; |
44 $opt_signature = "md5WithRSAEncryption"; |
44 $opt_signature = "md5WithRSAEncryption"; |
45 $opt_warning = "1month"; |
45 $opt_warning = "1month"; |
46 $opt_critical = "1week"; |
46 $opt_critical = "1week"; |
47 $opt_directory = "/etc"; |
47 $opt_directory = "/etc"; |
48 |
48 |
49 sub process_file(); |
49 sub process_file(); |
50 sub print_help(); |
50 sub print_help(); |
51 sub print_usage(); |
51 sub print_usage(); |
52 |
52 |
53 MAIN: { |
53 MAIN: { |
54 |
54 |
55 Getopt::Long::Configure('bundling'); |
55 Getopt::Long::Configure('bundling'); |
56 GetOptions( |
56 GetOptions( |
57 "i|init" => \$opt_init, |
57 "i|init" => \$opt_init, |
58 "h|help" => \$opt_help, |
58 "h|help" => \$opt_help, |
59 "V|version" => \$opt_version, |
59 "V|version" => \$opt_version, |
60 "b|binary=s" => \$opt_binary, |
60 "b|binary=s" => \$opt_binary, |
61 "d|directory=s" => \$opt_directory, |
61 "d|directory=s" => \$opt_directory, |
62 "w|warning=s" => \$opt_warning, |
62 "w|warning=s" => \$opt_warning, |
63 "c|critical=s" => \$opt_critical, |
63 "c|critical=s" => \$opt_critical, |
64 "s|signature" => \$opt_signature, |
64 "s|signature" => \$opt_signature, |
65 "e|exclude=s" => \@opt_exclude, |
65 "e|exclude=s" => \@opt_exclude, |
66 "d|debug" => \$opt_debug, |
66 "d|debug" => \$opt_debug, |
67 ); |
67 ); |
68 |
68 |
69 print_revision($ME, $VERSION) and exit $ERRORS{"OK"} if $opt_version; |
69 print_revision($ME, $VERSION) and exit $ERRORS{"OK"} if $opt_version; |
70 print_help() and exit $ERRORS{"OK"} if $opt_help; |
70 print_help() and exit $ERRORS{"OK"} if $opt_help; |
71 |
71 |
269 print "This plugin checks the expire date for openssl certificates.\n\n"; |
269 print "This plugin checks the expire date for openssl certificates.\n\n"; |
270 print_usage(); |
270 print_usage(); |
271 print "\n"; |
271 print "\n"; |
272 print " -b, --binary <binary>\n"; |
272 print " -b, --binary <binary>\n"; |
273 print " Path of openssl binary (default: /usr/bin/openssl)\n"; |
273 print " Path of openssl binary (default: /usr/bin/openssl)\n"; |
274 print " -d, --directory <path>\n"; |
274 print " -d, --directory <path>\n"; |
275 print " Absolute directory path in which will be recursively search for certificate files (default: /etc).\n"; |
275 print |
|
276 " Absolute directory path in which will be recursively search for certificate files (default: /etc).\n"; |
276 print " -w, --warning <time>\n"; |
277 print " -w, --warning <time>\n"; |
277 print |
278 print |
278 " Certificat should not be more than this time older (default: 1month).\n"; |
279 " Certificat should not be more than this time older (default: 1month).\n"; |
279 print |
280 print |
280 " For time can be used year, month, day, hour, minute, second and weeks.\n"; |
281 " For time can be used year, month, day, hour, minute, second and weeks.\n"; |