473,405 Members | 2,176 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

is using LDAP or SESSION more secure for authentication and access control?

I am considering a large project and they currently use LDAP on MS platform.
It would be moved to a LAMP platform. OpenLDAP is an option though I have
not used it before. I do feel fairly confortable with my ability to use
SESSIONS for authentication and access control.

Would it better to learn and use LDAP or can you REALLY have just as secure
authentication and access control using Sessions?

Thanks for your thoughts and experience.
Feb 8 '06 #1
6 2986
Notgiven wrote:
I am considering a large project and they currently use LDAP on MS
platform. It would be moved to a LAMP platform. OpenLDAP is an option
though I have not used it before. I do feel fairly confortable with my
ability to use SESSIONS for authentication and access control.

Would it better to learn and use LDAP or can you REALLY have just as
secure authentication and access control using Sessions?
Hi,

You better be the judge of that yourself.
Consider the following about sessions:

- A session with a client is based on some value that is passed to the
client. The client sends this value back each new request to the server.
- This is just a token, often in form of: PHPSESID=231jhg2fg14hg3ff43
- This sessionid is passed via cookie or URL

So untill now: Somebody has to intercept the sessionid on its route from
client to server and the other way round.
If somebody manages to do this, under most circumstances this bad guy can
'hijack the session', simply by going to the same page with the right
cookie set (for PHPSESSID)

If you can secure this part (by means of https eg) then you are fine (so
far).

How to use a session for security (admin-only pages example)

- A sessionid is used on the server to retrieve the actual data stored in
the session, like (in php):

to set some value:
$_SESSION["isadmin"] = "Y";

or on top of a script that demands admin-only entrance:
if ((isset($_SESSION["isadmin"]) && ($_SESSION["isadmin"] == "Y")) {
// OK
} else {
echo "Go away!";
exit;
}

So you'll have to adjust this logic everywhere in your application.
Next possible problem:

The server itself.
Consider where the sessiondata (like 'admin' value) is stored.
Default PHP install will use a filebased sessionstorage system.
It created a file in a temp directory under a name that includes the
sessionid.
PHP will get this file if a new request arives at the server.

Alternatively, you can write your own sessionhandling, and store it in a
database.

In both cases:
Ask yourself: Can somebody else get the session there? (in tempdirectory or
from database).

Remember that the tempdirectory is writable and readable for all users
(under most *nix distros).
The fileowner of the sessionfile will be the user that runs PHP.
Under *nix this is often www-data/apache/nobody.

So if you are in a shared hosting environment, somebody else running a
website on that machine, will run as the same user, thus will be able to
get the sessionfile and read/write it.
(Again under most setups)

Hope this helps you a bit to decide what is best.

Oh, my knowledge of LDAP is limited to 'heard that name before, something
with file/directorybased storage, right?'.
So I cannot help you compare.

Good luck.

Regards,
Erwin Moller

Thanks for your thoughts and experience.


Feb 8 '06 #2
"Erwin Moller"
<si******************************************@spam yourself.com> wrote in
message news:43***********************@news.xs4all.nl...
Notgiven wrote:
I am considering a large project and they currently use LDAP on MS
platform. It would be moved to a LAMP platform. OpenLDAP is an option
though I have not used it before. I do feel fairly confortable with my
ability to use SESSIONS for authentication and access control.

Would it better to learn and use LDAP or can you REALLY have just as
secure authentication and access control using Sessions?


Hi,

You better be the judge of that yourself.
Consider the following about sessions:

- A session with a client is based on some value that is passed to the
client. The client sends this value back each new request to the server.
- This is just a token, often in form of: PHPSESID=231jhg2fg14hg3ff43
- This sessionid is passed via cookie or URL

So untill now: Somebody has to intercept the sessionid on its route from
client to server and the other way round.
If somebody manages to do this, under most circumstances this bad guy can
'hijack the session', simply by going to the same page with the right
cookie set (for PHPSESSID)

If you can secure this part (by means of https eg) then you are fine (so
far).

How to use a session for security (admin-only pages example)

- A sessionid is used on the server to retrieve the actual data stored in
the session, like (in php):

to set some value:
$_SESSION["isadmin"] = "Y";

or on top of a script that demands admin-only entrance:
if ((isset($_SESSION["isadmin"]) && ($_SESSION["isadmin"] == "Y")) {
// OK
} else {
echo "Go away!";
exit;
}

So you'll have to adjust this logic everywhere in your application.
Next possible problem:

The server itself.
Consider where the sessiondata (like 'admin' value) is stored.
Default PHP install will use a filebased sessionstorage system.
It created a file in a temp directory under a name that includes the
sessionid.
PHP will get this file if a new request arives at the server.

Alternatively, you can write your own sessionhandling, and store it in a
database.

In both cases:
Ask yourself: Can somebody else get the session there? (in tempdirectory
or
from database).

Remember that the tempdirectory is writable and readable for all users
(under most *nix distros).
The fileowner of the sessionfile will be the user that runs PHP.
Under *nix this is often www-data/apache/nobody.

So if you are in a shared hosting environment, somebody else running a
website on that machine, will run as the same user, thus will be able to
get the sessionfile and read/write it.
(Again under most setups)

Hope this helps you a bit to decide what is best.

Oh, my knowledge of LDAP is limited to 'heard that name before, something
with file/directorybased storage, right?'.
So I cannot help you compare.

Good luck.

Regards,
Erwin Moller


Thanks for your insight. I am using sessions for auth/acess control now for
several apps so. like you, I understand how that works. I haven't done this
yet, but you can set the session store location/directory in the php.ini
file.

If you do that and use SSL, I think most of session security is covered.
The logic of access control is critical and requires lots of planning and
"what-if" analysis.

thanks again!
Feb 8 '06 #3
d
"Notgiven" <no*********@invalid.invalid> wrote in message
news:L4**************@bignews4.bellsouth.net...
I am considering a large project and they currently use LDAP on MS
platform. It would be moved to a LAMP platform. OpenLDAP is an option
though I have not used it before. I do feel fairly confortable with my
ability to use SESSIONS for authentication and access control.

Would it better to learn and use LDAP or can you REALLY have just as
secure authentication and access control using Sessions?

Thanks for your thoughts and experience.


I'd use LDAP. It will integrate directly with their domain controller (or
whatever is holding the directory), and save you lots of headache. You can
even use samba to act as a pam module, which you can use on linux to
authenticate users on a windows domain.

dave
Feb 9 '06 #4
>I am considering a large project and they currently use LDAP on MS platform.
It would be moved to a LAMP platform. OpenLDAP is an option though I have
not used it before. I do feel fairly confortable with my ability to use
SESSIONS for authentication and access control.

Would it better to learn and use LDAP or can you REALLY have just as secure
authentication and access control using Sessions?


This question seems a lot like "are you going to use roads or a
motor vehicle to go across town"? There's a good chance you will
want both.

LDAP as described here is functioning as a database of valid users
and passwords, and a method to check access. Alternatives might
include a MySQL database of users and passwords, a flat file, a
RADIUS server, or something hardcoded into code.

Issues like whether the passwords are encrypted when stored or
encrypted when transmitted are implementation details. If you want
it "secure", you have to describe the threat model. Is the problem
traffic sniffing? (encrypt passwords when transmitted) Or an
employee who walks off with a copy of the database (encrypt passwords
when stored). Sometimes it's not practical to do both.

You also need something that allows or disallows access to particular
pages. It also has the problem of grouping a set of accesses into
a "login session" as it is undesirable to make the user enter a
password on *every* page, and checking on every access can be
inefficient. PHP code with sessions is one way to do this. Apache
HTTP authentication is another (although it has disadvantages, like
not having a "logout" function). You can also use PHP code with
cookies. Or check IP addresses.

Gordon L. Burditt
Feb 9 '06 #5
"d" <d@example.com> wrote in message
news:G6******************@text.news.blueyonder.co. uk...
"Notgiven" <no*********@invalid.invalid> wrote in message
news:L4**************@bignews4.bellsouth.net...
I am considering a large project and they currently use LDAP on MS
platform. It would be moved to a LAMP platform. OpenLDAP is an option
though I have not used it before. I do feel fairly confortable with my
ability to use SESSIONS for authentication and access control.

Would it better to learn and use LDAP or can you REALLY have just as
secure authentication and access control using Sessions?

Thanks for your thoughts and experience.


I'd use LDAP. It will integrate directly with their domain controller (or
whatever is holding the directory), and save you lots of headache. You
can even use samba to act as a pam module, which you can use on linux to
authenticate users on a windows domain.

