From d11638fcc936aa6ee89720e5fc4f29de789531ec Mon Sep 17 00:00:00 2001 From: "tristan.champomier" Date: Fri, 11 Dec 2020 06:15:15 +0100 Subject: [PATCH] Fixed request #15. --- lib/system/system_control/systemcontrol.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/system/system_control/systemcontrol.php b/lib/system/system_control/systemcontrol.php index 5bdb2f9..9c26598 100755 --- a/lib/system/system_control/systemcontrol.php +++ b/lib/system/system_control/systemcontrol.php @@ -568,12 +568,19 @@ var $currentCoordinationObject=null; } }else{ /* Tentative de connexion */ + $clientIp=isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; if ($GLOBALS["SYSTEM_USER_SESSION"]->isNew==true) { - $clientIp=isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR']; // $message="log:".$login.",".date("Y-m-d H:i:s").",uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId().",eid:".$GLOBALS["SYSTEM_USER_SESSION"]->entryNodeId.",nid:".$GLOBALS["SYSTEM_USER_SESSION"]->navigationNodeId.",0"; $message="auth-failed: ".date("Y-m-d H:i:s")." Authentication attempt with user ".$login." from ".$clientIp.". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId(); addToLog( $message, $CONF_MESSAGE_FILE ); + } else { + $file= $CONF_AUTH_FILE; + if (isset($HTTP_REFERER)) + if (strpos($HTTP_REFERER, $SERVER_NAME)===false) + $file= $CONF_AUTH_ALIEN_FILE; + $message="auth-failed: ".date("Y-m-d H:i:s")." Authentication attempt with user ".$login." from ".$clientIp.". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId(); + addToLog( $message, $file ); } // if(file_exists("/usr/local/sbin/xmpp_notification.py")) if(file_exists("/usr/local/sbin/matrix_notification.py"))