103. Ldap

LDAP client configuration data, I/O functions.

103.1. Summary of Module Globals

List of Global Functions

  • AddMissingAttributes - For a given object, add all atributes this object is allowed to have according to its "objectclass" value. Added attributes have empty values.

  • AttributeDescription - Gets the description of attribute (from schema)

  • AutoPackages - Return needed packages and packages to be removed during autoinstallation.

  • CheckBaseConfig - Check if base config DN belongs to some existing object and offer creating it if necessary

  • CheckNDS - Check the server if it is NDS (novell directory service)

  • CheckOES - Check if current machine runs OES

  • CheckOrderOfCreation - Check if references to other objects are correct; create these objects if possible

  • CheckTemplateDN - Check if given DN exist and if it points to some template

  • CommitConfigModules - Save the edited map of configuration modules to global map

  • CommitTemplates - Save the edited map of templates to global map

  • ConvertDefaultValues - In template object, convert the list of values (where is in the form [ "a1=v1", "a2=v2"]) to map (in the form $[ "a1":"v1", "a2":"v2"]

  • CreateModule - Creates default new map for new configuration object

  • CreateTemplate - Creates default new map for a new object template

  • DomainChanged - If the domain has changed from a nonempty one, it may only be changed at boot time. Use this to warn the user.

  • Export - Dump the LDAP settings to a map, for autoinstallation use.

  • GetAllAttributes - Returns allowed and required attributes of given object class Read it from LDAP if it was not done yet.

  • GetBindDN - return administrator's DN if it was not read yet, read it now

  • GetConfigModules - Return the map of configuration modules (new copy) (in the form $[ DN: $[ map_of_one_module] ])

  • GetDefaultObjectClasses - Return list of default object classes for user or group There is fixed list here, it is not saved anywhere (only in default users plugin for LDAP objects)

  • GetDomain -

  • GetGroupsDN - Returns DN's of groups (objectclass=posixGroup) in given base

  • GetLDAPEntry - Search for one entry (=base scope) in LDAP directory

  • GetLDAPPassword - Asks user for bind password to LDAP server

  • GetMainConfigDN - Return main configuration object DN

  • GetObjectAttributes - Returns the list of all allowed and required attributes for each object class, given in the list of object classes

  • GetRequiredAttributes - Returns required attributes of given object class Read it from LDAP if it was not done yet.

  • GetTemplates - Return the map of templates (new copy)

  • Import - Get all the LDAP configuration from a map. When called by ldap_auto (preparing autoinstallation data) the map may be empty.

  • InitSchema - Prepare agent for later schema queries (agent reads schema to its internal structures)

  • LDAPAskAndBind - Asks for LDAP password and tries to bind with it

  • LDAPBind - Binds to LDAP server

  • LDAPError - Reads and returns error message from agent

  • LDAPErrorMap - Reads and returns error map (=message + code) from agent

  • LDAPErrorMessage - Error popup for errors detected during LDAP operation

  • LDAPInit - Initializes LDAP agent

  • ObjectClassExists - Returns true if given object class exists in schema

  • ObjectClassStructural - Returns true if given object class is of 'structural' type

  • ParentExists - Check for existence of parent object of given DN in LDAP tree return the answer

  • Read - Reads LDAP settings from the SCR

  • ReadConfigModules - Read configuration moduels from LDAP server

  • ReadDN - Searches for DN's of all objects defined by filter in given base ("sub")

  • ReadTemplates - Read object templates from LDAP server

  • RestartSSHD - Set the value of restart_sshd (= restart sshd during write)

  • Set - Only set variables, without checking anything

  • SetAnonymous - Set the value of 'anonymous' variable (= bind without password)

  • SetBindPassword - Set the value of bind_pass variable

  • SetDefaults - Set the defualt values, which should replace the ones from Read () Used during instalation, when we want to do a reasonable proposal

  • SetDomain - Set the LDAP domain.

  • SetGUI - Set the value of 'use_gui' variable (= show error popups)

  • SetReadSettings - set the value of read_settings variable which means, do not read some settings from system

  • ShortSummary - returns html formated configuration summary (shorter than Summary)

  • SingleValued - Check if attribute allowes only single or multiple value

  • Summary - Summary() returns html formated configuration summary

  • UpdatedArchPackages - Return list of architecture specific packages (derived from package list given as parameter) merged with the packages in parameter

  • Write - Saves LDAP configuration.

  • WriteLDAP - Writes map of objects to LDAP. Ask for password, when needed and shows the error message when necessary.

  • WriteOpenLdapConf - Modify also /etc/openldap/ldap.conf for the use of ldap client utilities (like ldapsearch)

  • WritePlusLine - If a file does not + entry, add it.

  • WriteToLDAP - Writes map of objects to LDAP

List of Global Variables

  • _autofs_allowed - If no, automounter will not be affected.

  • _start_autofs - Start automounter and import the settings from LDAP

  • attr_types - Map of atribute types (from schema). Indexed by names.

  • available_config_modules - Available configuration modules (objectclass names) TODO update

  • base_config_dn - DN of base configuration object

  • bind_dn - DN for binding to LDAP server

  • file_server - If home directories of LDAP users are stored on this machine

  • hash_schemas - encryption schemes supported by slappasswd

  • initial_defaults - The defualt values, which should replace the ones from Read () Used during instalation, when we want to do a reasonable proposal

  • initial_defaults_used - If the default values, used from ldap-server module were used to configure ldap-client

  • login_enabled - If login of LDAP uses to local machine is enabled

  • member_attribute - which attribute have LDAP groups for list of members

  • mkhomedir - if pam_mkhomedir is set in /etc/pam.d/commond-session

  • new_objects - defaults for adding new config objects and templates

  • nis_available - Is NIS service available? If yes, and LDAP client will be enabled, warn user (see bug #36981)

  • object_classes - Map of object classes (from schema). Indexed by names.

  • read_settings - If false, do not read settings already set from outside used e.g. for Users YaPI. see bug #60898

  • required_packages - Required packages for this module to operate -- they are now required only when LDAP is set for authentication

  • restart_sshd - if sshd should be restarted during write phase

  • server - IP addresses of LDAP server.

  • start - Are LDAP services available via nsswitch.conf?

  • use_gui - show popups with error messages?

  • write_only - Write only, used during autoinstallation. Don't run services and SuSEconfig, it's all done at one place.

103.2. Global Functions

103.2.1. AddMissingAttributes

For a given object, add all atributes this object is allowed to have according to its "objectclass" value. Added attributes have empty values.

Function parameters

  • map object

Return value

  • map - updated map

103.2.2. AttributeDescription

Gets the description of attribute (from schema)

Function parameters

  • string attr

Return value

  • string - description

103.2.3. AutoPackages

Return needed packages and packages to be removed during autoinstallation.

Return value

  • map - of lists.

103.2.4. CheckBaseConfig

Check if base config DN belongs to some existing object and offer creating it if necessary

Function parameters

  • string dn

Return value

  • boolean

103.2.5. CheckNDS

Check the server if it is NDS (novell directory service)

Return value

  • boolean

103.2.6. CheckOES

Check if current machine runs OES

Return value

  • boolean

103.2.7. CheckOrderOfCreation

Check if references to other objects are correct; create these objects if possible

Return value

  • boolean

103.2.8. CheckTemplateDN

Check if given DN exist and if it points to some template

Function parameters

  • string dn

Return value

  • map - empty map if DN don't exist, template map if DN points to template object, nil if object with given DN is not template

103.2.9. CommitConfigModules

Save the edited map of configuration modules to global map

Function parameters

  • map modules

Return value

  • boolean

103.2.10. CommitTemplates

Save the edited map of templates to global map

Function parameters

  • map templs

Return value

  • boolean

103.2.11. ConvertDefaultValues

In template object, convert the list of values (where is in the form [ "a1=v1", "a2=v2"]) to map (in the form $[ "a1":"v1", "a2":"v2"]

Function parameters

  • map templ

Return value

  • map - updated template map

103.2.12. CreateModule

Creates default new map for new configuration object

Function parameters

  • string cn

  • string class

Return value

  • map<string,any> - new module map

103.2.13. CreateTemplate

Creates default new map for a new object template

Function parameters

  • string cn

  • list<string> classes

Return value

  • map - template map

103.2.14. DomainChanged

If the domain has changed from a nonempty one, it may only be changed at boot time. Use this to warn the user.

Return value

  • boolean - whether changed by SetDomain

103.2.15. Export

Dump the LDAP settings to a map, for autoinstallation use.

Return value

  • map - $["start":, "servers":[...], "domain":]

103.2.16. GetAllAttributes

Returns allowed and required attributes of given object class Read it from LDAP if it was not done yet.

Function parameters

  • string class

Return value

  • list - attribute names (list of strings)

103.2.17. GetBindDN

return administrator's DN if it was not read yet, read it now

Return value

  • string

103.2.18. GetConfigModules

Return the map of configuration modules (new copy) (in the form $[ DN: $[ map_of_one_module] ])

Return value

  • map

103.2.19. GetDefaultObjectClasses

Return list of default object classes for user or group There is fixed list here, it is not saved anywhere (only in default users plugin for LDAP objects)

Function parameters

  • map template

Return value

  • list

103.2.20. GetDomain

Return value

  • string - Get the LDAP domain.

103.2.21. GetGroupsDN

Returns DN's of groups (objectclass=posixGroup) in given base

Function parameters

  • string base

Return value

  • list - groups (list of strings)

103.2.22. GetLDAPEntry

Search for one entry (=base scope) in LDAP directory

Function parameters

  • string dn

Return value

  • map - with entry values, empty map if nothing found, nil on error

103.2.23. GetLDAPPassword

Asks user for bind password to LDAP server

Function parameters

  • boolean enable_anonymous

Return value

  • string - password

103.2.24. GetMainConfigDN

Return main configuration object DN

Return value

  • string

103.2.25. GetObjectAttributes

Returns the list of all allowed and required attributes for each object class, given in the list of object classes

Function parameters

  • list classes

Return value

  • list - attribute names (list of strings)

103.2.26. GetRequiredAttributes

Returns required attributes of given object class Read it from LDAP if it was not done yet.

Function parameters

  • string class

Return value

  • list<string> - attribute names (list of strings)

103.2.27. GetTemplates

Return the map of templates (new copy)

Return value

  • map

103.2.28. Import

Get all the LDAP configuration from a map. When called by ldap_auto (preparing autoinstallation data) the map may be empty.

Function parameters

  • map settings

Return value

  • boolean - success

103.2.29. InitSchema

Prepare agent for later schema queries (agent reads schema to its internal structures)

Return value

  • string - error message

103.2.30. LDAPAskAndBind

Asks for LDAP password and tries to bind with it

Function parameters

  • boolean enable_anonymous

Return value

  • string - password entered, nil on cancel

103.2.31. LDAPBind

Binds to LDAP server

Function parameters

  • string pass

Return value

  • string

103.2.32. LDAPError

Reads and returns error message from agent

Return value

  • string

103.2.33. LDAPErrorMap

Reads and returns error map (=message + code) from agent

Return value

  • map

103.2.34. LDAPErrorMessage

Error popup for errors detected during LDAP operation

Function parameters

  • string type

  • string error

Return value

  • void

103.2.35. LDAPInit

Initializes LDAP agent

Return value

  • string

103.2.36. ObjectClassExists

Returns true if given object class exists in schema

Function parameters

  • string class

Return value

  • boolean

103.2.37. ObjectClassStructural

Returns true if given object class is of 'structural' type

Function parameters

  • string class

Return value

  • boolean

103.2.38. ParentExists

Check for existence of parent object of given DN in LDAP tree return the answer

Function parameters

  • string dn

Return value

  • boolean

103.2.39. Read

Reads LDAP settings from the SCR

Return value

  • boolean - success

103.2.40. ReadConfigModules

Read configuration moduels from LDAP server

Return value

  • string - error message

103.2.41. ReadDN

Searches for DN's of all objects defined by filter in given base ("sub")

Function parameters

  • string base

  • string search_filter

Return value

  • list<string> - of DN's (list of strings)

103.2.42. ReadTemplates

Read object templates from LDAP server

Return value

  • string - error message

103.2.43. RestartSSHD

Set the value of restart_sshd (= restart sshd during write)

Function parameters

  • boolean restart

Return value

  • void

103.2.44. Set

Only set variables, without checking anything

Function parameters

  • map settings

Return value

  • void

103.2.45. SetAnonymous

Set the value of 'anonymous' variable (= bind without password)

Function parameters

  • boolean anon

Return value

  • void

103.2.46. SetBindPassword

Set the value of bind_pass variable

Function parameters

  • string pass

Return value

  • void

103.2.47. SetDefaults

Set the defualt values, which should replace the ones from Read () Used during instalation, when we want to do a reasonable proposal

Function parameters

  • map settings

Return value

  • boolean

103.2.48. SetDomain

Set the LDAP domain.

Function parameters

  • string new_domain

Return value

  • void

103.2.49. SetGUI

Set the value of 'use_gui' variable (= show error popups)

Function parameters

  • boolean gui

Return value

  • void

103.2.50. SetReadSettings

set the value of read_settings variable which means, do not read some settings from system

Function parameters

  • boolean read

Return value

  • boolean

103.2.51. ShortSummary

returns html formated configuration summary (shorter than Summary)

Return value

  • string - summary

103.2.52. SingleValued

Check if attribute allowes only single or multiple value

Function parameters

  • string attr

Return value

  • boolean - answer

103.2.53. Summary

Summary() returns html formated configuration summary

Return value

  • string - summary

103.2.54. UpdatedArchPackages

Return list of architecture specific packages (derived from package list given as parameter) merged with the packages in parameter

Function parameters

  • list<string> packages

Return value

  • list<string>

103.2.55. Write

Saves LDAP configuration.

Function parameters

  • block<boolean> abort

Return value

  • symbol

103.2.56. WriteLDAP

Writes map of objects to LDAP. Ask for password, when needed and shows the error message when necessary.

Function parameters

  • map objects

Return value

  • boolean - success

103.2.57. WriteOpenLdapConf

Modify also /etc/openldap/ldap.conf for the use of ldap client utilities (like ldapsearch)

Return value

  • boolean - modified?

103.2.58. WritePlusLine

If a file does not + entry, add it.

Function parameters

  • boolean login

Return value

  • boolean - success?

103.2.59. WriteToLDAP

Writes map of objects to LDAP

Function parameters

  • map objects

Return value

  • map - error map (empty on success)

Example 7. 

 TODO


103.3. Global Variables

103.3.1. _autofs_allowed

If no, automounter will not be affected.

103.3.2. _start_autofs

Start automounter and import the settings from LDAP

103.3.3. attr_types

Map of atribute types (from schema). Indexed by names.

103.3.4. available_config_modules

Available configuration modules (objectclass names) TODO update

103.3.5. base_config_dn

DN of base configuration object

103.3.6. bind_dn

DN for binding to LDAP server

103.3.7. file_server

If home directories of LDAP users are stored on this machine

103.3.8. hash_schemas

encryption schemes supported by slappasswd

103.3.9. initial_defaults

The defualt values, which should replace the ones from Read () Used during instalation, when we want to do a reasonable proposal

103.3.10. initial_defaults_used

If the default values, used from ldap-server module were used to configure ldap-client

103.3.11. login_enabled

If login of LDAP uses to local machine is enabled

103.3.12. member_attribute

which attribute have LDAP groups for list of members

103.3.13. mkhomedir

if pam_mkhomedir is set in /etc/pam.d/commond-session

103.3.14. new_objects

defaults for adding new config objects and templates

103.3.15. nis_available

Is NIS service available? If yes, and LDAP client will be enabled, warn user (see bug #36981)

103.3.16. object_classes

Map of object classes (from schema). Indexed by names.

103.3.17. read_settings

If false, do not read settings already set from outside used e.g. for Users YaPI. see bug #60898

103.3.18. required_packages

Required packages for this module to operate -- they are now required only when LDAP is set for authentication

103.3.19. restart_sshd

if sshd should be restarted during write phase

103.3.20. server

IP addresses of LDAP server.

103.3.21. start

Are LDAP services available via nsswitch.conf?

103.3.22. use_gui

show popups with error messages?

103.3.23. write_only

Write only, used during autoinstallation. Don't run services and SuSEconfig, it's all done at one place.

103.4. Module Requirements

103.4.1. Module Imports

  • Arch
  • Autologin
  • DNS
  • Label
  • Message
  • Mode
  • Nsswitch
  • Package
  • Pam
  • Popup
  • ProductFeatures
  • Progress
  • Report
  • Service
  • Stage
  • Summary

103.4.2. Module Includes

  • ldap/routines.ycp