Welcome! Log In Create A New Profile

Advanced

[PATCH] Add a no_verify option for SSL client authentication

Eric O'Connor
August 18, 2012 11:50AM
Hello Nginx,

This patch adds a "ssl_verify_client no_verify;" option that triggers
a client to upload a certificate, but does not throw an exception when
that certificate does not validate. It also allows
"ssl_client_certificate" to not exist when this option is specified.

This is useful for our company's application where we would like to do
SSL client authentication on an application server.

Any feedback is welcome.

~ Eric O'Connor

---
src/http/modules/ngx_http_ssl_module.c | 3 ++-
src/http/ngx_http_request.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/http/modules/ngx_http_ssl_module.c
b/src/http/modules/ngx_http_ssl_module.c
index d759489..fede8e0 100644
--- a/src/http/modules/ngx_http_ssl_module.c
+++ b/src/http/modules/ngx_http_ssl_module.c
@@ -48,6 +48,7 @@ static ngx_conf_enum_t ngx_http_ssl_verify[] = {
{ ngx_string("off"), 0 },
{ ngx_string("on"), 1 },
{ ngx_string("optional"), 2 },
+ { ngx_string("no_verify"), 3 },
{ ngx_null_string, 0 }
};

@@ -466,7 +467,7 @@ ngx_http_ssl_merge_srv_conf(ngx_conf_t *cf, void
*parent, void *child)

if (conf->verify) {

- if (conf->client_certificate.len == 0) {
+ if (conf->client_certificate.len == 0 && conf->verify != 3) {
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
"no ssl_client_certificate for
ssl_client_verify");
return NGX_CONF_ERROR;
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index c104db1..5d02683 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1634,7 +1634,7 @@ ngx_http_process_request(ngx_http_request_t *r)
if (sscf->verify) {
rc = SSL_get_verify_result(c->ssl->connection);

- if (rc != X509_V_OK) {
+ if (sscf->verify != 3 && rc != X509_V_OK) {
ngx_log_error(NGX_LOG_INFO, c->log, 0,
"client SSL certificate verify error:
(%l:%s)",
rc, X509_verify_cert_error_string(rc));
--


_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Add a no_verify option for SSL client authentication

Eric O'Connor 1153 August 18, 2012 11:50AM

Re: [PATCH] Add a no_verify option for SSL client authentication

Tom van der Woerdt 510 August 20, 2012 03:48AM

Re: [PATCH] Add a no_verify option for SSL client authentication

Eric O'Connor 465 August 20, 2012 08:14AM

Re: [PATCH] Add a no_verify option for SSL client authentication

Tom van der Woerdt 483 August 20, 2012 08:38AM

Re: [PATCH] Add a no_verify option for SSL client authentication

Maxim Dounin 556 August 21, 2012 07:04AM

Re: [PATCH] Add a no_verify option for SSL client authentication

Eric O'Connor 467 August 20, 2012 10:50AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 79
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready