diff --git a/config/config.sample.php b/config/config.sample.php index a9b868ca9cf92decbe49f9544741b2383c4e56db..9a24c9364e016702a95e8315d19d0f67139edb5f 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -148,6 +148,9 @@ $CONFIG = array( (watch out, this option can increase the size of your log file)*/ "log_query" => false, +/* Enable or disable the logging of IP addresses in case of webform auth failures */ +"log_authfailip" => false, + /* * Configure the size in bytes log rotation should happen, 0 or false disables the rotation. * This rotates the current owncloud logfile to a new name, this way the total log usage diff --git a/lib/base.php b/lib/base.php index b0b2dca502f80477b02f055c03ed0f897c4a1e8f..ff4ca5882131c4cee65613e34414037d05eae533 100644 --- a/lib/base.php +++ b/lib/base.php @@ -760,6 +760,13 @@ class OC { // logon via web form elseif (OC::tryFormLogin()) { $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));