Skip to content

Commit

Permalink
fixed hardcoded path to log dir
Browse files Browse the repository at this point in the history
  • Loading branch information
J0WI committed Dec 24, 2014
1 parent b4e8724 commit 8be731a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions fail2ban.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ function init()

function log($args)
{
$log_entry = '[roundcube] FAILED login for ' .$args['user']. ' from ' .getenv('REMOTE_ADDR');
$log_entry = '[roundcube] FAILED login for ' .$args['user']. ' from ' .getenv('REMOTE_ADDR');
$log_config = rcmail::get_instance()->config->get('log_driver');

$log_dir = rcmail::get_instance()->config->get('log_dir');

if ($log_config == 'syslog'){
syslog(LOG_WARNING, $log_entry);
} elseif ($log_config == 'file'){
error_log('['.date('d-M-Y H:i:s O')."]: ".$log_entry."\n", 3, "logs/userlogins");
error_log('['.date('d-M-Y H:i:s O')."]: ".$log_entry."\n", 3, $log_dir."/userlogins");
} else {
echo 'WARNING!! The RoundCube Fail2Ban Plugin was unable to retrieve the log driver from the config, please check your config file for log_driver.';
}
Expand Down

0 comments on commit 8be731a

Please sign in to comment.