Config

Usage example

# Set config attribute:
standalone.config.set('passwordStorageScheme', 'SSHA')

# Reset config attribute (by deleting it):
standalone.config.reset('passwordStorageScheme')

# Enable/disable logs (error, access, audit):
standalone.config.enable_log('error')
standalone.config.disable_log('access')

# Set loglevel for errors log.
# If 'update' set to True, it will add the 'vals' to existing values in the loglevel attribute
standalone.config.loglevel(vals=(LOG_DEFAULT,), service='error', update=False)
# You can get log levels from lib389._constants
(LOG_TRACE,
LOG_TRACE_PACKETS,
LOG_TRACE_HEAVY,
LOG_CONNECT,
LOG_PACKET,
LOG_SEARCH_FILTER,
LOG_CONFIG_PARSER,
LOG_ACL,
LOG_ENTRY_PARSER,
LOG_HOUSEKEEPING,
LOG_REPLICA,
LOG_DEFAULT,
LOG_CACHE,
LOG_PLUGIN,
LOG_MICROSECONDS,
LOG_ACL_SUMMARY) = [1 << x for x in (list(range(8)) + list(range(11, 19)))]

# Set 'nsslapd-accesslog-logbuffering' to 'on' if True, otherwise set it to 'off'
standalone.config.logbuffering(True)

Module documentation

class lib389.config.Config(conn, dn=None)[source]

Manage “cn=config” tree, including: - enable SSL - set access and error logging - get and set “cn=config” attributes

disable_log(service)[source]

Disable a logging service in the 389ds instance. @param service - The logging service to Disable. Can be one of ‘access’

, ‘error’ or ‘audit’.

ex. disable_log(‘audit’)

dn

Get an object DN

Returns:DN
enable_log(service)[source]

Enable a logging service in the 389ds instance. @param service - The logging service to enable. Can be one of ‘access’,

‘error’ or ‘audit’.

ex. enable_log(‘audit’)

enable_ssl(secport=636, secargs=None)[source]

Configure SSL support into cn=encryption,cn=config.

secargs is a dict like {
‘nsSSLPersonalitySSL’: ‘Server-Cert’

}

loglevel(vals=(<ErrorLog.DEFAULT: 16384>, ), service='error', update=False)[source]

Set the access or error log level.

Parameters:
  • vals (list) – a list of log level codes (eg. lib389.ErrorLogLevelLOG_*) defaults to LOG_DEFAULT
  • service (str) – ‘access’ or ‘error’. There is no ‘audit’ log level. use enable_log or disable_log.
  • update (bool) – False for replace (default), True for update

ex. loglevel([lib389.ErrorLogLevel.DEFAULT, lib389.ErrorLogLevel.ENTRY_PARSER])

rdn

Get an object RDN

Returns:RDN