<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Monitoring SSL Certificate expiry.]]></title><description><![CDATA[<p dir="auto">Is there any way using NetXMS to monitor how long an SSL certificate has before it will expire?</p>
]]></description><link>https://forum.netxms.org/topic/5620/monitoring-ssl-certificate-expiry.</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 08:32:56 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/5620.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 20 Jun 2018 13:14:08 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Monitoring SSL Certificate expiry. on Fri, 04 Jun 2021 09:18:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/darren-leggett" aria-label="Profile: darren-leggett">@<bdi>darren-leggett</bdi></a> said in <a href="/post/24472">Monitoring SSL Certificate expiry.</a>:</p>
<blockquote>
<p dir="auto">Thanks for your responses.  I've tried using the OpenSSL suggestion from Victor but my NetXMS server is running on Windows.  When I tried to run s_client command it runs but does not exit for about a minute.  Any ideas how I can avoid this long delay?</p>
</blockquote>
<pre><code>echo | openssl s_client -showcerts -servername netxms.org -connect netxms.org:443 2&gt;/dev/null | openssl x509 -noout -enddate | cut -d = -f 2
</code></pre>
]]></description><link>https://forum.netxms.org/post/30108</link><guid isPermaLink="true">https://forum.netxms.org/post/30108</guid><dc:creator><![CDATA[hsvt]]></dc:creator><pubDate>Fri, 04 Jun 2021 09:18:20 GMT</pubDate></item><item><title><![CDATA[Reply to Monitoring SSL Certificate expiry. on Fri, 22 Jun 2018 12:51:30 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for your responses.  I've tried using the OpenSSL suggestion from Victor but my NetXMS server is running on Windows.  When I tried to run s_client command it runs but does not exit for about a minute.  Any ideas how I can avoid this long delay?</p>
]]></description><link>https://forum.netxms.org/post/24472</link><guid isPermaLink="true">https://forum.netxms.org/post/24472</guid><dc:creator><![CDATA[Darren Leggett]]></dc:creator><pubDate>Fri, 22 Jun 2018 12:51:30 GMT</pubDate></item><item><title><![CDATA[Reply to Monitoring SSL Certificate expiry. on Thu, 21 Jun 2018 00:17:00 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">On Windows you can use PowerShell to parse the local certificate store to generate a list of certificates. Something like the below should give you a list of certificates in your local computer store and only return the most recent one for certificates with the same subject and issuer, so you don't alert if you leave old certificates on your system beyond expiry.</p>
<pre><code>Get-Childitem -Path Cert:LocalMachine\My -recurse|?{$_.Subject -match "CN=.*\..*"}|Group-Object -Property Subject,Issuer|%{ $_.Group | Sort-Object -Property NotAfter -Descending | Select -First 1}
</code></pre>
<p dir="auto">You can use the output of the above to filter for only the type of certs you care about (e.g. you could remove certificates that were signed by a local CA or similar).<br />
Once you have that list, you can use instance discovery to go through those certificates and pull the expiration date. Just be aware that you'll be getting the expiration date in US format, i.e. MM/DD/YYYY. There's probably a way around that, but my PowerShell is limited :).<br />
Using a transform script, you should be able to check on age and alert for example if it's due to expire soon or if it has already expired. Sry, don't have example code for that part.</p>
<p dir="auto">Or are you after "Connect to website via https and tell me when the certificate expires", in which case you could probably use Nagios' check_http for that (you can configure and call that as an ExternalParameter on your NetXMS server). Again, we're not doing that, so don't have an example config.</p>
<p dir="auto">Cheers</p>
]]></description><link>https://forum.netxms.org/post/24462</link><guid isPermaLink="true">https://forum.netxms.org/post/24462</guid><dc:creator><![CDATA[Tursiops]]></dc:creator><pubDate>Thu, 21 Jun 2018 00:17:00 GMT</pubDate></item><item><title><![CDATA[Reply to Monitoring SSL Certificate expiry. on Wed, 20 Jun 2018 13:51:59 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">where this certificate is located? If it is web site certificate or file on file system you can use openssl command line tool to extract it (and run it as ExternalParameter in NetXMS agent). For example, the following external parameter will extract certificate validity date for given web site:</p>
<pre><code>ExternalParameterShellExec = HTTPS.CertificateExpireDate(*):echo | openssl s_client -showcerts -servername netxms.org -connect netxms.org:443 2&gt;/dev/null | openssl x509 -inform pem -noout -enddate | cut -d = -f 2
</code></pre>
<p dir="auto">Requesting it as</p>
<p dir="auto">HTTPS.CertificateExpireDate(<a href="http://netxms.org" rel="nofollow ugc">netxms.org</a>)</p>
<p dir="auto">will return</p>
<p dir="auto">Sep  2 21:57:24 2018 GMT</p>
<p dir="auto">Then you can use NXSL transformation script to convert it to UNIX timestamp:</p>
<pre><code>if ($1 match "^\\s*([A-Za-z]+)\\s+([0-9]+)\s+([0-9]+):([0-9]+):([0-9]+)\s+([0-9]+)")
{
   t = new TIME();
   t-&gt;year = $6;
   t-&gt;mon = MonthFromName($1);
   t-&gt;mday = $2;
   t-&gt;hour = $3;
   t-&gt;min = $4;
   t-&gt;sec = $5;
   t-&gt;isdst = -1;
   return mktime(t);
}
else
{
   return 0; // error
}

sub MonthFromName(name)
{
   m = 0;
   for(n : %("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"))
   {
      if (n == name)
         return m;
      m++;
   }
   return 0;  // error
}
</code></pre>
<p dir="auto">Alternatively you can use</p>
<pre><code>   return mktime(t) - time();
</code></pre>
<p dir="auto">to get number of seconds till certificate expiration.</p>
<p dir="auto">Best regards,<br />
Victor</p>
]]></description><link>https://forum.netxms.org/post/24457</link><guid isPermaLink="true">https://forum.netxms.org/post/24457</guid><dc:creator><![CDATA[victor]]></dc:creator><pubDate>Wed, 20 Jun 2018 13:51:59 GMT</pubDate></item></channel></rss>