check_cert.pl
changeset 3 50f5a78ba6fa
parent 2 b4dbae8f141c
child 4 7a88e0574d1b
equal deleted inserted replaced
2:b4dbae8f141c 3:50f5a78ba6fa
    33     "c=s" => \$opt_c, "critical=s" => \$opt_c,
    33     "c=s" => \$opt_c, "critical=s" => \$opt_c,
    34     "s=s" => \$opt_s, "signature=s" => \$opt_s,
    34     "s=s" => \$opt_s, "signature=s" => \$opt_s,
    35     "f=s" => \@opt_certfiles, "certfile=s" => \@opt_certfiles);
    35     "f=s" => \@opt_certfiles, "certfile=s" => \@opt_certfiles);
    36 
    36 
    37 if ($opt_V) {
    37 if ($opt_V) {
    38     print_revision($ME, "0.1");
    38     print_revision($ME, "0.3");
    39     exit $ERRORS{"OK"};
    39     exit $ERRORS{"OK"};
    40 }
    40 }
    41 
    41 
    42 if ($opt_h) {
    42 if ($opt_h) {
    43     print_help();
    43     print_help();
   129 
   129 
   130 # looking for stats
   130 # looking for stats
   131 foreach (sort keys %certs) {
   131 foreach (sort keys %certs) {
   132     if (@{$certs{$_}}[2]) {
   132     if (@{$certs{$_}}[2]) {
   133         if (@{$certs{$_}}[2] eq "$opt_s") {
   133         if (@{$certs{$_}}[2] eq "$opt_s") {
   134             push (@critical, "file: $_, CN=@{$certs{$_}}[0] Signature Algorithm: @{$certs{$_}}[2]");
   134             push (@warning, "file: $_, CN=@{$certs{$_}}[0] Signature Algorithm: @{$certs{$_}}[2]");
   135         }
   135         }
   136     }
   136     }
   137 
   137 
   138     if (@{$certs{$_}}[3] eq "WARNING") {
   138     if (@{$certs{$_}}[3] eq "WARNING") {
   139 	push (@warning, "file: $_, CN=@{$certs{$_}}[0] expires @{$certs{$_}}[1]");
   139 	push (@warning, "file: $_, CN=@{$certs{$_}}[0] expires @{$certs{$_}}[1]");
   174     print "     For time can be used year, month, day, hour, minute, second and weeks.\n";
   174     print "     For time can be used year, month, day, hour, minute, second and weeks.\n";
   175     print "  -c, --critical <time>\n";
   175     print "  -c, --critical <time>\n";
   176     print "     Certificat should not be more than this time older (default: 1week)\n";
   176     print "     Certificat should not be more than this time older (default: 1week)\n";
   177     print "     For time can be used year, month, day, hour, minute, second and weeks.\n";
   177     print "     For time can be used year, month, day, hour, minute, second and weeks.\n";
   178     print "  -s, --signature <signature algorithm>\n";
   178     print "  -s, --signature <signature algorithm>\n";
   179     print "     Return CRITICAL stauts if <signature algorithm> is used.\n";
   179     print "     Return WARNING status if <signature algorithm> is used (default: md5WithRSAEncryption).\n";
   180     print "  -f, --certfile <file,file,file, ...>\n";
   180     print "  -f, --certfile <file,file,file, ...>\n";
   181     print "     Absolute path of x509 or pkcs12 openssl certificate files, use comma-separated lists for multiple files.\n";
   181     print "     Absolute path of x509 or pkcs12 openssl certificate files, use comma-separated lists for multiple files.\n";
   182     print "  -h, --help\n";
   182     print "  -h, --help\n";
   183     print "     Print detailed help screen\n";
   183     print "     Print detailed help screen\n";
   184     print "  -V, --version\n";
   184     print "  -V, --version\n";