I am writing a simple script to check if the certificate for a website is valid. However, when I attempt to run the code in terminal, I receive an error message stating that the command
openssl cannot be found. Here is the code:
if true | openssl s_client -connect www.google.com:443 2>/dev/null | \ openssl x509 -noout -checkend 0; then echo "Certificate is not expired" else echo "Certificate is expired" fi
When I attempt to run this code, I receive this output:
./check-certificates.sh: line 6: openssl: command not found Certificate is expired
The code runs, but it does not recognise
openssl as a valid command, so it skips over the line of code where this is mentioned, and defaults to outputting "Certificate is expired".
sudo apt-get install openssl I receive this message:
... openssl is already the newest version (1.0.2g-1ubuntu4.15). ...
So it looks like
openssl has been successfully installed. I'm at a loss on how to fix this - does anybody have any ideas?
As requested, here is the output of
apropos openssl | grep "OpenSSL command line tool":
openssl (1ssl) - OpenSSL command line tool
locate openssl | grep /usr/bin: