rcmail.php: Machine-readable Login Log (Security) #8460
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proposal: Log the Login Success/Failure Log Messages in a JSON-readable fashion.
Rationale: fail2ban most likely never bans localhost. Localhost is trusted. However, in many installations, Dovecot (or another userauth subsystem) will log Roundcube logins as originating from the machine Roundcube runs on, probably localhost. Failed logins thru Roundcube thus result in being mistakenly considered as originating from "localhost" — which of course is not true, considering only Roundcube itself knows the true origin of the failed login attempt (
rcube_utils::remote_ip()
).This change request patches rcmail.php to write more
grep
and other machine-parse-friendly log messages, allowing for simpler extension of whatever fail2ban-like attack counter measures are in place. With this, one could even configure rsyslog to create own log files for Roundcube auth failures, based on the simple yet quite unique stringRC_LOGIN:FAILURE:
introduced here, again making it much easier for fail2ban to look in the right places.{EDIT 2022-02-26 17:50 UTC} Test case with some problematic strings on PHP 5.5.21 (released 2015-01-22):
{/EDIT}
Example rsyslog config snippet (of course, RC needs to be configured to log to syslog):