This script will connect to an LDAP instance and create a matrix corporal policy that can be fed to matrix-corporal.
Configuration is done by a json file, which contains general settings and a list of settings for individual groups/rooms.
Groups and rooms that are specified will be created upon running and saved in a lookup json to keep track of the rooms/groups which were already created.
The options for the config file are:
corporal
: Dictionary with default configuration for matrix corporaluser_defaults
: Default entries for user entries in the generated policyuser_mode
: Either "existing", "list" or "all"existing
: Generate Policy for users already existing on the matrix-synapse.list
: Take configuration option "users" as a list of users to generate a policy for.all
: Generate Policy for all users found in LDAP.
homeserver_domain_name
: matrix servernamer; The domain.org in the user id @user:domain.orghomeserver_api_endpoint
: url of the matrix serveradmin_auth_token
: auth token of an admin userlookup_path
: path for the lookup fileldap
: Settings for ldapurl
: url of the ldapserverbinddn
: binddn of the user used to access the ldapbinddn_pw
: password of that userfilter
: statement to filter the result of the ldap queryscope
: Scope of the ldap query; Can be "LEVEL", "SUBTREE", etc.user_base
: Base directory for usersuser_id
: ID attribute of a user which is used to construct the matrix IDuser_displayname
: Attribute of the user to determine the displayname. Defaults to user_iduser_avatar_uri
: Attribute of the user that holds an uri to a avatar imagegroup_base
: Base directory for groups that is used if it is not specified for the individual groupgroup_id
: ID attribute that is used to construct the matrix ID for groupsgroup_prefix
: Prefix to strip from the group_id in the matrix ID
rooms
: List of dicts to specify rooms that are set to be managed in the policyroom_alias_name
: matrix alias name for the roomtopic
: Topic to be set for the roommanaged
: If true, only people who are set as joined in the generated policy can be members of the room. Defaults to true.
communities
: List of dicts to specify the groups which are set to be managed in the policyldap_id
: Value of the attribute specified in ldap.group_idname
: name to be used in matrix for the grouprooms
: List of rooms that are to be added to the grouproom_visibility
: Default visibility of the rooms for non-members of the groupmanaged
: If true, only people who are set as joined in the generated policy can be members of the community. Defaults to true.