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

Add client certificate support #768

Open
Likqez opened this issue Dec 11, 2020 · 4 comments · May be fixed by #2956
Open

Add client certificate support #768

Likqez opened this issue Dec 11, 2020 · 4 comments · May be fixed by #2956

Comments

@Likqez
Copy link

Likqez commented Dec 11, 2020

Implement client certificates

Is your feature request related to a problem? Please describe.
I am securing my web applications with Cloudflare access. I did all the proxing through manual configuration of a nginx server.
But because I am running more and more applications, I wanted to have a nice GUI like this from npm.
As long npm does not support client certificates, I can not protect my website from unwanted access.

Describe the solution you'd like
I would like a feature to upload an SSL Cert without a key. Which is currently not possible. And then use it inside a proxy host, to verify the clients certificate.

@chaptergy chaptergy changed the title ssl_client_certificate & ssl_verify_client Add client certificate support May 12, 2021
@dmwilson1990
Copy link

With a bit of a workaround it is possible to do this. For whatever reason you're very limited in what you can add to the Edit Proxy Host >> Advance >> Custom Nginx Configuration section. However, you can put include. I wanted to authenticate with my smart card so I added two read only binds to the docker-compose stack:

      - /docker/proxy/DoD_CAs.pem:/etc/ssl/certs/DoD_CAs.pem:ro
      - /docker/proxy/cac_auth.conf:/etc/nginx/conf.d/include/cac_auth.conf:ro

Inside the custom nginx configuration section I added include conf.d/include/cac_auth.conf;

You should be able to add any custom nginx config using this method that would otherwise be unsupported in NPM. Here's what is inside my cac_auth.conf.

ssl_client_certificate /etc/ssl/certs/DoD_CAs.pem;
ssl_verify_client on;
if ($ssl_client_s_dn !~ "CN=YOURCERTCOMMONNAMEHERE") {
  return 403;
}

@Likqez
Copy link
Author

Likqez commented Sep 5, 2021

Thanks for the tip!
Native support would be awesome tho :)

@wrouesnel wrouesnel linked a pull request May 28, 2023 that will close this issue
@ybizeul
Copy link

ybizeul commented Nov 4, 2023

Tried @dmwilson1990 recommendation :

Command failed: /usr/sbin/nginx -t -g "error_log off;" nginx: [emerg] invalid condition "!~" in /etc/nginx/conf.d/include/client_cert.conf:3 nginx: configuration file /etc/nginx/nginx.conf test failed

That's the file content :

ssl_client_certificate /data/custom_ssl/tynsoe_ca.pem;
ssl_verify_client on;
if ($ssl_client_s_dn !~ "CN=yann") {
  return 403;
}

EDIT: It might have been that I didn't have Safari sending the certificate, because I didn't have it in my keychain yet. I removed the block totally though, as I'm assuming it'll trust any CA generated certificate in that case

Copy link

Issue is now considered stale. If you want to keep it open, please comment 👍

@github-actions github-actions bot added the stale label May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants