Merge pull request #10442 from owncloud/move-failed-logins

Move authentication failed logging to checkPassword
This commit is contained in:
Lukas Reschke 2014-08-15 16:50:28 +02:00
commit a822a31ce3
3 changed files with 5 additions and 10 deletions

View File

@ -185,9 +185,6 @@ $CONFIG = array(
(watch out, this option can increase the size of your log file)*/ (watch out, this option can increase the size of your log file)*/
"log_query" => false, "log_query" => false,
/* Enable or disable the logging of IP addresses in case of webform auth failures */
"log_authfailip" => false,
/* Whether ownCloud should log the last successfull cron exec */ /* Whether ownCloud should log the last successfull cron exec */
"cron_log" => true, "cron_log" => true,

View File

@ -849,13 +849,6 @@ class OC {
} // logon via web form } // logon via web form
elseif (OC::tryFormLogin()) { elseif (OC::tryFormLogin()) {
$error[] = 'invalidpassword'; $error[] = 'invalidpassword';
if ( OC_Config::getValue('log_authfailip', false) ) {
OC_Log::write('core', 'Login failed: user \''.$_POST["user"].'\' , wrong password, IP:'.$_SERVER['REMOTE_ADDR'],
OC_Log::WARN);
} else {
OC_Log::write('core', 'Login failed: user \''.$_POST["user"].'\' , wrong password, IP:set log_authfailip=true in conf',
OC_Log::WARN);
}
} }
OC_Util::displayLoginPage(array_unique($error)); OC_Util::displayLoginPage(array_unique($error));

View File

@ -164,6 +164,11 @@ class Manager extends PublicEmitter implements IUserManager {
} }
} }
} }
$remoteAddr = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
$forwardedFor = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : '';
\OC::$server->getLogger()->warning('Login failed: \''. $loginname .'\' (Remote IP: \''. $remoteAddr .'\', X-Forwarded-For: \''. $forwardedFor .'\')', array('app' => 'core'));
return false; return false;
} }