diff -pruN lighttpd-1.4.13.orig/src/base.h lighttpd-1.4.13/src/base.h
|
old
|
new
|
|
| 265 | 265 | buffer *ssl_ca_file; |
| 266 | 266 | buffer *ssl_cipher_list; |
| 267 | 267 | unsigned short ssl_use_sslv2; |
| | 268 | unsigned short ssl_verify_peer; |
| | 269 | unsigned short ssl_verify_depth; |
| 268 | 270 | |
| 269 | 271 | unsigned short use_ipv6; |
| 270 | 272 | unsigned short is_ssl; |
diff -pruN lighttpd-1.4.13.orig/src/configfile.c lighttpd-1.4.13/src/configfile.c
|
old
|
new
|
|
| 89 | 89 | { "server.core-files", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 45 */ |
| 90 | 90 | { "ssl.cipher-list", NULL, T_CONFIG_STRING, T_CONFIG_SCOPE_SERVER }, /* 46 */ |
| 91 | 91 | { "ssl.use-sslv2", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 47 */ |
| | 92 | { "ssl.verify-peer", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_SERVER }, /* 48 */ |
| | 93 | { "ssl.verify-depth", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_SERVER }, /* 49 */ |
| 92 | 94 | |
| 93 | 95 | { "server.host", "use server.bind instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, |
| 94 | 96 | { "server.docroot", "use server.document-root instead", T_CONFIG_DEPRECATED, T_CONFIG_SCOPE_UNSET }, |
| … |
… |
|
| 155 | 157 | s->max_write_idle = 360; |
| 156 | 158 | s->use_xattr = 0; |
| 157 | 159 | s->is_ssl = 0; |
| | 160 | s->ssl_verify_peer = 0; |
| | 161 | s->ssl_verify_depth = 9; |
| 158 | 162 | s->ssl_use_sslv2 = 1; |
| 159 | 163 | s->use_ipv6 = 0; |
| 160 | 164 | #ifdef HAVE_LSTAT |
| … |
… |
|
| 206 | 210 | |
| 207 | 211 | cv[46].destination = s->ssl_cipher_list; |
| 208 | 212 | cv[47].destination = &(s->ssl_use_sslv2); |
| | 213 | cv[48].destination = &(s->ssl_verify_peer); |
| | 214 | cv[49].destination = &(s->ssl_verify_depth); |
| 209 | 215 | |
| 210 | 216 | srv->config_storage[i] = s; |
| 211 | 217 | |
| … |
… |
|
| 327 | 333 | PATCH(ssl_cipher_list); |
| 328 | 334 | } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.engine"))) { |
| 329 | 335 | PATCH(is_ssl); |
| | 336 | } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.verify-peer"))) { |
| | 337 | PATCH(ssl_verify_peer); |
| | 338 | } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("ssl.verify-depth"))) { |
| | 339 | PATCH(ssl_verify_depth); |
| 330 | 340 | #ifdef HAVE_LSTAT |
| 331 | 341 | } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.follow-symlink"))) { |
| 332 | 342 | PATCH(follow_symlink); |
diff -pruN lighttpd-1.4.13.orig/src/connections.c lighttpd-1.4.13/src/connections.c
|
old
|
new
|
|
| 1320 | 1320 | ERR_error_string(ERR_get_error(), NULL)); |
| 1321 | 1321 | return NULL; |
| 1322 | 1322 | } |
| | 1323 | if (con->conf.ssl_verify_peer) |
| | 1324 | { |
| | 1325 | if(SSL_get_verify_result(con->ssl) != X509_V_OK) |
| | 1326 | { |
| | 1327 | log_error_write(srv, __FILE__, __LINE__, "ss", "SSL:", |
| | 1328 | ERR_error_string(ERR_get_error(), NULL)); |
| | 1329 | return NULL; |
| | 1330 | } |
| | 1331 | |
| | 1332 | } |
| 1323 | 1333 | } |
| 1324 | 1334 | #endif |
| 1325 | 1335 | return con; |
diff -pruN lighttpd-1.4.13.orig/src/network.c lighttpd-1.4.13/src/network.c
|
old
|
new
|
|
| 72 | 72 | buffer *b; |
| 73 | 73 | int is_unix_domain_socket = 0; |
| 74 | 74 | int fd; |
| | 75 | #ifdef USE_OPENSSL |
| | 76 | pid_t pid; |
| | 77 | #endif |
| 75 | 78 | |
| 76 | 79 | #ifdef SO_ACCEPTFILTER |
| 77 | 80 | struct accept_filter_arg afa; |
| … |
… |
|
| 359 | 362 | ERR_error_string(ERR_get_error(), NULL), s->ssl_ca_file); |
| 360 | 363 | return -1; |
| 361 | 364 | } |
| | 365 | if (s->ssl_verify_peer) { |
| | 366 | SSL_CTX_set_client_CA_list( |
| | 367 | s->ssl_ctx, SSL_load_client_CA_file(s->ssl_ca_file->ptr)); |
| | 368 | } |
| 362 | 369 | } |
| 363 | 370 | |
| 364 | 371 | if (SSL_CTX_use_certificate_file(s->ssl_ctx, s->ssl_pemfile->ptr, SSL_FILETYPE_PEM) < 0) { |
| … |
… |
|
| 380 | 387 | s->ssl_pemfile); |
| 381 | 388 | return -1; |
| 382 | 389 | } |
| | 390 | |
| | 391 | if (s->ssl_verify_peer) { |
| | 392 | SSL_CTX_set_verify(s->ssl_ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, NULL); |
| | 393 | SSL_CTX_set_verify_depth(s->ssl_ctx, s->ssl_verify_depth); |
| | 394 | } |
| | 395 | |
| | 396 | pid = getpid(); |
| | 397 | if (SSL_CTX_set_session_id_context(s->ssl_ctx, (void*)&pid, sizeof(pid)) != 1) { |
| | 398 | log_error_write(srv, __FILE__, __LINE__, "ss", "SSL:", |
| | 399 | ERR_error_string(ERR_get_error(), NULL)); |
| | 400 | return -1; |
| | 401 | } |
| | 402 | |
| 383 | 403 | SSL_CTX_set_default_read_ahead(s->ssl_ctx, 1); |
| 384 | 404 | SSL_CTX_set_mode(s->ssl_ctx, SSL_CTX_get_mode(s->ssl_ctx) | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER); |
| 385 | 405 | |