EllisLab text mark
Advanced Search
1 of 2
1
   
Which is best for ACL?
Posted: 08 September 2007 05:22 PM   [ Ignore ]   [ # 11 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-06
743 posts
Monotoba - 08 September 2007 08:25 PM

I have only begun to formulate my ideas of a lite-weight ACL however, what I foresee is a system that uses
per-asset (class/method) athorization for groups (roles) and users.

Unfortunately, I don’t know anything about FAL. But taking the Zend Framework ACL as an example, your assets (class/method) would be resources. You can get the current class/method using this:

$this->uri->router->class;
$this->uri->router->method

Let’s assume that the Zend ACL is in a custom library that is loaded in the constructor of a controller that requires authorization. Taking a simple example of authorizing based on the controller, within the ACL library you could check authorization like so:

$CI =& get_instance();
if (! 
$this->acl->isAllowed($_SESSION['username']$CI->uri->router->class))
{
   
// access denied!
 Signature 

“I am the terror that flaps in the night”

 
Posted: 08 September 2007 05:42 PM   [ Ignore ]   [ # 12 ]   [ Rating: 0 ]
Joined: 2007-09-05
24 posts

I looked at the ZendACL and I like what I see. The only issue I have in using it is that it would require loading other Zend framework libraries that replicate CI functionality i.e. the database library would be needed and so my application would need to load both CI and Zend dbi’s. I guess I could build an interface between the CI dbi and ZendACL/Auth libs. Zend does offer fine control over access to assets (resources)...

 Signature 

If you ask me if it can be done, the answer is yes! It can always be done. The correct question however, is what will it cost?

 
Posted: 08 September 2007 05:51 PM   [ Ignore ]   [ # 13 ]   [ Rating: 0 ]
Joined: 2007-09-05
24 posts

Ok, a closer look at Zend ACL tells me that I don’t need to use Zends dbi but that I may have to store my acl as a serialized object…

 Signature 

If you ask me if it can be done, the answer is yes! It can always be done. The correct question however, is what will it cost?

 
Posted: 08 September 2007 06:42 PM   [ Ignore ]   [ # 14 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-06
743 posts
Monotoba - 08 September 2007 09:51 PM

Ok, a closer look at Zend ACL tells me that I don’t need to use Zends dbi but that I may have to store my acl as a serialized object…

Yep, Zend Framework components are pretty modular. You could use the Zend Session and Auth components with the ACL, but even that isn’t necessary.

You only have to serialize the ACL object if you need to dynamically update it in your code. For example, you build a utility where an admin user can create additional roles/resources or edit them.

 Signature 

“I am the terror that flaps in the night”

 
Posted: 08 September 2007 07:04 PM   [ Ignore ]   [ # 15 ]   [ Rating: 0 ]
Joined: 2007-09-05
24 posts

Yes, I will need an admin function that allows roles and resources to be crud. I found a podcast on PHP Abstract that talks about the zend ACL. The only dependencies I’ve found so far is on the Zend Exception class… I prefere db storage and would like to encrypt the serialized data for security sake. After all, this is a global ACL and if it got leaked, you would loose all control. Have any suggestions on how best to do that?

 Signature 

If you ask me if it can be done, the answer is yes! It can always be done. The correct question however, is what will it cost?

 
Posted: 08 September 2007 07:29 PM   [ Ignore ]   [ # 16 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-06
743 posts

I probably don’t understand your concern, but even if someone had access to your server and could look at the ACL, what harm would that do? It is more important to protect usernames/passwords. I think that if a stranger could access your server, then you have larger concerns.

EDIT:
Sorry, I think I understand now. You want to serialize the ACL object and store it in the database. In which case, if someone could access your database, they could transparently change the ACL to grant a user admin privileges for example. That would be a problem since you might not know about it. So I guess if the serialized ACL is a string, you could use the CI encryption library when getting/saving the ACL to the database.

 Signature 

“I am the terror that flaps in the night”

 
Posted: 09 September 2007 12:10 AM   [ Ignore ]   [ # 17 ]   [ Rating: 0 ]
Joined: 2007-09-05
24 posts

Sorry for late reply but yes, my concern is if someone accessed the acl they could alter it. Encrypting it would solve this issue or at least make it much more difficult to alter the acl in the database. This is also why I seed passwords with extra characters before encrypting them with MD5 or SHA1. Both can be broken. In fact I once saw a demo of an MD5 hash broken on a laptop PC in less than an hour. The issue with MD5 is that collisions can happen in the hash. In other-words, two very different passwords can result in the same MD5 hash. MD5 was an improvement on MD4 but only decreases the odds of a collision and with pc’s gaining more processing power every few months, the MD5 hash simply is not tight enough alone. Many once secure hashing methods simply have become less secure becuase the processing power of pc’s has increase beyond what was expected when the algorythm was designed. Security is always a major concern for me.

 Signature 

If you ask me if it can be done, the answer is yes! It can always be done. The correct question however, is what will it cost?

 
Posted: 09 September 2007 01:33 AM   [ Ignore ]   [ # 18 ]   [ Rating: 0 ]
Joined: 2007-09-05
24 posts

P.S. If anyone thinks that MD5 is secure read this!

http://technocrat.net/d/2006/3/21/1500

MD5 broken in now under a minute!

 Signature 

If you ask me if it can be done, the answer is yes! It can always be done. The correct question however, is what will it cost?

 
Posted: 09 September 2007 08:11 AM   [ Ignore ]   [ # 19 ]   [ Rating: 0 ]
Joined: 2007-04-05
320 posts

Yeah, MD5 is pretty bad imo. I was testing it out with the online dictionary attacks on my own password. Took about 10 seconds.  All dictionary words are incredibly easy to break.

 
Posted: 09 September 2007 06:51 PM   [ Ignore ]   [ # 20 ]   [ Rating: 0 ]
Joined: 2006-07-10
485 posts

Spotted this a few minutes ago and it may apply to earlier messages in reference to Zend_ACL and storing ACL infomation in a database. It’s an extension to Zend_ACL posted on phpclasses.org. Have not looked at this, but the description seemed to apply.

http://www.phpclasses.org/browse/package/4100.html

 
Posted: 09 September 2007 07:41 PM   [ Ignore ]   [ # 21 ]   [ Rating: 0 ]
Joined: 2007-09-05
24 posts

What I don’t like about any Zend solution is that the Zend Framework appears to be writen for PHP5 only. I still have clients using PHP 4.x and MySQL 4.x and need to keep my code compliant.

 Signature 

If you ask me if it can be done, the answer is yes! It can always be done. The correct question however, is what will it cost?

 
Posted: 13 November 2007 05:01 PM   [ Ignore ]   [ # 22 ]   [ Rating: 0 ]
Joined: 2007-04-16
10 posts

Exactly.. that’s my main concern as well. Isn’t there any other ACL available?

Zend Framework isn’t really a solution for me because:

a) As mentioned above it would load it’s own libraries, which means more resources/time overhead.

b) Requires php5.1.x at least and I would like my app to be php4 compatible. On the other hand, frankly enough, my own host is using 5.0.5.

 
Posted: 13 November 2007 05:34 PM   [ Ignore ]   [ # 23 ]   [ Rating: 0 ]
Avatar
Joined: 2007-02-06
743 posts
Valdemar - 13 November 2007 10:01 PM

a) As mentioned above it would load it’s own libraries, which means more resources/time overhead.

Zend Framework components were designed to be isolated from one another. The acl component doesn’t rely on any other framework component (except the zend_exception class which can be changed to the native exception with a search/replace).

 Signature 

“I am the terror that flaps in the night”

 
Posted: 13 November 2007 06:15 PM   [ Ignore ]   [ # 24 ]   [ Rating: 0 ]
Joined: 2006-07-10
485 posts

If using Adodb for database abstraction is not a problem, you can use phpGACL. If you go that route, use the updated Adodb integration instructions at CiForge rather than the wiki instructions. It should be possible to convert phpGACL to use the CI DBAL with a bit of work.

There is a RBAC solution on sqlrecipes.com. Download instructions are mentioned in the comments on the article that discusses the solution.

 
Posted: 01 December 2007 06:50 PM   [ Ignore ]   [ # 25 ]   [ Rating: 0 ]
Avatar
Joined: 2006-10-31
29 posts

Of all the Access Control Libs/Models for CI, has anyone determined which one(s) are close to an RBAC implementation? as described here: http://en.wikipedia.org/wiki/Role-Based_Access_Control

And this RBAC system http://www.sqlrecipes.com/database_design/fine_grained_role_based_access_control_rbac_system-3/

Someone mentioned porting it to CodeIgniter, does anyone know of it’s success?

http://www.sqlrecipes.com/database_design/fine_grained_role_based_access_control_rbac_system-3/#post284

George

 
1 of 2
1