| 99 | |
| 100 | |
| 101 | void DB::TLSHandler::run() |
| 102 | { |
| 103 | #if USE_SSL |
| 104 | bool keys_are_explicitly_set = !params.privateKeyFile.empty() && !params.certificateFile.empty(); |
| 105 | bool acme_certificate_provided = config.has("acme"); |
| 106 | |
| 107 | Context::Ptr ctx; |
| 108 | |
| 109 | if (keys_are_explicitly_set || acme_certificate_provided) |
| 110 | { |
| 111 | ctx = SSLManager::instance().getCustomServerContext(prefix); |
| 112 | if (!ctx) |
| 113 | { |
| 114 | ctx = new Context(usage, params); |
| 115 | ctx->disableProtocols(disabled_protocols); |
| 116 | ctx->enableExtendedCertificateVerification(extended_verification); |
| 117 | if (prefer_server_ciphers) |
| 118 | ctx->preferServerCiphers(); |
| 119 | CertificateReloader::instance().tryLoad(config, ctx->sslContext(), prefix); |
| 120 | ctx = SSLManager::instance().setCustomServerContext(prefix, ctx); |
| 121 | } |
| 122 | } |
| 123 | else |
| 124 | { |
| 125 | ctx = SSLManager::instance().defaultServerContext(); |
| 126 | } |
| 127 | |
| 128 | socket() = SecureStreamSocket::attach(socket(), ctx); |
| 129 | stack_data.socket = socket(); |
| 130 | stack_data.certificate = params.certificateFile; |
| 131 | #else |
| 132 | throw Exception(::ErrorCodes::SUPPORT_IS_DISABLED, "SSL support for TCP protocol is disabled because Poco library was built without NetSSL support."); |
| 133 | #endif |
| 134 | } |
nothing calls this directly
no test coverage detected