17 #define NGX_DEFAULT_CIPHERS "HIGH:!aNULL:!MD5"
18 #define NGX_DEFAULT_ECDH_CURVE "prime256v1"
21 #ifdef TLSEXT_TYPE_next_proto_neg
23 const unsigned char **out,
unsigned int *outlen,
void *arg);
32 static void *ngx_http_ssl_create_srv_conf(
ngx_conf_t *cf);
33 static char *ngx_http_ssl_merge_srv_conf(
ngx_conf_t *cf,
34 void *parent,
void *child);
105 &ngx_http_ssl_protocols },
119 &ngx_http_ssl_verify },
151 ngx_http_ssl_session_cache,
203 ngx_http_ssl_add_variables,
209 ngx_http_ssl_create_srv_conf,
210 ngx_http_ssl_merge_srv_conf,
219 &ngx_http_ssl_module_ctx,
220 ngx_http_ssl_commands,
235 {
ngx_string(
"ssl_protocol"), NULL, ngx_http_ssl_static_variable,
238 {
ngx_string(
"ssl_cipher"), NULL, ngx_http_ssl_static_variable,
241 {
ngx_string(
"ssl_session_id"), NULL, ngx_http_ssl_variable,
244 {
ngx_string(
"ssl_client_cert"), NULL, ngx_http_ssl_variable,
247 {
ngx_string(
"ssl_client_raw_cert"), NULL, ngx_http_ssl_variable,
251 {
ngx_string(
"ssl_client_s_dn"), NULL, ngx_http_ssl_variable,
254 {
ngx_string(
"ssl_client_i_dn"), NULL, ngx_http_ssl_variable,
257 {
ngx_string(
"ssl_client_serial"), NULL, ngx_http_ssl_variable,
260 {
ngx_string(
"ssl_client_verify"), NULL, ngx_http_ssl_variable,
270 #ifdef TLSEXT_TYPE_next_proto_neg
272 #define NGX_HTTP_NPN_ADVERTISE "\x08http/1.1"
276 const unsigned char **out,
unsigned int *outlen,
void *arg)
278 #if (NGX_HTTP_SPDY || NGX_DEBUG)
292 *out = (
unsigned char *) NGX_SPDY_NPN_ADVERTISE NGX_HTTP_NPN_ADVERTISE;
293 *outlen =
sizeof(NGX_SPDY_NPN_ADVERTISE NGX_HTTP_NPN_ADVERTISE) - 1;
295 return SSL_TLSEXT_ERR_OK;
300 *out = (
unsigned char *) NGX_HTTP_NPN_ADVERTISE;
301 *outlen =
sizeof(NGX_HTTP_NPN_ADVERTISE) - 1;
303 return SSL_TLSEXT_ERR_OK;
324 for (len = 0; v->
data[len]; len++) { }
377 for (v = ngx_http_ssl_vars; v->
name.
len; v++) {
432 ngx_http_ssl_merge_srv_conf(
ngx_conf_t *cf,
void *parent,
void *child)
491 "no \"ssl_certificate\" is defined for "
492 "the \"ssl\" directive in %s:%ui",
499 "no \"ssl_certificate_key\" is defined for "
500 "the \"ssl\" directive in %s:%ui",
513 "no \"ssl_certificate_key\" is defined "
523 #ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
525 if (SSL_CTX_set_tlsext_servername_callback(conf->
ssl.
ctx,
526 ngx_http_ssl_servername)
530 "nginx was built with SNI support, however, now it is linked "
531 "dynamically to an OpenSSL library which has no tlsext support, "
532 "therefore SNI is not available");
537 #ifdef TLSEXT_TYPE_next_proto_neg
538 SSL_CTX_set_next_protos_advertised_cb(conf->
ssl.
ctx,
539 ngx_http_ssl_npn_advertised, NULL);
557 if (SSL_CTX_set_cipher_list(conf->
ssl.
ctx,
562 "SSL_CTX_set_cipher_list(\"%V\") failed",
570 "no ssl_client_certificate for ssl_client_verify");
596 SSL_CTX_set_options(conf->
ssl.
ctx, SSL_OP_CIPHER_SERVER_PREFERENCE);
684 if (
ngx_strcmp(value[i].data,
"builtin") == 0) {
689 if (value[i].len >
sizeof(
"builtin:") - 1
690 &&
ngx_strncmp(value[i].data,
"builtin:",
sizeof(
"builtin:") - 1)
693 n =
ngx_atoi(value[i].data +
sizeof(
"builtin:") - 1,
694 value[i].len - (
sizeof(
"builtin:") - 1));
705 if (value[i].len >
sizeof(
"shared:") - 1
706 &&
ngx_strncmp(value[i].data,
"shared:",
sizeof(
"shared:") - 1)
711 for (j =
sizeof(
"shared:") - 1; j < value[
i].
len; j++) {
712 if (value[i].data[j] ==
':') {
724 name.
data = value[
i].
data +
sizeof(
"shared:") - 1;
726 size.
len = value[
i].
len - j - 1;
737 "session cache \"%V\" is too small",
744 &ngx_http_ssl_module);
766 "invalid session cache \"%V\"", &value[i]);