123. Ldap

LDAP client configuration data, I/O functions.

123.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.

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

  • 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

  • ConnectWithoutTLS - popup shown after failed connection: ask for retry withou TLS (see bug 246397)

  • 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

  • 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.

  • GetBaseDN - Get the Base DN

  • 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)

  • 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

  • LDAPInitWithTLSCheck - Initializes LDAP agent, offers to turn off TLS if it failed

  • 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)

  • SetBaseDN - Set new LDAP base DN

  • 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

  • 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.

  • WriteNow - wrapper for Write, without abort block

  • 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.

123.2. Global Functions

123.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

123.2.2. AttributeDescription

Gets the description of attribute (from schema)

Function parameters

  • string attr

Return value

  • string - description

123.2.3. AutoPackages

Return needed packages and packages to be removed during autoinstallation.

Return value

  • map - of lists.

123.2.4. BaseDNChanged

If the base DN 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 SetBaseDN

123.2.5. CheckBaseConfig

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

Function parameters

  • string dn

Return value

  • boolean

123.2.6. CheckNDS

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

Return value

  • boolean

123.2.7. CheckOES

Check if current machine runs OES

Return value

  • boolean

123.2.8. CheckOrderOfCreation

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

Return value

  • boolean

123.2.9. 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

123.2.10. CommitConfigModules

Save the edited map of configuration modules to global map

Function parameters

  • map modules

Return value

  • boolean

123.2.11. CommitTemplates

Save the edited map of templates to global map

Function parameters

  • map templs

Return value

  • boolean

123.2.12. ConnectWithoutTLS

popup shown after failed connection: ask for retry withou TLS (see bug 246397)

Function parameters

  • map errmap

Return value

  • boolean - true if user wants to retry without TLS

123.2.13. 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

123.2.14. CreateModule

Creates default new map for new configuration object

Function parameters

  • string cn

  • string class

Return value

  • map<string,any> - new module map

123.2.15. CreateTemplate

Creates default new map for a new object template

Function parameters

  • string cn

  • list<string> classes

Return value

  • map - template map

123.2.16. Export

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

Return value

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

123.2.17. 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)

123.2.18. GetBaseDN

Get the Base DN

Return value

  • string

123.2.19. GetBindDN

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

Return value

  • string

123.2.20. GetConfigModules

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

Return value

  • map

123.2.21. 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

123.2.22. GetGroupsDN

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

Function parameters

  • string base

Return value

  • list - groups (list of strings)

123.2.23. 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

123.2.24. GetLDAPPassword

Asks user for bind password to LDAP server

Function parameters

  • boolean enable_anonymous

Return value

  • string - password

123.2.25. GetMainConfigDN

Return main configuration object DN

Return value

  • string

123.2.26. 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)

123.2.27. 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)

123.2.28. GetTemplates

Return the map of templates (new copy)

Return value

  • map

123.2.29. 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

123.2.30. InitSchema

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

Return value

  • string - error message

123.2.31. LDAPAskAndBind

Asks for LDAP password and tries to bind with it

Function parameters

  • boolean enable_anonymous

Return value

  • string - password entered, nil on cancel

123.2.32. LDAPBind

Binds to LDAP server

Function parameters

  • string pass

Return value

  • string

123.2.33. LDAPError

Reads and returns error message from agent

Return value

  • string

123.2.34. LDAPErrorMap

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

Return value

  • map

123.2.35. LDAPErrorMessage

Error popup for errors detected during LDAP operation

Function parameters

  • string type

  • string error

Return value

  • void

123.2.36. LDAPInit

Initializes LDAP agent

Return value

  • string

123.2.37. LDAPInitWithTLSCheck

Initializes LDAP agent, offers to turn off TLS if it failed

Function parameters

  • map args

Return value

  • string

123.2.38. ObjectClassExists

Returns true if given object class exists in schema

Function parameters

  • string class

Return value

  • boolean

123.2.39. ObjectClassStructural

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

Function parameters

  • string class

Return value

  • boolean

123.2.40. ParentExists

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

Function parameters

  • string dn

Return value

  • boolean

123.2.41. Read

Reads LDAP settings from the SCR

Return value

  • boolean - success

123.2.42. ReadConfigModules

Read configuration moduels from LDAP server

Return value

  • string - error message

123.2.43. 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)

123.2.44. ReadTemplates

Read object templates from LDAP server

Return value

  • string - error message

123.2.45. RestartSSHD

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

Function parameters

  • boolean restart

Return value

  • void

123.2.46. Set

Only set variables, without checking anything

Function parameters

  • map settings

Return value

  • void

123.2.47. SetAnonymous

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

Function parameters

  • boolean anon

Return value

  • void

123.2.48. SetBaseDN

Set new LDAP base DN

Function parameters

  • string new_base_dn

Return value

  • void

123.2.49. SetBindPassword

Set the value of bind_pass variable

Function parameters

  • string pass

Return value

  • void

123.2.50. 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

123.2.51. SetGUI

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

Function parameters

  • boolean gui

Return value

  • void

123.2.52. SetReadSettings

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

Function parameters

  • boolean read

Return value

  • boolean

123.2.53. ShortSummary

returns html formated configuration summary (shorter than Summary)

Return value

  • string - summary

123.2.54. SingleValued

Check if attribute allowes only single or multiple value

Function parameters

  • string attr

Return value

  • boolean - answer

123.2.55. Summary

Summary() returns html formated configuration summary

Return value

  • string - summary

123.2.56. 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>

123.2.57. Write

Saves LDAP configuration.

Function parameters

  • block<boolean> abort

Return value

  • symbol

123.2.58. 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

123.2.59. WriteNow

wrapper for Write, without abort block

Return value

  • boolean

123.2.60. WriteOpenLdapConf

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

Return value

  • boolean - modified?

123.2.61. WritePlusLine

If a file does not + entry, add it.

Function parameters

  • boolean login

Return value

  • boolean - success?

123.2.62. WriteToLDAP

Writes map of objects to LDAP

Function parameters

  • map objects

Return value

  • map - error map (empty on success)

Example 23. 

 TODO


123.3. Global Variables

123.3.1. _autofs_allowed

If no, automounter will not be affected.

123.3.2. _start_autofs

Start automounter and import the settings from LDAP

123.3.3. attr_types

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

123.3.4. available_config_modules

Available configuration modules (objectclass names) TODO update

123.3.5. base_config_dn

DN of base configuration object

123.3.6. bind_dn

DN for binding to LDAP server

123.3.7. file_server

If home directories of LDAP users are stored on this machine

123.3.8. hash_schemas

encryption schemes supported by slappasswd

123.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

123.3.10. initial_defaults_used

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

123.3.11. login_enabled

If login of LDAP uses to local machine is enabled

123.3.12. member_attribute

which attribute have LDAP groups for list of members

123.3.13. mkhomedir

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

123.3.14. new_objects

defaults for adding new config objects and templates

123.3.15. nis_available

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

123.3.16. object_classes

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

123.3.17. read_settings

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

123.3.18. required_packages

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

123.3.19. restart_sshd

if sshd should be restarted during write phase

123.3.20. server

IP addresses of LDAP server.

123.3.21. start

Are LDAP services available via nsswitch.conf?

123.3.22. use_gui

show popups with error messages?

123.3.23. write_only

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

123.4. Module Requirements

123.4.1. Module Imports

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

123.4.2. Module Includes

  • ldap/routines.ycp