MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / run

Method run

src/Server/TLSHandler.cpp:101–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99
100
101void 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}

Callers

nothing calls this directly

Calls 12

attachFunction · 0.85
disableProtocolsMethod · 0.80
preferServerCiphersMethod · 0.80
sslContextMethod · 0.80
defaultServerContextMethod · 0.80
ExceptionClass · 0.50
emptyMethod · 0.45
hasMethod · 0.45
tryLoadMethod · 0.45

Tested by

no test coverage detected