proxygen
|
#include <TLSCredProcessor.h>
Public Member Functions | |
TLSCredProcessor () | |
TLSCredProcessor (std::chrono::milliseconds pollInterval) | |
~TLSCredProcessor () | |
void | setTicketPathToWatch (const std::string &ticketFile) |
void | setCertPathsToWatch (std::set< std::string > certFiles) |
void | addTicketCallback (std::function< void(wangle::TLSTicketKeySeeds)> callback) |
void | addCertCallback (std::function< void()> callback) |
void | stop () |
void | setPollInterval (std::chrono::milliseconds pollInterval) |
Static Public Member Functions | |
static folly::Optional< wangle::TLSTicketKeySeeds > | processTLSTickets (const std::string &fileName) |
Private Member Functions | |
void | ticketFileUpdated (const std::string &ticketFile) noexcept |
void | certFileUpdated () noexcept |
Private Attributes | |
std::unique_ptr< FilePoller > | poller_ |
std::string | ticketFile_ |
std::set< std::string > | certFiles_ |
std::vector< std::function< void(wangle::TLSTicketKeySeeds)> > | ticketCallbacks_ |
std::vector< std::function< void()> > | certCallbacks_ |
A class that monitors files related to TLS credentials that fire callbacks when they change. Callbacks are fired in a background thread.
Definition at line 31 of file TLSCredProcessor.h.
wangle::TLSCredProcessor::TLSCredProcessor | ( | ) |
Definition at line 44 of file TLSCredProcessor.cpp.
|
explicit |
Definition at line 47 of file TLSCredProcessor.cpp.
wangle::TLSCredProcessor::~TLSCredProcessor | ( | ) |
void wangle::TLSCredProcessor::addCertCallback | ( | std::function< void()> | callback | ) |
Definition at line 68 of file TLSCredProcessor.cpp.
References certCallbacks_, and folly::gen::move.
Referenced by TEST_F().
void wangle::TLSCredProcessor::addTicketCallback | ( | std::function< void(wangle::TLSTicketKeySeeds)> | callback | ) |
Definition at line 63 of file TLSCredProcessor.cpp.
References folly::gen::move, and ticketCallbacks_.
Referenced by TEST_F().
|
privatenoexcept |
Definition at line 107 of file TLSCredProcessor.cpp.
References certCallbacks_.
Referenced by setCertPathsToWatch().
|
static |
This parses a TLS ticket file with the tickets and returns a TLSTicketKeySeeds structure if the file is valid. The TLS ticket file is formatted as a json blob { "old": [ "seed1", ... ], "new": [ ... ], "current": [ ... ] } Seeds are aribitrary length secret strings which are used to derive ticket encryption keys.
Definition at line 113 of file TLSCredProcessor.cpp.
References folly::dynamic::count(), wangle::TLSTicketKeySeeds::currentSeeds, wangle::TLSTicketKeySeeds::newSeeds, folly::none, wangle::TLSTicketKeySeeds::oldSeeds, folly::parseJson(), folly::readFile(), string, folly::dynamic::type(), and folly::WARNING.
Referenced by main(), and ticketFileUpdated().
void wangle::TLSCredProcessor::setCertPathsToWatch | ( | std::set< std::string > | certFiles | ) |
Set cert related files to watch. This would include paths like cert, key, and CA. Cert callbacks will be fired if any of these change. Empty strings are ignored.
Definition at line 84 of file TLSCredProcessor.cpp.
References certFiles_, certFileUpdated(), folly::gen::move, and poller_.
Referenced by main(), setPollInterval(), and TEST_F().
void wangle::TLSCredProcessor::setPollInterval | ( | std::chrono::milliseconds | pollInterval | ) |
Definition at line 56 of file TLSCredProcessor.cpp.
References certFiles_, poller_, setCertPathsToWatch(), setTicketPathToWatch(), and ticketFile_.
Referenced by TEST_F().
void wangle::TLSCredProcessor::setTicketPathToWatch | ( | const std::string & | ticketFile | ) |
Set the ticket path to watch. Any previous ticket path will stop being watched. This is not thread safe.
Definition at line 73 of file TLSCredProcessor.cpp.
References poller_, ticketFile_, and ticketFileUpdated().
Referenced by main(), setPollInterval(), and TEST_F().
void wangle::TLSCredProcessor::stop | ( | ) |
Definition at line 50 of file TLSCredProcessor.cpp.
References poller_.
Referenced by ~TLSCredProcessor().
|
privatenoexcept |
Definition at line 97 of file TLSCredProcessor.cpp.
References processTLSTickets(), and ticketCallbacks_.
Referenced by setTicketPathToWatch().
|
private |
Definition at line 89 of file TLSCredProcessor.h.
Referenced by addCertCallback(), and certFileUpdated().
|
private |
Definition at line 87 of file TLSCredProcessor.h.
Referenced by setCertPathsToWatch(), and setPollInterval().
|
private |
Definition at line 85 of file TLSCredProcessor.h.
Referenced by setCertPathsToWatch(), setPollInterval(), setTicketPathToWatch(), and stop().
|
private |
Definition at line 88 of file TLSCredProcessor.h.
Referenced by addTicketCallback(), and ticketFileUpdated().
|
private |
Definition at line 86 of file TLSCredProcessor.h.
Referenced by setPollInterval(), and setTicketPathToWatch().