-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle updated self-signed cert #25
Comments
I re-worded my bug after I realized that it was my own code (modeled after the examples in this repo) that was storing off the cert. |
Apologies for the delay, I have been volunteering for a political party in the UK general elections. The IQ Gateway does seem to renew its certificate early before expiration (a few months or so I've observed). As you've identified, this library stores the certificate as a one time operation when It's not advisable to trust any HTTPS connection with any self-signed certificate as something on your network could then pretend to be the IQ Gateway and steal your credentials, but if that is not a concern ensuring you simply do not call It's of course possible to have your code call For me an annual outage is acceptable - as with most organisations they have to have a brief outage when they rotate certificates and crypto material... but as stated the library does support the YOLO approach to trusting HTTPS servers by simply removing the Is there anything further I can do to improve the library or its behaviour - or should I just close this issue? We are of course not in control of when the cert gets renewed - although I do have unofficial access to the IQ Gateway source code so could find out exactly what date the renewal happens (although it may be remotely invoked)? |
Looking at the IQ Gateway code
So at 6:25 AM each day and < 100 days before expiration a new certificate will be generated. You could probably automate the Adding a hard dependency on |
I have a script that runs regularly to collect data from my enphase system, and put it into a local DB for my own custom charts.
A couple days ago, this script started failing with errors like this:
I eventually realized that this was happening because the self-signed cert that the Envoy gateway was using had been updated. Based on the advice in
Documentation/Wrappers/Python/README.adoc
and the examples inPython/examples
, I calledGateway.trust_gateway()
to store the cert for future validation. I moved that captured cert file aside, and the next time I ran my script it succeeded, and created a newconfiguration/gateway.cer
file.Old cert:
New cert:
I realize that it is more secure to use this trusted cert, but I'm not sure what a secure way to handle this update would look like. Obviously, accepting any new cert upon validation failure would be no better than not saving the cert in the first place. I had thought that I could reduce the window by only accepting a new cert close to the "Not After" validity date, but in my case, the cert was changed on Aug 21 - over 2 months before it would have expired. I could accept any new cert with the same Issuer/Subject fields, since these seem to be specific to my Envoy gateway (it has my serial number in it). But an attacker could just as easily read the current cert, and spoof a cert with those field values, too.
Please update the documentation to mention this case, and update the examples to gracefully handle it.
The text was updated successfully, but these errors were encountered: