-
Notifications
You must be signed in to change notification settings - Fork 799
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
support HTTPS/TLS. #946
support HTTPS/TLS. #946
Conversation
@karezachen Hi, the feature is very nice. We are looking for prometheus python client with TLS support. Our project is pending on the feature. Can you pls set reviewer and ask them to review and merge it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good! Simple and but nice!
Thank you. I think this is interesting, however we would need to document it better and make sure that we error if the arguments passed are not correct (e.g. an array of 2). Maybe we should review the API to make it more clear which is which in the array, maybe by using multiple arguments or a custom object? What would be alternate proposals here? |
@karezachen Hi Kareza, thank you for the improvement.
|
@Charles1000Chen @roidelapluie Hi,Thank you for the review. I have wrapped the If you have any other suggestions, I am more than willing to make the changes. |
@csmarchbanks PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doc improvement suggestion. Pls add the optional parameters into the doc. thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comments
I have started using the PR in its current state for our Z HMC Prometheus exporter (see PR zhmcclient/zhmc-prometheus-exporter#361), and it worked. However, see my comments, above. |
@karezachen Hi Kareza. I have reviewed the latest version of the PR and have opened some new review comments. I was not able to mark some of the old ones as resolved, so I updated the comments that they were resolved, and then I hided the comments. |
Signed-off-by: kareza <[email protected]>
Signed-off-by: kareza <[email protected]>
1.A better description of what's new. 2.Modify the parameter order of the start_wsgi_server method to maintain forward compatibility. 3.Enable authentication mode when safe. Signed-off-by: kareza <[email protected]>
Author: Andreas Maier <[email protected]> Signed-off-by: kareza <[email protected]>
@roidelapluie @xiqing-zhang @xiqing-zhang Thank you all for the discussion and review of this PR. What is still missing before it can be merged? |
@karezachen Hello Kareza. Thanks much for integrating the remaining changes. My review comments have all been resolved. From my perspective, the PR could be merged. @roidelapluie @csmarchbanks Anything left to be done from your perspective? |
@karezachen @roidelapluie @csmarchbanks I have tested by zhmc-prometheus-exporter and the mTLS feature works well. Could you help to get the pr merged? Thanks. |
👋 I am just coming back from leave and still catching up. I hope to have time to review this soon though if @roidelapluie does not get to it first. |
Note that I was not able to mark my review comments as resolved, but I consider all of them resolved. |
Hi, I tired the HTTPS option but I get an error, TypeError: start_wsgi_server() got an unexpected keyword argument 'tls' it seems that the tls=[certfile, keyfile] is not a valid argument for the function. Can you advise on the topic? Thank you, Constantin |
@GeluConstantin I did use the Please refer to README to use |
@GeluConstantin Hi Constantin. I tried the branch of this PR with HTTPS shortly after its last update and it worked fine. Note that the branch has 7 commits, so you need to use all of them. |
Hi Andy, do you know when the PR is going to be integrated into a release? At the moment I use the latest prometheus-client release 0.17.1 and this release has not yet the HTTPS feature. Thank you for the feebdack, Constantin |
@GeluConstantin No, I don't know. I am not a maintainer of the project. @roidelapluie or @csmarchbanks Any chance to get this PR reviewed and merged? |
I used fastAPI to provide HTTPS, so my problem is solved. Kind regards, Gelu |
I am out this week, so unlikely until next week. I have the open question about mTLS behavior when I reviewed it, but otherwise this looks ok to me. I just either need to hear back from @roidelapluie or investigate the behavior next week when I am back. |
@csmarchbanks Any result on your investigation on the PR? We do need your help to have this PR merged. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, by default mTLS should not be enabled. You can find more detail in https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md, but I believe we should not set ssl_cxt.verify_mode
to ssl.CERT_REQUIRED
by default, and instead have the user opt in.
To be most like the exporter toolkit we would allow users to pass in any verify mode, but I would also be ok with only the default (CERT_NONE
), or a flag to enable mTLS and then set CERT_REQUIRED
.
…ertificates. Signed-off-by: kareza <[email protected]>
@csmarchbanks @roidelapluie Kareza has updated the PR to implement the suggestion with the renamed client_cafile/path parameters. It seems the only open comment at this point is the one about the default for mTLS. I suggested a solution in the comment further up. Could you please let us know how you like that solution? |
- Update `_get_ssl_ctx` func, default not to set `ssl_ctx.verify_mode=ssl.CERT_REQUIRED`. - Update the description of default in README.md. Signed-off-by: kareza <[email protected]>
@Charles1000Chen @xiqing-zhang @andy-maier @csmarchbanks @roidelapluie Thank you very much for your help with this PR, I think our problems have been solved. Is it possible to merge this PR now? Thanks |
@csmarchbanks @roidelapluie Any chance to merge this PR and release a new version? From the perspective of the contributors and reviewers of the PR, all open review comments have been addressed. |
This review comment has not been addressed yet, looks like it was hidden by the Github UI though: #946 (comment). I do think it is reasonable to remove |
@csmarchbanks Hi Chris, the |
@csmarchbanks As Charles1000Chen points out, removing |
Apparently I had a pending comment and didn't click the send button :( I am happy with the current behavior (keep being able to use the default certificate store). I would like @roidelapluie to ok that as well since he brought up the concern originally though. |
Let's keep the ability to use the system store. This PR LGTM, thank you all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 I think that covers it, thanks as well!
@karezachen Thanks again, Kareza for the contributions! |
#930
HTTP
Demo
Curl HTTPS Request
Response
Support HTTPS/TLS
Demo
Generate server cert and server key.
Curl HTTPS Request
Response
Enabled mTLS
Demo
Generate client cert and client key.
Curl HTTPS Request
Response
Curl HTTPS Request with client cert and client key
Response