equal
deleted
inserted
replaced
20 $opt_w = "1month"; |
20 $opt_w = "1month"; |
21 $opt_c = "1week"; |
21 $opt_c = "1week"; |
22 $opt_b = "/usr/bin/openssl"; |
22 $opt_b = "/usr/bin/openssl"; |
23 $opt_s = "md5WithRSAEncryption"; |
23 $opt_s = "md5WithRSAEncryption"; |
24 |
24 |
25 my $revision = '1.2.2'; |
25 my $revision = '1.2.3'; |
26 |
26 |
27 Getopt::Long::Configure('bundling'); |
27 Getopt::Long::Configure('bundling'); |
28 GetOptions( |
28 GetOptions( |
29 "V" => \$opt_V, |
29 "V" => \$opt_V, |
30 "version" => \$opt_V, |
30 "version" => \$opt_V, |
97 |
97 |
98 # check x509 certificates |
98 # check x509 certificates |
99 while (<CERT>) { |
99 while (<CERT>) { |
100 /unable to load certificate/ and $rc = 1 and last; |
100 /unable to load certificate/ and $rc = 1 and last; |
101 /Signature\sAlgorithm:\s($opt_s)\s+$/ and $sig = $1; |
101 /Signature\sAlgorithm:\s($opt_s)\s+$/ and $sig = $1; |
102 /^subject=\s.*CN=(.*)\s+$/ and $cn = $1; |
102 /^subject=\s?.*CN\s*=\s*(.*)\s+$/ and $cn = $1; |
103 /^notAfter=(.*)\s+$/ and $enddate = $1; |
103 /^notAfter=(.*)\s+$/ and $enddate = $1; |
104 /^(SSL\sclient)\s:\sYes$/ and $cert_type = $1; |
104 /^(SSL\sclient)\s:\sYes$/ and $cert_type = $1; |
105 /^(SSL\sserver)\s:\sYes$/ and $cert_type = $1; |
105 /^(SSL\sserver)\s:\sYes$/ and $cert_type = $1; |
106 } |
106 } |
107 close(CERT); |
107 close(CERT); |
123 while (<READ>) { |
123 while (<READ>) { |
124 /unable to load certificate/ |
124 /unable to load certificate/ |
125 and print "CERT CRITICAL: unable to load certificate\n" |
125 and print "CERT CRITICAL: unable to load certificate\n" |
126 and exit $ERRORS{"CRITICAL"}; |
126 and exit $ERRORS{"CRITICAL"}; |
127 /Signature\sAlgorithm:\s($opt_s)\s+$/ and $sig = $1; |
127 /Signature\sAlgorithm:\s($opt_s)\s+$/ and $sig = $1; |
128 /^subject=\s.*CN=(.*)\s+$/ and $cn = $1; |
128 /^subject=\s?.*CN\s*=\s*(.*)\s+$/ and $cn = $1; |
129 /^notAfter=(.*)\s+$/ and $enddate = $1; |
129 /^notAfter=(.*)\s+$/ and $enddate = $1; |
130 /^(SSL\sclient)\s:\sYes$/ and $cert_type = $1; |
130 /^(SSL\sclient)\s:\sYes$/ and $cert_type = $1; |
131 /^(SSL\sserver)\s:\sYes$/ and $cert_type = $1; |
131 /^(SSL\sserver)\s:\sYes$/ and $cert_type = $1; |
132 } |
132 } |
133 close(READ); |
133 close(READ); |