Skip to content

Commit f4e89ad

Browse files
authored
Merge pull request civicrm#14833 from seamuslee001/ids_ip_logging_improvements
Ensure that if present the HTTP_X_FORWARDED_FOR IP address is used in…
2 parents 9585cab + e7ecda7 commit f4e89ad

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

CRM/Core/IDS.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,10 +247,8 @@ public function react(IDS_Report $result) {
247247
* @return bool
248248
*/
249249
private function log($result, $reaction = 0) {
250-
$ip = (isset($_SERVER['SERVER_ADDR']) &&
251-
$_SERVER['SERVER_ADDR'] != '127.0.0.1') ? $_SERVER['SERVER_ADDR'] : (
252-
isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : '127.0.0.1'
253-
);
250+
// Include X_FORWARD_FOR ip address if set as per IDS patten.
251+
$ip = $_SERVER['REMOTE_ADDR'] . (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? ' (' . $_SERVER['HTTP_X_FORWARDED_FOR'] . ')' : '');
254252

255253
$data = [];
256254
$session = CRM_Core_Session::singleton();

0 commit comments

Comments
 (0)