11#ifndef SQUID_SRC_SSL_SUPPORT_H
12#define SQUID_SRC_SSL_SUPPORT_H
27#if HAVE_OPENSSL_X509V3_H
28#include <openssl/x509v3.h>
31#include <openssl/err.h>
33#if HAVE_OPENSSL_ENGINE_H
34#include <openssl/engine.h>
50#ifndef SQUID_CERT_VALIDATION_ITERATION_MAX
51#define SQUID_CERT_VALIDATION_ITERATION_MAX 16384
75class CertValidationResponse;
395#if defined(__cplusplus)
404int SSL_set_fd(SSL *ssl,
int fd)
406 return ::SSL_set_fd(ssl, _get_osfhandle(fd));
410#define SSL_set_fd(ssl,fd) Squid::SSL_set_fd(ssl,fd)
417#define SSL_set_fd(s,f) (SSL_set_fd(s, _get_osfhandle(f)))
either a domain name (as defined in DNS RFC 1034) or an IP address
char at(size_type pos) const
TLS squid.conf settings for a remote server peer.
TLS squid.conf settings for a listening port.
an algorithm for checking/testing/comparing X.509 certificate names
bool match(const Ssl::GeneralName &) const
whether the given name satisfies algorithm conditions
virtual bool matchIp(const Ip::Address &) const =0
virtual bool matchDomainName(const Dns::DomainName &) const =0
static VerifyCallbackParameters & At(Security::Connection &)
static VerifyCallbackParameters * New(Security::Connection &)
static VerifyCallbackParameters * Find(Security::Connection &)
bool callerHandlesMissingCertificates
convenience base for any class with pure virtual method(s)
void useSquidUntrusted(SSL_CTX *sslContext)
Security::ContextPointer GenerateSslContext(CertificateProperties const &, Security::ServerOptions &, bool trusted)
std::vector< const char * > BumpModeStr
const char * bumpMode(int bm)
SBuf sslGetUserCertificatePEM(SSL *ssl)
bool configureSSL(SSL *ssl, CertificateProperties const &properties, AnyP::PortCfg &port)
bool generateUntrustedCert(Security::CertPointer &untrustedCert, Security::PrivateKeyPointer &untrustedPkey, Security::CertPointer const &cert, Security::PrivateKeyPointer const &pkey)
void chainCertificatesToSSLContext(Security::ContextPointer &, Security::ServerOptions &)
void InRamCertificateDbKey(const Ssl::CertificateProperties &certProperties, SBuf &key)
const char * sslGetUserAttribute(SSL *ssl, const char *attribute_name)
BIO * BIO_new_SBuf(SBuf *buf)
Security::ContextPointer createSSLContext(Security::CertPointer &x509, Security::PrivateKeyPointer &pkey, Security::ServerOptions &)
Create SSL context and apply ssl certificate and private key to it.
bool verifySslCertificate(const Security::ContextPointer &, CertificateProperties const &)
bool configureSSLUsingPkeyAndCertFromMemory(SSL *ssl, const char *data, AnyP::PortCfg &port)
bool loadCerts(const char *certsFile, Ssl::CertsIndexedList &list)
int asn1timeToString(ASN1_TIME *tm, char *buf, int len)
const char * sslGetCAAttribute(SSL *ssl, const char *attribute_name)
Security::ContextPointer GenerateSslContextUsingPkeyAndCertFromMemory(const char *data, Security::ServerOptions &, bool trusted)
GETX509ATTRIBUTE GetX509Fingerprint
SBuf sslGetUserCertificateChainPEM(SSL *ssl)
void configureUnconfiguredSslContext(Security::ContextPointer &, Ssl::CertSignAlgorithm signAlgorithm, AnyP::PortCfg &)
void setClientSNI(SSL *ssl, const char *fqdn)
bool loadSquidUntrusted(const char *path)
const char * sslGetUserEmail(SSL *ssl)
GETX509ATTRIBUTE GetX509UserAttribute
void unloadSquidUntrusted()
char const * GETX509ATTRIBUTE(X509 *, const char *)
GETX509ATTRIBUTE GetX509CAAttribute
std::shared_ptr< SSL_CTX > ContextPointer
bool HasMatchingSubjectName(X509 &, const GeneralNameMatcher &)
bool HasSubjectName(X509 &, const AnyP::Host &)
whether at least one common or alternate subject name matches the given one
void DisablePeerVerification(Security::ContextPointer &)
bool InitClientContext(Security::ContextPointer &, Security::PeerOptions &, Security::ParsedPortFlags)
initialize a TLS client context with OpenSSL specific settings
RefCount< CertValidationResponse > CertValidationResponsePointer
void SSL_add_untrusted_cert(SSL *ssl, X509 *cert)
bool VerifyConnCertificates(Security::Connection &, const Ssl::X509_STACK_Pointer &extraCerts)
Security::CertPointer findIssuerCertificate(X509 *cert, const STACK_OF(X509) *serverCertificates, const Security::ContextPointer &context)
bool missingChainCertificatesUrls(std::queue< SBuf > &URIs, const STACK_OF(X509) &serverCertificates, const Security::ContextPointer &context)
const EVP_MD * DefaultSignHash
int AskPasswordCb(char *buf, int size, int rwflag, void *userdata)
void MaybeSetupRsaCallback(Security::ContextPointer &)
if required, setup callback for generating ephemeral RSA keys
const char * findIssuerUri(X509 *cert)
finds certificate issuer URI in the Authority Info Access extension
std::unique_ptr< STACK_OF(X509), sk_X509_free_wrapper > X509_STACK_Pointer
std::multimap< SBuf, X509 * > CertsIndexedList
certificates indexed by issuer name
void ConfigurePeerVerification(Security::ContextPointer &, const Security::ParsedPortFlags)
set the certificate verify callback for a context
bool InitServerContext(Security::ContextPointer &, AnyP::PortCfg &)
initialize a TLS server context with OpenSSL specific settings
STACK_OF(X509) *X509_STORE_CTX_get0_untrusted(X509_STORE_CTX *ctx)