Squid Web Cache master
Loading...
Searching...
No Matches
ServerOptions.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9#include "squid.h"
10#include "anyp/PortCfg.h"
11#include "base/IoManip.h"
12#include "base/Packable.h"
13#include "cache_cf.h"
15#include "fatal.h"
16#include "globals.h"
18#include "security/Session.h"
19#include "SquidConfig.h"
20#if USE_OPENSSL
21#include "compat/openssl.h"
22#include "ssl/support.h"
23
24#if HAVE_OPENSSL_DECODER_H
25#include <openssl/decoder.h>
26#endif
27#if HAVE_OPENSSL_ERR_H
28#include <openssl/err.h>
29#endif
30#endif
31
32#include <limits>
33
58
59void
61{
62 if (!*token) {
63 // config says just "ssl" or "tls" (or "tls-")
64 encryptTransport = true;
65 return;
66 }
67
68 // parse the server-only options
69 if (strncmp(token, "clientca=", 9) == 0) {
70 clientCaFile = SBuf(token + 9);
71 } else if (strncmp(token, "dh=", 3) == 0) {
72 // clear any previous Diffi-Helman configuration
73 dh.clear();
74 dhParamsFile.clear();
75 eecdhCurve.clear();
76
77 dh.append(token + 3);
78
79 if (!dh.isEmpty()) {
80 auto pos = dh.find(':');
81 if (pos != SBuf::npos) { // tls-dh=eecdhCurve:dhParamsFile
82 eecdhCurve = dh.substr(0,pos);
83 dhParamsFile = dh.substr(pos+1);
84 } else { // tls-dh=dhParamsFile
85 dhParamsFile = dh;
86 // empty eecdhCurve means "do not use EECDH"
87 }
88 }
89
90 loadDhParams();
91
92 } else if (strncmp(token, "dhparams=", 9) == 0) {
93 if (!eecdhCurve.isEmpty()) {
94 debugs(83, DBG_PARSE_NOTE(1), "WARNING: UPGRADE: EECDH settings in tls-dh= override dhparams=");
95 return;
96 }
97
98 // backward compatibility for dhparams= configuration
99 dh.clear();
100 dh.append(token + 9);
101 dhParamsFile = dh;
102
103 loadDhParams();
104
105 } else if (strncmp(token, "dynamic_cert_mem_cache_size=", 28) == 0) {
106 parseBytesOptionValue(&dynamicCertMemCacheSize, "bytes", token + 28);
107 // XXX: parseBytesOptionValue() self_destruct()s on invalid values,
108 // probably making this comparison and misleading ERROR unnecessary.
109 if (dynamicCertMemCacheSize == std::numeric_limits<size_t>::max()) {
110 debugs(3, DBG_CRITICAL, "ERROR: Cannot allocate memory for '" << token << "'. Using default of 4MB instead.");
111 dynamicCertMemCacheSize = 4*1024*1024; // 4 MB
112 }
113
114 } else if (strcmp(token, "generate-host-certificates") == 0) {
115 generateHostCertificates = true;
116 } else if (strcmp(token, "generate-host-certificates=on") == 0) {
117 generateHostCertificates = true;
118 } else if (strcmp(token, "generate-host-certificates=off") == 0) {
119 generateHostCertificates = false;
120
121 } else if (strncmp(token, "context=", 8) == 0) {
122#if USE_OPENSSL
123 staticContextSessionId = SBuf(token+8);
124 // to hide its arguably sensitive value, do not print token in these debugs
125 if (staticContextSessionId.length() > SSL_MAX_SSL_SESSION_ID_LENGTH) {
126 debugs(83, DBG_CRITICAL, "FATAL: Option 'context=' value is too long. Maximum " << SSL_MAX_SSL_SESSION_ID_LENGTH << " characters.");
128 }
129#else
130 debugs(83, DBG_PARSE_NOTE(DBG_IMPORTANT), "WARNING: Option 'context=' requires --with-openssl. Ignoring.");
131#endif
132
133 } else {
134 // parse generic TLS options
136 }
137}
138
139void
140Security::ServerOptions::dumpCfg(std::ostream &os, const char *pfx) const
141{
142 // dump out the generic TLS options
144
145 if (!encryptTransport)
146 return; // no other settings are relevant
147
148 // dump the server-only options
149 if (!dh.isEmpty())
150 os << ' ' << pfx << "dh=" << dh;
151
152 if (!generateHostCertificates)
153 os << ' ' << pfx << "generate-host-certificates=off";
154
155 if (dynamicCertMemCacheSize != 4*1024*1024) // 4MB default, no 'tls-' prefix
156 os << ' ' << "dynamic_cert_mem_cache_size=" << dynamicCertMemCacheSize << "bytes";
157
158 if (!staticContextSessionId.isEmpty())
159 os << ' ' << pfx << "context=" << staticContextSessionId;
160}
161
164{
166#if USE_OPENSSL
168
169 SSL_CTX *t = SSL_CTX_new(TLS_server_method());
170 if (!t) {
171 const auto x = ERR_get_error();
172 debugs(83, DBG_CRITICAL, "ERROR: Failed to allocate TLS server context: " << Security::ErrorString(x));
173 }
174 ctx = convertContextFromRawPtr(t);
175
176#elif HAVE_LIBGNUTLS
177 // Initialize for X.509 certificate exchange
178 gnutls_certificate_credentials_t t;
179 if (const auto x = gnutls_certificate_allocate_credentials(&t)) {
180 debugs(83, DBG_CRITICAL, "ERROR: Failed to allocate TLS server context: " << Security::ErrorString(x));
181 }
182 ctx = convertContextFromRawPtr(t);
183
184#else
185 debugs(83, DBG_CRITICAL, "ERROR: Failed to allocate TLS server context: No TLS library");
186
187#endif
188
189 return ctx;
190}
191
192void
194{
195 const char *portType = AnyP::ProtocolType_str[port.transport.protocol];
196 for (auto &keyData : certs) {
197 keyData.loadFromFiles(port, portType);
198 }
199
200 if (generateHostCertificates) {
201 createSigningContexts(port);
202 }
203
204 if (!certs.empty() && !createStaticServerContext(port)) {
205 char buf[128];
206 fatalf("%s_port %s initialization error", portType, port.s.toUrl(buf, sizeof(buf)));
207 }
208
209 // if generate-host-certificates=off and certs is empty, no contexts may be created.
210 // features depending on contexts do their own checks and error messages later.
211}
212
213bool
215{
216 updateTlsVersionLimits();
217
218 Security::ContextPointer t(createBlankContext());
219 if (t) {
220
221#if USE_OPENSSL
222 if (certs.size() > 1) {
223 // NOTE: calling SSL_CTX_use_certificate() repeatedly _replaces_ the previous cert details.
224 // so we cannot use it and support multiple server certificates with OpenSSL.
225 debugs(83, DBG_CRITICAL, "ERROR: OpenSSL does not support multiple server certificates. Ignoring additional cert= parameters.");
226 }
227
228 const auto &keys = certs.front();
229
230 if (!SSL_CTX_use_certificate(t.get(), keys.cert.get())) {
231 const auto x = ERR_get_error();
232 debugs(83, DBG_CRITICAL, "ERROR: Failed to acquire TLS certificate '" << keys.certFile << "': " << Security::ErrorString(x));
233 return false;
234 }
235
236 if (!SSL_CTX_use_PrivateKey(t.get(), keys.pkey.get())) {
237 const auto x = ERR_get_error();
238 debugs(83, DBG_CRITICAL, "ERROR: Failed to acquire TLS private key '" << keys.privateKeyFile << "': " << Security::ErrorString(x));
239 return false;
240 }
241
242 for (auto cert : keys.chain) {
243 if (SSL_CTX_add_extra_chain_cert(t.get(), cert.get())) {
244 // increase the certificate lock
245 X509_up_ref(cert.get());
246 } else {
247 const auto error = ERR_get_error();
248 debugs(83, DBG_IMPORTANT, "WARNING: can not add certificate to SSL context chain: " << Security::ErrorString(error));
249 }
250 }
251
252#elif HAVE_LIBGNUTLS
253 for (auto &keys : certs) {
254 gnutls_x509_crt_t crt = keys.cert.get();
255 gnutls_x509_privkey_t xkey = keys.pkey.get();
256 const auto x = gnutls_certificate_set_x509_key(t.get(), &crt, 1, xkey);
257 if (x != GNUTLS_E_SUCCESS) {
258 SBuf whichFile = keys.certFile;
259 if (keys.certFile != keys.privateKeyFile) {
260 whichFile.appendf(" and ");
261 whichFile.append(keys.privateKeyFile);
262 }
263 debugs(83, DBG_CRITICAL, "ERROR: Failed to initialize server context with keys from " << whichFile << ": " << Security::ErrorString(x));
264 return false;
265 }
266 // XXX: add cert chain to the context
267 }
268#endif
269
270 if (!loadClientCaFile())
271 return false;
272
273 // by this point all config related files must be loaded
274 if (!updateContextConfig(t)) {
275 debugs(83, DBG_CRITICAL, "ERROR: Configuring static TLS context");
276 return false;
277 }
278 }
279
280 staticContext = std::move(t);
281 return bool(staticContext);
282}
283
284void
286{
287 // For signing we do not have a pre-initialized context object. Instead
288 // contexts are generated as needed. This method initializes the cert
289 // and key pointers used to sign those contexts later.
290
291 signingCa = certs.front();
292
293 const char *portType = AnyP::ProtocolType_str[port.transport.protocol];
294 if (!signingCa.cert) {
295 char buf[128];
296 // XXX: we never actually checked that the cert is capable of signing!
297 fatalf("No valid signing certificate configured for %s_port %s", portType, port.s.toUrl(buf, sizeof(buf)));
298 }
299
300 if (!signingCa.pkey)
301 debugs(3, DBG_IMPORTANT, "No TLS private key configured for " << portType << "_port " << port.s);
302
303#if USE_OPENSSL
304 Ssl::generateUntrustedCert(untrustedSigningCa.cert, untrustedSigningCa.pkey, signingCa.cert, signingCa.pkey);
305#elif HAVE_LIBGNUTLS
306 // TODO: implement for GnuTLS. Just a warning for now since generate is implicitly on for all crypto builds.
307 signingCa.cert.reset();
308 signingCa.pkey.reset();
309 debugs(83, DBG_CRITICAL, "WARNING: Dynamic TLS certificate generation requires --with-openssl.");
310 return;
311#else
312 debugs(83, DBG_CRITICAL, "ERROR: Dynamic TLS certificate generation requires --with-openssl.");
313 return;
314#endif
315
316 if (!untrustedSigningCa.cert) {
317 char buf[128];
318 fatalf("Unable to generate signing certificate for untrusted sites for %s_port %s", portType, port.s.toUrl(buf, sizeof(buf)));
319 }
320}
321
322void
324{
325 // if caFiles is set, just use that
326 if (caFiles.size())
327 return;
328
329 // otherwise fall back to clientca if it is defined
330 if (!clientCaFile.isEmpty())
331 caFiles.emplace_back(clientCaFile);
332}
333
337bool
339{
340 if (clientCaFile.isEmpty())
341 return true;
342
343#if USE_OPENSSL
344 auto *stk = SSL_load_client_CA_file(clientCaFile.c_str());
346#endif
347 if (!clientCaStack) {
348 debugs(83, DBG_CRITICAL, "FATAL: Unable to read client CAs from file: " << clientCaFile);
349 }
350
351 return bool(clientCaStack);
352}
353
360void
362{
363 if (dhParamsFile.isEmpty())
364 return;
365
366 // TODO: After loading and validating parameters, also validate that "the
367 // public and private components have the correct mathematical
368 // relationship". See EVP_PKEY_check().
369
370#if USE_OPENSSL
371#if OPENSSL_VERSION_MAJOR < 3
372 DH *dhp = nullptr;
373 if (FILE *in = fopen(dhParamsFile.c_str(), "r")) {
374 dhp = PEM_read_DHparams(in, nullptr, nullptr, nullptr);
375 fclose(in);
376 } else {
377 const auto xerrno = errno;
378 debugs(83, DBG_IMPORTANT, "WARNING: Failed to open '" << dhParamsFile << "'" << ReportSysError(xerrno));
379 return;
380 }
381
382 if (!dhp) {
383 debugs(83, DBG_IMPORTANT, "WARNING: Failed to read DH parameters '" << dhParamsFile << "'");
384 return;
385 }
386
387 int codes;
388 if (DH_check(dhp, &codes) == 0) {
389 if (codes) {
390 debugs(83, DBG_IMPORTANT, "WARNING: Failed to verify DH parameters '" << dhParamsFile << "' (" << asHex(codes) << ")");
391 DH_free(dhp);
392 dhp = nullptr;
393 }
394 }
395
396 parsedDhParams.resetWithoutLocking(dhp);
397
398#else // OpenSSL 3.0+
399 const auto type = "DH";
400
402 EVP_PKEY *rawPkey = nullptr;
403 using DecoderContext = std::unique_ptr<OSSL_DECODER_CTX, HardFun<void, OSSL_DECODER_CTX*, &OSSL_DECODER_CTX_free> >;
404 if (const DecoderContext dctx{OSSL_DECODER_CTX_new_for_pkey(&rawPkey, "PEM", nullptr, type, 0, nullptr, nullptr)}) {
405
406 // OpenSSL documentation is vague on this, but OpenSSL code and our
407 // tests suggest that rawPkey remains nil here while rawCtx keeps
408 // rawPkey _address_ for use by the decoder (see OSSL_DECODER_from_fp()
409 // below). Thus, we must not move *rawPkey into a smart pointer until
410 // decoding is over. For cleanup code simplicity, we assert nil rawPkey.
411 assert(!rawPkey);
412
413 if (OSSL_DECODER_CTX_get_num_decoders(dctx.get()) == 0) {
414 debugs(83, DBG_IMPORTANT, "WARNING: No suitable decoders found for " << type << " parameters" << Ssl::ReportAndForgetErrors);
415 return;
416 }
417
418 if (const auto in = fopen(dhParamsFile.c_str(), "r")) {
419 if (OSSL_DECODER_from_fp(dctx.get(), in)) {
420 assert(rawPkey);
421 const Security::DhePointer pkey(rawPkey);
422 if (const Ssl::EVP_PKEY_CTX_Pointer pkeyCtx{EVP_PKEY_CTX_new_from_pkey(nullptr, pkey.get(), nullptr)}) {
423 switch (EVP_PKEY_param_check(pkeyCtx.get())) {
424 case 1: // success
425 parsedDhParams = pkey;
426 break;
427 case -2:
428 debugs(83, DBG_PARSE_NOTE(2), "WARNING: OpenSSL does not support " << type << " parameters check: " << dhParamsFile << Ssl::ReportAndForgetErrors);
429 break;
430 default:
431 debugs(83, DBG_IMPORTANT, "ERROR: Failed to verify " << type << " parameters in " << dhParamsFile << Ssl::ReportAndForgetErrors);
432 break;
433 }
434 } else {
435 // TODO: Reduce error reporting code duplication.
436 debugs(83, DBG_IMPORTANT, "ERROR: Cannot check " << type << " parameters in " << dhParamsFile << Ssl::ReportAndForgetErrors);
437 }
438 } else {
439 debugs(83, DBG_IMPORTANT, "WARNING: Failed to decode " << type << " parameters '" << dhParamsFile << "'" << Ssl::ReportAndForgetErrors);
440 EVP_PKEY_free(rawPkey); // probably still nil, but just in case
441 }
442 fclose(in);
443 } else {
444 const auto xerrno = errno;
445 debugs(83, DBG_IMPORTANT, "WARNING: Failed to open '" << dhParamsFile << "'" << ReportSysError(xerrno));
446 }
447
448 } else {
449 debugs(83, DBG_IMPORTANT, "WARNING: Unable to create decode context for " << type << " parameters" << Ssl::ReportAndForgetErrors);
450 return;
451 }
452#endif
453#endif // USE_OPENSSL
454}
455
456bool
458{
459 updateContextOptions(ctx);
460 updateContextSessionId(ctx);
461
462#if USE_OPENSSL
463 if (parsedFlags & SSL_FLAG_NO_SESSION_REUSE) {
464 SSL_CTX_set_session_cache_mode(ctx.get(), SSL_SESS_CACHE_OFF);
465 }
466
468 debugs(83, 5, "Enabling quiet SSL shutdowns (RFC violation).");
469 SSL_CTX_set_quiet_shutdown(ctx.get(), 1);
470 }
471
472 if (!sslCipher.isEmpty()) {
473 debugs(83, 5, "Using cipher suite " << sslCipher << ".");
474 if (!SSL_CTX_set_cipher_list(ctx.get(), sslCipher.c_str())) {
475 auto ssl_error = ERR_get_error();
476 debugs(83, DBG_CRITICAL, "ERROR: Failed to set SSL cipher suite '" << sslCipher << "': " << Security::ErrorString(ssl_error));
477 return false;
478 }
479 }
480
482#endif
483
484 updateContextEecdh(ctx);
485 updateContextCa(ctx);
486 updateContextClientCa(ctx);
487
488#if USE_OPENSSL
489 SSL_CTX_set_mode(ctx.get(), SSL_MODE_NO_AUTO_CHAIN);
490 if (parsedFlags & SSL_FLAG_DONT_VERIFY_DOMAIN)
491 SSL_CTX_set_ex_data(ctx.get(), ssl_ctx_ex_index_dont_verify_domain, (void *) -1);
492
494#endif
495 return true;
496}
497
498void
500{
501#if USE_OPENSSL
502 if (clientCaStack) {
503 ERR_clear_error();
504 if (STACK_OF(X509_NAME) *clientca = SSL_dup_CA_list(clientCaStack.get())) {
505 SSL_CTX_set_client_CA_list(ctx.get(), clientca);
506 } else {
507 auto ssl_error = ERR_get_error();
508 debugs(83, DBG_CRITICAL, "ERROR: Failed to dupe the client CA list: " << Security::ErrorString(ssl_error));
509 return;
510 }
511
512 Ssl::ConfigurePeerVerification(ctx, parsedFlags);
513
514 updateContextCrl(ctx);
515 updateContextTrust(ctx);
516
517 } else {
519 }
520#else
521 (void)ctx;
522#endif
523}
524
525void
527{
528 // set Elliptic Curve details into the server context
529 if (!eecdhCurve.isEmpty()) {
530 debugs(83, 9, "Setting Ephemeral ECDH curve to " << eecdhCurve << ".");
531
532#if USE_OPENSSL && OPENSSL_VERSION_NUMBER >= 0x0090800fL && !defined(OPENSSL_NO_ECDH)
533
535
536 int nid = OBJ_sn2nid(eecdhCurve.c_str());
537 if (!nid) {
538 debugs(83, DBG_CRITICAL, "ERROR: Unknown EECDH curve '" << eecdhCurve << "'");
539 return;
540 }
541
542#if OPENSSL_VERSION_MAJOR < 3
543 auto ecdh = EC_KEY_new_by_curve_name(nid);
544 if (!ecdh) {
545 const auto x = ERR_get_error();
546 debugs(83, DBG_CRITICAL, "ERROR: Unable to configure Ephemeral ECDH: " << Security::ErrorString(x));
547 return;
548 }
549
550 if (!SSL_CTX_set_tmp_ecdh(ctx.get(), ecdh)) {
551 const auto x = ERR_get_error();
552 debugs(83, DBG_CRITICAL, "ERROR: Unable to set Ephemeral ECDH: " << Security::ErrorString(x));
553 }
554 EC_KEY_free(ecdh);
555
556#else
557 // TODO: Support multiple group names via SSL_CTX_set1_groups_list().
558 if (!SSL_CTX_set1_groups(ctx.get(), &nid, 1)) {
559 debugs(83, DBG_CRITICAL, "ERROR: Unable to set Ephemeral ECDH: " << Ssl::ReportAndForgetErrors);
560 return;
561 }
562#endif
563#else
564 debugs(83, DBG_CRITICAL, "ERROR: EECDH is not available in this build." <<
565 " Please link against OpenSSL>=0.9.8 and ensure OPENSSL_NO_ECDH is not set.");
566 (void)ctx;
567#endif
568 }
569
570 // set DH parameters into the server context
571#if USE_OPENSSL
572 if (parsedDhParams) {
573#if OPENSSL_VERSION_MAJOR < 3
574 if (SSL_CTX_set_tmp_dh(ctx.get(), parsedDhParams.get()) != 1) {
575 debugs(83, DBG_IMPORTANT, "ERROR: Unable to set DH parameters in TLS context (using legacy OpenSSL): " << Ssl::ReportAndForgetErrors);
576 }
577#else
578 const auto tmp = EVP_PKEY_dup(parsedDhParams.get());
579 if (!tmp) {
580 debugs(83, DBG_IMPORTANT, "ERROR: Unable to duplicate DH parameters: " << Ssl::ReportAndForgetErrors);
581 return;
582 }
583 if (SSL_CTX_set0_tmp_dh_pkey(ctx.get(), tmp) != 1) {
584 debugs(83, DBG_IMPORTANT, "ERROR: Unable to set DH parameters in TLS context: " << Ssl::ReportAndForgetErrors);
585 EVP_PKEY_free(tmp);
586 }
587#endif // OPENSSL_VERSION_MAJOR
588 }
589#endif // USE_OPENSSL
590}
591
592void
594{
595#if USE_OPENSSL
596 if (!staticContextSessionId.isEmpty())
597 SSL_CTX_set_session_id_context(ctx.get(), reinterpret_cast<const unsigned char*>(staticContextSessionId.rawContent()), staticContextSessionId.length());
598#else
599 (void)ctx;
600#endif
601}
602
AsHex< Integer > asHex(const Integer n)
a helper to ease AsHex object creation
Definition IoManip.h:169
class SquidConfig Config
void error(char *format,...)
#define assert(EX)
Definition assert.h:17
void parseBytesOptionValue(size_t *bptr, const char *units, char const *value)
Parse bytes number from a string.
Definition cache_cf.cc:1383
void self_destruct(void)
Definition cache_cf.cc:275
a stream manipulator for printing a system call error (if any)
Definition SBuf.h:94
static const size_type npos
Definition SBuf.h:100
SBuf & appendf(const char *fmt,...) PRINTF_FORMAT_ARG2
Definition SBuf.cc:229
SBuf & append(const SBuf &S)
Definition SBuf.cc:185
T * get() const
Returns raw and possibly nullptr pointer.
virtual void parse(const char *)
parse a TLS squid.conf option
PeerOptions & operator=(const PeerOptions &)=default
virtual void dumpCfg(std::ostream &, const char *pfx) const
output squid.conf syntax with 'pfx' prefix on parameters for the stored settings
TLS squid.conf settings for a listening port.
size_t dynamicCertMemCacheSize
max size of generated certificates memory cache (4 MB default)
void createSigningContexts(const AnyP::PortCfg &)
Security::ContextPointer createBlankContext() const override
generate an unset security context object
void updateContextEecdh(Security::ContextPointer &)
update the context with DH, EDH, EECDH settings
SBuf dhParamsFile
Diffi-Helman ciphers parameter file.
X509_NAME_STACK_Pointer clientCaStack
CA certificate(s) to use when verifying client certificates.
bool createStaticServerContext(AnyP::PortCfg &)
SBuf eecdhCurve
Elliptic curve for ephemeral EC-based DH key exchanges.
Security::KeyData untrustedSigningCa
x509 certificate and key for signing untrusted generated certificates
void parse(const char *) override
parse a TLS squid.conf option
bool generateHostCertificates
dynamically make host cert
void dumpCfg(std::ostream &, const char *pfx) const override
output squid.conf syntax with 'pfx' prefix on parameters for the stored settings
SBuf staticContextSessionId
"session id context" for staticContext
void initServerContexts(AnyP::PortCfg &)
SBuf dh
Diffi-Helman cipher config.
void syncCaFiles()
sync the various sources of CA files to be loaded
Security::DhePointer parsedDhParams
DH parameters for temporary/ephemeral DH key exchanges.
bool updateContextConfig(Security::ContextPointer &)
update the given TLS security context using squid.conf settings
ServerOptions & operator=(const ServerOptions &)
std::unique_ptr< STACK_OF(X509_NAME), Security::ServerOptions::sk_X509_NAME_free_wrapper > X509_NAME_STACK_Pointer
void updateContextSessionId(Security::ContextPointer &)
update the context with a configured session ID (if any)
SBuf clientCaFile
name of file to load client CAs from
Security::KeyData signingCa
x509 certificate and key for signing generated certificates
void updateContextClientCa(Security::ContextPointer &)
update the context with CA details used to verify client certificates
int unclean_shutdown
struct SquidConfig::@97 SSL
#define DBG_PARSE_NOTE(x)
Definition Stream.h:42
#define DBG_IMPORTANT
Definition Stream.h:38
#define debugs(SECTION, LEVEL, CONTENT)
Definition Stream.h:192
#define DBG_CRITICAL
Definition Stream.h:37
static int port
void fatalf(const char *fmt,...)
Definition fatal.cc:68
int ssl_ctx_ex_index_dont_verify_domain
bool generateUntrustedCert(Security::CertPointer &untrustedCert, Security::PrivateKeyPointer &untrustedPkey, Security::CertPointer const &cert, Security::PrivateKeyPointer const &pkey)
Definition support.cc:1463
const char * ProtocolType_str[]
void SetSessionCacheCallbacks(Security::ContextPointer &)
Setup the given TLS context with callbacks used to manage the session cache.
Definition Session.cc:409
std::shared_ptr< SSL_CTX > ContextPointer
Definition Context.h:29
const char * ErrorString(const LibErrorCode code)
converts numeric LibErrorCode into a human-friendlier string
Definition forward.h:152
std::unique_ptr< EVP_PKEY_CTX, HardFun< void, EVP_PKEY_CTX *, &EVP_PKEY_CTX_free > > EVP_PKEY_CTX_Pointer
Definition gadgets.h:67
void DisablePeerVerification(Security::ContextPointer &)
Definition support.cc:528
std::ostream & ReportAndForgetErrors(std::ostream &)
Definition gadgets.cc:82
void Initialize()
Definition support.cc:747
void MaybeSetupRsaCallback(Security::ContextPointer &)
if required, setup callback for generating ephemeral RSA keys
Definition support.cc:238
void ForgetErrors()
Clear any errors accumulated by OpenSSL in its global storage.
Definition gadgets.cc:65
void ConfigurePeerVerification(Security::ContextPointer &, const Security::ParsedPortFlags)
set the certificate verify callback for a context
Definition support.cc:501
#define TLS_server_method
Definition openssl.h:200
STACK_OF(X509) *X509_STORE_CTX_get0_untrusted(X509_STORE_CTX *ctx)
Definition openssl.h:237
#define SSL_FLAG_NO_SESSION_REUSE
Definition forward.h:57
#define SSL_FLAG_DONT_VERIFY_DOMAIN
Definition forward.h:56
static char * keys[]