Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
create users from /etc/passwd?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Tim  
View profile  
 More options Feb 2 2012, 10:47 am
From: Tim <jtim.arn...@gmail.com>
Date: Thu, 2 Feb 2012 07:47:30 -0800 (PST)
Local: Thurs, Feb 2 2012 10:47 am
Subject: create users from /etc/passwd?

I'm running Django 1.3.1 on FreeBSD + Apache2.2 inside an intranet.

I do not grok authentication, so here is my problem and a question about
how I can solve it (maybe).
What I need is the name of the user who hits the application. I don't care
about the password, I just need to know who they are. I've been unable to
get the REMOTE_USER from Apache, mainly because I think Apache doesn't know
it either (no authentication is used on the httpd.conf).

I thought (here's my maybe solution) I might create a bunch of users in
Django by parsing the /etc/passwd database. Then at least each user would
have the same username/password they use to login to the network.

Is that possible? Is there a better way to get the username?
thanks,
--Tim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Furbee  
View profile  
 More options Feb 2 2012, 11:23 am
From: Furbee <Furbeena...@gmail.com>
Date: Thu, 2 Feb 2012 08:23:39 -0800
Local: Thurs, Feb 2 2012 11:23 am
Subject: Re: create users from /etc/passwd?

Hi Tim,

I'm not totally sure, but I don't think this will work. You could parse the
passwd file to get the usernames, but the passwords are encrypted. Since
you don't have the system's decryption key, you would not be able to
determine the password. If you just used what is in /etc/shadow it would
not match the password that the users enter when they try to authenticate
in Django.

I would suggest using Django's built-in authentication system. Then when a
user goes to your site, and enters their credentials, you will be able to
access the user information in the view with request.user (assuming
"request" is your view's first parameter name).

Django's documentation is a lifesaver, here's setting up User
Authentication:
https://docs.djangoproject.com/en/1.3/topics/auth/

Here's accessing session information when a user is logged in.
https://docs.djangoproject.com/en/1.3/topics/http/sessions/

Finally, you can use the decorator @login_required for views that require
authentication. However, I found it easier for many applications that use
site-wide authentication (usually the case with intranet development) to
use middleware to require login for every page. I implemented something
similar to this and it works perfectly.:
http://onecreativeblog.com/post/59051248/django-login-required-middle...

You're want to study up on how middleware works, here:
https://docs.djangoproject.com/en/1.3/topics/http/middleware/

Good Luck,

Furbee


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Thorsten Sanders  
View profile  
 More options Feb 2 2012, 11:26 am
From: Thorsten Sanders <thorsten.sand...@gmx.net>
Date: Thu, 02 Feb 2012 17:26:18 +0100
Local: Thurs, Feb 2 2012 11:26 am
Subject: Re: create users from /etc/passwd?
https://bitbucket.org/maze/django-pam/

maybe that helps?

On 02.02.2012 16:47, Tim wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
David Fischer  
View profile  
 More options Feb 2 2012, 1:34 pm
From: David Fischer <djfis...@gmail.com>
Date: Thu, 2 Feb 2012 10:34:10 -0800 (PST)
Local: Thurs, Feb 2 2012 1:34 pm
Subject: Re: create users from /etc/passwd?

Depending on your intranet, you may already have an LDAP directory. If you
do, I would use a combination of Apache, mod_ldap<http://httpd.apache.org/docs/2.2/mod/mod_ldap.html>and Django's
RemoteUserMiddleware<https://docs.djangoproject.com/en/1.3/howto/auth-remote-user/>
.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Tim  
View profile  
 More options Feb 2 2012, 3:00 pm
From: Tim <jtim.arn...@gmail.com>
Date: Thu, 2 Feb 2012 12:00:23 -0800 (PST)
Local: Thurs, Feb 2 2012 3:00 pm
Subject: Re: create users from /etc/passwd?

Thanks for all this great information. Thorsten, I do have hope that 'pam'
will solve the problem, but if I get nowhere with that, Furbee's links and
info will help me go further; I just didn't want the user to have to sign
on twice when I don't really care about authentication, just user
identification.  In any case, I'm reading those docs now, and the blog
article.

David, I wish I could do this via the LDAP set up but as far as I can tell
there isn't one.

thanks again!
--Tim


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Dewhirst  
View profile  
 More options Feb 2 2012, 6:38 pm
From: Mike Dewhirst <mi...@dewhirst.com.au>
Date: Fri, 03 Feb 2012 10:38:20 +1100
Local: Thurs, Feb 2 2012 6:38 pm
Subject: Re: create users from /etc/passwd?
On 3/02/2012 7:00am, Tim wrote:

> Thanks for all this great information. Thorsten, I do have hope that
> 'pam' will solve the problem, but if I get nowhere with that, Furbee's
> links and info will help me go further; I just didn't want the user to
> have to sign on twice when I don't really care about authentication,
> just user identification. In any case, I'm reading those docs now, and
> the blog article.

> David, I wish I could do this via the LDAP set up but as far as I can
> tell there isn't one.

You can.

If you accept that users will have to authenticate in your Django app
then if you use ldap you won't have to worry about passwords at all.
They will enter the same username and password they usually do when they
power up their workstations.

I have used Peter Herndon's django-ldap-groups very successfully to do
just that. It will create a new user including any ldap groups you set
up for Django based entirely on successful ldap authentication. It will
bring whatever ldap info across to Django that you require.

Mike


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »