Bug 10005 - drakauth unable to generate valid ldap authentification
Summary: drakauth unable to generate valid ldap authentification
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: x86_64 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Derek Jennings
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 7667
  Show dependency treegraph
 
Reported: 2013-05-06 17:41 CEST by Fabrice Boyrie
Modified: 2015-05-17 17:14 CEST (History)
3 users (show)

See Also:
Source RPM: drakxtools-curses-15.47-1.mga3
CVE:
Status comment:


Attachments

Description Fabrice Boyrie 2013-05-06 17:41:59 CEST
Description of problem:
I'm trying again to configure ldap authentification on Mageia
I have an ldap server with a self signed certificate. So in drakauth, I click on use encrypt connection with tls and I give the file containing certificate of ldap server.
  But authentification doesn't works.

It seems drakauth now use nslcd.
But in nslcd.conf, base field is not filled. And certificate file is not configured (I think it is the field tls_cacertfile)



Reproducible: 

Steps to Reproduce:
David Walser 2013-05-06 20:53:13 CEST

Assignee: bugsquad => thierry.vignaud

Comment 1 David Walser 2013-05-08 17:40:57 CEST
Indeed, it doesn't modify /etc/nslcd.conf at all.

CC: (none) => luigiwalser

Comment 2 David Walser 2013-05-08 17:52:55 CEST
It also needs to enable and start the nslcd service, and restart or stop and disable the nscd service (depending on whether they can work together or not).
Comment 3 David Walser 2013-08-28 20:30:59 CEST
In this file on your system:
/usr/lib/libDrakX/authentication.pm

Also in SVN here:
http://svnweb.mageia.org/soft/drakx/trunk/perl-install/authentication.pm?revision=7897&view=markup

the funtions read_ldap_conf() and update_ldap_conf() need to use /etc/nslcd.conf instead of /etc/ldap.conf.

In configure_nss_ldap(). instead of using host, I think it should use uri, so it'd be like uri => "ldaps://" . $authentication->{LDAP_server} . "/"

For the nss_base_* things, the code would probably have to be changed, because the config parameter is just "base" for all three of those.  The conf lines look like this:
base group cn=Users,dc=domain,dc=com
base passwd cn=Users,dc=domain,dc=com
base shadow cn=Users,dc=domain,dc=com

The ?sub at the end doesn't need to be there.   You could just add a scope => sub to make that the default (it actually is the default).

Also, the tls_checkpeer => "yes" should be changed to tls_reqcert => "demand".

I could write the patch for that, except for I don't know how to handle the changes needed for the "base" lines.
Derek Jennings 2013-08-30 23:05:13 CEST

CC: (none) => derekjenn

Derek Jennings 2013-08-31 14:46:39 CEST

Blocks: (none) => 7667

Comment 4 Derek Jennings 2013-08-31 15:10:39 CEST
David

Would you like to try this out?

http://gitweb.mageia.org/software/drakx/diff/perl-install/authentication.pm?id=72ea5fb83d926327079b5632a9e81a029ec965d9


For Bug 7667  it is not immediately clear to me what needs doing.  If you can give me a pointer it would be useful.
Comment 5 David Walser 2013-08-31 15:15:53 CEST
(In reply to Derek Jennings from comment #4)
> David
> 
> Would you like to try this out?
> 
> http://gitweb.mageia.org/software/drakx/diff/perl-install/authentication.
> pm?id=72ea5fb83d926327079b5632a9e81a029ec965d9

I won't be able to verify it until I get back to work, but it looks perfect, save for maybe you'd want to add a scope => sub too (although it is the default).  Seeing as it's currently completely broken, it won't hurt to go ahead and get that committed and pushed now.  Thanks!

> For Bug 7667  it is not immediately clear to me what needs doing.  If you
> can give me a pointer it would be useful.

Indeed.  Hopefully we can get more feedback from Zombie.
Comment 6 Derek Jennings 2013-08-31 15:49:00 CEST
>maybe you'd want to add a scope => sub too (although it is the default).

Done

Fixed in git.
I'll not push a package just now. There are bound to be more updates to drakxtools  coming along.

Status: NEW => ASSIGNED
Assignee: thierry.vignaud => derekjenn

David Walser 2013-08-31 15:50:14 CEST

CC: (none) => thierry.vignaud

Comment 7 Thierry Vignaud 2013-08-31 17:10:29 CEST
BTW I think in the future we should switch to use sssd for LDAP.
It's much simpler, one single config for both PAM & NSS.
Comment 8 David Walser 2013-08-31 17:13:51 CEST
Interesting.  Using Active Directory at work, I couldn't get sssd working, but I did get nss-pam-ldapd.  nss-pam-ldapd seems a lot simpler and more obvious to me as far as configuring by hand.  Assuming it works correctly, I don't know that it makes much difference which one the tool uses.  I suppose it could offer a choice too (maybe as an advanced option).
Comment 9 Thierry Vignaud 2013-08-31 17:16:38 CEST
It was very simple to configure on RHEL6 to bind on a AD.
Some advanced stuff isn't documented at all.

IUcan mail you doc if you want to.
Comment 10 David Walser 2013-08-31 17:18:23 CEST
Sure, I can experiment with it some more when I get back to work.
Comment 11 David Walser 2013-09-03 14:28:37 CEST
Derek,

I think the conclusions reached from Bug 7667 so far are that the tls_reqcert should be "allow" by default, instead of "demand", as demand requires adding a certificate in /etc/pki/tls/certs so that it can verify the server cert.  Actually adding the ability to add the cert through the tool such that you can use demand would be an optional extra feature, as would configuring the sudo thing Zombie discussed there, but neither is strictly necessary.

Also, another thing I just thought of, you might want to do:
if ($authentication->{cafile} eq '1') {
update_ldap_conf(
	uri => "ldaps://" . $authentication->{LDAP_server} . "/",
                );
} else {
update_ldap_conf(
	uri => "ldap://" . $authentication->{LDAP_server} . "/",
                );
       }

So that it doesn't try to use SSL when you haven't asked it to, as that might not work.
Comment 12 David Walser 2013-09-11 00:17:43 CEST
Derek,

I think Colin pushed an update containing your previous commit, so the changes suggested in Comment 11 still should be made.  Once that's done I think this can be marked as fixed.
Comment 13 Derek Jennings 2013-09-11 15:19:50 CEST
Committed to git

http://gitweb.mageia.org/software/drakx/plain/perl-install/authentication.pm

I'll not push a package yet. There are bound to be other updates to drakxtools shortly.
Comment 14 David Walser 2013-09-11 15:34:30 CEST
Thanks Derek.  As this issue also affects Mageia 3, at some point you might want to backport these fixes there.
Comment 15 Samuel Verschelde 2015-05-17 17:14:37 CEST
Should be fixed now.

Status: ASSIGNED => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.