Skip to content
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

www/caddy: Add client certificate authentication for domains and subdomains #4089

Open
3 tasks done
bob4os opened this issue Jul 12, 2024 · 6 comments
Open
3 tasks done
Labels
feature Adding new functionality help wanted Contributor missing

Comments

@bob4os
Copy link

bob4os commented Jul 12, 2024

Important notices
Before you add a new report, we ask you kindly to acknowledge the following:

Is your feature request related to a problem? Please describe.
I would like to use client certificates for authentication on certain domains.

Describe the solution you'd like
A dropdown for choosing the client authentication mode and another dropdown for choosing one or more certificate authorities provided by OPNsense (https://caddyserver.com/docs/caddyfile/directives/tls#client_auth).
Probably placed in the Trust or Access part in domains or subdomains?

Describe alternatives you've considered
Using NGINX but I like the simplicity of caddy.

Additional context
Adding the (non-standard) verifier module for revoked certificates would be the icing on the cake but a lot of extra work...?

@bob4os
Copy link
Author

bob4os commented Jul 12, 2024

@Monviech Would you be willing to help me out with this request?

@Monviech
Copy link
Member

Monviech commented Jul 12, 2024

I'm not sure.

There's already:

  • Access Lists
  • Basic Auth
  • Forward Auth

So already 3 ways to control access. Is a 4th method really needed?

Client Certificate Authentication seems more like a business related feature for me.

The os-OPNWAF has client certificate authentication built in and also supplies automatic Let's Encrypt certificates: https://docs.opnsense.org/vendor/deciso/opnwaf.html#protect-a-local-server-with-certificates

EDIT: Of course - PRs are welcome.

@bob4os
Copy link
Author

bob4os commented Jul 12, 2024

Well it probably is a business feature but it is also available in HAProxy and NGINX.
The OPNWAF plugin is based on Apache as far as I can see, I have never warmed up to it.

I wanted to benefit from automatic certificates without the need for the ACME plugin (nothing wrong with it), probably even OCSP for client certificates, HTTP3...

I will give it a try.

@Monviech
Copy link
Member

Monviech commented Jul 12, 2024

If you want to give it a try, the backend scripts already take care of the certificate extraction.

You would only need to add things to the model, form controller, reverse_proxy view and the Caddyfile template.

Shouldn't be too hard if you keep the scope of it simple. All the certificate logic has already been implemented at multiple points so its probably just some copy pasting.

The hardest part is the template. The authentication methods like basic auth and access lists kaskade into each other with uuid handles. Its that multiple authentication methods can coexist at the same time in a specific order. Thats the most conplex part to get right.

@bob4os
Copy link
Author

bob4os commented Jul 12, 2024

I did a bit of research last week, but didn't have time this week.
But it does seem managable, yes.

Do you have a preference as were to put the ui elements?
In the Caddyfile it is placed in the tls directive, so I would place it in the Trust collapsible.

@Monviech
Copy link
Member

Since its more of an access control feature I would put it under Access in domains and subdomains. In Trust it might confuse people.

Thanks for giving it a try :)

@Monviech Monviech added feature Adding new functionality help wanted Contributor missing labels Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Adding new functionality help wanted Contributor missing
Development

No branches or pull requests

2 participants