Skip to contentSkip to conversation

ocsp_check - signature verification and cert staus results are separate

PATCH In review Hubert Kario 3 participants 6 messages Sep 26, 2014 – Oct 6, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ocsp_check - signature verification and cert staus results are separate

when openssl returns result of parsing and verification of the OCSP response, the signature verification is separate from the certificate status, as such it's necessary to check both of them.

Otherwise results like:

Response Verify Failure
140170966779776:error:27069076:OCSP routines:OCSP_basic_verify:signer certificate not found:ocsp_vfy.c:85:
ca/cert.pem: good

        This Update: Sep 23 12:12:28 2014 GMT

will be accepted as being trustworthy.

Note that "Response verify OK" is printed on stderr, so it can't be discarded.

---
 contrib/OCSP_check/OCSP_check.sh | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
contrib/OCSP_check/OCSP_check.sh +6 -3
index 553c3dc..ce7ec04 100644
@@ -97,12 +97,15 @@ if [ $check_depth -eq -1 ] || [ $cur_depth -eq $check_depth ]; then
                     "$nonce" \
                     -CAfile "$verify" \
                     -url "$ocsp_url" \
-                    -serial "${serial}" 2>/dev/null)
+                    -serial "${serial}" 2>&1)
 
     if [ $? -eq 0 ]; then
-      # check that it's good
+      # check that the reported status of certificate is ok
       if echo "$status" | grep -Fq "^${serial}: good"; then
-        exit 0
+        # check if signature on the OCSP response verified correctly
+        if echo "$status" | grep -Fq "^Response verify OK"; then
+            exit 0
+        fi
       fi
     fi
   fi
Signature · 1 line
1.9.3
#1 lore raw

PATCH 2/2 ocsp_check - double check if ocsp didn't report any errors in execution

in case the reposnses are too old, ocsp tool can return text like this:

Response verify OK
ca/cert.pem: WARNING: Status times invalid.
139990703290240:error:2707307D:OCSP routines:OCSP_check_validity:status expired:ocsp_cl.c:358:
good

        This Update: Sep 21 12:12:48 2014 GMT
        Next Update: Sep 22 12:12:48 2014 GMT

light change in buffering can cause "verify OK" and "ca/cert.pem: good" to be placed in a way that matching will be valid

---
 contrib/OCSP_check/OCSP_check.sh | 4 ++++
 1 file changed, 4 insertions(+)
contrib/OCSP_check/OCSP_check.sh +4 -0
index ce7ec04..6876c6d 100644
@@ -100,6 +100,10 @@ if [ $check_depth -eq -1 ] || [ $cur_depth -eq $check_depth ]; then
                     -serial "${serial}" 2>&1)
 
     if [ $? -eq 0 ]; then
+      # check if ocsp didn't report any errors
+      if echo "$status" | grep -Eq "(error|fail)"; then
+          exit 1
+      fi
       # check that the reported status of certificate is ok
       if echo "$status" | grep -Fq "^${serial}: good"; then
         # check if signature on the OCSP response verified correctly
Signature · 1 line
1.9.3
#2 lore raw

Re: [Openvpn-devel] [PATCH 2/2] ocsp_check - double check if ocsp didn't report any errors in execution

ACK

-Steffan

Quoted 31 lines · Hubert Kario

in case the reposnses are too old, ocsp tool can return text like this:

Response verify OK
ca/cert.pem: WARNING: Status times invalid.
139990703290240:error:2707307D:OCSP routines:OCSP_check_validity:status expired:ocsp_cl.c:358:
good

        This Update: Sep 21 12:12:48 2014 GMT
        Next Update: Sep 22 12:12:48 2014 GMT

light change in buffering can cause "verify OK" and "ca/cert.pem: good" to be placed in a way that matching will be valid

---
 contrib/OCSP_check/OCSP_check.sh | 4 ++++
 1 file changed, 4 insertions(+)
contrib/OCSP_check/OCSP_check.sh +4 -0
index ce7ec04..6876c6d 100644
@@ -100,6 +100,10 @@ if [ $check_depth -eq -1 ] || [ $cur_depth -eq $check_depth ]; then
                     -serial "${serial}" 2>&1)
 
     if [ $? -eq 0 ]; then
