cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Does Dynatrace monitor SSL certificate validation

AK
Advisor

Hi Folks,

We have a customer who wants to monitor SSL certification validation check via dynatrace.

Is it possible to monitor SSL certificate validation? I'm seeking more information from the customer about the this but this is what I got as requirement.

BR,

AK

53 REPLIES 53

By Dynatrace our of the box not but you can make OneAgent plugin that will validate it and send data as custom metrics to Dynatrace


Hi Sebastian,

Thanks for response.

Any document available with respect to this? I mean, specific to OneAgent plugin creation for SSL certification validation check.

BR,

AK


There are not documents like this because these are custom things. What you need to do is first finding way how using python (or bash) get information about certificates. When you will have this you are good to go for writing plugin because you will need those peace of code as source of extra metrics. That's all basically.

Sebastian


Julius_Loman
Leader

I've written a OneAgent plugin for SSL/TLS certificate expiration check (also does notification in advance). If you need to check certificates locally for any process running on a host monitored by oneagent.

If you are interested, you can download it from https://github.com/juliusloman/dynatrace-oneagent-plugin-sslcertcheck.


TEMPEST a.s., Slovakia, Dynatrace Master Partner

Hi Julius,


I have uploaded your OneAgent plugin for SSL/TLS certificate expiration however dont how to deploy plugin to hosts running OneAgents


Download the zip file. (available in the releases tab).

You have to do two steps:

  1. Upload the plugin into the tenant in Settings > Monitoring > Monitored technologies
  2. Unzip the plugin on each oneagent monitored host in /opt/dynatrace/oneagent/plugin_deployment/ (if you oneagent is installed in the default path).
    Dynatrace does not have any means to deploy the plugin centrally, that why you have to deploy it manually or using some configuration management tools.

OneAgent will pick up the new plugin just after a few minutes. No need to restart OneAgent


TEMPEST a.s., Slovakia, Dynatrace Master Partner

i have given it necessary permission as well

*ADMINSHELL* opt/dynatrace/remotepluginmodule/plugin_deployment/dynatrace-oneagent-plugin-sslcertcheck-master # ll
total 20
-rwxr-xr-x 1 root root 2277 Jan 12 21:22 plugin.json
-rwxr-xr-x 1 root root 2172 Jan 12 21:22 README.md
-rwxr-xr-x 1 root root 9410 Jan 12 21:22 sslcertcheck_plugin.py
*ADMINSHELL* opt/dynatrace/remotepluginmodule/plugin_deployment/dynatrace-oneagent-plugin-sslcertcheck-master #


First - you have downloaded the repo, not the built plugin. Head to the releases page and download the release zip file, that's actually here.

Second - you have put it into the directory of ActiveGate plugin module. This is a OneAgent plugin, not an ActiveGate plugin. Unless you have installed OneAgent in some nondefault directory, it is the /opt/dynatrace/oneagent/plugin_deployment/ directory.


TEMPEST a.s., Slovakia, Dynatrace Master Partner

Yes,I have downloaded file name called Source code(ZIP) and I have uploaded like below.


Is it right way to download and upload it?


No, it is the file custom.python.sslcertcheck_plugin.zip not the zip code.
Upload this file to the tenant as on your screenshot and also unzip the file on an agent.


TEMPEST a.s., Slovakia, Dynatrace Master Partner

unzip the file on an agent means do i have to unzip and put this custom.python.sslcertcheck_pluginunder /opt/dynatrace/oneagent/plugin_deployment/ on the host right?


Exactly. Is should look like this


# ls -l /opt/dynatrace/oneagent/plugin_deployment/custom.python.sslcertcheck_plugin/  
total
drwxrwxr-x 1 root root  382 Jan 12 22:24 asn1cryp
drwxrwxr-x 1 root root   96 Jan 12 22:24 asn1crypto-1.3.0.dist-in
-rwxrwxr-x 1 root root 2277 Jan 12 22:21 plugin.js
-rwxrwxr-x 1 root root 2172 Jan 12 22:17 README.
drwxrwxr-x 1 root root   82 Jan 12 22:24 sslcertcheck_plugin-1.0.dist-in
-rwxrwxr-x 1 root root 9410 Jan 12 22:02 sslcertcheck_plugin.py

TEMPEST a.s., Slovakia, Dynatrace Master Partner

As per your guideline,I have uploaded,still its not capturing

how to check the certificate are listed and monitoring in dynatrace?

