]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - helpers/ssl/cert_valid.pl
SourceFormat Enforcement
[thirdparty/squid.git] / helpers / ssl / cert_valid.pl
index 41a19848d7defa14e1233da8e96dc1b59bc9bdc2..3ddd8cb7d70ed65a0b8707b3c8a859d2a6fc7fcf 100755 (executable)
@@ -43,6 +43,12 @@ Retrieves the SSL certificate error list from squid and echo back without any ch
 
 =head1 COPYRIGHT
 
+ * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+
 (C) 2012 The Measurement Factory, Author: Tsantilas Christos
 
 This program is free software. You may redistribute copies of it under the
@@ -93,9 +99,13 @@ while (<>) {
 
         print(STDERR logPrefix()."GOT ". "Code=".$code." $bodylen \n") if ($debug); #.$body;
         my $hostname;
-        parseRequest($body, \$hostname, \%errors, \%certs);
+        my $sslVersion = "-";
+        my $sslCipher = "-";
+        parseRequest($body, \$hostname, \$sslVersion, \$sslCipher, \%errors, \%certs);
         print(STDERR logPrefix()."Parse result: \n") if ($debug);
         print(STDERR logPrefix()."\tFOUND host:".$hostname."\n") if ($debug);
+        print(STDERR logPrefix()."\tFOUND ssl version:".$sslVersion."\n") if ($debug);
+        print(STDERR logPrefix()."\tFOUND ssl cipher:".$sslCipher."\n") if ($debug);
         print(STDERR logPrefix()."\tFOUND ERRORS:") if ($debug);
         foreach my $err (keys %errors) {
             print(STDERR logPrefix().$errors{$err}{"name"}."/".$errors{$err}{"cert"}." ,")  if ($debug);
@@ -167,6 +177,8 @@ sub parseRequest
 {
     my($request)=shift;
     my $hostname = shift;
+    my $sslVersion = shift;
+    my $sslCipher = shift;
     my $errors = shift;
     my $certs = shift;
     while ($request !~ /^\s*$/) {
@@ -177,6 +189,12 @@ sub parseRequest
             $$hostname = $host;
             $request =~ s/^host=.*$//m;
         }
+        if ($request =~ s/^proto_version=(.*?)$//m) {
+            $$sslVersion = $1;
+        }
+        if ($request =~ s/^cipher=(.*?)$//m) {
+            $$sslCipher = $1;
+        }
         if ($request =~ /^cert_(\d+)=/) {
             my $certId = "cert_".$1;
             my($vallen) = index($request, "-----END CERTIFICATE-----") + length("-----END CERTIFICATE-----");