matrixsynapse: Enable LDAP integration

Signed-off-by: Hemanth Kumar Veeranki <hemanthveeranki@gmail.com>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Hemanth Kumar Veeranki authored and Sunil Mohan Adapa committed 2017-10-18 17:30:18 +05:30
1 parent 4e7a2a1d3e
commit 025cf4dd2c
2 files changed
+21 -1

No files matched your search

+20
View File
@@ -21,7 +21,11 @@
Configuration helper for Matrix-Synapse server.
"""
import argparse
import collections
from ruamel.yaml import round_trip_dump, round_trip_load
from ruamel.yaml.scalarstring import DoubleQuotedScalarString as __
from plinth import action_utils
from plinth.modules.matrixsynapse import CONFIG_FILE_PATH
@@ -58,6 +62,22 @@ def subcommand_post_install(_):
if listener['port'] == 8448:
listener['bind_address'] = '0.0.0.0'
# Setup ldap parameters
config.insert(0, 'password_providers', [{}])
config['password_providers'][0]['module'] = __(
'ldap_auth_provider.LdapAuthProvider')
ldap_config = {
'enabled': True,
'uri': __('ldap://localhost:389'),
'start_tls': False,
'base': __('ou=users,dc=thisbox'),
'attributes': {
'uid': __('uid'),
'name': __('uid'),
'mail': __('')
}
}
config['password_providers'][0]['config'] = ldap_config
with open(CONFIG_FILE_PATH, 'w') as config_file:
round_trip_dump(config, config_file)