*ADMINSHELL* opt/dynatrace/remotepluginmodule/plugin_deployment/custom.python.sslcertcheck_plugin # ll
total 32
drwxr-xr-x 2 root root 4096 Jan 21 09:18 asn1crypto
drwxr-xr-x 2 root root 4096 Jan 21 09:18 asn1crypto-1.3.0.dist-info
-rwxr-xr-x 1 root root 2277 Jan 21 09:18 plugin.json
-rwxr-xr-x 1 root root 2172 Jan 21 09:18 README.md
drwxr-xr-x 2 root root 4096 Jan 21 09:18 sslcertcheck_plugin-1.0.dist-info
-rwxr-xr-x 1 root root 9410 Jan 21 09:18 sslcertcheck_plugin.py



Hello @Gokul S.,
you still have the plugin copied in an incorrect directory. This directory is for the remote plugins (executed by ActiveGate).

You need to have the plugin copied in this directory

/opt/dynatrace/oneagent/plugin_deployment/custom.python.sslcertcheck_plugin/

and not in:

/opt/dynatrace/remotepluginmodule/plugin_deployment/custom.python.sslcertcheck_plugin


I've added a new release (1.01) that of the plugin that will inform you about certificates the plugin found and will monitor:


TEMPEST a.s., Slovakia, Dynatrace Master Partner

Still its not working.

Can you review my below steps :

1)I have place the custom.python.sslcertcheck_plugin zip file under Settings->Monitoring->Monitored technologies->Add new technology monitoring->Build OneAgent plugin with Python->Upload your plugin here or via command line (choose Upload plugin)

2)Unzip the custom.python.sslcertcheck_plugin file and placed the file under

opt/dynatrace/oneagent/plugin_deployment/custom.python.sslcertcheck_plugin/custom.python.sslcertcheck_plugin# ll
total 32
drwxr-xr-x 2 root root 4096 Jan 23 13:11 asn1crypto
drwxr-xr-x 2 root root 4096 Jan 23 13:11 asn1crypto-1.3.0.dist-info
-rwxr-xr-x 1 root root 2278 Jan 23 13:11 plugin.json
-rwxr-xr-x 1 root root 3017 Jan 23 13:11 README.md
drwxr-xr-x 2 root root 4096 Jan 23 13:11 sslcertcheck_plugin-1.1.dist-info
-rwxr-xr-x 1 root root 10459 Jan 23 13:11 sslcertcheck_plugin.py

Is it right?


You have it unzipped in one more directory - you have two directories custom.python.sslcertcheck_plugin in the path.

It must look like this:

# ls -al /opt/dynatrace/oneagent/plugin_deployment/custom.python.sslcertcheck_plugin/
total 20
drwxrwxr-x 1 root root  222 Jan 16 15:41 .
drwxr-xr-x 1 root root  140 Jan 13 11:25 ..
drwxrwxr-x 1 root root  382 Jan 12 22:24 asn1crypto
drwxrwxr-x 1 root root   96 Jan 12 22:24 asn1crypto-1.3.0.dist-info
-rwxrwxr-x 1 root root 2277 Jan 12 22:21 plugin.json
-rwxrwxr-x 1 root root 2172 Jan 12 22:17 README.md
drwxrwxr-x 1 root root   82 Jan 12 22:24 sslcertcheck_plugin-1.0.dist-info
-rwxrwxr-x 1 root root 9458 Jan 16 15:41 sslcertcheck_plugin.

TEMPEST a.s., Slovakia, Dynatrace Master Partner

still its not capturing ,How much time take to pick it up?


Hey Julius,

This is awesome. I have been asked about this type of feature before. Appreciate you for open sourcing this project!

Thanks

-Dallas


Thanks! Happy to share.


TEMPEST a.s., Slovakia, Dynatrace Master Partner

Thanks for clear explanation usage of the plugin. @Julius L.

Pretty cool stuff! Do you know if there is a compilation of other types of plugins?

Antonio Sousa

Hi Julius, thanks for writing this plugin. We're looking for something like this. I have exactly done as per the given steps for my Apache HTTP Server running on Windows 2012, but its not capturing the data. Please help.

Regards, Sandeep

Hi Julius, thanks for this wonderful plugin, it is successfully detecting the certificates.


One quick query regarding the metrics consumption, will it consume any custom metrics in terms of licenses?


Thanks.

No custom metrics are consumed.

TEMPEST a.s., Slovakia, Dynatrace Master Partner

Hi Julius,

Followed the same procedure. But receiving an error. Is this known ?