+      # check if ocsp didn't report any errors
+      if echo "$status" | grep -Eq "(error|fail)"; then
+          exit 1
+      fi
       # check that the reported status of certificate is ok
       if echo "$status" | grep -Fq "^${serial}: good"; then
         # check if signature on the OCSP response verified correctly
#3 lore raw

[Openvpn-devel] [PATCH applied] Re: ocsp_check - double check if ocsp didn't report any errors in execution

In reply to Hubert Kario

Your patch has been applied to the master and release/2.3 branches.

commit 51390f4de4f02edf377d55a7ef108798d2d8dc88 (master) commit 27ab61cec7cefa645a1e02834e032eef12907598 (release/2.3)

Author: Hubert Kario
Date:   Fri Sep 26 12:24:01 2014 +0200
     ocsp_check - double check if ocsp didn't report any errors in execution

     Acked-by: Steffan Karger <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/9055
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#4 lore raw
In reply to Hubert Kario

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

ACK

- -Steffan

Quoted 29 lines · Hubert Kario

when openssl returns result of parsing and verification of the OCSP response, the signature verification is separate from the certificate status, as such it's necessary to check both of them.

Otherwise results like:

Response Verify Failure 140170966779776:error:27069076:OCSP routines:OCSP_basic_verify:signer certificate not found:ocsp_vfy.c:85: ca/cert.pem: good This Update: Sep 23 12:12:28 2014 GMT

will be accepted as being trustworthy.

Note that "Response verify OK" is printed on stderr, so it can't be discarded.

contrib/OCSP_check/OCSP_check.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)

(quoted diff) +0 -0

b/contrib/OCSP_check/OCSP_check.sh index 553c3dc..ce7ec04 100644 --- a/contrib/OCSP_check/OCSP_check.sh +++ b/contrib/OCSP_check/OCSP_check.sh @@ -97,12 +97,15 @@ if [ $check_depth -eq -1 ] || [ $cur_depth -eq $check_depth ]; then "$nonce" \ -CAfile "$verify" \ -url "$ocsp_url" \ -
-serial "${serial}" 2>/dev/null) + -serial
"${serial}" 2>&1)

Quoted 7 lines

if [ $? -eq 0 ]; then - # check that it's good + # check
that the reported status of certificate is ok if echo "$status" |
grep -Fq "^${serial}: good"; then - exit 0 + # check
if signature on the OCSP response verified correctly + if
echo "$status" | grep -Fq "^Response verify OK"; then +
exit 0 + fi fi fi fi

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQEcBAEBCAAGBQJUMTOWAAoJEJgCyj0AftKIH94H/AmwiKXEaT+k32B5Qie33iNa r38WbFtQoTDKJAlZZ4ykGhgqo5bVoec/zVYJaGVmBYVDFUK8lzL6xaeIOT5aQbQ4 L3noEtdzRPpS+sSMLrFA+MinRLDaknbFArIc9JjkSV2Z8vNw4R3cJnKtzss7ZJ7N aPpD6porhLK/phCP4dtqwZo5iEqXyfX1pW2ThzUbgfZ2wmdf1S6Ja8/40ZwQiCrN aIkfnAXt/2PLSPIuCcE3hQTdJx4hp68pEo7Xl0jtYFKDNVUC7NDVfDO9BztbrfVP MIxDDneS0JB93YNqcu8Ah0GKBM354h1jvjaB/XtAncVjjfCHHzYk36doxlXeqRw= =G1/O
-----END PGP SIGNATURE-----

#5 lore raw
In reply to Hubert Kario

Your patch has been applied to the master and release/2.3 branches.

commit e0c9e8452932a964b556daaeacdf7d9eab133e36 (master) commit 99400ef8524a5565a40637c825f4dcde475c54dd (release/2.3)

Author: Hubert Kario
Date:   Fri Sep 26 12:24:00 2014 +0200
     ocsp_check - signature verification and cert staus results are separate

     Signed-off-by: Hubert Kario <[email protected]...>
     Acked-by: Steffan Karger <[email protected]...>
     Message-Id: <[email protected]...>
     URL: http://article.gmane.org/gmane.network.openvpn.devel/9054
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering