Bug - 5511: Check for Change in Remote IP address for Session Security. Disable when...
authorAmit Gupta <amitddng135@gmail.com>
Tue, 8 Oct 2013 04:03:54 +0000 (09:03 +0530)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 9 Feb 2015 20:00:01 +0000 (17:00 -0300)
To Test:
1) Enable the system preference SessionRestrictionByIP
2) Change your system IP. It will not checkout your system IP or signout.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>

C4/Auth.pm
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/admin.pref

index e6c121a..1238e8f 100644 (file)
@@ -1162,6 +1162,7 @@ sub checkauth {
         INPUTS                                => \@inputs,
         casAuthentication                     => C4::Context->preference("casAuthentication"),
         shibbolethAuthentication              => $shib,
+        SessionRestrictionByIP                => C4::Context->preference("SessionRestrictionByIP"),
         suggestion                            => C4::Context->preference("suggestion"),
         virtualshelves                        => C4::Context->preference("virtualshelves"),
         LibraryName                           => "" . C4::Context->preference("LibraryName"),
@@ -1352,7 +1353,7 @@ sub check_api_auth {
                 $userid    = undef;
                 $sessionID = undef;
                 return ( "expired", undef, undef );
-            } elsif ( $ip ne $ENV{'REMOTE_ADDR'} ) {
+            } elsif ( C4::Context->preference('SessionRestrictionByIP') && $ip ne $ENV{'REMOTE_ADDR'} ) {
 
                 # IP address changed
                 $session->delete();
@@ -1604,8 +1605,8 @@ sub check_cookie_auth {
             C4::Context->_unset_userenv($sessionID);
             $userid    = undef;
             $sessionID = undef;
-            return ( "expired", undef );
-        } elsif ( $ip ne $ENV{'REMOTE_ADDR'} ) {
+            return ("expired", undef);
+        } elsif ( C4::Context->preference('SessionRestrictionByIP') && $ip ne $ENV{'REMOTE_ADDR'} ) {
 
             # IP address changed
             $session->delete();
index f796361..e2ea915 100644 (file)
@@ -63,6 +63,13 @@ Administration:
                   yes: Require
                   no: "Don't require"
             - staff to log in from a computer in the IP address range <a href="/cgi-bin/koha/admin/branches.pl">specified by their library</a> (if any).
+        -
+            - pref: SessionRestrictionByIP
+              default: 0
+              choices:
+                  yes: Enable
+                  no: "Disable"
+            - Check for Change in Remote IP address for Session Security. Disable when remote ip address changes frequently.
         # PostgreSQL is supported by CGI::Session but not by Koha.
         -
             - Store login session information