SSSDConfig.py revision 780ffc9f6d5e1fcd4df3d390b56cb98878223cc0
7a8401ce858002b67e8f4198fde45a1562696ccbChristian MaederCreated on Sep 18, 2009
37eedb575dd3dc0ab25809693aa2d318f9084c56Christian Maeder@author: sgallagh
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyerclass AlreadyInitializedError(SSSDConfigException): pass
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyerclass NotInitializedError(SSSDConfigException): pass
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyerclass NoOutputFileError(SSSDConfigException): pass
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyerclass NoServiceError(SSSDConfigException): pass
32d98ca5e560cf6c1062a0463be4c350af32bed5Thiemo Wiedemeyerclass NoSectionError(SSSDConfigException): pass
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyerclass NoOptionError(SSSDConfigException): pass
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyerclass ServiceNotRecognizedError(SSSDConfigException): pass
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyerclass ServiceAlreadyExists(SSSDConfigException): pass
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyerclass NoDomainError(SSSDConfigException): pass
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyerclass DomainNotRecognized(SSSDConfigException): pass
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyerclass DomainAlreadyExistsError(SSSDConfigException): pass
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyerclass NoSuchProviderError(SSSDConfigException): pass
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyerclass NoSuchProviderSubtypeError(SSSDConfigException): pass
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyerclass ProviderSubtypeInUse(SSSDConfigException): pass
6e2c6baa4352577819386beb3a21d7c247eab52cThiemo Wiedemeyertranslation = gettext.translation(PACKAGE, LOCALEDIR, fallback=True)
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer# TODO: This needs to be made external
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'debug_level' : _('Set the verbosity of the debug logging'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'debug_timestamps' : _('Include timestamps in debug logs'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'debug_to_files' : _('Write debug messages to logfiles'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'timeout' : _('Ping timeout before restarting service'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'command' : _('Command to start service'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'reconnection_retries' : _('Number of times to attempt connection to Data Providers'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'sbus_timeout' : _('Timeout for messages sent over the SBUS'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 're_expression' : _('Regex to parse username and domain'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'full_name_format' : _('Printf-compatible format for displaying fully-qualified names'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'enum_cache_timeout' : _('Enumeration cache timeout length (seconds)'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'entry_cache_no_wait_timeout' : _('Entry cache background update timeout length (seconds)'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'entry_negative_timeout' : _('Negative cache timeout length (seconds)'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'filter_users' : _('Users that SSSD should explicitly ignore'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'filter_groups' : _('Groups that SSSD should explicitly ignore'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'filter_users_in_groups' : _('Should filtered users appear in groups'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'pwfield' : _('The value of the password field the NSS provider should return'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'offline_credentials_expiration' : _('How long to allow cached logins between online logins (days)'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'offline_failed_login_attempts' : _('How many failed logins attempts are allowed when offline'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'offline_failed_login_delay' : _('How long (minutes) to deny login after offline_failed_login_attempts has been reached'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'auth_provider' : _('Authentication provider'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'access_provider' : _('Access control provider'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'chpass_provider' : _('Password change provider'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'timeout' : _('Ping timeout before restarting domain'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'enumerate' : _('Enable enumerating all users/groups'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'cache_credentials' : _('Cache credentials for offline login'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'store_legacy_passwords' : _('Store password hashes'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'use_fully_qualified_names' : _('Display users/groups in fully-qualified form'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'entry_cache_timeout' : _('Entry cache timeout length (seconds)'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'lookup_family_order' : _('Restrict or prefer a specific address family when performing DNS lookups'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'account_cache_expiration' : _('How long to keep cached entries after last successful login (days)'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'dns_resolver_timeout' : _('How long to wait for replies from DNS when resolving servers (seconds)'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'dns_discovery_domain' : _('The domain part of service discovery DNS query'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'ipa_hostname' : _('IPA client hostname'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'ipa_dyndns_update' : _("Whether to automatically update the client's DNS entry in FreeIPA"),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'ipa_dyndns_iface' : _("The interface whose IP should be used for dynamic DNS updates"),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'krb5_kdcip' : _('Kerberos server address'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'krb5_auth_timeout' : _('Authentication timeout'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'krb5_ccachedir' : _('Directory to store credential caches'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'krb5_ccname_template' : _("Location of the user's credential cache"),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'krb5_keytab' : _("Location of the keytab to validate credentials"),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'krb5_validate' : _("Enable credential validation"),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'krb5_store_password_if_offline' : _("Store password if offline for later online authentication"),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'krb5_kpasswd' : _('Server where the change password service is running if not on the KDC'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'ldap_uri' : _('ldap_uri, The URI of the LDAP server'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'ldap_search_base' : _('The default base DN'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'ldap_schema' : _('The Schema Type in use on the LDAP server, rfc2307'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'ldap_default_bind_dn' : _('The default bind DN'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'ldap_default_authtok_type' : _('The type of the authentication token of the default bind DN'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'ldap_default_authtok' : _('The authentication token of the default bind DN'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_network_timeout' : _('Length of time to attempt connection'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_opt_timeout' : _('Length of time to attempt synchronous LDAP operations'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_offline_timeout' : _('Length of time between attempts to reconnect while offline'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_tls_cacert' : _('File that contains CA certificates'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_tls_cacertdir' : _('Path to CA certificate directory'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'ldap_tls_reqcert' : _('Require TLS certificate verification'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_sasl_mech' : _('Specify the sasl mechanism to use'),
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyer 'ldap_sasl_authid' : _('Specify the sasl authorization id to use'),
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyer 'krb5_kdcip' : _('Kerberos server address'),
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyer 'ldap_krb5_keytab' : _('Kerberos service keytab'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'ldap_krb5_init_creds' : _('Use Kerberos auth for LDAP connection'),
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyer 'ldap_referrals' : _('Follow LDAP referrals'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_krb5_ticket_lifetime' : _('Lifetime of TGT for LDAP connection'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_search_timeout' : _('Length of time to wait for a search request'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_enumeration_refresh_timeout' : _('Length of time between enumeration updates'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'ldap_id_use_start_tls' : _('Require TLS for ID lookups'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_user_search_base' : _('Base DN for user lookups'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_user_search_scope' : _('Scope of user lookups'),
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyer 'ldap_user_search_filter' : _('Filter for user lookups'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_user_object_class' : _('Objectclass for users'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_user_name' : _('Username attribute'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_user_uid_number' : _('UID attribute'),
c7f4a6ff1152bff4eb0025eb70cfb2d96b55d4d8Thiemo Wiedemeyer 'ldap_user_gid_number' : _('Primary GID attribute'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_user_homedir' : _('Home directory attribute'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_user_principal' : _('User principal attribute (for Kerberos)'),
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyer 'ldap_user_member_of' : _('memberOf attribute'),
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyer 'ldap_user_modify_timestamp' : _('Modification time attribute'),
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyer 'ldap_pwd_policy' : _('Policy to evaluate the password expiration'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'ldap_access_filter' : _('LDAP filter to determine access privileges'),
2083e66e910c2144cf800f31910993064c5f16beThiemo Wiedemeyer 'simple_allow_users' : _('Comma separated list of allowed users'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'simple_deny_users' : _('Comma separated list of prohibited users'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'default_shell' : _('Default shell, /bin/bash'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'base_directory' : _('Base for home directories'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'proxy_lib_name' : _('The name of the NSS library to use'),
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer 'proxy_pam_target' : _('PAM stack to use')
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer return([x.strip() for x in l])
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyer def __init__(self, schemafile, schemaplugindir):
9b01b265715d725c17d51619d297bbb97f37d1b5Thiemo Wiedemeyer #TODO: get these from a global setting
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyer #Read the primary config file
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyer # Read in the provider files
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyer except SyntaxError: # can be raised with readfp
57bb31a6834641607fff7fc457b5a3e19238a132Christian Maeder # Set up lookup table for types
d1066b8fb69179973dcab47154858d77e72760a7Thiemo Wiedemeyer # Lookup table for acceptable boolean values
6e2c6baa4352577819386beb3a21d7c247eab52cThiemo Wiedemeyer # Parse values
6e2c6baa4352577819386beb3a21d7c247eab52cThiemo Wiedemeyer for option in self.strip_comments_empty(options):
6e2c6baa4352577819386beb3a21d7c247eab52cThiemo Wiedemeyer split_option = striplist(unparsed_option.split(','))
6e2c6baa4352577819386beb3a21d7c247eab52cThiemo Wiedemeyer primarytype = self.type_lookup[split_option[PRIMARY_TYPE]]
6e2c6baa4352577819386beb3a21d7c247eab52cThiemo Wiedemeyer subtype = self.type_lookup[split_option[SUBTYPE]]
6e2c6baa4352577819386beb3a21d7c247eab52cThiemo Wiedemeyer mandatory = self.bool_lookup[split_option[MANDATORY]]
6e2c6baa4352577819386beb3a21d7c247eab52cThiemo Wiedemeyer if option_strings.has_key(option['name']):
desc,
desc,
desc,
desc,
desc,
raise ParsingError
desc,
desc,
raise ParsingError
raise ParsingError
fixed_options = []
raise ParsingError
desc,
raise ParsingError
return parsed_options
return defaults
return service_list
providers = {}
return providers
raise TypeError
options = {}
return options
filtered_options = {}
return filtered_options
filtered_options = {}
return filtered_options
if value == None:
except ValueError:
except KeyError:
if raise_error:
newvalue = []
for x in value:
except ValueError:
except KeyError:
if raise_error:
raise TypeError
options = {}
% provider)
return options
filtered_options = {}
return filtered_options
filtered_options = {}
return filtered_options
if(provider_type):
return options
if value == None:
except ValueError:
except KeyError:
if raise_error:
newvalue = []
for x in value:
except ValueError:
except KeyError:
if raise_error:
except NoSuchProviderError:
raise NoOptionError
raise TypeError
raise NoSuchProviderError
raise ProviderSubtypeInUse
provider))
(provider,
provider = None
provider = None
if not provider:
Usually /etc/sssd/sssd.api.d
raise AlreadyInitializedError
if not configfile:
raise ParsingError
raise AlreadyInitializedError
raise NotInitializedError
if outputfile == None:
raise NoOutputFileError
raise NotInitializedError
return service_list
raise NotInitializedError
raise NoServiceError
except NoOptionError:
return service
raise NotInitializedError
return service
raise NotInitializedError
raise NotInitializedError
raise TypeError
addkw = []
raise NotInitializedError
active_domains = []
return active_domains
raise NotInitializedError
active_domains = []
if x not in active_domains]
return domains
raise NotInitializedError
return domains
raise NotInitializedError
providers = [ (x['name'],x['value']) for x in self.strip_comments_empty(self.options('domain/%s' % name))
except NoOptionError:
except NoOptionError:
return domain
raise NotInitializedError
raise DomainAlreadyExistsError
return domain
raise NotInitializedError
raise NoDomainError
raise NotInitializedError
raise NoDomainError
if not item:
raise NotInitializedError
raise NoDomainError
if not item:
raise NotInitializedError
raise NotInitializedError
raise TypeError
oldindex = None
addkw = []
if oldindex: