Пример #1
0
def add_ldap_servers_configuration(self, servers, config=None, config_d_dir="/etc/clickhouse-server/config.d",
        config_file="ldap_servers.xml", timeout=60, restart=False, node=None):
    """Add LDAP servers configuration to config.xml.
    """
    if config is None:
        config = create_ldap_servers_config_content(servers, config_d_dir, config_file)
    return add_config(config, restart=restart, node=node)
Пример #2
0
def add_ldap_external_user_directory(
    self,
    server,
    roles=None,
    role_mappings=None,
    config_d_dir="/etc/clickhouse-server/config.d",
    config_file=None,
    timeout=60,
    restart=True,
    config=None,
    node=None,
):
    """Add LDAP external user directory."""
    if config_file is None:
        config_file = f"ldap_external_user_directory_with_role_mapping_{getuid()}.xml"

    if config is None:
        config = create_ldap_external_user_directory_config_content(
            server=server,
            roles=roles,
            role_mappings=role_mappings,
            config_d_dir=config_d_dir,
            config_file=config_file,
        )

    return add_config(config, restart=restart, node=node)
Пример #3
0
def ldap_authenticated_users(*users, config_d_dir="/etc/clickhouse-server/users.d",
        config_file=None, timeout=300, restart=True, config=None, rbac=False, node=None):
    """Add LDAP authenticated users.
    """
    if node is None:
        node = current().context.node

    if rbac:
        return add_users_identified_with_ldap(*users, node=node)
    else:
        if config_file is None:
            config_file = f"ldap_users_{getuid()}.xml"
        if config is None:
            config = create_ldap_users_config_content(*users, config_d_dir=config_d_dir, config_file=config_file)
        return add_config(config, timeout=timeout, restart=restart, node=node)
Пример #4
0
def modify_config(config, restart=False, node=None):
    """Apply updated configuration file."""
    return add_config(config, restart=restart, modify=True, node=node)