-
Notifications
You must be signed in to change notification settings - Fork 23
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
First (very incomplete) attempt at http-01 challenge type #65
Conversation
* HTTP01Responder * AutoHTTPEndpoint
I'll probably only get to look at this PR over the weekend, but could you elaborate a bit about how your proxy setup is configured? (I want to make sure I understand the use case properly) The reason I suggested a file-based So if I understand correctly, the scenario is something like this: You have a reverse proxy / load balancer terminating your TLS, proxying to a Twisted application on the backend that is serving plain HTTP. The reverse proxy / load balancer isn't capable of provisioning the needed certificates itself, however, and you don't want the backend service to terminate the TLS connection, so you want the backend service to obtain the certificates (using the |
@mithrandi yeah that explanation is about right, txacme on a backend server, separate from the frontend load-balancers. There are a couple of reasons for this. We have one of these new-fangled container orchestration systems, and I'm trying to build a service using txacme that will integrate with the platform to automatically set up HTTPS for things running on the platform. Our load balancers (HAProxy) have dynamically-generated config depending on what's running on the cluster. This txacme service I'm building would essentially be "just another container" running somewhere on the cluster and the load balancers would dynamically route ACME challenges to it. This service would then (through some hoops) update the certs on the load-balancers. I've seen ways to route the tls-sni-01 challenge (such as this) but so far those solutions are very convoluted; compared to, say, routing all requests with a path starting with |
Okay, that sounds reasonable. I think the |
Cool. Please don't rush to review as this is so incomplete and it's a Friday afternoon. But if I'm doing something very wrong please tell me 😅 |
Aside from my inline comments, there were also some Reviewed 5 of 5 files at r1. src/txacme/endpoint.py, line 133 [r1] (raw file):
I think the idea of But for src/txacme/challenges/_http.py, line 26 [r1] (raw file):
Unfortunately this won't work; In order to make this actually work, you would have to construct a tree of multiple resources (one child for So in that case, you would use src/txacme/challenges/_http.py, line 36 [r1] (raw file):
This class is probably not necessary; you can use src/txacme/test/test_challenges.py, line 178 [r1] (raw file):
The tests here are a good start. Unfortunately, they fail to detect the issue with the path that I mentioned above, for reasons of symmetry (the tests are broken in the same way as the actual implementation, so they pass). I think some HTTP-level tests would be appropriate here as well. Conveniently, Comments from Reviewable |
Oh, and finally, if you're having any difficulty figuring out any of my feedback or otherwise how to go about doing things, feel free to ask for help 😀 Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed. Comments from Reviewable |
* Not /.well-known/acme-challenge/<token>, just /<token> * Use twisted.web.static.Data as the child resource
Current coverage is 99.93% (diff: 100%)@@ master #65 diff @@
==========================================
Files 21 22 +1
Lines 1561 1606 +45
Methods 0 0
Messages 0 0
Branches 143 145 +2
==========================================
+ Hits 1560 1605 +45
Misses 1 1
Partials 0 0
|
src/txacme/challenges/_http.py, line 26 at r1 (raw file):
|
@mithrandi sorry for the extremely slow response 😢. I've been focussing on other bits of our system to make sure this whole thing is actually feasible (it is). Thanks a lot for your initial feedback 🍰. I've removed the I'm still not really clear on what the API for this will be, though, without |
To integrate this into an existing web server, there would be two steps:
Does that sound reasonable for your use case? We should probably have something in the documentation explaining how to do this, once all the details are figured out. |
Yeah I think that sounds reasonable, thanks. |
* testtools' `succeeded()`
I've figured out the test failures, and (as hypothesised on IRC) it's all bytes vs unicode. As usual, py27's implicit encoding and decoding sweeps this all under the rug. For starters, all URL components should be bytes rather than unicode:
These changes get us to the point where the resource is found and returns a response. However, we're expecting bytes in the response and we're getting unicode. Since the bytes are what we actually care about, we probably want to use |
Test passing finally :) |
Reviewed 1 of 3 files at r2, 2 of 2 files at r6. src/txacme/challenges/_http.py, line 26 at r1 (raw file):
|
Review status: all files reviewed at latest revision, 4 unresolved discussions, some commit checks failed. a discussion (no related file): Comments from Reviewable |
Reviewed 2 of 2 files at r7, 1 of 1 files at r8. Comments from Reviewable |
Hi there,
I'm trying to add the
http-01
challenge type to txacme. I'd like to havehttp-01
support as it is much easier to work with thantls-sni-01
when performing ACME challenges from behind an HTTP proxy.I've seen that you've mentioned that you'd like a file-based
http-01
responder in #31. I think a "standalone" setup with a basic HTTP server is a simpler start and is better matched to what I specifically need.Apologies that this is a very incomplete attempt right now... I'm sort of getting lost in all this Twisted stuff. But I wanted to get some code out there to try get feedback at an early stage. I will hopefully be working with a colleague on this next week. He has much better Twisted skills than I do.
Thanks for txacme :)
This change is