dave


Thanks. This will be a standalone server not included in any domain.
Feb 9 '06 #6
> LDAP as described here is functioning as a database of valid users
and passwords, and a method to check access. Alternatives might
include a MySQL database of users and passwords, a flat file, a
RADIUS server, or something hardcoded into code.

Issues like whether the passwords are encrypted when stored or
encrypted when transmitted are implementation details. If you want
it "secure", you have to describe the threat model. Is the problem
traffic sniffing? (encrypt passwords when transmitted) Or an
employee who walks off with a copy of the database (encrypt passwords
when stored). Sometimes it's not practical to do both.

You also need something that allows or disallows access to particular
pages. It also has the problem of grouping a set of accesses into
a "login session" as it is undesirable to make the user enter a
password on *every* page, and checking on every access can be
inefficient. PHP code with sessions is one way to do this. Apache
HTTP authentication is another (although it has disadvantages, like
not having a "logout" function). You can also use PHP code with
cookies. Or check IP addresses.


So as I understand it, LDAP is an alternative to userid and passwords in a
database for authenticating.

Regarding sessions, right - I use them in my apps for controlling access to
certain pages.

Not being familiar with LDAP, I thought is was a magic bullet for
authenticating AND intra-application access control. I see not that it is
not. Rather, as I understand it, it is one of several authentication
methods.

Thanks again
Feb 9 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: dmcconkey | last post by:
Hi folks, I've been searching for a while and haven't found my specific question anywhere else. If this has already been asked, please accept my appologies and point me to the appropriate...
6
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms...
0
by: DotNetShadow | last post by:
Hi Guys I was wondering if you can help me out with the following problem. I created a basic secure | non secure website. So I have the root directory as publically allowable pages and a...
5
by: Ĺženol Akbulak | last post by:
Hello; I use in my web application FormsAuthentication. Also I use Session state (InProc). When a user logged in, I can read Session parameters. (For example Session). Problem is that, when...
5
by: Jed Parsons | last post by:
Hi, authenticates a user against our ldap server.: User types in name and password, and module sees if name and password check out right with the ldap server. I see that it's pretty...
3
by: Jay-nospam | last post by:
Hi there, I am having trouble getting an ASP.NET web application to connect to another computer and passing the proper credentials and I hope someone can help me. I have a stand-alone Windows...
2
by: Jay | last post by:
Hi, This is Jay Mehta. I have this problem when using LDAP. I extract names and EmailId's of all those present from LDAP and populate in a datagrid. Now when run locally, it is running...
1
by: Rohit Ambani | last post by:
I have created Login.aspx Page On Click of Login Button.I invoke the code as follows ====================================================== Dim adPath As String = "LDAP://172.21.1.19" 'Path to your...
9
by: Ben | last post by:
Hello, I'll bet this has been asked a million times but I can't seem to find a thread that gives the clear example I need. This PC has MySQL and IIS configured and running. The MySQL database is...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.