OpenVPN 3 Core Library
|
Implements the PsidCookie interface. More...
#include <psid_cookie_impl.hpp>
Public Member Functions | |
PsidCookieImpl (ServerProto::Factory *psfp) | |
virtual | ~PsidCookieImpl ()=default |
Intercept | intercept (ConstBuffer &pkt_buf, const PsidCookieAddrInfoBase &pcaib) override |
Called when a potential new client session packet is received. | |
ProtoSessionID | get_cookie_psid () override |
Get the cookie psid from client's 2nd packet. | |
void | provide_psid_cookie_transport (PsidCookieTransportBase::Ptr pctb) override |
Give this component the transport needed to send the server's HARD_RESET. | |
![]() | |
virtual | ~PsidCookie ()=default |
![]() | |
RC () noexcept=default | |
RC (const RC &)=delete | |
virtual | ~RC ()=default |
RC & | operator= (const RC &)=delete |
olong | use_count () const noexcept |
Delegates call to RCImpl and returns the result. | |
Static Public Member Functions | |
static void | pre_threading_setup () |
![]() | |
static constexpr bool | is_thread_safe () |
Delegates call to RCImpl and returns the result. | |
Static Public Attributes | |
static constexpr int | SID_SIZE = ProtoSessionID::SIZE |
Private Types | |
using | CookieHelper = ProtoContext::PsidCookieHelper |
Private Member Functions | |
Intercept | process_clients_initial_reset (ConstBuffer &pkt_buf, const PsidCookieAddrInfoBase &pcaib) |
Intercept | process_clients_server_reset_ack (ConstBuffer &pkt_buf, const PsidCookieAddrInfoBase &pcaib) |
ProtoSessionID | calculate_session_id_hmac (const ProtoSessionID &cli_psid, const PsidCookieAddrInfoBase &pcaib, unsigned int offset) |
Calculate the psid cookie, the ProtoSessionID hmac. | |
bool | check_session_id_hmac (const ProtoSessionID &srv_psid, const ProtoSessionID &cli_psid, const PsidCookieAddrInfoBase &pcaib) |
Static Private Member Functions | |
static StaticKey | create_key () |
static const StaticKey & | get_key () |
Private Attributes | |
const ProtoContext::ProtoConfig & | pcfg_ |
bool | not_tls_auth_mode_ |
TimePtr | now_ |
const Time::Duration & | handwindow_ |
OvpnHMACInstance::Ptr | ta_hmac_recv_ |
OvpnHMACInstance::Ptr | ta_hmac_send_ |
SSLLib::CryptoAPI::HMACContext | hmac_ctx_ |
PsidCookieTransportBase::Ptr | pctb_ |
ProtoSessionID | cookie_psid_ |
Static Private Attributes | |
static constexpr CryptoAlgs::Type | digest_ = CryptoAlgs::Type::SHA256 |
Additional Inherited Members | |
![]() | |
enum class | Intercept { DECLINE_HANDLING , EARLY_DROP , DROP_1ST , HANDLE_1ST , DROP_2ND , HANDLE_2ND } |
Values returned by the intercept() function. More... | |
typedef RCPtr< PsidCookie > | Ptr |
![]() | |
typedef RCPtr< RC > | Ptr |
Implements the PsidCookie interface.
This code currently only supports tls-auth. The approach can be applied with minimal changes also to tls-crypt/no auth but requires more changes/protocol changes and updated clients for the tls-crypt-v2 case.
This class is not thread safe; it expects to be instantiated in each thread of a multi-threaded server implementation.
Definition at line 44 of file psid_cookie_impl.hpp.
|
private |
Definition at line 132 of file psid_cookie_impl.hpp.
|
inline |
Definition at line 56 of file psid_cookie_impl.hpp.
|
virtualdefault |
|
inlineprivate |
Calculate the psid cookie, the ProtoSessionID hmac.
cli_psid | Client's protocol session id, ProtoSessionID |
pcaib | Client's address information, reproducibly hashable |
offset | moves the time valid time window backward from current |
Definition at line 288 of file psid_cookie_impl.hpp.
|
inlineprivate |
|
inlinestaticprivate |
|
inlineoverridevirtual |
Get the cookie psid from client's 2nd packet.
This provides the server's psid (a.k.a, the cookie_psid) as returned by the client in it's 2nd packet. It may only be called after intercept() returns HANDLE_2ND, indicating a valid psid cookie. Further, it may only be called once as it invalidates the internal data source after it sets the return value.
Implements openvpn::PsidCookie.
Definition at line 117 of file psid_cookie_impl.hpp.
|
inlinestaticprivate |
|
inlineoverridevirtual |
Called when a potential new client session packet is received.
Called by the server implementation when it recieves a packet for which it has no state information. Such a packet is potentially a client HARD_RESET or a 2nd client packet returning the psid cookie.
pkt_buf | The packet received by the server implementation. |
pcaib | The address information as contained in an instance of the class that the server implementation derived from the PsidCookieAddrInfoBase class |
Implements openvpn::PsidCookie.
Definition at line 91 of file psid_cookie_impl.hpp.
|
inlinestatic |
|
inlineprivate |
|
inlineprivate |
|
inlineoverridevirtual |
Give this component the transport needed to send the server's HARD_RESET.
The server implementation must call this method before the intercept() function is asked to handle a packet
pctb | The transport capability as provided by the server implementation's object derived from the PsidCookieTransportBase class |
Implements openvpn::PsidCookie.
Definition at line 124 of file psid_cookie_impl.hpp.
|
private |
Definition at line 360 of file psid_cookie_impl.hpp.
|
staticconstexprprivate |
Definition at line 346 of file psid_cookie_impl.hpp.
|
private |
Definition at line 351 of file psid_cookie_impl.hpp.
|
private |
Definition at line 357 of file psid_cookie_impl.hpp.
|
private |
Definition at line 349 of file psid_cookie_impl.hpp.
|
private |
Definition at line 350 of file psid_cookie_impl.hpp.
|
private |
Definition at line 348 of file psid_cookie_impl.hpp.
|
private |
Definition at line 359 of file psid_cookie_impl.hpp.
|
staticconstexpr |
Definition at line 47 of file psid_cookie_impl.hpp.
|
private |
Definition at line 353 of file psid_cookie_impl.hpp.
|
private |
Definition at line 354 of file psid_cookie_impl.hpp.