need virtualmin to add mail attribute to ldap user

23 posts / 0 new
Last post
#1 Sun, 05/10/2009 - 06:37
staticanime

need virtualmin to add mail attribute to ldap user

Hi all, I need to set Virtualmin to add the mail attribute to an LDAp user when creating said user in Virtualmin.

I use joomla for a website, with LDAP auth, and it won't work if the mail attribute isn't set, and I don't want to have to do it manually, so can anyone help?

Also, is there any way to modify the templates to change premissions on a sub-domains folder, to prevent the Apache 403 errors I'm getting. say I have forum.example.com, I have to go chmod a+x forum.example.com, and public_html inside that folder before Apache will let me see webpages for that domain :(

Sun, 05/10/2009 - 12:43
Joe
Joe's picture

<div class='quote'>I use joomla for a website, with LDAP auth, and it won't work if the mail attribute isn't set, and I don't want to have to do it manually, so can anyone help?</div>

There are probably multiple ways to solve this one. I don't have an LDAP system handy to test on, but I'm betting there's a way to preconfigure this attribute for new users in the LDAP Server module. But, I might be wrong.

I assume you've read through Jamie's Virtualmin with LDAP guide here:

http://www.virtualmin.com/documentation/id,combining_virtualmin_and_ldap/

Anyway, if there isn't a way to inject the mail attribute automatically with Virtualmin, you could do it with one of the &quot;Commands to run after changes&quot; options. Look in Webmin-&gt;System-&gt;Users and Groups-&gt;Module Config-&gt;Before and after commands. You could use an LDAP command to update the user to add that attribute. There are ENV variables set by Virtualmin when creating and modifying users, so you can make a script to do what you need with the information it needs to do the job...usually in just a line or two. Variables are documented here (though not all variables are set for all situations):

http://www.virtualmin.com/documentation/id,template_variable_listing/

I'm not an expert on LDAP, so I'll ask Jamie to chime in on this thread.

