Skip to content
This repository was archived by the owner on Jun 8, 2020. It is now read-only.
This repository was archived by the owner on Jun 8, 2020. It is now read-only.

bad detection of PEM format #9

@yoshi314

Description

@yoshi314

When server is serving DER, the pem detection loop may fail with invalid encoding error

--- a/plugins/check_crl
+++ b/plugins/check_crl
@@ -56,11 +56,11 @@ def check_crl(url, warn, crit):

     try:
         inform = 'DER'
-        crlfile = open(tmpcrl, "r")
-        for line in crlfile:
-            if "BEGIN X509 CRL" in line:
+        lookup = "BEGIN X509 CRL"
+        with open(tmpcrl,"rb") as crlfile:
+            line = crlfile.readline()
+            if  lookup.encode() in line:
                 inform = 'PEM'
-                break


This seems to work, although i am no python expert.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions