Forums / Setup & design / Ip based Intranet authentication

Ip based Intranet authentication

Author Message

Andy Masiar

Tuesday 08 March 2005 7:25:27 am

Hi,

Is it possible to authenticate users based on their IP?

I would like to give users "read" access if they are coming from certain range of IP's and requiring them to authenticate if they are accessing the company's intranet from home for example.

Thank you for your help,

Andy

Björn Dieding@xrow.de

Tuesday 08 March 2005 7:29:43 am

No sorry, Not out of the box...

you would need to hack the kernel or supply a custom loginhandler

Looking for a new job? http://www.xrow.com/xrow-GmbH/Jobs
Looking for hosting? http://hostingezpublish.com
-----------------------------------------------------------------------------
GMT +01:00 Hannover, Germany
Web: http://www.xrow.com/

Mark Marsiglio

Tuesday 08 March 2005 7:55:14 am

If you use URL based siteaccesses, you can kind of do this with Apache configurations. I think the limitation is that you would have access or not, no chance to login would be provided.

If you disallowed all outside network access, and then required VPN into the network to access the intranet you could get around this. The VPN would handle the authenication.

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions

Kristian Hole

Wednesday 09 March 2005 12:31:59 am

Hi!

I have made a patch for login based on IP. This is made for only one user, but you get the idea of how to do it.

This patch gets the IPaddress and the corresponding user from the site.ini.append.php file. (Patch is for 3.5.1)

--- ezpublish_releases/ezpublish-3.5.1/pre_check.php     2005-02-24 12:05:54.000000000 +0100
+++ precheck_fixedfor351.php    2005-03-09 09:26:30.999605632 +0100
@@ -89,6 +89,19 @@
 //     $uri =& $GLOBALS['eZRequestedURI'];
     $check = array( "module" => "user",
                     "function" => "login" );
+
+       //---LoginOnIP-HACK
+    if ( $ini->hasVariable( 'LoginOnIP', 'IPAddress' ) && $ini->hasVariable( 'LoginOnIP', 'UserID' )
+         && $_SERVER['REMOTE_ADDR'] == $ini->variable( 'LoginOnIP', 'IPAddress' ) )
+    {
+        include_once( 'kernel/classes/datatypes/ezuser/ezuser.php' );
+
+        $userID = ( int ) $ini->variable( 'LoginOnIP', 'UserID' );
+        $user = eZUser::fetch( $userID );
+        eZUser::setCurrentlyLoggedInUser( $user, $userID );
+    }
+       //---LoginOnIP-HACK
+
     if ( $http->hasSessionVariable( "eZUserLoggedInID" ) and
          $http->sessionVariable( "eZUserLoggedInID" ) != '' and
          $http->sessionVariable( "eZUserLoggedInID" ) != $ini->variable( 'UserSettings', 'AnonymousUserID' ) )
@@ -173,4 +186,4 @@
 }

It is _not_ recommended to change the kernel, because upgrades will be much harder. But if you really want to do it, this is how.

Kristian

http://ez.no/ez_publish/documenta...tricks/show_which_templates_are_used
http://ez.no/doc/ez_publish/techn...te_operators/miscellaneous/attribute

Andy Masiar

Thursday 10 March 2005 8:35:10 am

Thank you for your replies.

Since ez is going to be authenticating to LDAP anyway, I think I'm going to end up using mod_auth_ldap apache module to authenticate intranet users when not on intranet.

I'm going to try to get it to work this weekend.

Andy

eZ debug

Timing: Jan 18 2025 16:17:08
Script start
Timing: Jan 18 2025 16:17:08
Module start 'content'
Timing: Jan 18 2025 16:17:08
Module end 'content'
Timing: Jan 18 2025 16:17:08
Script end

Main resources:

Total runtime0.1823 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0102 587.7344180.8281
Module start 'content' 0.01020.0069 768.562597.9141
Module end 'content' 0.01700.1649 866.4766526.0781
Script end 0.1820  1,392.5547 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00402.1683200.0002
Check MTime0.00150.8185200.0001
Mysql Total
Database connection0.00191.029710.0019
Mysqli_queries0.127369.84511410.0009
Looping result0.00150.82581390.0000
Template Total0.164590.310.1645
Template load0.00080.444810.0008
Template processing0.163789.802910.1637
Override
Cache load0.00060.320910.0006
Sytem overhead
Fetch class attribute can translate value0.00090.471210.0009
XML
Image XML parsing0.00020.134410.0002
General
dbfile0.00201.0965200.0001
String conversion0.00000.006030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs