473,408 Members | 2,813 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,408 software developers and data experts.

authentication service for unix

Hi,

this is not so much a python question, but as my app is developed in python,
I'll ask anway.

I'm looking for a method to authenticate users for a corba application
server, running under linux. I want to be able to authenticate users that
are valid unix users. Having role/group information would be nice later on.

Currently I use PAM, but thats not so good as I have to run the process as
root - but for obvious reasons I don't especially like that idea.

Any ideas? May ladp of any use here? Saslauthd seems to look good, but so
far I haven't found a binding.

--
Regards,

Diez B. Roggisch
Jul 18 '05 #1
4 1922
"Diez B. Roggisch" <de*********@web.de> writes:
I'm looking for a method to authenticate users for a corba application
server, running under linux. I want to be able to authenticate users that
are valid unix users. Having role/group information would be nice later on.


AF_UNIX sockets under Linux provide an "ancillary message" operation
that lets you check the user id of the process at the other end of a
socket. Unfortunately, Python's socket module doesn't support that
operation. I have a Sourceforge bug in about it and may someday get
around to writing a patch, but of course you're welcome to do it first ;).
Jul 18 '05 #2
Diez B. Roggisch wrote:
Hi,

this is not so much a python question, but as my app is developed
in python, I'll ask anway.

I'm looking for a method to authenticate users for a corba
application server, running under linux. I want to be able to
authenticate users that are valid unix users. Having role/group
information would be nice later on.

Currently I use PAM, but thats not so good as I have to run the
process as root - but for obvious reasons I don't especially like
that idea.


Using PAM is definitively not the reason why your process must be run
as root. What exactly are you doing?

Mathias
Jul 18 '05 #3
> Using PAM is definitively not the reason why your process must be run
as root. What exactly are you doing?


Well, I started fiddling around with pam, and found that when running it as
user the only one I could authenticate was the user the process ran with.

Then I asked about that on the pam mailinglist, and somebody told me that
root rights are necessary.

PAM is not very well documented - if you can point me into the right
direction how to make it work for a normal user, and maybe even have some
meta-data attached to a user (e.g. grouplist), your very welcome!

The following script is authenticating every user if run as root. The
service "claros" is defined like this:

auth required pam_unix.so
account required pam_access.so
Here comes the script.

import PAM

def authenticate(user, password):
class AuthConv:
def __init__(_, password):
_.password = password

def __call__(_, auth, query_list, userData):
print "AuthConv called, pwd: %s" % _.password
resp = []
for query, qt in query_list:
if qt == PAM.PAM_PROMPT_ECHO_ON:
resp.append((_.password, 0))
elif qt == PAM.PAM_PROMPT_ECHO_OFF:
resp.append((_.password, 0))
elif qt == PAM.PAM_PROMPT_ERROR_MSG or type ==
PAM.PAM_PROMPT_TEXT_INFO:
print query
resp.append(('', 0))
else:
return None
return resp
auth = PAM.pam()
auth.start("claros")
auth.set_item(PAM.PAM_USER, user)
auth.set_item(PAM.PAM_CONV, AuthConv(password))
try:
auth.authenticate()
auth.acct_mgmt()
print "Authentication successful"
except PAM.error, resp:
print 'Go away, %s! (%s)' % (user, resp)
raise
authenticate("user", "pwd")

--
Regards,

Diez B. Roggisch
Jul 18 '05 #4
Diez B. Roggisch wrote:
Using PAM is definitively not the reason why your process must be
run as root. What exactly are you doing?


Well, I started fiddling around with pam, and found that when
running it as user the only one I could authenticate was the user
the process ran with.


Ok, my fault - you're right. If you are going to authenticate a local
user you usually need read access to /etc/shadow.

The easiest way to work around is using an existing tool like login
or su. They do the PAM stuff for you.

Mathias

Jul 18 '05 #5

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

Similar topics

1
by: Brian Beck | last post by:
After a bit of searching I haven't been able to find a definite resource for Kerberos authentication from Python. Any help would be appreciated. Here's what I've found... ...
0
by: Matt | last post by:
Hello all, We are using Forms Authentication in an application to protect both sensitive ASP.Net pages and Web services. This question is relating to Web services and forms authentication,...
0
by: Albertas | last post by:
What I'm doing wrong that I can't make my authentication to work. Here is the situation: I'm hosting a Web Service from a Windows forms application, using .NET Framework 3.0 WCF. And I want to...
18
by: troywalker | last post by:
I am new to LDAP and Directory Services, and I have a project that requires me to authenticate users against a Sun Java System Directory Server in order to access the application. I have found...
3
by: =?Utf-8?B?RGFuZGFuIFpoYW5n?= | last post by:
Now I have a web application, a web service and a SQL Server database. The Web application will invoke the web service, the web service invokes the SQL Server stored procedure. I let the web...
1
by: bugnthecode | last post by:
Hi, I am trying to put together a small app that uses one of my company's web service. Originally I interfaced with this web service using java, and have the example code. I believe the web...
2
by: Enda Manni | last post by:
Hi, I have a gSoap Web Service written using C++, it uses SOAP username and password authentication. I also have a C# form client consuming the web service, all this was working fine until I...
3
by: Enda Manni | last post by:
Hi, I have a gSoap Web Service written using C++, it uses SOAP username and password authentication. I also have a C# form client consuming the web service, all this was working fine until...
5
by: Rory Becker | last post by:
Having now created a Custom MembershipProvider that seems to work correctly with my Logon and ChangePassword controls, I am, as they say, a happy bunny. The next stange is to move on to the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.