Bug 690237

Summary: yast2-dns-server fails to setup LDAP config
Product: [openSUSE] openSUSE 11.4 Reporter: Wolfgang Rosenauer <wolfgang>
Component: YaST2Assignee: Lukas Ocilka <locilka>
Status: RESOLVED FIXED QA Contact: Jiri Srain <jsrain>
Severity: Normal    
Priority: P3 - Medium CC: jsuchome, lchiquitto, qwatli
Version: Final   
Target Milestone: Factory   
Hardware: All   
OS: openSUSE 11.4   
Whiteboard: maint:running:45804:moderate maint:released:sle11-sp1:47741
Found By: Community User Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Deadline: 2012-03-13   
Attachments: y2logs
Proposed patch
Another patch

Description Wolfgang Rosenauer 2011-04-27 12:30:26 UTC
I've created an ldap server using YaST which apparently worked fine.

Now my next step was to set up DNS using yast2-dns-server but at the moment I switched on LDAP support I got an error message that my ldap configuration is invalid:

2011-04-27 14:01:07 <1> oxlive(14168) [Perl] modules/DnsServer.pm(DnsServer::LdapInit):1629 Trying LDAP server: 127.0.0.1:389
2011-04-27 14:01:07 <1> oxlive(14168) [Perl] modules/DnsServer.pm(DnsServer::LdapInit):1642 Trying LDAP domain: dc=rosenauer,dc=org
2011-04-27 14:01:07 <1> oxlive(14168) [Perl] modules/DnsServer.pm(DnsServer::LdapInit):1649 Main configuration DN: 
2011-04-27 14:01:07 <1> oxlive(14168) [Perl] modules/DnsServer.pm(DnsServer::LdapInit):1653 Main config DN not found

The above might be true. The only thing in the LDAP is the base object at this point since I've just created it. The DNS module should create the structure it needs itself.
Comment 1 Wolfgang Rosenauer 2011-04-27 15:07:00 UTC
Created attachment 426855 [details]
y2logs
Comment 2 Wolfgang Rosenauer 2011-04-27 15:23:38 UTC
Now I found again the pretty hidden tab "Administration settings" and the checkbox for "Create default configuration objects".

(NB: why is the Bind DN not preset with cn=Administrator as the ldap-server module is suggesting?)

Anyway after checking this and configuring the bind dn I actually ended up with the ldapconfig object in my LDAP tree.

... and finally yast2 dns-server was able to save my config.

So this is now only a usability bug. It took me quite some time to find the relevant workflow. Would be nice if that could be made more visible.
Comment 3 Lukas Ocilka 2011-06-20 11:35:12 UTC
Jiri, could you help me with this please?

I thought we usually create the default configuration (by a particular
server config module) or am I wrong? Or does it only work with SLES?
Comment 4 Jiří Suchomel 2011-06-20 11:58:49 UTC
(In reply to comment #3)
> Jiri, could you help me with this please?
> 
> I thought we usually create the default configuration 

We do it in ldap-client module, as Wolfgang writes ("Create default configuration objects"). The objects created here are the basic on (usually ou=ldapconfig, written as BASE_CONFIG_DN in /etc/sysconfig/ldap) plus user and group objects.

Maybe dns/mail/dhcp server should check if the main config object already exists and report proper error if it does not. Or even allow creating it. (In ldap-client, this is what CreateDefaultLDAPConfiguration function does)
Comment 5 Lukas Ocilka 2011-10-31 15:06:18 UTC
Jiri, is this functionality provided by some module? IMO if it's already
written for users, it could be provided as a generic API?
Comment 6 Jiří Suchomel 2011-11-30 08:56:27 UTC
(In reply to comment #5)
> Jiri, is this functionality provided by some module? IMO if it's already
> written for users, it could be provided as a generic API?

It's there in Ldap.ycp, which you are already using.

If you need to check presence of the object (specified by DN) in LDAP tree, use 

        Ldap::GetLDAPEntry (string dn)

It returns a map (empty for non-existing object) or nil in case of error.

If your LDAP connection is already established, you can use the agent directly, e.g. with

        list objects = (list)SCR::Read (.ldap.search, $[
            "base_dn":  dn,
            "attrs":    [],
            "scope":    0, // only this one
            "not_found_ok": true // do not throw error when object does not exist
        ]);
Comment 7 Lukas Ocilka 2012-02-13 17:10:25 UTC
Created attachment 475894 [details]
Proposed patch
Comment 8 Lukas Ocilka 2012-02-13 17:12:48 UTC
*** Bug 710430 has been marked as a duplicate of this bug. ***
Comment 9 Lukas Ocilka 2012-02-13 17:20:15 UTC
- Checking for and adding required LDAP schemas (yast, dnszone)
  while writing the configuration. Fixed handling if configuration
  cannot be written to LDAP (bnc#690237).

Fixed in SVN. New package for Factory (and SLE 11) will be released soon.
Comment 10 Bernhard Wiedemann 2012-02-28 13:00:17 UTC
This is an autogenerated message for OBS integration:
This bug (690237) was mentioned in
https://build.opensuse.org/request/show/107396 Factory / yast2-dns-server
Comment 11 Swamp Workflow Management 2012-02-28 13:24:47 UTC
The SWAMPID for this issue is 45804.
This issue was rated as moderate.
Please submit fixed packages until 2012-03-13.
Also create a patchinfo file using this link:
https://swamp.suse.de/webswamp/wf/45804
Comment 12 Lukas Ocilka 2012-05-29 12:35:20 UTC
Reopening, doesn't work well for SLE 11 SP1
Comment 15 Lukas Ocilka 2012-06-01 13:38:05 UTC
Created attachment 493326 [details]
Another patch

This makes it work even on SLE11-SP1 (Still not tested with SP2)
Comment 16 Lukas Ocilka 2012-06-01 13:50:25 UTC
Bruce, I've created a new patch additional to the latest yast2-dns-server
package. Please apply the patch and retest with clean system (no LDAP
database present, no config, etc.)

This is how I tested the patch:
1.) Run yast2 ldap-server and create some default database
    I've used
      dc=seven-swords,dc=net
      cn=Administrator
2.) Run yast2 ldap-client and adjust the correct settings
    I've used
      127.0.0.1
      dc=seven-swords,dc=net
3.) Then I still had to edit /etc/sysconfig/ldap
      BASE_CONFIG_DN="ou=ldapconfig,dc=seven-swords,dc=net"
      BIND_DN="cn=Administrator,dc=seven-swords,dc=net"
4.) Run yast2 dns-server, switch to using LDAP, create some
    master zone, store and check the LDAP database.

Works for me.
Comment 19 Bruce Ma 2012-06-05 03:08:43 UTC
I will retest it, that's OK.
But I had already commit and approved it last week.
So now I can't get it from SWAP.
Comment 20 Lukas Ocilka 2012-06-05 09:35:39 UTC
The same patch also applies to SLE11-SP2 (just tested)
Comment 22 Lukas Ocilka 2012-06-05 13:52:14 UTC
New package yast2-dns-server-2.23.3 has been submitted to openSUSE:Factory
Comment 25 Swamp Workflow Management 2012-06-18 12:14:08 UTC
Update released for: yast2-dns-server
Products:
SLE-SDK 11-SP2 (i386, x86_64)
SLE-SERVER 11-SP2 (i386, ia64, ppc64, s390x, x86_64)
SLES4VMWARE 11-SP2 (i386, x86_64)
Comment 26 Swamp Workflow Management 2012-06-18 12:32:39 UTC
Update released for: yast2-dns-server
Products:
SLE-SDK 11-SP1 (i386, x86_64)
SLE-SERVER 11-SP1 (i386, ia64, ppc64, s390x, x86_64)
SLE-SERVER 11-SP1-TERADATA (x86_64)
SLES4VMWARE 11-SP1 (i386, x86_64)