How to clear this ?

Can you share the plugin engine log file from that agent?

TEMPEST a.s., Slovakia, Dynatrace Master Partner

Error is being triggered because of line 148 in the python file.

sub=cert['subject'].native['common_name'],

Py code near the line 148 :

self.logger.info("SSLCheck result {hps} subject CN {sub} notvalidbefore {nvb} novalidafter {nva}".format(hps=hps,
sub=cert['subject'].native['common_name'],
nvb=cert['validity']['not_before'].native,
nva=cert['validity']['not_after'].native))


In the plugin engine log :

2020-07-24 13:36:14,326 DEBUG 140009279579904(MainThread) - [report_status] {('custom.python.sslcertcheck_plugin', 9331643405291913339): (PluginFullStatus(pluginName=custom.python.sslcertcheck_plugin, pluginVersion=1.01, state=ERROR_UNKNOWN, description=common_name, monitoredEntityId=xxxxxxxxxx, stacktrace=Traceback (most recent call last):
File "/var/lib/dynatrace/oneagent/agent/runtime/engine_unpacked/ruxit/plugin_state_machine.py", line 340, in _execute_next_task
self._query_plugin()
File "/var/lib/dynatrace/oneagent/agent/runtime/engine_unpacked/ruxit/plugin_state_machine.py", line 672, in _query_plugin
self._plugin_run_data.plugin_instance._query_internal(**self._plugin_run_data.plugin_args)
File "/var/lib/dynatrace/oneagent/agent/runtime/engine_unpacked/ruxit/api/base_plugin.py", line 455, in _query_internal
return self.query(**kwargs)
File "/opt/dynatrace/oneagent/plugin_deployment/custom.python.sslcertcheck_plugin/sslcertcheck_plugin.py", line 148, in query
sub=cert['subject'].native['common_name'],
KeyError: 'common_name'
),


Hope this would be sufficient.

Hi Julius,

The plugin is working for other servers.
Seems like there is some issue for that particular server.
Could you point out what that can be ?


Appreciate your quick responses and superb plugin development !

Hi @Julius L.
when you get a chance, can you please respond to my post on the issue i am having..
Thanks,
Avi

leon_vanzyl
Helper

We have created an AG Plugin that checks Certs: https://github.com/mediro-ict/activegate_python_ssl_plugin

It worked for me. Thanks!

@Leon Van Z.Thank you for the plugin.I have successfully uploaded activegate plugin in dynatrace but not able to capture the details...It has getting error: Hosts not being polled..Also I have query about host details format..The format is like www.example.com:443 but I have entered hostname like example:443 which is the name assign to particular host...could you please help me to resolve this issue.


larry_roberts
Champion

@Julius L. At long last I got around to trying this out and I must say.... OUTSTANDING!

This is a keeper! Thank you!

Thanks @Larry R.!... I have made few fixes - mainly regarding metadata - all information in one entry for each certificate. I hope this will be in the repository very soon.

TEMPEST a.s., Slovakia, Dynatrace Master Partner

khannanitin105
Newcomer

@Sandeep K. i also successfully connected but in dynatrace which tab i can see my certification details?

If you used my plugin it will show in the properties for the process group (you need to expand them).

TEMPEST a.s., Slovakia, Dynatrace Master Partner

avinash_podise1
Participant

Hi @Julius Loman
we installed the plugin on the server and uploaded extension in dynatrace. but we are getting an error

Error ('SSLCertCheck_Plugin' object has no attribute 'config') for:

lnbroams04.highmark.com


please help us on what we are missing here..

on server

/opt/dynatrace/oneagent/plugin_deployment/custom.python.sslcertcheck_plugin

drwxrwxr-x. 2 root root 4096 Jan 21 13:19 asn1crypto

drwxrwxr-x. 2 root root 4096 Jan 21 13:19 asn1crypto-1.3.0.dist-info

-rwxrwxr-x. 1 root root 2278 Jan 21 09:46 plugin.json

-rwxrwxr-x. 1 root root 3017 Jan 21 10:54 README.md

drwxrwxr-x. 2 root root 4096 Jan 21 13:19 sslcertcheck_plugin-1.1.dist-info

-rwxrwxr-x. 1 root root 10459 Jan 21 13:19 sslcertcheck_plugin.py



in Dynatrace


simran_arora
Newcomer

Hi @Julius L. I have deployed this but getting same events continously ,like it is giving details of same certificate again and again ,so can you tell like what is to be changed so that we do not get same certificate after every one min or so