<div class='quote'>Also, is there any way to modify the templates to change premissions on a sub-domains folder, to prevent the Apache 403 errors I'm getting.
say I have forum.example.com, I have to go chmod a+x forum.example.com, and public_html inside that folder before Apache will let me see webpages for that domain :(</div>

Apache isn't getting group membership set correctly. I'm not sure how that's done in LDAP...but I would think it would be covered by the docs Jamie wrote on the topic, but I might be wrong. In short, Apache gets automatically added to your new virtual server group, which gives it access to the home directories, while allowing them to remain mode 750 (which means no users can see other users content, but Apache can see everybody).

--

Check out the forum guidelines!

Sun, 05/10/2009 - 16:32 (Reply to #2)
Joe
Joe's picture

For LDAP, you can have Virtualmin add the mail attribute to users .. assuming that you have already set it up to create users and groups in LDAP, as documented on the page Joe linked to. Just go to System Settings -&gt; Module Config -&gt; Advanced options, and enable the 'Add mail attribute to LDAP users?' setting.

--

Check out the forum guidelines!

Mon, 05/11/2009 - 07:46 (Reply to #3)
staticanime

<b>Joe wrote:</b>
<div class='quote'>There are probably multiple ways to solve this one. I don't have an LDAP system handy to test on, but I'm betting there's a way to preconfigure this attribute for new users in the LDAP Server module. But, I might be wrong.

I assume you've read through Jamie's Virtualmin with LDAP guide here:

http://www.virtualmin.com/documentation/id,combining_virtualmin_and_ldap/
</div>

Yeah, I followed that guide.

<div class='quote'>Also, is there any way to modify the templates to change premissions on a sub-domains folder, to prevent the Apache 403 errors I'm getting.
say I have forum.example.com, I have to go chmod a+x forum.example.com, and public_html inside that folder before Apache will let me see webpages for that domain :(</div>

Apache isn't getting group membership set correctly. I'm not sure how that's done in LDAP...but I would think it would be covered by the docs Jamie wrote on the topic, but I might be wrong. In short, Apache gets automatically added to your new virtual server group, which gives it access to the home directories, while allowing them to remain mode 750 (which means no users can see other users content, but Apache can see everybody).[/quote]

I looked, and my user is getting added to the www-data group, but I still get the 403 errors unless my sub-domains main folder, and it's public_html folder are chmod'd a+x (751 I think). So I dunno what's going on :(

<div class='quote'>
For LDAP, you can have Virtualmin add the mail attribute to users .. assuming that you have already set it up to create users and groups in LDAP, as documented on the page Joe linked to. Just go to System Settings -&gt; Module Config -&gt; Advanced options, and enable the 'Add mail attribute to LDAP users?' setting.
</div>
I found that and set it, hope it works

Mon, 05/11/2009 - 08:44 (Reply to #4)
Joe
Joe's picture

What are the permissions on the sub-domain's home and public_html directories being set to before you change them?

--

Check out the forum guidelines!

Tue, 05/12/2009 - 00:08 (Reply to #5)
staticanime

750 for both, AFAIK. This might just be a bug with Ubuntu, as I've heard of a lot of people getting the 403 error, and the fix was to change the permissions to 751, and I can set Virtualmin to go that, but only for the public_html folder. I need the home to also be 751 instead of 750, or else Apache will 403 me.

Tue, 05/12/2009 - 01:06 (Reply to #6)
Joe
Joe's picture

The difference between 750 and 751 is whether Apache is a member of the group that owns the directories in question. Sounds like in your case, it is not. I don't know how LDAP interacts in that equation.

--

Check out the forum guidelines!

Tue, 05/12/2009 - 08:38 (Reply to #7)
Joe
Joe's picture

It looks like the user Apache runs as it's being added to domain's groups in LDAP. You might want to double-check what that user is (the ps auxwww command will tell you), and then make sure it is in each domain's group as a secondary member.

--

Check out the forum guidelines!

Tue, 05/12/2009 - 10:02 (Reply to #8)
staticanime

Well, from what I can tell, my memebers are getting added to the apache group, here's a screenshot from the LDAP Groups part of the LDAP User &amp; Groups module. As you can see, I have two users, static &amp; spark.

<img src='http://img100.imageshack.us/img100/6595/79493888.png' style='border:0px'>

Tue, 05/12/2009 - 11:04 (Reply to #9)
Joe
Joe's picture

That looks good to me. If you login to the system and run the command &quot;groups www-data&quot;, does it show those groups?

Also, if you run &quot;ps axuwwww | grep www-data&quot;, does it find the Apache processes?

--

Check out the forum guidelines!

Tue, 05/12/2009 - 14:15 (Reply to #10)
staticanime

The first command returns &quot;www-data subversion&quot;, and the second command returns the apache processes.

<div class='quote'>
For LDAP, you can have Virtualmin add the mail attribute to users .. assuming that you have already set it up to create users and groups in LDAP, as documented on the page Joe linked to. Just go to System Settings -&gt; Module Config -&gt; Advanced options, and enable the 'Add mail attribute to LDAP users?' setting.</div>
This didn't work, the new user I created (with a domain), doesn't have a mail attribute in their LDAP attributes :(

Tue, 05/12/2009 - 14:25 (Reply to #11)
staticanime

EDIT: (Reply actually, since EDIT is broke). You have to specify an administrative mailbox when creating a domain for the mail attribute to be set, it won't set up a default one, like say, username@domain.com

Tue, 05/12/2009 - 14:48 (Reply to #12)
Joe
Joe's picture

<div class='quote'>The first command returns &quot;www-data subversion&quot;, and the second command returns the apache processes.</div>

Odd, that's exactly what it should be.
I don't suppose that restarting Apache perhaps helps?

--

Check out the forum guidelines!

Wed, 05/13/2009 - 01:57 (Reply to #13)
staticanime

Nope, tried that multiple times. I don't suppose it would help if I re-created the apache user/group in LDAP, then delete the system user, do you think that might work?

Wed, 05/13/2009 - 08:16 (Reply to #14)
Joe
Joe's picture

That shouldn't be needed - non-LDAP users should still be able to have LDAP secondary groups.

If you like, I can login to your system myself and take a look at this. My email is jcameron@virtualmin.com

--

Check out the forum guidelines!

Thu, 05/14/2009 - 07:50 (Reply to #15)
staticanime

Email sent

Thu, 05/14/2009 - 08:56 (Reply to #16)
Joe
Joe's picture

I don't see the email .. what was the subject line?

--

Check out the forum guidelines!

Thu, 05/14/2009 - 22:55 (Reply to #17)
staticanime

The subject line was the name of this topic, and it came from static dot anime at hotmail dot com

Fri, 05/15/2009 - 07:55 (Reply to #18)
Joe
Joe's picture

Got it, thanks!

--

Check out the forum guidelines!

Fri, 05/15/2009 - 09:02 (Reply to #19)
Joe
Joe's picture

After some looking around on your system, I finally found it! In /etc/ldap.conf there is a line nss_initgroups_ignoreusers that lists users for whom secondary groups won't come from LDAP .. and www-data was in that list. Once I removed it, all was good.

--

Check out the forum guidelines!

Sat, 05/16/2009 - 02:02 (Reply to #20)
staticanime

Excellent, thanks very much :)

Sat, 05/16/2009 - 02:22 (Reply to #21)
staticanime

EDIT: Ok, so Apache's working, but the system still isn't adding the mail attribute to the LDAP user when creating or editing a domain :(

Sat, 05/16/2009 - 17:07 (Reply to #22)
Joe
Joe's picture

I just logged into your system again, and created the test user jcameron@staticanime.net .. and the mail attribute was added OK in LDAP.

--

Check out the forum guidelines!

Topic locked