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

bad detection of PEM format #9

Open
yoshi314 opened this issue Jul 22, 2019 · 0 comments · May be fixed by #10
Open

bad detection of PEM format #9

yoshi314 opened this issue Jul 22, 2019 · 0 comments · May be fixed by #10

Comments

@yoshi314
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant