int ngx_ssl_session_ticket_keys_index;
int ngx_ssl_certificate_index;
int ngx_ssl_next_certificate_index;
+int ngx_ssl_certificate_name_index;
int ngx_ssl_stapling_index;
return NGX_ERROR;
}
+ ngx_ssl_certificate_name_index = X509_get_ex_new_index(0, NULL, NULL, NULL,
+ NULL);
+
+ if (ngx_ssl_certificate_name_index == -1) {
+ ngx_ssl_error(NGX_LOG_ALERT, log, 0, "X509_get_ex_new_index() failed");
+ return NGX_ERROR;
+ }
+
ngx_ssl_stapling_index = X509_get_ex_new_index(0, NULL, NULL, NULL, NULL);
if (ngx_ssl_stapling_index == -1) {
return NGX_ERROR;
}
+ if (X509_set_ex_data(x509, ngx_ssl_certificate_name_index, cert->data)
+ == 0)
+ {
+ ngx_ssl_error(NGX_LOG_EMERG, ssl->log, 0, "X509_set_ex_data() failed");
+ X509_free(x509);
+ BIO_free(bio);
+ return NGX_ERROR;
+ }
+
if (X509_set_ex_data(x509, ngx_ssl_next_certificate_index,
SSL_CTX_get_ex_data(ssl->ctx, ngx_ssl_certificate_index))
== 0)
X509 *cert;
X509 *issuer;
+ u_char *name;
+
time_t valid;
time_t refresh;
staple->timeout = 60000;
staple->verify = verify;
staple->cert = cert;
+ staple->name = X509_get_ex_data(staple->cert,
+ ngx_ssl_certificate_name_index);
if (file->len) {
/* use OCSP response from the file */
if (rc == 0) {
ngx_log_error(NGX_LOG_WARN, ssl->log, 0,
- "\"ssl_stapling\" ignored, issuer certificate not found");
+ "\"ssl_stapling\" ignored, "
+ "issuer certificate not found for certificate \"%s\"",
+ staple->name);
X509_STORE_CTX_free(store_ctx);
return NGX_DECLINED;
}
if (aia == NULL) {
ngx_log_error(NGX_LOG_WARN, ssl->log, 0,
"\"ssl_stapling\" ignored, "
- "no OCSP responder URL in the certificate");
+ "no OCSP responder URL in the certificate \"%s\"",
+ staple->name);
return NGX_DECLINED;
}
if (s == NULL) {
ngx_log_error(NGX_LOG_WARN, ssl->log, 0,
"\"ssl_stapling\" ignored, "
- "no OCSP responder URL in the certificate");
+ "no OCSP responder URL in the certificate \"%s\"",
+ staple->name);
X509_email_free(aia);
return NGX_DECLINED;
}
} else {
ngx_log_error(NGX_LOG_WARN, ssl->log, 0,
"\"ssl_stapling\" ignored, "
- "invalid URL prefix in OCSP responder \"%V\"", &u.url);
+ "invalid URL prefix in OCSP responder \"%V\" "
+ "in the certificate \"%s\"",
+ &u.url, staple->name);
return NGX_DECLINED;
}
if (u.err) {
ngx_log_error(NGX_LOG_WARN, ssl->log, 0,
"\"ssl_stapling\" ignored, "
- "%s in OCSP responder \"%V\"", u.err, &u.url);
+ "%s in OCSP responder \"%V\" "
+ "in the certificate \"%s\"",
+ u.err, &u.url, staple->name);
return NGX_DECLINED;
}