#include <bio.h>
Public Member Functions | |
ServerBio (const int anFd) | |
void | stateChanged (const SSL *ssl, int where, int ret) override |
The ServerBio version of the Ssl::Bio::stateChanged method. More... | |
int | write (const char *buf, int size, BIO *table) override |
int | read (char *buf, int size, BIO *table) override |
void | flush (BIO *table) override |
void | setClientFeatures (Security::TlsDetails::Pointer const &details, SBuf const &hello) |
Sets the random number to use in client SSL HELLO message. More... | |
bool | resumingSession () |
bool | encryptedCertificates () const |
bool | holdWrite () const |
The write hold state. More... | |
void | holdWrite (bool h) |
Enables or disables the write hold state. More... | |
void | recordInput (bool r) |
Enables or disables the input data recording, for internal analysis. More... | |
bool | canSplice () |
Whether we can splice or not the SSL stream. More... | |
bool | canBump () |
Whether we can bump or not the SSL stream. More... | |
void | mode (Ssl::BumpMode m) |
The bumping mode. More... | |
Ssl::BumpMode | bumpMode () |
return the bumping mode More... | |
bool | gotHello () const |
bool | gotHelloFailed () const |
Return true if the Server Hello parsing failed. More... | |
const Security::TlsDetails::Pointer & | receivedHelloDetails () const |
int | fd () const |
The SSL socket descriptor. More... | |
const SBuf & | rBufData () |
The buffered input data. More... | |
Static Public Member Functions | |
static BIO * | Create (const int fd, Security::Io::Type type) |
static void | Link (SSL *ssl, BIO *bio) |
Tells ssl connection to use BIO and monitor state via stateChanged() More... | |
Protected Attributes | |
const int | fd_ |
the SSL socket we are reading and writing More... | |
SBuf | rbuf |
Used to buffer input data. More... | |
Private Member Functions | |
int | readAndGive (char *buf, const int size, BIO *table) |
Read and give everything to OpenSSL. More... | |
int | readAndParse (char *buf, const int size, BIO *table) |
int | readAndBuffer (BIO *table) |
int | giveBuffered (char *buf, const int size) |
Private Attributes | |
Security::TlsDetails::Pointer | clientTlsDetails |
SSL client features extracted from ClientHello message or SSL object. More... | |
SBuf | clientSentHello |
TLS client hello message, used to adapt our tls Hello message to the server. More... | |
SBuf | helloMsg |
Used to buffer output data. More... | |
mb_size_t | helloMsgSize |
bool | helloBuild |
True if the client hello message sent to the server. More... | |
bool | allowSplice |
True if the SSL stream can be spliced. More... | |
bool | allowBump |
True if the SSL stream can be bumped. More... | |
bool | holdWrite_ |
The write hold state of the bio. More... | |
bool | record_ |
If true the input data recorded to rbuf for internal use. More... | |
bool | parsedHandshake |
whether we are done parsing TLS Hello More... | |
bool | parseError |
error while parsing server hello message More... | |
Ssl::BumpMode | bumpMode_ |
size_t | rbufConsumePos |
The size of data stored in rbuf which passed to the openSSL. More... | |
Security::HandshakeParser | parser_ |
The TLS/SSL messages parser. More... | |
Detailed Description
BIO node to handle socket IO for squid server side If bumping is enabled, analyses the SSL hello message sent by squid OpenSSL subsystem (step3 bumping step) against bumping mode:
- Peek mode: Send client hello message instead of the openSSL generated hello message and normally denies bumping and allow only splice or terminate the SSL connection
- Stare mode: Sends the openSSL generated hello message and normally denies splicing and allow bump or terminate the SSL connection If SQUID_USE_OPENSSL_HELLO_OVERWRITE_HACK is enabled also checks if the openSSL library features are compatible with the features reported in web client SSL hello message and if it is, overwrites the openSSL SSL object members to replace hello message with web client hello message. This is may allow bumping in peek mode and splicing in stare mode after the server hello message received.
Constructor & Destructor Documentation
◆ ServerBio()
Member Function Documentation
◆ bumpMode()
|
inline |
Definition at line 161 of file bio.h.
References bumpMode_.
Referenced by Ssl::PeekingPeerConnector::noteNegotiationError(), and Ssl::PeekingPeerConnector::noteWantWrite().
◆ canBump()
|
inline |
Definition at line 158 of file bio.h.
References allowBump.
Referenced by Ssl::PeekingPeerConnector::checkForPeekAndSplice().
◆ canSplice()
|
inline |
Definition at line 156 of file bio.h.
References allowSplice.
Referenced by Ssl::PeekingPeerConnector::checkForPeekAndSplice().
◆ Create()
|
staticinherited |
Creates a low-level BIO table, creates a high-level Ssl::Bio object for a given socket, and then links the two together via BIO_C_SET_FD.
Definition at line 62 of file bio.cc.
References Ssl::Bio::fd(), squid_bio_create(), squid_bio_ctrl(), squid_bio_destroy(), squid_bio_puts(), squid_bio_read(), squid_bio_write(), and SquidMethods.
Referenced by CreateSession().
◆ encryptedCertificates()
bool Ssl::ServerBio::encryptedCertificates | ( | ) | const |
whether the server encrypts its certificate (e.g., TLS v1.3)
- Return values
-
false the server uses plain certs or its intent is unknown
Definition at line 438 of file bio.cc.
References Security::Tls1p3orLater().
Referenced by Ssl::PeekingPeerConnector::noteNegotiationError().
◆ fd()
|
inlineinherited |
Definition at line 49 of file bio.h.
References Ssl::Bio::fd_.
Referenced by Ssl::Bio::Create(), Security::NegotiationHistory::retrieveNegotiatedInfo(), and squid_bio_ctrl().
◆ flush()
|
overridevirtual |
The ServerBio version of the Ssl::Bio::flush method. Flushes any buffered data
Reimplemented from Ssl::Bio.
Definition at line 423 of file bio.cc.
References Ssl::Bio::write().
◆ giveBuffered()
◆ gotHello()
|
inline |
- Return values
-
true if the Server hello message received
Definition at line 164 of file bio.h.
References parsedHandshake, and parseError.
◆ gotHelloFailed()
|
inline |
Definition at line 167 of file bio.h.
References parsedHandshake, and parseError.
◆ holdWrite() [1/2]
|
inline |
Definition at line 150 of file bio.h.
References holdWrite_.
Referenced by Ssl::PeekingPeerConnector::checkForPeekAndSpliceMatched(), Ssl::PeekingPeerConnector::noteNegotiationError(), and Ssl::PeekingPeerConnector::noteWantWrite().
◆ holdWrite() [2/2]
|
inline |
Definition at line 152 of file bio.h.
References holdWrite_.
◆ Link()
|
staticinherited |
◆ mode()
|
inline |
Definition at line 160 of file bio.h.
References bumpMode_.
Referenced by Ssl::PeekingPeerConnector::initialize().
◆ rBufData()
|
inlineinherited |
Definition at line 61 of file bio.h.
References Ssl::Bio::rbuf.
Referenced by Ssl::PeekingPeerConnector::initialize().
◆ read()
◆ readAndBuffer()
|
private |
Reads more data into the read buffer. Returns either the number of bytes read or, on errors (including "try again" errors), a negative number.
Definition at line 326 of file bio.cc.
References Ssl::Bio::read().
◆ readAndGive()
Definition at line 280 of file bio.cc.
References Ssl::Bio::read(), and size.
◆ readAndParse()
◆ receivedHelloDetails()
|
inline |
- Returns
- the TLS Details advertised by TLS server.
Definition at line 170 of file bio.h.
References Security::HandshakeParser::details, and parser_.
Referenced by Security::PeerConnector::recordNegotiationDetails().
◆ recordInput()
|
inline |
Definition at line 154 of file bio.h.
References record_.
Referenced by Ssl::PeekingPeerConnector::checkForPeekAndSpliceMatched(), and Ssl::PeekingPeerConnector::initialize().
◆ resumingSession()
bool Ssl::ServerBio::resumingSession | ( | ) |
Definition at line 432 of file bio.cc.
Referenced by Ssl::PeekingPeerConnector::noteNegotiationError().
◆ setClientFeatures()
void Ssl::ServerBio::setClientFeatures | ( | Security::TlsDetails::Pointer const & | details, |
SBuf const & | hello | ||
) |
Definition at line 263 of file bio.cc.
Referenced by Ssl::PeekingPeerConnector::initialize().
◆ stateChanged()
Reimplemented from Ssl::Bio.
Definition at line 257 of file bio.cc.
References Ssl::Bio::stateChanged().
◆ write()
The ServerBio version of the Ssl::Bio::write method If a clientRandom number is set then rewrites the raw hello message "client random" field with the provided random number. It may buffer the output packets.
Reimplemented from Ssl::Bio.
Definition at line 354 of file bio.cc.
References assert, Ssl::bumpPeek, Ssl::bumpStare, debugs, Must, size, and Ssl::Bio::write().
Member Data Documentation
◆ allowBump
|
private |
◆ allowSplice
|
private |
Definition at line 185 of file bio.h.
Referenced by canSplice().
◆ bumpMode_
|
private |
Definition at line 191 of file bio.h.
Referenced by bumpMode(), and mode().
◆ clientSentHello
◆ clientTlsDetails
|
private |
◆ fd_
|
protectedinherited |
Definition at line 63 of file bio.h.
Referenced by Ssl::Bio::Bio(), and Ssl::Bio::fd().
◆ helloBuild
◆ helloMsg
◆ helloMsgSize
◆ holdWrite_
|
private |
Definition at line 187 of file bio.h.
Referenced by holdWrite().
◆ parsedHandshake
|
private |
Definition at line 189 of file bio.h.
Referenced by gotHello(), and gotHelloFailed().
◆ parseError
|
private |
Definition at line 190 of file bio.h.
Referenced by gotHello(), and gotHelloFailed().
◆ parser_
|
private |
Definition at line 195 of file bio.h.
Referenced by receivedHelloDetails().
◆ rbuf
|
protectedinherited |
Definition at line 64 of file bio.h.
Referenced by Ssl::Bio::rBufData(), and Ssl::ClientBio::setReadBufData().
◆ rbufConsumePos
◆ record_
|
private |
Definition at line 188 of file bio.h.
Referenced by recordInput().
The documentation for this class was generated from the following files: