From ba7d55b7c1e607b7c0767e7339dd0b6e67ce6065 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Tue, 1 May 2018 10:43:20 +0000 Subject: [PATCH] added: config parameters: bool log_check_proxy_ip_header; // check whether there is a 'log_proxy_ip_header' header // and if so then log the IP address from it // default: false std::wstring log_proxy_ip_header; // proxy header representing the real IP address of a client // default: X-Real-IP git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1104 e52654a7-88a9-db11-a3e9-0013d4bc506e --- winixd/core/app.cpp | 8 +++++++- winixd/core/config.cpp | 2 ++ winixd/core/config.h | 10 ++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/winixd/core/app.cpp b/winixd/core/app.cpp index 867ba34..6fc36d7 100644 --- a/winixd/core/app.cpp +++ b/winixd/core/app.cpp @@ -936,8 +936,14 @@ void App::LogAccess() log << log1; log.PrintDate(cur.request->start_date, config.log_time_zone_id); + log << ' '; + + if( config.log_check_proxy_ip_header ) + log << cur.request->headers_in.Text(config.log_proxy_ip_header, L"no-log_proxy_ip_header"); + else + log << cur.request->env_remote_addr; + log << ' ' - << cur.request->env_remote_addr << ' ' << cur.request->env_request_method << ' ' << cur.request->env_http_host << cur.request->env_request_uri << ' ' diff --git a/winixd/core/config.cpp b/winixd/core/config.cpp index 202c290..c75431d 100644 --- a/winixd/core/config.cpp +++ b/winixd/core/config.cpp @@ -149,6 +149,8 @@ void Config::AssignValues(bool stdout_is_closed) log_env_variables = Bool(L"log_env_variables", false); log_env_http_variables = Bool(L"log_env_http_variables", false); log_http_answer_headers = Bool(L"log_http_answer_headers", false); + log_check_proxy_ip_header = Bool(L"log_check_proxy_ip_header", false); + log_proxy_ip_header = Text(L"log_proxy_ip_header", L"X-Real-IP"); post_file_max = Size(L"post_file_max", 8388608); // 8 MB diff --git a/winixd/core/config.h b/winixd/core/config.h index 4adacc9..8227cad 100644 --- a/winixd/core/config.h +++ b/winixd/core/config.h @@ -122,6 +122,16 @@ public: // default: false bool log_plugin_call; + // check whether there is a 'log_proxy_ip_header' header + // and if so then log the IP address from it + // default: false + bool log_check_proxy_ip_header; + + // proxy header representing the real IP address of a client + // default: X-Real-IP + std::wstring log_proxy_ip_header; + + // how many characters in values should be logged from POST parameters // default: 80 // set to 0 to turn it off