Skip to content

Commit

Permalink
Merge pull request #14833 from seamuslee001/ids_ip_logging_improvements
Browse files Browse the repository at this point in the history
Ensure that if present the HTTP_X_FORWARDED_FOR IP address is used in…
  • Loading branch information
totten authored Jul 24, 2019
2 parents 9585cab + e7ecda7 commit f4e89ad
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions CRM/Core/IDS.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,8 @@ public function react(IDS_Report $result) {
* @return bool
*/
private function log($result, $reaction = 0) {
$ip = (isset($_SERVER['SERVER_ADDR']) &&
$_SERVER['SERVER_ADDR'] != '127.0.0.1') ? $_SERVER['SERVER_ADDR'] : (
isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : '127.0.0.1'
);
// Include X_FORWARD_FOR ip address if set as per IDS patten.
$ip = $_SERVER['REMOTE_ADDR'] . (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? ' (' . $_SERVER['HTTP_X_FORWARDED_FOR'] . ')' : '');

$data = [];
$session = CRM_Core_Session::singleton();
Expand Down

0 comments on commit f4e89ad

Please sign in to comment.