Added a new input plugin to check SSL certs#1762
Added a new input plugin to check SSL certs#1762egarbi wants to merge 4 commits intoinfluxdata:masterfrom
Conversation
|
The README.md in this pull request for the plugin is incorrect. The example text for telegraf.conf should read: ... in order to fix the lack of quotes and the incorrect variable I'd love to see this plugin in the main product! Please expedite! 👍 |
|
@wcgcoder Thanks for your input, Readme has been fixed however checks are failing for an unrelated issue. |
|
Thanks so much. Looks like a problem from outside your plugin. Not sure why as I'm rather new to this, but I was able to manually add your plugin to commit |
|
Hi there. |
|
@okv We are using the github milestones to prioritize pull requests. When there is new information it will be reflected here. |
|
will be waiting for it, thanks for your information |
|
Maybe a separate tool, but how nice would it be to integrate your SSL Labs score into this check? https://github.com/ssllabs/ssllabs-scan |
|
@danielnelson I know you said updates will be posted here, but i'm getting itchy to have this functionality in the official release. Any update on a potential release date? |
|
I've patched the error handling issue on a new branch (fe7235c) and signed the CLA. Does someone want to cherry-pick this or should I raise a new PR? It could be great to get this released with v1.4. |
|
@egarbi Can you integrate the fix by @swestcott into your branch? |
| # SSL request given a list of servers (server:port) and a timeout | ||
| [[inputs.check_ssl]] | ||
| ## Servers ( Default [] ) | ||
| servers = ["github.com:443"] |
There was a problem hiding this comment.
We shouldn't use a real site as an example, since I'm sure they wouldn't appreciate being polled by Telegraf, you can use example.org instead. Please do this throughout the pull request.
What about other protocols, should this start with tcp://? Then we could support udp and tcp6
| ### Measurements & Fields: | ||
|
|
||
| - ssl_cert | ||
| - time_to_expire (int) # seconds left for the SSL cert to expire |
There was a problem hiding this comment.
Appears to be a float, you can format this like - time_to_expire (int, seconds).
What do you think about naming this expire_seconds or similar to indicate units?
| // Gather gets all metric fields and tags and returns any errors it encounters | ||
| func (c *CheckExpire) Gather(acc telegraf.Accumulator) error { | ||
| errChan := errchan.New(len(c.Servers)) | ||
| for _, server := range c.Servers { |
There was a problem hiding this comment.
I think we should run these concurrently.
| certs, err := c.checkHost(server) | ||
| errChan.C <- err | ||
| if err != nil { | ||
| timeToExpire = 0 |
There was a problem hiding this comment.
I'm not sure about this, if there is an error it does not necessarily mean the cert is expired.
| # Check SSL Input Plugin | ||
|
|
||
| This input plugin will return how much time (in seconds) left for a SSL cert to expire. | ||
| Warning, this check doesnt verify if SSL is valid/secure or not. |
There was a problem hiding this comment.
We should recommend that the user use a increased interval, since 10s default would be too small.
| @@ -0,0 +1,32 @@ | |||
| # Check SSL Input Plugin | |||
There was a problem hiding this comment.
I'm not sure that ssl is the right name for this, maybe it should be x509 or cert?
There was a problem hiding this comment.
@danielnelson So, what exactly should I change? Everything? the directory, file names and the references to them?
There was a problem hiding this comment.
Yeah, I think we need to change all of this.
| certs := conn.ConnectionState().PeerCertificates | ||
|
|
||
| if certs == nil || len(certs) < 1 { | ||
| return nil, errors.New("Could not get server's certificate from the TLS connection.") |
There was a problem hiding this comment.
Include the name of the server that caused this.
…c4d100f369d60c44d71bc602d702180c42
|
Since this PR is pretty stalled, what would be the best way to try to get it merged again ? Pick the patches, apply requested changes and open a new PR ? |
|
@antoinealb if you want to start from where I left, be my guest. This was my first go project ever and I don't really now have much time to spend on this. |
|
sounds like we should close this in favor of #3768 . Thoughts? |
Required for all PRs: