Adds timestamp to log and updates README Fail2Ban section

This commit is contained in:
Thomas Leister 2014-12-19 14:10:09 +01:00
parent ba5c9fbd72
commit f9e179790e
2 changed files with 12 additions and 3 deletions

View file

@ -190,8 +190,7 @@ You can then login into the admin dashboard with that e-mail address and the cor
### Logfile
You can enable logging. WebMUM will then write messages into the file log/log.txt when a login attempt fails.
After several attempts you can block the attacker's IP-address with Fail2Ban. For Fail2Ban configuration please visit this page: http://www.fail2ban.org/wiki/index.php/HOWTOs
When logging is enabled, WebMUM will write messages into the file log/log.txt (e.g. when a login attempt fails).
To enable logging, comment in the line
@ -199,6 +198,16 @@ To enable logging, comment in the line
... and make sure that PHP has permissions to write the log file to log/log.txt.
"Login-failed-messages" have the following scheme:
Dec 19 13:00:19: WebMUM login failed for IP 127.0.0.1
If you want to use **Fail2Ban** with WebMUM, the filter has to be:
[Definition]
failregex = ^(.*)\: WebMUM login failed for IP <HOST>$
## Update / Upgrade WebMUM
If you cloned WebMUM into your filesystem via `git clone https://github.com/ThomasLeister/webmum`:

View file

@ -96,7 +96,7 @@ function write_pass_hash_to_db($pass_hash, $uid){
function writeLog($text){
if(defined('WRITE_LOG')){
$logfile = fopen("log/log.txt", "a") or die("Unable to create / open logfile \"log/log.txt\" in root directory!");
fwrite($logfile, $text."\n");
fwrite($logfile, date('M d H:i:s').": ".$text."\n");
fclose($logfile);
}
}