DEV Community

James Moberg
James Moberg

Posted on

How to Check SSL Certificate using ColdFusion & CURL.exe

A CFML developer in the ColdFusion Programmers Facebook Group referenced my DEV article regarding how to identify the SSL expiration date using ColdFusion as they were encountering some issues and thought it may be due to the version of Java that was being using.

Here's a UDF that I wrote a couple years ago that leverages CURL (open source) to fetch & identify the current SSL certificate data in use.

I've added a resolveIp option so that you can override DNS lookup and bind the hostname to any IP so that both origin & WAF IP addresses can be tested. (Some web applications often have more than 1 IP address and both certificates should to be tested.)

There's also a useragent option to pass a custom user agent in case you require something specific to bypass security restrictions. (I recommend perform requests for static robots.txt files. Even if robots.txt doesn't exist, the "404 Not Found" message will return the error using the SSL connection and this is all that really matters.)

BTW: If you're going to CFSummit2023 in Las Vegas, come find me. I enjoy meeting other CFDevs. (The person that I usually talk about tech with is my .NET brother.)

result = checkSSLCertificate("https://www.adobe.com/robots.txt");

writedump(result);
Enter fullscreen mode Exit fullscreen mode

Image description

ColdFusion/CFML Source Code

Enjoy!

https://gist.github.com/JamoCA/fa7449d1f1a8b920d901b9b14a773e96

Top comments (0)