Puddinq.com sharing knowledge

Use curl to get certificate expiration date

Use curl to get certificate expiration date

Bash article icon

If you want to get the expiration date for an ssl certificate on a website, you can run the following command:

curl -vI https://www.example.com 2>&1 | grep "expire date"

But if the website is not live (dns is not pointing that way), you can make a curl request as if some resolve
combination ip-address / domain name is in your hostfile. (without putting it in your hostfile)

curl -vI https://www.example.com --resolve 'www.example.com:443:188.114.87.0' 2>&1 | grep "expire date"

The resolve argument sets the curl environment if an https call is made to example.com to use the ip mentioned after 443:
the format for resolve is: domain:port:ip