-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
caddytls: clientauth: leaf verifier: make trusted leaf certs source pluggable #6050
caddytls: clientauth: leaf verifier: make trusted leaf certs source pluggable #6050
Conversation
7269bfc
to
56813fd
Compare
@mohammed90, I don't know if this is what you meant by "we should make this pluggable" so this is still in draft. I would like to get your early feedback about where this is going. This is my first time creating a caddy module from scratch and hosting it so any advice is appreciated 😅 Thank you in advance for your help. |
Thanks @armadi1809 ! @mohammed90 , is this similar to #5784? |
No. This one is for the verifiers. Thanks, @armadi1809! I'm a bit busy this weekend, but you'll need to go through this page: |
56813fd
to
6cf5094
Compare
@mohammed90 Thank you for your explanation. I actually went through that document before working on this but looks like I didn't totally get your point. I made some changes in my last commit but I still have some doubts regarding the concept of "pluggable" in this case. I changed the logic to have the new module contain the decoded certs and provide them to the |
Did you forget to push? I don't see your changes, I only see your rebase from earlier. |
The changes are part of the rebase. I changed the type of the new module we're adding from a |
Okay, it's still not what @mohammed90 was asking for - it's still not pluggable. To be pluggable (in the sense of a Caddy plugin, not "plugging data into the config", if that was unclear), there needs to be an interface that a plugin could implement to provide info or perform a task. Read through https://caddyserver.com/docs/extending-caddy, especially the part on namespaces & interfaces. We want this to be a Host Module which can take a guest module as input, and guest modules will load certificates in various ways (i.e. from file, or statically, or from an HTTP endpoint, or a storage plugin, etc). For example, the // ClientCertificateVerifier is a type which verifies client certificates.
// It is called during verifyPeerCertificate in the TLS handshake.
type ClientCertificateVerifier interface {
VerifyClientCertificate(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error
} We do already have the |
Francis is right 💯
I think it's best to re-use the interface and the namespace, which is |
I think it would have to special-case skip the I don't think the existing |
Yeah, just looked at the code now and noticed the same thing. Re-using the existing interface won't work because the data returned by the interface, i.e. We'll need a new interface and a new namespace. |
I think I am starting to understand 😅 . Thanks for mentioning the |
You're doing great! Sorry I haven't been more involved in the process lately (baby takes up my spare brain cycles and time) -- but you're on the right track. Thank you! |
6cf5094
to
ecd3716
Compare
I think this now aligns closer to what you guys meant, right? |
ecd3716
to
0034bc8
Compare
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.
Looking good! I think we're close 😃
f4f6178
to
cc3b18b
Compare
All the feedback items should now be resolved. I guess my last question is, will we be providing a couple of |
I think we should have some built in, same as |
I added some built in leaf certs loaders. I didn't know if I should be incorporating the file and the folder loaders into the Caddyfile config similarly to the |
5d04e51
to
3026a8e
Compare
Thanks for working on this and so many other patches recently, @armadi1809. Could you join our developer Slack? That way you're welcome to discuss changes and other Caddy things in more real-time with our team. Just let me know which email address to send the invite to. |
@mholt Thank you for the invite! I appreciate it. You can use [email protected] |
37eb0cb
to
4a5a8ba
Compare
@mohammed90 I added tests for the file and folder loaders. Is that what you meant by loading the config and check whether or not it meets the expectations? |
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.
This is looking better! Just a few cleanup items.
Also, add some tests under caddytest/integration
that will simply do tester.InitServer
with config that has leaf verifiers. Just 1 for comfort.
* core: OnExit callbacks * core: Process-global OnExit callbacks
Bumps [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action) from 3 to 4. - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](golangci/golangci-lint-action@v3...v4) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
5acc7bf
to
43e9ba4
Compare
43e9ba4
to
348a2d4
Compare
@mohammed90 all the feedback items from above should now be resolved. I also added a test for the PEM loader as well as an integration test. |
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.
Looks great now! Thank you, Aziz, for working on this.
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.
Thank you, I think we're getting close!! Just a couple of nits and a question to clarify.
@mholt Thanks for reviewing. All the feedback items should now be resolved. And thank you @mohammed90 for all your efforts with this! |
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.
Awesome! Just one thing I missed, then we merge. ha
That's weird, govulncheck wasn't failing just 30 minutes ago... fluke? |
I think the vuln was published recently: https://pkg.go.dev/vuln/GO-2024-2611 |
Of course, our luck 🙄 |
Yeah 😶 The fastest course of action is if you, @mholt, update the dep Or... @armadi1809, can you just run this?
|
Okay... I think we should be good to go now 😅 |
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 -- nice work, thanks for the contribution!
(And you are fast. I am working through a lot of things today so you beat me to it!)
Closes #6046