handler: Add ignore_fingerprinting to config (#33)
This commit is contained in:
@@ -71,6 +71,10 @@
|
||||
// If enabled, specific requests that look like git HTTP(s) clones will be let through.
|
||||
"git_host": false,
|
||||
|
||||
// If enabled, fingerprinting is ignored and any IP will be able to use
|
||||
// the cached token as long as it is still valid.
|
||||
"ignore_fingerprinting": false,
|
||||
|
||||
// Traffic logging to a .csv file
|
||||
"logging": {
|
||||
"log_traffic": false,
|
||||
|
||||
@@ -36,6 +36,7 @@ class CConfig {
|
||||
std::vector<SConfigRule> rules = {};
|
||||
int default_challenge_difficulty = 4;
|
||||
int token_valid_for = 3600;
|
||||
bool ignore_fingerprinting = false;
|
||||
bool async_proxy = true;
|
||||
std::vector<SProxyRule> proxy_rules;
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ void CServerHandler::onRequest(const Pistache::Http::Request& req, Pistache::Htt
|
||||
if (TOKEN.valid()) {
|
||||
const auto AGE = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() -
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(TOKEN.issued().time_since_epoch()).count();
|
||||
if (AGE <= g_pConfig->m_config.token_valid_for * 1000 && TOKEN.fingerprint() == NRequestUtils::fingerprintForRequest(req)) {
|
||||
if (AGE <= g_pConfig->m_config.token_valid_for * 1000 && (TOKEN.fingerprint() == NRequestUtils::fingerprintForRequest(req) || g_pConfig->m_config.ignore_fingerprinting)) {
|
||||
Debug::log(LOG, " | Action: PASS (token)");
|
||||
g_pTrafficLogger->logTraffic(req, "PASS (token)");
|
||||
proxyPass(req, response);
|
||||
|
||||
Reference in New Issue
Block a user