Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-d option works in 'mysterious ways' #97

Open
franps opened this issue Aug 31, 2020 · 2 comments
Open

-d option works in 'mysterious ways' #97

franps opened this issue Aug 31, 2020 · 2 comments

Comments

@franps
Copy link

franps commented Aug 31, 2020

Hey, how are you? A friend of mine found this code and I'm trying it to see if it fits the needs I have.
I found useful the option to find certificate files and check them, but have some issues using the option.

My directory: /tmp/ssltest

$ ls
testcert.pem  testcert2.pem

I found that when you use the -d option, if you point to the directory, you find both certificates

$ ./ssl-cert-check -d /tmp/ssltest/

Host                                            Status       Expires      Days
----------------------------------------------- ------------ ------------ ----
FILE:/tmp/ssltest//testcert.pem                 Expiring     Sep 12, 2020   12
FILE:/tmp/ssltest//testcert2.pem                Expiring     Sep  1, 2020    1 

If you use *.pem, it finds the first file and stop searching:

./ssl-cert-check -d /tmp/ssltest/*.pem

Host                                            Status       Expires      Days
----------------------------------------------- ------------ ------------ ----
FILE:/tmp/ssltest/testcert.pem                  Expiring     Sep 12, 2020   12

I assume this behavior is not the expected. But if pointing to the directory was my workaround, I had no problem with that. Then I tried having more files in the directory /tmp/ssltest, I created a txt file

$ ls
test.txt      testcert.pem  testcert2.pem

But when I tried searching for certificates in the directory, the script tried to read the txt and failed.

$ ./ssl-cert-check -d /tmp/ssltest/
Host                                            Status       Expires      Days
----------------------------------------------- ------------ ------------ ----
FILE:/tmp/ssltest//testcert.pem                 Expiring     Sep 12, 2020   12
unable to load certificate
4536331884:error:09FFF06C:PEM routines:CRYPTO_internal:no start line:/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-47.140.1/libressl-2.8/crypto/pem/pem_lib.c:684:Expecting: TRUSTED CERTIFICATE
unable to load certificate
4755144300:error:09FFF06C:PEM routines:CRYPTO_internal:no start line:/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-47.140.1/libressl-2.8/crypto/pem/pem_lib.c:684:Expecting: TRUSTED CERTIFICATE
unable to load certificate
4533202540:error:09FFF06C:PEM routines:CRYPTO_internal:no start line:/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-47.140.1/libressl-2.8/crypto/pem/pem_lib.c:684:Expecting: TRUSTED CERTIFICATE
unable to load certificate
4610739820:error:09FFF06C:PEM routines:CRYPTO_internal:no start line:/AppleInternal/BuildRoot/Library/Caches/com.apple.xbs/Sources/libressl/libressl-47.140.1/libressl-2.8/crypto/pem/pem_lib.c:684:Expecting: TRUSTED CERTIFICATE
FILE:/tmp/ssltest//test.txt                     Expired           0,    0 -2459093
FILE:/tmp/ssltest//testcert2.pem                Expiring     Sep  1, 2020    1

Am I using it wrong? The example in the readme file used the *.pem but I couldn't make it check all the certs in the directory

@niv-amar
Copy link

niv-amar commented Nov 7, 2022

I have the same issue...
Some one already solve it?

@franps
Copy link
Author

franps commented Nov 7, 2022

I don't remember much of this, but I do remember to ended up coding a horrible script for nagios (I needed to use nagios at the time). The code to search all the certs works fine (I think), but the nagios alerting I remember was pretty bad.
https://github.com/franps/nagios-cryppy

Hope it helps!

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

No branches or pull requests

2 participants