[Xfce4-commits] <moka:master> Log failed tokens as well.

Nick Schermer noreply at xfce.org
Sun Nov 20 17:04:01 CET 2011


Updating branch refs/heads/master
         to bb255c83993f2dfd71e9811d5eda19fa48ac052f (commit)
       from 569194aae0c602ef8eb964398326be7ca7df71df (commit)

commit bb255c83993f2dfd71e9811d5eda19fa48ac052f
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Nov 20 17:03:42 2011 +0100

    Log failed tokens as well.

 lib/controllers/authentication.rb |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/lib/controllers/authentication.rb b/lib/controllers/authentication.rb
index 756f6d1..8d6ae72 100755
--- a/lib/controllers/authentication.rb
+++ b/lib/controllers/authentication.rb
@@ -126,7 +126,7 @@ module Moka
           # report the failed login, so we can use fail2ban on the server
           logger = Logger.new('auth.log')
           logger.datetime_format = "%Y-%m-%d %H:%M:%S"
-          logger.warn "Authentication failure for #{request.env['REMOTE_ADDR']}"
+          logger.warn "Authentication failure from #{request.env['REMOTE_ADDR']}"
           logger.close
 
           view :login_unauthenticated
@@ -172,6 +172,12 @@ module Moka
             env[:step] = "valid"
           else
             env[:step] = "invalid"
+
+            # report the failed token, so we can use fail2ban on the server
+            logger = Logger.new('auth.log')
+            logger.datetime_format = "%Y-%m-%d %H:%M:%S"
+            logger.warn "Invalid token for #{params[:username]} from #{request.env['REMOTE_ADDR']}"
+            logger.close
           end
 
           view :login_forgot


More information about the Xfce4-commits mailing list