diff --git a/examples/userver/userver.cfg.default b/examples/userver/userver.cfg.default index e1320e27..11d805af 100644 --- a/examples/userver/userver.cfg.default +++ b/examples/userver/userver.cfg.default @@ -112,6 +112,9 @@ userver { # MAX_KEEP_ALIVE 1000 +# LOAD_BALANCE_DEVICE_NETWORK eth1 +# LOAD_BALANCE_LOADAVG_THRESHOLD 4.5 + # DH_FILE ../ulib/CA/param.dh # CERT_FILE ../ulib/CA/server.crt # KEY_FILE ../ulib/CA/server.key diff --git a/examples/userver/userver.cpp b/examples/userver/userver.cpp index da09b978..e978e927 100644 --- a/examples/userver/userver.cpp +++ b/examples/userver/userver.cpp @@ -80,8 +80,13 @@ public: // // LISTEN_BACKLOG max number of ready to be delivered connections to accept() // SET_REALTIME_PRIORITY flag indicating that the preforked processes will be scheduled under the real-time policies SCHED_FIFO + // + // CLIENT_THRESHOLD min number of clients to active polling // CLIENT_FOR_PARALLELIZATION minum number of clients to active parallelization // + // LOAD_BALANCE_DEVICE_NETWORK network interface name of cluster of physical server + // LOAD_BALANCE_LOADAVG_THRESHOLD system load threshold to proxies the request on other userver on the network cluster ([0-9].[0-9]) + // // PID_FILE write main process pid on file indicated // WELCOME_MSG message of welcome to send initially to client connected // RUN_AS_USER downgrade security to that user account diff --git a/include/ulib/ssl/net/sslsocket.h b/include/ulib/ssl/net/sslsocket.h index d3f69f37..03e2153b 100644 --- a/include/ulib/ssl/net/sslsocket.h +++ b/include/ulib/ssl/net/sslsocket.h @@ -249,8 +249,9 @@ public: } stapling; static stapling staple; - static bool doStapling(); + static bool ocsp_use_nonce; + static bool doStapling(); static void cleanupStapling(); static bool setDataForStapling(); static void certificate_status_callback(SSL* _ssl, void* data); diff --git a/src/ulib/net/server/plugin/usp/businesses.usp.save b/src/ulib/net/server/plugin/usp/businesses.usp.save deleted file mode 100644 index 3d4505aa..00000000 --- a/src/ulib/net/server/plugin/usp/businesses.usp.save +++ /dev/null @@ -1,470 +0,0 @@ - - - - - diff --git a/src/ulib/ssl/net/sslsocket.cpp b/src/ulib/ssl/net/sslsocket.cpp index 3bfff5a7..131b0061 100644 --- a/src/ulib/ssl/net/sslsocket.cpp +++ b/src/ulib/ssl/net/sslsocket.cpp @@ -31,11 +31,12 @@ #define SSL_ERROR_WANT_ACCEPT SSL_ERROR_WANT_READ #endif -int USSLSocket::session_cache_index; -SSL_CTX* USSLSocket::cctx; // client -SSL_CTX* USSLSocket::sctx; // server +int USSLSocket::session_cache_index; +SSL_CTX* USSLSocket::cctx; // client +SSL_CTX* USSLSocket::sctx; // server #if !defined(OPENSSL_NO_OCSP) && defined(SSL_CTRL_SET_TLSEXT_STATUS_REQ_CB) +bool USSLSocket::ocsp_use_nonce; USSLSocket::stapling USSLSocket::staple; #endif @@ -1346,7 +1347,9 @@ next: // extract OCSP responder URL from certificate (void) U_SYSCALL(OCSP_request_add0_id, "%p,%p", staple.req, staple.id); - (void) U_SYSCALL(OCSP_request_add1_nonce, "%p,%p,%d", staple.req, 0, -1); + U_INTERNAL_DUMP("ocsp_use_nonce = %b", ocsp_use_nonce) + + if (ocsp_use_nonce) (void) U_SYSCALL(OCSP_request_add1_nonce, "%p,%p,%d", staple.req, 0, -1); // sign the request @@ -1475,26 +1478,45 @@ bool USSLSocket::doStapling() basic = (OCSP_BASICRESP*) U_SYSCALL(OCSP_response_get1_basic, "%p", resp); - result = (basic && U_SYSCALL(OCSP_check_nonce, "%p,%p", staple.req, basic) > 0); + if (ocsp_use_nonce && + U_SYSCALL(OCSP_check_nonce, "%p,%p", staple.req, basic) != 1) + { + result = false; - if (result == false) goto end; + U_DEBUG("ocsp: response has wrong nonce value"); + + goto end; + } // verify signature result = (U_SYSCALL(OCSP_basic_verify, "%p,%p,%p,%lu", basic, 0, UServices::store, staple.verify ? OCSP_TRUSTOTHER : OCSP_NOVERIFY) == 1); - if (result == false) goto end; + if (result == false) + { + U_DEBUG("ocsp: couldn't verify OCSP basic response"); + + goto end; + } result = (U_SYSCALL(OCSP_resp_find_status, "%p,%p,%p,%lu", basic, staple.id, &status, 0, 0, &thisupdate, &nextupdate) == 1); + if (result == false) + { + U_DEBUG("ocsp: no Status found"); + + goto end; + } + nextupdate_str = UStringExt::ASN1TimetoString(nextupdate); U_INTERNAL_DUMP("OCSP_resp_find_status() - %d: %s This update: %s Next update: %v", status, OCSP_cert_status_str(status), UStringExt::ASN1TimetoString(thisupdate).data(), nextupdate_str.rep) - if (result == false || - status != V_OCSP_CERTSTATUS_GOOD) + if (status != V_OCSP_CERTSTATUS_GOOD) { + result = false; + goto end; }