From c737d73eabf96aa2cf6bb5650db3bb5e688cbe4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Wed, 8 Dec 2021 15:32:40 +0100 Subject: [PATCH 1/8] Add an option to always include a config section Some subsections (e.g. auth.password) group similar config options and their presence or absence does not change system behaviour. For example, user can skip 'auth.password' or define it as empty and the system still stores passwords, just with the default settings. When such subsections include defaults, they need to be always present, hence specifying 'include = always' makes the defaults always available. Such behaviour cannot be applied universally as for most sections their presence or absence is meaningful. --- include/mongoose_config_spec.hrl | 5 +++-- src/config/mongoose_config_parser_toml.erl | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/mongoose_config_spec.hrl b/include/mongoose_config_spec.hrl index 9f369f66bc..0e6438ded5 100644 --- a/include/mongoose_config_spec.hrl +++ b/include/mongoose_config_spec.hrl @@ -8,9 +8,10 @@ validate = any :: mongoose_config_validator:section_validator(), format_items = none :: mongoose_config_spec:format_items(), process :: undefined | mongoose_config_parser_toml:list_processor(), - wrap = default :: mongoose_config_spec:wrapper(), defaults = #{} :: #{mongoose_config_parser_toml:toml_key() => - mongoose_config_parser_toml:config_part()}}). + mongoose_config_parser_toml:config_part()}, + wrap = default :: mongoose_config_spec:wrapper(), + include = when_present :: always | when_present}). -record(list, {items :: mongoose_config_spec:config_node(), validate = any :: mongoose_config_validator:list_validator(), diff --git a/src/config/mongoose_config_parser_toml.erl b/src/config/mongoose_config_parser_toml.erl index 5536e78597..d900d9992c 100644 --- a/src/config/mongoose_config_parser_toml.erl +++ b/src/config/mongoose_config_parser_toml.erl @@ -108,7 +108,8 @@ ensure_keys(Keys, Section) -> [config_part()]. parse_section(Path, M, #section{items = Items, defaults = Defaults}) -> FilteredDefaults = maps:filter(fun(K, _V) -> not maps:is_key(K, M) end, Defaults), - ProcessedConfig = maps:map(fun(K, V) -> handle([K|Path], V, get_spec_for_key(K, Items)) end, M), + M1 = maps:merge(get_always_included(Items), M), + ProcessedConfig = maps:map(fun(K, V) -> handle([K|Path], V, get_spec_for_key(K, Items)) end, M1), ProcessedDefaults = maps:map(fun(K, V) -> handle_default([K|Path], V, maps:get(K, Items)) end, FilteredDefaults), lists:flatmap(fun({_K, ConfigParts}) -> ConfigParts end, @@ -126,6 +127,9 @@ get_spec_for_key(Key, Items) -> end end. +get_always_included(Items) -> + maps:from_list([{K, #{}} || {K, #section{include = always}} <- maps:to_list(Items)]). + -spec parse_list(path(), [toml_value()], mongoose_config_spec:config_list()) -> [config_part()]. parse_list(Path, L, #list{items = ItemSpec}) -> lists:flatmap(fun(Elem) -> From 5ccc66d7c3c121289af0134e50c0b9a951d6408d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Wed, 8 Dec 2021 15:52:47 +0100 Subject: [PATCH 2/8] Set defaults for simple options in the auth section The defaults should be always available even if auth section is missing from the config (which is valid), so the top-level auth section needs to be always included. --- src/config/mongoose_config_spec.erl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/config/mongoose_config_spec.erl b/src/config/mongoose_config_spec.erl index f09b9b5544..4894e54a6c 100644 --- a/src/config/mongoose_config_spec.erl +++ b/src/config/mongoose_config_spec.erl @@ -102,12 +102,13 @@ root() -> General = general(), + Auth = auth(), #section{ items = #{<<"general">> => General#section{required = [<<"default_server_domain">>], process = fun ?MODULE:process_general/1, defaults = general_defaults()}, <<"listen">> => listen(), - <<"auth">> => auth(), + <<"auth">> => Auth#section{include = always}, <<"outgoing_pools">> => outgoing_pools(), <<"services">> => services(), <<"modules">> => modules(), @@ -483,8 +484,11 @@ auth() -> validate = {module, cyrsasl}, process = fun ?MODULE:process_sasl_mechanism/1}} }, - wrap = host_config, - format_items = map + format_items = map, + defaults = #{<<"methods">> => [], + <<"sasl_external">> => [standard], + <<"sasl_mechanisms">> => cyrsasl:default_modules()}, + wrap = host_config }. all_auth_methods() -> From 68cc3c9ca64093f488f3db2d0aa88dc14651e623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Wed, 8 Dec 2021 15:49:46 +0100 Subject: [PATCH 3/8] Use the defaults from the auth section Also remove processing of old (already removed) 'sasl_external' values. --- src/auth/ejabberd_auth.erl | 2 +- src/sasl/cyrsasl.erl | 5 ++--- src/sasl/cyrsasl_external.erl | 8 +------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/auth/ejabberd_auth.erl b/src/auth/ejabberd_auth.erl index 4007a4a9e8..abbc75866b 100644 --- a/src/auth/ejabberd_auth.erl +++ b/src/auth/ejabberd_auth.erl @@ -417,7 +417,7 @@ auth_modules_for_host_type(HostType) -> -spec auth_methods(mongooseim:host_type()) -> [atom()]. auth_methods(HostType) -> - mongoose_config:get_opt([{auth, HostType}, methods], []). + mongoose_config:get_opt([{auth, HostType}, methods]). -spec auth_method_to_module(atom()) -> authmodule(). auth_method_to_module(Method) -> diff --git a/src/sasl/cyrsasl.erl b/src/sasl/cyrsasl.erl index 54cde7cd87..bf80574e6c 100644 --- a/src/sasl/cyrsasl.erl +++ b/src/sasl/cyrsasl.erl @@ -29,12 +29,11 @@ -export([listmech/1, server_new/6, server_start/4, - server_step/2]). + server_step/2, + default_modules/0]). -ignore_xref([behaviour_info/1]). --include("mongoose.hrl"). - -type sasl_module() :: module(). -type mechanism() :: binary(). diff --git a/src/sasl/cyrsasl_external.erl b/src/sasl/cyrsasl_external.erl index b9f14585bb..95e3909580 100644 --- a/src/sasl/cyrsasl_external.erl +++ b/src/sasl/cyrsasl_external.erl @@ -105,13 +105,7 @@ authorize(Creds) -> get_verification_list(Creds) -> HostType = mongoose_credentials:host_type(Creds), - case mongoose_config:get_opt([{auth, HostType}, sasl_external], [standard]) of - [] -> [standard]; - List when is_list(List) -> List; - standard -> [standard]; - use_common_name -> [standard, common_name]; - allow_just_user_identity -> [standard, auth_id] - end. + mongoose_config:get_opt([{auth, HostType}, sasl_external]). verification_loop([VerificationFn | T], Creds) -> case verify_creds(VerificationFn, Creds) of From a3cd3be7d24660d62c4fc03dd395f4a13b44dbef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Wed, 8 Dec 2021 19:19:42 +0100 Subject: [PATCH 4/8] Add the possibility to check nested options in config_parser_SUITE As there are more and more defaults, it becomes necessary to check only one expected option value even if it is nested in maps, e.g. for auth options. It is now possible to do it with ?cfg and ?cfgh macros, e.g. ?cfg(Path, ExpectedValue, RawConfig) --- test/config_parser_SUITE.erl | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/test/config_parser_SUITE.erl b/test/config_parser_SUITE.erl index 852179273e..4e8e46dce3 100644 --- a/test/config_parser_SUITE.erl +++ b/test/config_parser_SUITE.erl @@ -3014,15 +3014,20 @@ assert_options_host(ExpectedOptions, RawConfig) -> HostOptions = [{host_key(Key, ?HOST_TYPE), Value} || {Key, Value} <- ExpectedOptions], assert_options(HostOptions, HostConfig). --type key_prefix() :: {shaper | acl | access, atom()} | atom() | {atom(), jid:lserver()}. +-type key_prefix() :: top_level_key_prefix() | key_path_prefix(). +-type top_level_key_prefix() :: {shaper | acl | access, atom()} | atom(). +-type key_path_prefix() :: [atom() | binary()]. -%% @doc Create full per-host config key for host-or-global options --spec host_key(key_prefix(), mongooseim:host_type_or_global()) -> mongoose_config:key(). +%% @doc Build full per-host config key for host-or-global options +-spec host_key(top_level_key_prefix(), mongooseim:host_type_or_global()) -> mongoose_config:key(); + (key_path_prefix(), mongooseim:host_type_or_global()) -> mongoose_config:key_path(). host_key({Key, Tag}, HostType) when Key =:= shaper; Key =:= acl; Key =:= access -> {Key, Tag, HostType}; -host_key(Key, HostType) -> +host_key([TopKey | Rest], HostType) when is_atom(TopKey) -> + [{TopKey, HostType} | Rest]; +host_key(Key, HostType) when is_atom(Key) -> {Key, HostType}. -spec assert_error_host_or_global(mongoose_config_parser_toml:toml_section()) -> any(). @@ -3056,18 +3061,26 @@ maybe_insert_dummy_domain(M, DomainName) -> %% helpers for testing individual options --spec assert_options([{mongoose_config:key(), mongoose_config:value()}], +-spec assert_options([{mongoose_config:key() | mongoose_config:key_path(), mongoose_config:value()}], [mongoose_config_parser_toml:config()]) -> any(). assert_options(ExpectedOptions, Config) -> lists:foreach(fun({Key, Value}) -> assert_option(Key, Value, Config) end, ExpectedOptions). --spec assert_option(mongoose_config:key(), mongoose_config:value(), +-spec assert_option(mongoose_config:key() | mongoose_config:key_path(), mongoose_config:value(), [mongoose_config_parser_toml:config()]) -> any(). assert_option(Key, Value, Config) -> - case lists:keyfind(Key, 1, Config) of - false -> ct:fail({"option not found", Key, Value, Config}); - ActualOpt -> handle_config_option({Key, Value}, ActualOpt) - end. + compare_values(Key, Value, get_config_value(Key, Config)). + +-spec get_config_value(mongoose_config:key() | mongoose_config:key_path(), + [mongoose_config_parser_toml:config()]) -> + mongoose_config:value(). +get_config_value([TopKey | Rest], Config) -> + case lists:keyfind(TopKey, 1, Config) of + false -> ct:fail({"option not found", TopKey, Config}); + {_, TopValue} -> lists:foldl(fun maps:get/2, TopValue, Rest) + end; +get_config_value(Key, Config) -> + get_config_value([Key], Config). -spec assert_error([mongoose_config_parser_toml:config()]) -> any(). assert_error(Config) -> From 9e874e20eec5bbb13362cdf3b290076061d545c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Wed, 8 Dec 2021 19:22:55 +0100 Subject: [PATCH 5/8] Update auth tests with the newly introduced defaults Check only the required options - otherwise all expected default values would need to be provided in each assertion. --- test/config_parser_SUITE.erl | 69 ++++++++++++++++++++---------------- 1 file changed, 38 insertions(+), 31 deletions(-) diff --git a/test/config_parser_SUITE.erl b/test/config_parser_SUITE.erl index 4e8e46dce3..98ac88c89e 100644 --- a/test/config_parser_SUITE.erl +++ b/test/config_parser_SUITE.erl @@ -818,17 +818,19 @@ listen_http_handlers_domain(_Config) -> %% tests: auth auth_methods(_Config) -> - ?cfgh(auth, #{methods => [internal, rdbms]}, + ?cfg([{auth, global}, methods], [], #{}), % global default + ?cfgh([auth, methods], [], #{<<"auth">> => #{}}), % default + ?cfgh([auth, methods], [internal, rdbms], #{<<"auth">> => #{<<"methods">> => [<<"internal">>, <<"rdbms">>]}}), ?errh(#{<<"auth">> => #{<<"methods">> => [<<"supernatural">>]}}). auth_password_format(_Config) -> - ?cfgh(auth, #{password_format => {scram, [sha, sha256]}}, + ?cfgh([auth, password_format], {scram, [sha, sha256]}, #{<<"auth">> => #{<<"password">> => #{<<"format">> => <<"scram">>, <<"hash">> => [<<"sha">>, <<"sha256">>]}}}), - ?cfgh(auth, #{password_format => scram}, + ?cfgh([auth, password_format], scram, #{<<"auth">> => #{<<"password">> => #{<<"format">> => <<"scram">>}}}), - ?cfgh(auth, #{password_format => plain}, + ?cfgh([auth, password_format], plain, #{<<"auth">> => #{<<"password">> => #{<<"format">> => <<"plain">>}}}), ?errh(#{<<"auth">> => #{<<"password">> => #{<<"format">> => <<"no password">>}}}), ?errh(#{<<"auth">> => #{<<"password">> => #{<<"format">> => <<"scram">>, @@ -837,14 +839,16 @@ auth_password_format(_Config) -> <<"hash">> => [<<"sha1234">>]}}}). auth_scram_iterations(_Config) -> - ?cfgh(auth, #{scram_iterations => 1000}, + ?cfgh([auth, scram_iterations], 1000, #{<<"auth">> => #{<<"scram_iterations">> => 1000}}), ?errh(#{<<"auth">> => #{<<"scram_iterations">> => false}}). auth_sasl_external(_Config) -> - ?cfgh(auth, #{sasl_external => [standard, - common_name, - {mod, cyrsasl_external_verification}]}, + ?cfg([{auth, global}, sasl_external], [standard], #{}), % global default + ?cfgh([auth, sasl_external], [standard], #{<<"auth">> => #{}}), % default + ?cfgh([auth, sasl_external], [standard, + common_name, + {mod, cyrsasl_external_verification}], #{<<"auth">> => #{<<"sasl_external">> => [<<"standard">>, <<"common_name">>, @@ -852,53 +856,56 @@ auth_sasl_external(_Config) -> ?errh(#{<<"auth">> => #{<<"sasl_external">> => [<<"unknown">>]}}). auth_sasl_mechanisms(_Config) -> - ?cfgh(auth, #{sasl_mechanisms => [cyrsasl_external, cyrsasl_scram]}, + Default = cyrsasl:default_modules(), + ?cfg([{auth, global}, sasl_mechanisms], Default, #{}), % global default + ?cfg([{auth, global}, sasl_mechanisms], Default, #{<<"auth">> => #{}}), % default + ?cfgh([auth, sasl_mechanisms], [cyrsasl_external, cyrsasl_scram], #{<<"auth">> => #{<<"sasl_mechanisms">> => [<<"external">>, <<"scram">>]}}), ?errh(#{<<"auth">> => #{<<"sasl_mechanisms">> => [<<"none">>]}}). auth_allow_multiple_connections(_Config) -> - ?cfgh(auth, #{anonymous => #{allow_multiple_connections => true}}, + ?cfgh([auth, anonymous, allow_multiple_connections], true, auth_raw(<<"anonymous">>, #{<<"allow_multiple_connections">> => true})), ?errh(auth_raw(<<"anonymous">>, #{<<"allow_multiple_connections">> => <<"yes">>})). auth_anonymous_protocol(_Config) -> - ?cfgh(auth, #{anonymous => #{protocol => login_anon}}, + ?cfgh([auth, anonymous, protocol], login_anon, auth_raw(<<"anonymous">>, #{<<"protocol">> => <<"login_anon">>})), ?errh(auth_raw(<<"anonymous">>, #{<<"protocol">> => <<"none">>})). auth_ldap_pool(_Config) -> - ?cfgh(auth, #{ldap => #{pool_tag => ldap_pool}}, + ?cfgh([auth, ldap], #{pool_tag => ldap_pool}, auth_ldap_raw(#{<<"pool_tag">> => <<"ldap_pool">>})), ?errh(auth_ldap_raw(#{<<"pool_tag">> => <<>>})). auth_ldap_bind_pool(_Config) -> - ?cfgh(auth, #{ldap => #{bind_pool_tag => ldap_bind_pool}}, + ?cfgh([auth, ldap], #{bind_pool_tag => ldap_bind_pool}, auth_ldap_raw(#{<<"bind_pool_tag">> => <<"ldap_bind_pool">>})), ?errh(auth_ldap_raw(#{<<"bind_pool_tag">> => true})). auth_ldap_base(_Config) -> - ?cfgh(auth, #{ldap => #{base => <<"ou=Users,dc=example,dc=com">>}}, + ?cfgh([auth, ldap, base], <<"ou=Users,dc=example,dc=com">>, auth_ldap_raw(#{<<"base">> => <<"ou=Users,dc=example,dc=com">>})), ?errh(auth_ldap_raw(#{<<"base">> => 10})). auth_ldap_uids(_Config) -> - ?cfgh(auth, #{ldap => #{uids => [{<<"uid1">>, <<"user=%u">>}]}}, + ?cfgh([auth, ldap, uids], [{<<"uid1">>, <<"user=%u">>}], auth_ldap_raw(#{<<"uids">> => [#{<<"attr">> => <<"uid1">>, <<"format">> => <<"user=%u">>}]})), - ?cfgh(auth, #{ldap => #{uids => [<<"uid1">>]}}, + ?cfgh([auth, ldap, uids], [<<"uid1">>], auth_ldap_raw(#{<<"uids">> => [#{<<"attr">> => <<"uid1">>}]})), ?errh(auth_ldap_raw(#{<<"uids">> => [#{<<"format">> => <<"user=%u">>}]})). auth_ldap_filter(_Config) -> - ?cfgh(auth, #{ldap => #{filter => <<"(objectClass=inetOrgPerson)">>}}, + ?cfgh([auth, ldap, filter], <<"(objectClass=inetOrgPerson)">>, auth_ldap_raw(#{<<"filter">> => <<"(objectClass=inetOrgPerson)">>})), ?errh(auth_ldap_raw(#{<<"filter">> => 10})). auth_ldap_dn_filter(_Config) -> - ?cfgh(auth, #{ldap => #{dn_filter => {<<"(user=%u@%d)">>, []}}}, + ?cfgh([auth, ldap, dn_filter], {<<"(user=%u@%d)">>, []}, auth_ldap_raw(#{<<"dn_filter">> => #{<<"filter">> => <<"(user=%u@%d)">>}})), Pattern = <<"(&(name=%s)(owner=%D)(user=%u@%d))">>, - ?cfgh(auth, #{ldap => #{dn_filter => {Pattern, [<<"sn">>]}}}, + ?cfgh([auth, ldap, dn_filter], {Pattern, [<<"sn">>]}, auth_ldap_raw(#{<<"dn_filter">> => #{<<"filter">> => Pattern, <<"attributes">> => [<<"sn">>]}})), ?errh(auth_ldap_raw(#{<<"dn_filter">> => #{<<"attributes">> => [<<"sn">>]}})), @@ -910,7 +917,7 @@ auth_ldap_local_filter(_Config) -> Filter = #{<<"operation">> => <<"equal">>, <<"attribute">> => <<"accountStatus">>, <<"values">> => [<<"enabled">>]}, - ?cfgh(auth, #{ldap => #{local_filter => {equal, {"accountStatus", ["enabled"]}}}}, + ?cfgh([auth, ldap, local_filter], {equal, {"accountStatus", ["enabled"]}}, auth_ldap_raw(#{<<"local_filter">> => Filter})), [?errh(auth_ldap_raw(#{<<"local_filter">> => maps:remove(K, Filter)})) || K <- maps:keys(Filter)], @@ -919,22 +926,22 @@ auth_ldap_local_filter(_Config) -> ?errh(auth_ldap_raw(#{<<"local_filter">> => Filter#{<<"values">> := []}})). auth_ldap_deref(_Config) -> - ?cfgh(auth, #{ldap => #{deref => always}}, auth_ldap_raw(#{<<"deref">> => <<"always">>})), + ?cfgh([auth, ldap, deref], always, auth_ldap_raw(#{<<"deref">> => <<"always">>})), ?errh(auth_ldap_raw(#{<<"deref">> => <<"sometimes">>})). auth_external(_Config) -> RequiredOpts = #{<<"program">> => <<"/usr/bin/auth">>}, Config = #{program => "/usr/bin/auth"}, - ?cfgh(auth, #{external => Config}, + ?cfgh([auth, external], Config, auth_raw(<<"external">>, RequiredOpts)), - ?cfgh(auth, #{external => Config#{instances => 2}}, + ?cfgh([auth, external, instances], 2, auth_raw(<<"external">>, RequiredOpts#{<<"instances">> => 2})), ?errh(auth_raw(<<"external">>, #{<<"program">> => <<>>})), ?errh(auth_raw(<<"external">>, #{<<"instances">> => 2})), ?errh(auth_raw(<<"external">>, RequiredOpts#{<<"instances">> => 0})). auth_http_basic_auth(_Config) -> - ?cfgh(auth, #{http => #{basic_auth => "admin:admin123"}}, + ?cfgh([auth, http, basic_auth], "admin:admin123", auth_raw(<<"http">>, #{<<"basic_auth">> => <<"admin:admin123">>})), ?errh(auth_raw(<<"http">>, #{<<"basic_auth">> => true})). @@ -945,11 +952,11 @@ auth_jwt(_Config) -> Config = #{algorithm => <<"HS512">>, secret => {value, "secret123"}, username_key => user}, - ?cfgh(auth, #{jwt => Config}, + ?cfgh([auth, jwt], Config, auth_raw(<<"jwt">>, Opts)), - ?cfgh(auth, #{jwt => Config#{secret => {file, "/home/user/jwt_secret"}}}, + ?cfgh([auth, jwt, secret], {file, "/home/user/jwt_secret"}, auth_raw(<<"jwt">>, Opts#{<<"secret">> := #{<<"file">> => <<"/home/user/jwt_secret">>}})), - ?cfgh(auth, #{jwt => Config#{secret => {env, "SECRET"}}}, + ?cfgh([auth, jwt, secret], {env, "SECRET"}, auth_raw(<<"jwt">>, Opts#{<<"secret">> := #{<<"env">> => <<"SECRET">>}})), ?errh(auth_raw(<<"jwt">>, Opts#{<<"secret">> := #{<<"value">> => 123}})), ?errh(auth_raw(<<"jwt">>, Opts#{<<"secret">> := #{<<"file">> => <<>>}})), @@ -961,19 +968,19 @@ auth_jwt(_Config) -> [?errh(auth_raw(<<"jwt">>, maps:without([K], Opts))) || K <- maps:keys(Opts)]. auth_riak_bucket_type(_Config) -> - ?cfgh(auth, #{riak => #{bucket_type => <<"buckethead">>}}, + ?cfgh([auth, riak, bucket_type], <<"buckethead">>, auth_raw(<<"riak">>, #{<<"bucket_type">> => <<"buckethead">>})), ?errh(auth_raw(<<"riak">>, #{<<"bucket_type">> => <<>>})). auth_rdbms_users_number_estimate(_Config) -> - ?cfgh(auth, #{rdbms => #{users_number_estimate => true}}, + ?cfgh([auth, rdbms, users_number_estimate], true, auth_raw(<<"rdbms">>, #{<<"users_number_estimate">> => true})), ?errh(auth_raw(<<"rdbms">>, #{<<"users_number_estimate">> => 1200})). auth_dummy(_Config) -> - ?cfgh(auth, #{dummy => #{base_time => 0}}, + ?cfgh([auth, dummy, base_time], 0, auth_raw(<<"dummy">>, #{<<"base_time">> => 0})), - ?cfgh(auth, #{dummy => #{variance => 10}}, + ?cfgh([auth, dummy, variance], 10, auth_raw(<<"dummy">>, #{<<"variance">> => 10})), ?errh(auth_raw(<<"dummy">>, #{<<"base_time">> => -5})), ?errh(auth_raw(<<"dummy">>, #{<<"variance">> => 0})). From 0f8e8efa0c59c417f5160777ac075c842cc352b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Wed, 8 Dec 2021 19:24:21 +0100 Subject: [PATCH 6/8] Update config_parser_SUITE test data with new auth defaults Listing the sasl mechanisms is verbose, but there is no better way to do it right now. If the number of such default values grows a lot, it might be necessary to - either have a dynamic way of listing them - or reduce the number of host (types) in the files. So far it does not seem to be a major issue. --- .../host_types.options | 50 +++++++++++++++++-- .../miscellaneous.options | 22 +++++++- test/config_parser_SUITE_data/modules.options | 20 ++++++++ .../mongooseim-pgsql.options | 25 ++++++++-- .../outgoing_pools.options | 30 +++++++++++ .../config_parser_SUITE_data/s2s_only.options | 20 ++++++++ 6 files changed, 157 insertions(+), 10 deletions(-) diff --git a/test/config_parser_SUITE_data/host_types.options b/test/config_parser_SUITE_data/host_types.options index ce934ab302..633082e7dc 100644 --- a/test/config_parser_SUITE_data/host_types.options +++ b/test/config_parser_SUITE_data/host_types.options @@ -15,11 +15,51 @@ mongoose_router_external_localnode,mongoose_router_external, mongoose_router_dynamic_domains,ejabberd_s2s]}. {sm_backend,{mnesia,[]}}. -{{auth,<<"another host type">>},#{methods => []}}. -{{auth,<<"localhost">>},#{methods => [test3]}}. -{{auth,<<"some host type">>},#{methods => [test2]}}. -{{auth,<<"this is host type">>},#{methods => [test1]}}. -{{auth,<<"yet another host type">>},#{methods => [test1,test2]}}. +{{auth,<<"another host type">>}, + #{methods => [], + sasl_external => [standard], + sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. +{{auth,<<"localhost">>}, + #{methods => [test3], + sasl_external => [standard], + sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. +{{auth,<<"some host type">>}, + #{methods => [test2], + sasl_external => [standard], + sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. +{{auth,<<"this is host type">>}, + #{methods => [test1], + sasl_external => [standard], + sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. +{{auth,<<"yet another host type">>}, + #{methods => [test1,test2], + sasl_external => [standard], + sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. {{modules,<<"another host type">>},[{test_mim_module2,[]}]}. {{modules,<<"localhost">>},[{test_mim_module3,[]}]}. {{modules,<<"some host type">>},[]}. diff --git a/test/config_parser_SUITE_data/miscellaneous.options b/test/config_parser_SUITE_data/miscellaneous.options index 43c3d4969a..fc54d2dbd5 100644 --- a/test/config_parser_SUITE_data/miscellaneous.options +++ b/test/config_parser_SUITE_data/miscellaneous.options @@ -47,8 +47,17 @@ local_filter => {equal,{"accountStatus",["enabled"]}}, pool_tag => default, uids => [<<"uid">>,{<<"uid2">>,<<"%u">>}]}, + methods => [], rdbms => #{users_number_estimate => true}, - riak => #{bucket_type => <<"user_bucket">>}}}. + riak => #{bucket_type => <<"user_bucket">>}, + sasl_external => [standard], + sasl_mechanisms => + [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. {{auth,<<"localhost">>}, #{anonymous => #{allow_multiple_connections => true, protocol => sasl_anon}, @@ -66,8 +75,17 @@ local_filter => {equal,{"accountStatus",["enabled"]}}, pool_tag => default, uids => [<<"uid">>,{<<"uid2">>,<<"%u">>}]}, + methods => [], rdbms => #{users_number_estimate => true}, - riak => #{bucket_type => <<"user_bucket">>}}}. + riak => #{bucket_type => <<"user_bucket">>}, + sasl_external => [standard], + sasl_mechanisms => + [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. {{replaced_wait_timeout,<<"anonymous.localhost">>},2000}. {{replaced_wait_timeout,<<"localhost">>},2000}. {{route_subdomains,<<"anonymous.localhost">>},s2s}. diff --git a/test/config_parser_SUITE_data/modules.options b/test/config_parser_SUITE_data/modules.options index 5d3273ca90..470239c9db 100644 --- a/test/config_parser_SUITE_data/modules.options +++ b/test/config_parser_SUITE_data/modules.options @@ -13,6 +13,26 @@ mongoose_router_external_localnode,mongoose_router_external, mongoose_router_dynamic_domains,ejabberd_s2s]}. {sm_backend,{mnesia,[]}}. +{{auth,<<"dummy_host">>}, + #{methods => [], + sasl_external => [standard], + sasl_mechanisms => + [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. +{{auth,<<"localhost">>}, + #{methods => [], + sasl_external => [standard], + sasl_mechanisms => + [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. { {modules,<<"dummy_host">>}, [{mod_jingle_sip, diff --git a/test/config_parser_SUITE_data/mongooseim-pgsql.options b/test/config_parser_SUITE_data/mongooseim-pgsql.options index 304f9c046a..ab86532761 100644 --- a/test/config_parser_SUITE_data/mongooseim-pgsql.options +++ b/test/config_parser_SUITE_data/mongooseim-pgsql.options @@ -128,16 +128,35 @@ {{auth,<<"anonymous.localhost">>}, #{anonymous => #{allow_multiple_connections => true, protocol => both}, - methods => [anonymous]}}. + methods => [anonymous], + sasl_external => [standard], + sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. {{auth,<<"localhost">>}, #{methods => [rdbms], - sasl_external => [standard], password_format => {scram,[sha256]}, + sasl_external => [standard], + sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth], scram_iterations => 64}}. {{auth,<<"localhost.bis">>}, #{methods => [rdbms], - sasl_external => [standard], password_format => {scram,[sha256]}, + sasl_external => [standard], + sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth], scram_iterations => 64}}. { {modules,<<"anonymous.localhost">>}, diff --git a/test/config_parser_SUITE_data/outgoing_pools.options b/test/config_parser_SUITE_data/outgoing_pools.options index 2eb65f90a9..1d98f46a8b 100644 --- a/test/config_parser_SUITE_data/outgoing_pools.options +++ b/test/config_parser_SUITE_data/outgoing_pools.options @@ -60,6 +60,36 @@ mongoose_router_external_localnode,mongoose_router_external, mongoose_router_dynamic_domains,ejabberd_s2s]}. {sm_backend,{mnesia,[]}}. +{{auth,<<"anonymous.localhost">>}, + #{methods => [], + sasl_external => [standard], + sasl_mechanisms => + [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. +{{auth,<<"localhost">>}, + #{methods => [], + sasl_external => [standard], + sasl_mechanisms => + [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. +{{auth,<<"localhost.bis">>}, + #{methods => [], + sasl_external => [standard], + sasl_mechanisms => + [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. {{replaced_wait_timeout,<<"anonymous.localhost">>},2000}. {{replaced_wait_timeout,<<"localhost">>},2000}. {{replaced_wait_timeout,<<"localhost.bis">>},2000}. diff --git a/test/config_parser_SUITE_data/s2s_only.options b/test/config_parser_SUITE_data/s2s_only.options index f2d6072112..b2f2179e01 100644 --- a/test/config_parser_SUITE_data/s2s_only.options +++ b/test/config_parser_SUITE_data/s2s_only.options @@ -22,6 +22,26 @@ {sm_backend,{mnesia,[]}}. {domain_certfile,#{<<"example.com">> => "/path/to/example_com.pem", <<"example.org">> => "/path/to/example_org.pem"}}. +{{auth,<<"dummy_host">>}, + #{methods => [], + sasl_external => [standard], + sasl_mechanisms => + [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. +{{auth,<<"localhost">>}, + #{methods => [], + sasl_external => [standard], + sasl_mechanisms => + [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, + cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, + cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, + cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, + cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, + cyrsasl_anonymous,cyrsasl_oauth]}}. {{replaced_wait_timeout,<<"dummy_host">>},2000}. {{replaced_wait_timeout,<<"localhost">>},2000}. {s2s_address,#{<<"fed1">> => "127.0.0.1", From 932b5287c2c13ec01d9b20c6388848511b693ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Thu, 9 Dec 2021 08:56:54 +0100 Subject: [PATCH 7/8] Update mongoose_config_SUITE with the new auth defaults --- test/mongoose_config_SUITE.erl | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/mongoose_config_SUITE.erl b/test/mongoose_config_SUITE.erl index 61713f4aea..c229c47bfb 100644 --- a/test/mongoose_config_SUITE.erl +++ b/test/mongoose_config_SUITE.erl @@ -126,13 +126,11 @@ minimal_config_opts() -> {mongooseimctl_access_commands, []}, {rdbms_server_type, generic}, {registration_timeout, 600}, - {routing_modules, [mongoose_router_global, - mongoose_router_localdomain, - mongoose_router_external_localnode, - mongoose_router_external, - mongoose_router_dynamic_domains, - ejabberd_s2s]}, + {routing_modules, ejabberd_router:default_routing_modules()}, {sm_backend, {mnesia, []}}, + {{auth,<<"localhost">>}, #{methods => [], + sasl_external => [standard], + sasl_mechanisms => cyrsasl:default_modules()}}, {{replaced_wait_timeout, <<"localhost">>}, 2000}]. start_slave_node(Config) -> From 953b3880df6498198bed0820fe1f35e4329994d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chrz=C4=85szcz?= Date: Thu, 9 Dec 2021 16:31:56 +0100 Subject: [PATCH 8/8] Make expected options dynamically generated Move away from explicit Erlang terms to avoid increasing verbosity when introducing defaults and having to copy-paste code fragments when such defaults change. --- test/config_parser_SUITE.erl | 2 +- .../host_types.options | 72 -- .../miscellaneous.options | 92 --- test/config_parser_SUITE_data/modules.options | 565 -------------- .../mongooseim-pgsql.options | 264 ------- .../outgoing_pools.options | 95 --- .../config_parser_SUITE_data/s2s_only.options | 58 -- test/config_parser_helper.erl | 693 ++++++++++++++++++ test/mongoose_config_SUITE.erl | 4 +- 9 files changed, 695 insertions(+), 1150 deletions(-) delete mode 100644 test/config_parser_SUITE_data/host_types.options delete mode 100644 test/config_parser_SUITE_data/miscellaneous.options delete mode 100644 test/config_parser_SUITE_data/modules.options delete mode 100644 test/config_parser_SUITE_data/mongooseim-pgsql.options delete mode 100644 test/config_parser_SUITE_data/outgoing_pools.options delete mode 100644 test/config_parser_SUITE_data/s2s_only.options create mode 100644 test/config_parser_helper.erl diff --git a/test/config_parser_SUITE.erl b/test/config_parser_SUITE.erl index 98ac88c89e..875f1c4889 100644 --- a/test/config_parser_SUITE.erl +++ b/test/config_parser_SUITE.erl @@ -3098,7 +3098,7 @@ assert_error(Config) -> test_config_file(Config, File) -> OptionsPath = ejabberd_helper:data(Config, File ++ ".options"), - {ok, ExpectedOpts} = file:consult(OptionsPath), + ExpectedOpts = config_parser_helper:options(File), TOMLPath = ejabberd_helper:data(Config, File ++ ".toml"), State = mongoose_config_parser:parse_file(TOMLPath), diff --git a/test/config_parser_SUITE_data/host_types.options b/test/config_parser_SUITE_data/host_types.options deleted file mode 100644 index 633082e7dc..0000000000 --- a/test/config_parser_SUITE_data/host_types.options +++ /dev/null @@ -1,72 +0,0 @@ -{all_metrics_are_global,false}. -{default_server_domain,<<"localhost">>}. -{hide_service_name,false}. -{host_types, - [<<"this is host type">>,<<"some host type">>, - <<"another host type">>,<<"yet another host type">>]}. -{hosts,[<<"localhost">>]}. -{language,<<"en">>}. -{loglevel,warning}. -{mongooseimctl_access_commands,[]}. -{rdbms_server_type,generic}. -{registration_timeout,600}. -{routing_modules, - [mongoose_router_global,mongoose_router_localdomain, - mongoose_router_external_localnode,mongoose_router_external, - mongoose_router_dynamic_domains,ejabberd_s2s]}. -{sm_backend,{mnesia,[]}}. -{{auth,<<"another host type">>}, - #{methods => [], - sasl_external => [standard], - sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{auth,<<"localhost">>}, - #{methods => [test3], - sasl_external => [standard], - sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{auth,<<"some host type">>}, - #{methods => [test2], - sasl_external => [standard], - sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{auth,<<"this is host type">>}, - #{methods => [test1], - sasl_external => [standard], - sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{auth,<<"yet another host type">>}, - #{methods => [test1,test2], - sasl_external => [standard], - sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{modules,<<"another host type">>},[{test_mim_module2,[]}]}. -{{modules,<<"localhost">>},[{test_mim_module3,[]}]}. -{{modules,<<"some host type">>},[]}. -{{modules,<<"this is host type">>},[]}. -{{modules,<<"yet another host type">>},[{test_mim_module1,[]}]}. -{{replaced_wait_timeout,<<"another host type">>},2000}. -{{replaced_wait_timeout,<<"localhost">>},2000}. -{{replaced_wait_timeout,<<"some host type">>},2000}. -{{replaced_wait_timeout,<<"this is host type">>},2000}. -{{replaced_wait_timeout,<<"yet another host type">>},2000}. diff --git a/test/config_parser_SUITE_data/miscellaneous.options b/test/config_parser_SUITE_data/miscellaneous.options deleted file mode 100644 index fc54d2dbd5..0000000000 --- a/test/config_parser_SUITE_data/miscellaneous.options +++ /dev/null @@ -1,92 +0,0 @@ -{all_metrics_are_global,false}. -{cowboy_server_name,"Apache"}. -{default_server_domain,<<"localhost">>}. -{hide_service_name,true}. -{host_types,[]}. -{hosts,[<<"localhost">>,<<"anonymous.localhost">>]}. -{language,<<"en">>}. -{listen, - [{{5280,{0,0,0,0},tcp}, - ejabberd_cowboy, - [{modules, - [{"_","/ws-xmpp",mod_websockets, - [{ejabberd_service, - [{access,all}, - {max_fsm_queue,1000}, - {password,"secret"}, - {shaper_rule,fast}]}]}]}, - {transport_options,[{max_connections,1024},{num_acceptors,10}]}]}]}. -{loglevel,warning}. -{mongooseimctl_access_commands, - [{local,["join_cluster"],[{node,"mongooseim@prime"}]}]}. -{rdbms_server_type,mssql}. -{registration_timeout,600}. -{routing_modules, - [mongoose_router_global,mongoose_router_localdomain]}. -{services, - [{service_mongoose_system_metrics, - [{initial_report,300000}, - {periodic_report,10800000}, - report, - {tracking_id,"UA-123456789"}]}]}. -{sm_backend,{mnesia,[]}}. -{{auth,<<"anonymous.localhost">>}, - #{anonymous => #{allow_multiple_connections => true, - protocol => sasl_anon}, - http => #{basic_auth => "admin:admin"}, - external => #{instances => 1, - program => "/usr/bin/authenticator"}, - jwt => #{algorithm => <<"RS256">>, - secret => {value,"secret123"}, - username_key => user}, - ldap => #{base => <<"ou=Users,dc=esl,dc=com">>, - bind_pool_tag => bind, - deref => never, - dn_filter => {<<"(&(name=%s)(owner=%D)(user=%u@%d))">>,[<<"sn">>]}, - filter => <<"(&(objectClass=shadowAccount)(memberOf=Jabber Users))">>, - local_filter => {equal,{"accountStatus",["enabled"]}}, - pool_tag => default, - uids => [<<"uid">>,{<<"uid2">>,<<"%u">>}]}, - methods => [], - rdbms => #{users_number_estimate => true}, - riak => #{bucket_type => <<"user_bucket">>}, - sasl_external => [standard], - sasl_mechanisms => - [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{auth,<<"localhost">>}, - #{anonymous => #{allow_multiple_connections => true, - protocol => sasl_anon}, - http => #{basic_auth => "admin:admin"}, - external => #{instances => 1, - program => "/usr/bin/authenticator"}, - jwt => #{algorithm => <<"RS256">>, - secret => {value,"secret123"}, - username_key => user}, - ldap => #{base => <<"ou=Users,dc=esl,dc=com">>, - bind_pool_tag => bind, - deref => never, - dn_filter => {<<"(&(name=%s)(owner=%D)(user=%u@%d))">>,[<<"sn">>]}, - filter => <<"(&(objectClass=shadowAccount)(memberOf=Jabber Users))">>, - local_filter => {equal,{"accountStatus",["enabled"]}}, - pool_tag => default, - uids => [<<"uid">>,{<<"uid2">>,<<"%u">>}]}, - methods => [], - rdbms => #{users_number_estimate => true}, - riak => #{bucket_type => <<"user_bucket">>}, - sasl_external => [standard], - sasl_mechanisms => - [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{replaced_wait_timeout,<<"anonymous.localhost">>},2000}. -{{replaced_wait_timeout,<<"localhost">>},2000}. -{{route_subdomains,<<"anonymous.localhost">>},s2s}. -{{route_subdomains,<<"localhost">>},s2s}. diff --git a/test/config_parser_SUITE_data/modules.options b/test/config_parser_SUITE_data/modules.options deleted file mode 100644 index 470239c9db..0000000000 --- a/test/config_parser_SUITE_data/modules.options +++ /dev/null @@ -1,565 +0,0 @@ -{all_metrics_are_global,false}. -{default_server_domain,<<"localhost">>}. -{hide_service_name,false}. -{host_types,[]}. -{hosts,[<<"localhost">>,<<"dummy_host">>]}. -{language,<<"en">>}. -{loglevel,warning}. -{mongooseimctl_access_commands,[]}. -{rdbms_server_type,generic}. -{registration_timeout,600}. -{routing_modules, - [mongoose_router_global,mongoose_router_localdomain, - mongoose_router_external_localnode,mongoose_router_external, - mongoose_router_dynamic_domains,ejabberd_s2s]}. -{sm_backend,{mnesia,[]}}. -{{auth,<<"dummy_host">>}, - #{methods => [], - sasl_external => [standard], - sasl_mechanisms => - [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{auth,<<"localhost">>}, - #{methods => [], - sasl_external => [standard], - sasl_mechanisms => - [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{ - {modules,<<"dummy_host">>}, - [{mod_jingle_sip, - [{listen_port,5600}, - {local_host,"localhost"}, - {proxy_host,"localhost"}, - {proxy_port,5600}, - {sdp_origin,"127.0.0.1"}]}, - {mod_shared_roster_ldap, - [{ldap_base,"ou=Users,dc=ejd,dc=com"}, - {ldap_filter,"(objectClass=inetOrgPerson)"}, - {ldap_group_cache_validity,1}, - {ldap_groupattr,"ou"}, - {ldap_memberattr,"cn"}, - {ldap_rfilter,"(objectClass=inetOrgPerson)"}, - {ldap_user_cache_validity,1}, - {ldap_userdesc,"cn"}]}, - {mod_mam_rdbms_user,[muc,pm]}, - {mod_global_distrib, - [{bounce,[{max_retries,3},{resend_after_ms,300}]}, - {cache,[{domain_lifetime_seconds,60}]}, - {connections, - [{advertised_endpoints,[{"172.16.0.2",5555}]}, - {connections_per_endpoint,30}, - {endpoints,[{"172.16.0.2",5555}]}, - {tls_opts,[{cafile,"priv/ca.pem"},{certfile,"priv/dc1.pem"}]}]}, - {global_host,"example.com"}, - {local_host,"datacenter1.example.com"}, - {redis,[{pool,global_distrib}]}]}, - {mod_register, - [{access,all}, - {password_strength,32}, - {registration_watchers,[<<"JID1">>,<<"JID2">>]}, - {welcome_message,{"Subject","Body"}}]}, - {mod_mam_rdbms_async_pool_writer,[pm]}, - {mod_adhoc,[{iqdisc,one_queue},{report_commands_node,true}]}, - {mod_event_pusher_sns, - [{access_key_id,"AKIAIOSFODNN7EXAMPLE"}, - {account_id,"123456789012"}, - {muc_messages_topic,"user_messagegroup_sent"}, - {plugin_module,mod_event_pusher_sns_defaults}, - {pm_messages_topic,"user_message_sent"}, - {pool_size,100}, - {presence_updates_topic,"user_presence_updated"}, - {publish_retry_count,2}, - {publish_retry_time_ms,50}, - {region,"eu-west-1"}, - {secret_access_key,"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, - {sns_host,"sns.eu-west-1.amazonaws.com"}]}, - {mod_muc, - [{access,muc}, - {access_create,muc_create}, - {default_room_options, - [{affiliations, - [{{<<"alice">>,<<"localhost">>,<<"resource1">>},member}, - {{<<"bob">>,<<"localhost">>,<<"resource2">>},owner}]}, - {password_protected,true}]}, - {host,{fqdn,<<"muc.example.com">>}}, - {http_auth_pool,my_auth_pool}]}, - {mod_ping, - [{ping_interval,60000}, - {ping_req_timeout,32000}, - {send_pings,true}, - {timeout_action,none}]}, - {mod_mam, - [{archive_chat_markers,true}, - {full_text_search,false}, - {is_archivable_message,mod_mam_utils}, - {no_stanzaid_element,true}]}, - {mod_disco, - [{extra_domains,[<<"some_domain">>,<<"another_domain">>]}, - {iqdisc,one_queue}, - {server_info, - [[{name,<<"abuse-address">>},{urls,[<<"admin@example.com">>]}], - [{modules,[mod_muc,mod_disco]}, - {name,<<"friendly-spirits">>}, - {urls,[<<"spirit1@localhost">>,<<"spirit2@localhost">>]}]]}, - {users_can_see_hidden_services,true}]}, - {mod_event_pusher_http, - [{configs, - [[{callback_module,mod_event_pusher_http_defaults}, - {path,"/notifications"}, - {pool_name,http_pool}]]}]}, - {mod_event_pusher_hook_translator,[]}, - {mod_mam_mnesia_prefs,[muc]}, - {mod_mam_muc, - [{archive_chat_markers,true}, - {full_text_search,true}, - {host,{fqdn,<<"muc.example.com">>}}, - {is_archivable_message,mod_mam_utils}]}, - {mod_event_pusher_rabbit, - [{chat_msg_exchange, - [{name,<<"chat_msg">>}, - {recv_topic,<<"chat_msg_recv">>}, - {sent_topic,<<"chat_msg_sent">>}]}, - {groupchat_msg_exchange, - [{name,<<"groupchat_msg">>}, - {recv_topic,<<"groupchat_msg_recv">>}, - {sent_topic,<<"groupchat_msg_sent">>}]}, - {presence_exchange,[{name,<<"presence">>},{type,<<"topic">>}]}]}, - {mod_vcard, - [{host,{fqdn,<<"directory.example.com">>}}, - {ldap_search_fields, - [{<<"User">>,<<"%u">>},{<<"Full Name">>,<<"displayName">>}]}, - {ldap_search_reported, - [{<<"Full Name">>,<<"FN">>},{<<"Given Name">>,<<"FIRST">>}]}, - {ldap_vcard_map, - [{<<"FAMILY">>,<<"%s">>,[<<"sn">>]}, - {<<"FN">>,<<"%s">>,[<<"displayName">>]}]}, - {matches,1}, - {search,true}]}, - {mod_keystore, - [{keys, - [{access_secret,ram}, - {access_psk,{file,"priv/access_psk"}}, - {provision_psk,{file,"priv/provision_psk"}}]}, - {ram_key_size,1000}]}, - {mod_mam_rdbms_arch,[no_writer,pm]}, - {mod_bosh, - [{inactivity,20}, - {maxpause,120}, - {max_wait,infinity}, - {server_acks,true}]}, - {mod_push_service_mongoosepush, - [{api_version,"v3"}, - {max_http_connections,100}, - {pool_name,mongoose_push_http}]}, - {mod_auth_token, - [{{validity_period,access},{13,minutes}}, - {{validity_period,refresh},{13,days}}]}, - {mod_extdisco, - [[{host,"stun1"}, - {password,"password"}, - {port,3478}, - {transport,"udp"}, - {type,stun}, - {username,"username"}], - [{host,"stun2"}, - {password,"password"}, - {port,2222}, - {transport,"tcp"}, - {type,stun}, - {username,"username"}], - [{host,"192.168.0.1"},{type,turn}]]}, - {mod_mam_cache_user,[muc,pm]}, - {mod_roster,[{store_current_id,true},{versioning,true}]}, - {mod_http_upload, - [{backend,s3}, - {expiration_time,120}, - {host,{prefix,<<"upload.">>}}, - {s3,[{access_key_id,"AKIAIOSFODNN7EXAMPLE"}, - {add_acl,true}, - {bucket_url,"https://s3-eu-west-1.amazonaws.com/mybucket"}, - {region,"eu-west-1"}, - {secret_access_key, - "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}]}]}, - {mod_last,[{backend,mnesia},{iqdisc,{queues,10}}]}, - {mod_offline, - [{access_max_user_messages,max_user_offline_messages}, - {backend,riak}, - {bucket_type,<<"offline">>}]}, - {mod_mam_muc_rdbms_arch, - [muc, - {db_jid_format,mam_jid_rfc}, - {db_message_format,mam_message_xml}]}, - {mod_csi,[{buffer_max,40}]}, - {mod_caps,[{cache_life_time,86},{cache_size,1000}]}, - {mod_pubsub, - [{access_createnode,pubsub_createnode}, - {backend,rdbms}, - {ignore_pep_from_offline,false}, - {last_item_cache,mnesia}, - {max_items_node,1000}, - {pep_mapping,[{<<"urn:xmpp:microblog:0">>,<<"mb">>}]}, - {plugins,[<<"flat">>,<<"pep">>]}]}, - {mod_mam_rdbms_prefs,[pm]}, - {mod_mam_meta, - [{archive_chat_markers,true}, - {backend,rdbms}, - {full_text_search,true}, - {is_archivable_message,mod_mam_utils}, - {muc, - [{async_writer,false}, - {host,{fqdn,<<"muc.example.com">>}}, - {rdbms_message_format,simple}, - {user_prefs_store,mnesia}]}, - {no_stanzaid_element,true}, - {pm,[{full_text_search,false},{user_prefs_store,rdbms}]}]}, - {mod_muc_light, - [{rooms_per_user,10}, - {rooms_per_page,5}, - {rooms_in_rosters,true}, - {max_occupants,50}, - {legacy_mode,true}, - {host,{fqdn,<<"muclight.example.com">>}}, - {equal_occupants,true}, - {config_schema, - [{<<"display-lines">>,30,display_lines,integer}, - {<<"roomname">>,<<"The Room">>,roomname,binary}]}, - {blocking,false}, - {all_can_invite,true}, - {all_can_configure,true}]}, - {mod_stream_management, - [{ack_freq,1}, - {buffer_max,30}, - {resume_timeout,600}, - {stale_h, - [{enabled,true}, - {stale_h_geriatric,3600}, - {stale_h_repeat_after,1800}]}]}, - {mod_muc_log, - [{access_log,muc}, - {cssfile,<<"path/to/css/file">>}, - {outdir,"www/muc"}, - {top_link,{"/","Home"}}]}, - {mod_inbox, - [{aff_changes,true}, - {groupchat,[muclight]}, - {remove_on_kicked,true}, - {reset_markers,[<<"displayed">>]}]}, - {mod_event_pusher_push, - [{backend,mnesia}, - {plugin_module,mod_event_pusher_push_plugin_defaults}, - {virtual_pubsub_hosts,[{fqdn,<<"host1">>},{fqdn,<<"host2">>}]}, - {wpool,[{workers,200}]}]}, - {mod_event_pusher, - [{backends, - [{http, - [{callback_module,mod_event_pusher_http_defaults}, - {path,"/notifications"}, - {pool_name,http_pool}]}, - {push, - [{backend,mnesia}, - {plugin_module,mod_event_pusher_push_plugin_defaults}, - {virtual_pubsub_hosts, - [{fqdn,<<"host1">>},{fqdn,<<"host2">>}]}, - {wpool,[{workers,200}]}]}, - {rabbit, - [{chat_msg_exchange, - [{name,<<"chat_msg">>}, - {recv_topic,<<"chat_msg_recv">>}, - {sent_topic,<<"chat_msg_sent">>}]}, - {groupchat_msg_exchange, - [{name,<<"groupchat_msg">>}, - {recv_topic,<<"groupchat_msg_recv">>}, - {sent_topic,<<"groupchat_msg_sent">>}]}, - {presence_exchange, - [{name,<<"presence">>},{type,<<"topic">>}]}]}, - {sns, - [{access_key_id,"AKIAIOSFODNN7EXAMPLE"}, - {account_id,"123456789012"}, - {muc_messages_topic,"user_messagegroup_sent"}, - {plugin_module,mod_event_pusher_sns_defaults}, - {pm_messages_topic,"user_message_sent"}, - {pool_size,100}, - {presence_updates_topic,"user_presence_updated"}, - {publish_retry_count,2}, - {publish_retry_time_ms,50}, - {region,"eu-west-1"}, - {secret_access_key, - "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, - {sns_host,"sns.eu-west-1.amazonaws.com"}]}]}]}, - {mod_carboncopy,[{iqdisc,no_queue}]}, - {mod_version,[{os_info,true}]}]}. -{ - {modules,<<"localhost">>}, - [{mod_jingle_sip, - [{listen_port,5600}, - {local_host,"localhost"}, - {proxy_host,"localhost"}, - {proxy_port,5600}, - {sdp_origin,"127.0.0.1"}]}, - {mod_shared_roster_ldap, - [{ldap_base,"ou=Users,dc=ejd,dc=com"}, - {ldap_filter,"(objectClass=inetOrgPerson)"}, - {ldap_group_cache_validity,1}, - {ldap_groupattr,"ou"}, - {ldap_memberattr,"cn"}, - {ldap_rfilter,"(objectClass=inetOrgPerson)"}, - {ldap_user_cache_validity,1}, - {ldap_userdesc,"cn"}]}, - {mod_mam_rdbms_user,[muc,pm]}, - {mod_global_distrib, - [{bounce,[{max_retries,3},{resend_after_ms,300}]}, - {cache,[{domain_lifetime_seconds,60}]}, - {connections, - [{advertised_endpoints,[{"172.16.0.2",5555}]}, - {connections_per_endpoint,30}, - {endpoints,[{"172.16.0.2",5555}]}, - {tls_opts,[{cafile,"priv/ca.pem"},{certfile,"priv/dc1.pem"}]}]}, - {global_host,"example.com"}, - {local_host,"datacenter1.example.com"}, - {redis,[{pool,global_distrib}]}]}, - {mod_register, - [{access,all}, - {password_strength,32}, - {registration_watchers,[<<"JID1">>,<<"JID2">>]}, - {welcome_message,{"Subject","Body"}}]}, - {mod_mam_rdbms_async_pool_writer,[pm]}, - {mod_adhoc,[{iqdisc,one_queue},{report_commands_node,true}]}, - {mod_event_pusher_sns, - [{access_key_id,"AKIAIOSFODNN7EXAMPLE"}, - {account_id,"123456789012"}, - {muc_messages_topic,"user_messagegroup_sent"}, - {plugin_module,mod_event_pusher_sns_defaults}, - {pm_messages_topic,"user_message_sent"}, - {pool_size,100}, - {presence_updates_topic,"user_presence_updated"}, - {publish_retry_count,2}, - {publish_retry_time_ms,50}, - {region,"eu-west-1"}, - {secret_access_key,"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, - {sns_host,"sns.eu-west-1.amazonaws.com"}]}, - {mod_muc, - [{access,muc}, - {access_create,muc_create}, - {default_room_options, - [{affiliations, - [{{<<"alice">>,<<"localhost">>,<<"resource1">>},member}, - {{<<"bob">>,<<"localhost">>,<<"resource2">>},owner}]}, - {password_protected,true}]}, - {host,{fqdn,<<"muc.example.com">>}}, - {http_auth_pool,my_auth_pool}]}, - {mod_ping, - [{ping_interval,60000}, - {ping_req_timeout,32000}, - {send_pings,true}, - {timeout_action,none}]}, - {mod_mam, - [{archive_chat_markers,true}, - {full_text_search,false}, - {is_archivable_message,mod_mam_utils}, - {no_stanzaid_element,true}]}, - {mod_disco, - [{extra_domains,[<<"some_domain">>,<<"another_domain">>]}, - {iqdisc,one_queue}, - {server_info, - [[{name,<<"abuse-address">>},{urls,[<<"admin@example.com">>]}], - [{modules,[mod_muc,mod_disco]}, - {name,<<"friendly-spirits">>}, - {urls,[<<"spirit1@localhost">>,<<"spirit2@localhost">>]}]]}, - {users_can_see_hidden_services,true}]}, - {mod_event_pusher_http, - [{configs, - [[{callback_module,mod_event_pusher_http_defaults}, - {path,"/notifications"}, - {pool_name,http_pool}]]}]}, - {mod_event_pusher_hook_translator,[]}, - {mod_mam_mnesia_prefs,[muc]}, - {mod_mam_muc, - [{archive_chat_markers,true}, - {full_text_search,true}, - {host,{fqdn,<<"muc.example.com">>}}, - {is_archivable_message,mod_mam_utils}]}, - {mod_event_pusher_rabbit, - [{chat_msg_exchange, - [{name,<<"chat_msg">>}, - {recv_topic,<<"chat_msg_recv">>}, - {sent_topic,<<"chat_msg_sent">>}]}, - {groupchat_msg_exchange, - [{name,<<"groupchat_msg">>}, - {recv_topic,<<"groupchat_msg_recv">>}, - {sent_topic,<<"groupchat_msg_sent">>}]}, - {presence_exchange,[{name,<<"presence">>},{type,<<"topic">>}]}]}, - {mod_vcard, - [{host,{fqdn,<<"directory.example.com">>}}, - {ldap_search_fields, - [{<<"User">>,<<"%u">>},{<<"Full Name">>,<<"displayName">>}]}, - {ldap_search_reported, - [{<<"Full Name">>,<<"FN">>},{<<"Given Name">>,<<"FIRST">>}]}, - {ldap_vcard_map, - [{<<"FAMILY">>,<<"%s">>,[<<"sn">>]}, - {<<"FN">>,<<"%s">>,[<<"displayName">>]}]}, - {matches,1}, - {search,true}]}, - {mod_keystore, - [{keys, - [{access_secret,ram}, - {access_psk,{file,"priv/access_psk"}}, - {provision_psk,{file,"priv/provision_psk"}}]}, - {ram_key_size,1000}]}, - {mod_mam_rdbms_arch,[no_writer,pm]}, - {mod_bosh, - [{inactivity,20}, - {maxpause,120}, - {max_wait,infinity}, - {server_acks,true}]}, - {mod_push_service_mongoosepush, - [{api_version,"v3"}, - {max_http_connections,100}, - {pool_name,mongoose_push_http}]}, - {mod_auth_token, - [{{validity_period,access},{13,minutes}}, - {{validity_period,refresh},{13,days}}]}, - {mod_extdisco, - [[{host,"stun1"}, - {password,"password"}, - {port,3478}, - {transport,"udp"}, - {type,stun}, - {username,"username"}], - [{host,"stun2"}, - {password,"password"}, - {port,2222}, - {transport,"tcp"}, - {type,stun}, - {username,"username"}], - [{host,"192.168.0.1"},{type,turn}]]}, - {mod_mam_cache_user,[muc,pm]}, - {mod_roster,[{store_current_id,true},{versioning,true}]}, - {mod_http_upload, - [{backend,s3}, - {expiration_time,120}, - {host,{prefix,<<"upload.">>}}, - {s3,[{access_key_id,"AKIAIOSFODNN7EXAMPLE"}, - {add_acl,true}, - {bucket_url,"https://s3-eu-west-1.amazonaws.com/mybucket"}, - {region,"eu-west-1"}, - {secret_access_key, - "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}]}]}, - {mod_last,[{backend,mnesia},{iqdisc,{queues,10}}]}, - {mod_offline, - [{access_max_user_messages,max_user_offline_messages}, - {backend,riak}, - {bucket_type,<<"offline">>}]}, - {mod_mam_muc_rdbms_arch, - [muc, - {db_jid_format,mam_jid_rfc}, - {db_message_format,mam_message_xml}]}, - {mod_csi,[{buffer_max,40}]}, - {mod_caps,[{cache_life_time,86},{cache_size,1000}]}, - {mod_pubsub, - [{access_createnode,pubsub_createnode}, - {backend,rdbms}, - {ignore_pep_from_offline,false}, - {last_item_cache,mnesia}, - {max_items_node,1000}, - {pep_mapping,[{<<"urn:xmpp:microblog:0">>,<<"mb">>}]}, - {plugins,[<<"flat">>,<<"pep">>]}]}, - {mod_mam_rdbms_prefs,[pm]}, - {mod_mam_meta, - [{archive_chat_markers,true}, - {backend,rdbms}, - {full_text_search,true}, - {is_archivable_message,mod_mam_utils}, - {muc, - [{async_writer,false}, - {host,{fqdn,<<"muc.example.com">>}}, - {rdbms_message_format,simple}, - {user_prefs_store,mnesia}]}, - {no_stanzaid_element,true}, - {pm,[{full_text_search,false},{user_prefs_store,rdbms}]}]}, - {mod_muc_light, - [{rooms_per_user,10}, - {rooms_per_page,5}, - {rooms_in_rosters,true}, - {max_occupants,50}, - {legacy_mode,true}, - {host,{fqdn,<<"muclight.example.com">>}}, - {equal_occupants,true}, - {config_schema, - [{<<"display-lines">>,30,display_lines,integer}, - {<<"roomname">>,<<"The Room">>,roomname,binary}]}, - {blocking,false}, - {all_can_invite,true}, - {all_can_configure,true}]}, - {mod_stream_management, - [{ack_freq,1}, - {buffer_max,30}, - {resume_timeout,600}, - {stale_h, - [{enabled,true}, - {stale_h_geriatric,3600}, - {stale_h_repeat_after,1800}]}]}, - {mod_muc_log, - [{access_log,muc}, - {cssfile,<<"path/to/css/file">>}, - {outdir,"www/muc"}, - {top_link,{"/","Home"}}]}, - {mod_inbox, - [{aff_changes,true}, - {groupchat,[muclight]}, - {remove_on_kicked,true}, - {reset_markers,[<<"displayed">>]}]}, - {mod_event_pusher_push, - [{backend,mnesia}, - {plugin_module,mod_event_pusher_push_plugin_defaults}, - {virtual_pubsub_hosts,[{fqdn,<<"host1">>},{fqdn,<<"host2">>}]}, - {wpool,[{workers,200}]}]}, - {mod_event_pusher, - [{backends, - [{http, - [{callback_module,mod_event_pusher_http_defaults}, - {path,"/notifications"}, - {pool_name,http_pool}]}, - {push, - [{backend,mnesia}, - {plugin_module,mod_event_pusher_push_plugin_defaults}, - {virtual_pubsub_hosts, - [{fqdn,<<"host1">>},{fqdn,<<"host2">>}]}, - {wpool,[{workers,200}]}]}, - {rabbit, - [{chat_msg_exchange, - [{name,<<"chat_msg">>}, - {recv_topic,<<"chat_msg_recv">>}, - {sent_topic,<<"chat_msg_sent">>}]}, - {groupchat_msg_exchange, - [{name,<<"groupchat_msg">>}, - {recv_topic,<<"groupchat_msg_recv">>}, - {sent_topic,<<"groupchat_msg_sent">>}]}, - {presence_exchange, - [{name,<<"presence">>},{type,<<"topic">>}]}]}, - {sns, - [{access_key_id,"AKIAIOSFODNN7EXAMPLE"}, - {account_id,"123456789012"}, - {muc_messages_topic,"user_messagegroup_sent"}, - {plugin_module,mod_event_pusher_sns_defaults}, - {pm_messages_topic,"user_message_sent"}, - {pool_size,100}, - {presence_updates_topic,"user_presence_updated"}, - {publish_retry_count,2}, - {publish_retry_time_ms,50}, - {region,"eu-west-1"}, - {secret_access_key, - "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, - {sns_host,"sns.eu-west-1.amazonaws.com"}]}]}]}, - {mod_carboncopy,[{iqdisc,no_queue}]}, - {mod_version,[{os_info,true}]}]}. -{{replaced_wait_timeout,<<"dummy_host">>},2000}. -{{replaced_wait_timeout,<<"localhost">>},2000}. diff --git a/test/config_parser_SUITE_data/mongooseim-pgsql.options b/test/config_parser_SUITE_data/mongooseim-pgsql.options deleted file mode 100644 index ab86532761..0000000000 --- a/test/config_parser_SUITE_data/mongooseim-pgsql.options +++ /dev/null @@ -1,264 +0,0 @@ -{all_metrics_are_global,false}. -{default_server_domain,<<"localhost">>}. -{hide_service_name,false}. -{host_types,[]}. -{hosts, - [<<"localhost">>,<<"anonymous.localhost">>,<<"localhost.bis">>]}. -{language,<<"en">>}. -{listen, - [{{5222,{0,0,0,0},tcp}, - ejabberd_c2s, - [{access,c2s}, - {max_stanza_size,65536}, - {shaper,c2s_shaper}, - {certfile,"tools/ssl/mongooseim/server.pem"}, - {dhfile,"tools/ssl/mongooseim/dh_server.pem"}, - starttls, - {zlib,10000}]}, - {{5223,{0,0,0,0},tcp}, - ejabberd_c2s, - [{access,c2s},{max_stanza_size,65536},{shaper,c2s_shaper},{zlib,4096}]}, - {{5280,{0,0,0,0},tcp}, - ejabberd_cowboy, - [{modules, - [{"_","/http-bind",mod_bosh,[]}, - {"_","/ws-xmpp",mod_websockets, - [{ejabberd_service, - [{access,all},{password,"secret"},{shaper_rule,fast}]}]}]}, - {transport_options,[{max_connections,1024},{num_acceptors,10}]}]}, - {{5285,{0,0,0,0},tcp}, - ejabberd_cowboy, - [{modules, - [{"_","/http-bind",mod_bosh,[]}, - {"_","/ws-xmpp",mod_websockets, - [{max_stanza_size,100},{ping_rate,120000},{timeout,infinity}]}, - {"localhost","/api",mongoose_api_admin, - [{auth,{<<"ala">>,<<"makotaipsa">>}}]}, - {"localhost","/api/contacts/{:jid}",mongoose_api_client,[]}]}, - {ssl, - [{certfile,"tools/ssl/mongooseim/cert.pem"}, - {keyfile,"tools/ssl/mongooseim/key.pem"}, - {password,[]}]}, - {transport_options,[{max_connections,1024},{num_acceptors,10}]}]}, - {{8088,{127,0,0,1},tcp}, - ejabberd_cowboy, - [{modules,[{"localhost","/api",mongoose_api_admin,[]}]}, - {transport_options,[{max_connections,1024},{num_acceptors,10}]}]}, - {{8089,{0,0,0,0},tcp}, - ejabberd_cowboy, - [{modules, - [{"_","/api-docs/[...]",cowboy_static, - {priv_dir,cowboy_swagger,"swagger", - [{mimetypes,cow_mimetypes,all}]}}, - {"_","/api-docs/swagger.json",cowboy_swagger_json_handler,#{}}, - {"_","/api-docs",cowboy_swagger_redirect_handler,#{}}, - {"_","/api/sse",lasse_handler,[mongoose_client_api_sse]}, - {"_","/api/contacts/[:jid]",mongoose_client_api_contacts,[]}, - {"_","/api/messages/[:with]",mongoose_client_api_messages,[]}, - {"_","/api/rooms/[:id]",mongoose_client_api_rooms,[]}, - {"_","/api/rooms/[:id]/config",mongoose_client_api_rooms_config, - []}, - {"_","/api/rooms/[:id]/messages", - mongoose_client_api_rooms_messages,[]}, - {"_","/api/rooms/:id/users/[:user]", - mongoose_client_api_rooms_users,[]}]}, - {protocol_options,[{compress,true}]}, - {ssl, - [{certfile,"tools/ssl/mongooseim/cert.pem"}, - {keyfile,"tools/ssl/mongooseim/key.pem"}, - {password,[]}]}, - {transport_options,[{max_connections,1024},{num_acceptors,10}]}]}, - {{5288,{127,0,0,1},tcp}, - ejabberd_cowboy, - [{modules, - [{"localhost","/api",mongoose_api, - [{handlers,[mongoose_api_metrics,mongoose_api_users]}]}]}, - {transport_options,[{max_connections,1024},{num_acceptors,10}]}]}, - {{5269,{0,0,0,0},tcp}, - ejabberd_s2s_in, - [{max_stanza_size,131072}, - {shaper,s2s_shaper}, - {dhfile,"tools/ssl/mongooseim/dh_server.pem"}]}, - {{8888,{127,0,0,1},tcp}, - ejabberd_service, - [{access,all},{password,"secret"},{shaper_rule,fast}]}, - {{8666,{127,0,0,1},tcp}, - ejabberd_service, - [{access,all}, - {conflict_behaviour,kick_old}, - {password,"secret"}, - {shaper_rule,fast}]}, - {{8189,{127,0,0,1},tcp}, - ejabberd_service, - [{access,all}, - {hidden_components,true}, - {password,"secret"}, - {shaper_rule,fast}]}]}. -{loglevel,warning}. -{max_fsm_queue,1000}. -{mongooseimctl_access_commands,[]}. -{outgoing_pools, - [{rdbms,global,default, - [{workers,5}], - [{server, - {pgsql,"localhost","ejabberd","ejabberd","mongooseim_secret", - [{ssl,required}, - {ssl_opts, - [{cacertfile,"priv/ssl/cacert.pem"}, - {server_name_indication,disable}, - {verify,verify_peer}]}]}}]}, - {redis,<<"localhost">>,global_distrib,[{workers,10}],[]}]}. -{outgoing_s2s_port,5299}. -{rdbms_server_type,generic}. -{registration_timeout,infinity}. -{routing_modules, - [mongoose_router_global,mongoose_router_localdomain, - mongoose_router_external_localnode,mongoose_router_external, - mongoose_router_dynamic_domains,ejabberd_s2s]}. -{s2s_certfile,"tools/ssl/mongooseim/server.pem"}. -{s2s_use_starttls,optional}. -{services, - [{service_admin_extra, - [{submods, - [node,accounts,sessions,vcard,gdpr,upload,roster,last,private, - stanza,stats]}]}, - {service_mongoose_system_metrics, - [{initial_report,300000},{periodic_report,10800000}]}]}. -{sm_backend,{mnesia,[]}}. -{{auth,<<"anonymous.localhost">>}, - #{anonymous => #{allow_multiple_connections => true, - protocol => both}, - methods => [anonymous], - sasl_external => [standard], - sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{auth,<<"localhost">>}, - #{methods => [rdbms], - password_format => {scram,[sha256]}, - sasl_external => [standard], - sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth], - scram_iterations => 64}}. -{{auth,<<"localhost.bis">>}, - #{methods => [rdbms], - password_format => {scram,[sha256]}, - sasl_external => [standard], - sasl_mechanisms => [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth], - scram_iterations => 64}}. -{ - {modules,<<"anonymous.localhost">>}, - [{mod_register, - [{access,register}, - {ip_access,[{allow,"127.0.0.0/8"},{deny,"0.0.0.0/0"}]}, - {welcome_message,{"Hello","I am MongooseIM"}}]}, - {mod_adhoc,[]}, - {mod_sic,[]}, - {mod_private,[{backend,rdbms}]}, - {mod_privacy,[{backend,rdbms}]}, - {mod_disco,[{users_can_see_hidden_services,false}]}, - {mod_commands,[]}, - {mod_muc_light_commands,[]}, - {mod_vcard,[{backend,rdbms},{host,{prefix,<<"vjud.">>}}]}, - {mod_blocking,[]}, - {mod_bosh,[]}, - {mod_roster,[{backend,rdbms}]}, - {mod_last,[{backend,rdbms}]}, - {mod_offline,[{backend,rdbms}]}, - {mod_amp,[]}, - {mod_muc_commands,[]}, - {mod_stream_management,[]}, - {mod_carboncopy,[]}]}. -{ - {modules,<<"localhost">>}, - [{mod_register, - [{access,register}, - {ip_access,[{allow,"127.0.0.0/8"},{deny,"0.0.0.0/0"}]}, - {welcome_message,{"Hello","I am MongooseIM"}}]}, - {mod_adhoc,[]}, - {mod_sic,[]}, - {mod_private,[{backend,rdbms}]}, - {mod_privacy,[{backend,rdbms}]}, - {mod_disco,[{users_can_see_hidden_services,false}]}, - {mod_commands,[]}, - {mod_muc_light_commands,[]}, - {mod_vcard,[{backend,rdbms},{host,{prefix,<<"vjud.">>}}]}, - {mod_blocking,[]}, - {mod_bosh,[]}, - {mod_roster,[{backend,rdbms}]}, - {mod_last,[{backend,rdbms}]}, - {mod_offline,[{backend,rdbms}]}, - {mod_amp,[]}, - {mod_muc_commands,[]}, - {mod_stream_management,[]}, - {mod_carboncopy,[]}]}. -{ - {modules,<<"localhost.bis">>}, - [{mod_register, - [{access,register}, - {ip_access,[{allow,"127.0.0.0/8"},{deny,"0.0.0.0/0"}]}, - {welcome_message,{"Hello","I am MongooseIM"}}]}, - {mod_adhoc,[]}, - {mod_sic,[]}, - {mod_private,[{backend,rdbms}]}, - {mod_privacy,[{backend,rdbms}]}, - {mod_disco,[{users_can_see_hidden_services,false}]}, - {mod_commands,[]}, - {mod_muc_light_commands,[]}, - {mod_vcard,[{backend,rdbms},{host,{prefix,<<"vjud.">>}}]}, - {mod_blocking,[]}, - {mod_bosh,[]}, - {mod_roster,[{backend,rdbms}]}, - {mod_last,[{backend,rdbms}]}, - {mod_offline,[{backend,rdbms}]}, - {mod_amp,[]}, - {mod_muc_commands,[]}, - {mod_stream_management,[]}, - {mod_carboncopy,[]}]}. -{{replaced_wait_timeout,<<"anonymous.localhost">>},2000}. -{{replaced_wait_timeout,<<"localhost">>},2000}. -{{replaced_wait_timeout,<<"localhost.bis">>},2000}. -{s2s_address,#{<<"fed1">> => "127.0.0.1"}}. -{{s2s_default_policy,<<"anonymous.localhost">>},allow}. -{{s2s_default_policy,<<"localhost">>},allow}. -{{s2s_default_policy,<<"localhost.bis">>},allow}. -{{access,c2s,global},[{deny,blocked},{allow,all}]}. -{{access,c2s_shaper,global},[{none,admin},{normal,all}]}. -{{access,local,global},[{allow,local}]}. -{{access,mam_get_prefs,global},[{default,all}]}. -{{access,mam_get_prefs_global_shaper,global}, - [{mam_global_shaper,all}]}. -{{access,mam_get_prefs_shaper,global},[{mam_shaper,all}]}. -{{access,mam_lookup_messages,global},[{default,all}]}. -{{access,mam_lookup_messages_global_shaper,global}, - [{mam_global_shaper,all}]}. -{{access,mam_lookup_messages_shaper,global},[{mam_shaper,all}]}. -{{access,mam_set_prefs,global},[{default,all}]}. -{{access,mam_set_prefs_global_shaper,global}, - [{mam_global_shaper,all}]}. -{{access,mam_set_prefs_shaper,global},[{mam_shaper,all}]}. -{{access,max_user_offline_messages,global}, - [{5000,admin},{100,all}]}. -{{access,max_user_sessions,global},[{10,all}]}. -{{access,muc,global},[{allow,all}]}. -{{access,muc_admin,global},[{allow,admin}]}. -{{access,muc_create,global},[{allow,local}]}. -{{access,register,global},[{allow,all}]}. -{{access,s2s_shaper,global},[{fast,all}]}. -{{acl,local,global},[{user_regexp,<<>>}]}. -{{shaper,fast,global},{maxrate,50000}}. -{{shaper,mam_global_shaper,global},{maxrate,1000}}. -{{shaper,mam_shaper,global},{maxrate,1}}. -{{shaper,normal,global},{maxrate,1000}}. diff --git a/test/config_parser_SUITE_data/outgoing_pools.options b/test/config_parser_SUITE_data/outgoing_pools.options deleted file mode 100644 index 1d98f46a8b..0000000000 --- a/test/config_parser_SUITE_data/outgoing_pools.options +++ /dev/null @@ -1,95 +0,0 @@ -{all_metrics_are_global,false}. -{default_server_domain,<<"localhost">>}. -{hide_service_name,false}. -{host_types,[]}. -{hosts, - [<<"localhost">>,<<"anonymous.localhost">>,<<"localhost.bis">>]}. -{language,<<"en">>}. -{loglevel,warning}. -{mongooseimctl_access_commands,[]}. -{outgoing_pools, - [{cassandra,global,default,[], - [{keyspace,"big_mongooseim"}, - {servers, - [{"cassandra_server1.example.com",9042}, - {"cassandra_server2.example.com",9042}]}]}, - {elastic,global,default,[],[{host,"localhost"}]}, - {http,global,mongoose_push_http, - [{workers,50}], - [{server,"https://localhost:8443"}, - {path_prefix,"/"}, - {request_timeout,2000}]}, - {ldap,host,default, - [{workers,5}], - [{password,"ldap-admin-password"}, - {rootdn,"cn=admin,dc=example,dc=com"}, - {servers,["ldap-server.example.com"]}]}, - {rabbit,host,event_pusher, - [{workers,20}], - [{amqp_host,"localhost"}, - {amqp_password,"guest"}, - {amqp_port,5672}, - {amqp_username,"guest"}, - {confirms_enabled,true}, - {max_worker_queue_len,100}]}, - {rdbms,global,default, - [{workers,5}], - [{server, - {pgsql,"localhost","ejabberd","ejabberd","mongooseim_secret", - [{ssl,required}, - {ssl_opts, - [{cacertfile,"priv/ssl/cacert.pem"}, - {server_name_indication,disable}, - {verify,verify_peer}]}]}}, - {keepalive_interval,30}]}, - {redis,<<"localhost">>,global_distrib,[{workers,10}],[]}, - {riak,global,default, - [{strategy,next_worker},{workers,20}], - [{address,"127.0.0.1"}, - {credentials,"username","pass"}, - {port,8087}, - {ssl_opts, - [{certfile,"path/to/cert.pem"}, - {keyfile,"path/to/key.pem"}, - {verify,verify_peer}]}, - {cacertfile,"path/to/cacert.pem"}]}]}. -{rdbms_server_type,generic}. -{registration_timeout,600}. -{routing_modules, - [mongoose_router_global,mongoose_router_localdomain, - mongoose_router_external_localnode,mongoose_router_external, - mongoose_router_dynamic_domains,ejabberd_s2s]}. -{sm_backend,{mnesia,[]}}. -{{auth,<<"anonymous.localhost">>}, - #{methods => [], - sasl_external => [standard], - sasl_mechanisms => - [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{auth,<<"localhost">>}, - #{methods => [], - sasl_external => [standard], - sasl_mechanisms => - [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{auth,<<"localhost.bis">>}, - #{methods => [], - sasl_external => [standard], - sasl_mechanisms => - [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{replaced_wait_timeout,<<"anonymous.localhost">>},2000}. -{{replaced_wait_timeout,<<"localhost">>},2000}. -{{replaced_wait_timeout,<<"localhost.bis">>},2000}. diff --git a/test/config_parser_SUITE_data/s2s_only.options b/test/config_parser_SUITE_data/s2s_only.options deleted file mode 100644 index b2f2179e01..0000000000 --- a/test/config_parser_SUITE_data/s2s_only.options +++ /dev/null @@ -1,58 +0,0 @@ -{all_metrics_are_global,false}. -{default_server_domain,<<"localhost">>}. -{hide_service_name,false}. -{host_types,[]}. -{hosts,[<<"localhost">>,<<"dummy_host">>]}. -{language,<<"en">>}. -{loglevel,warning}. -{mongooseimctl_access_commands,[]}. -{outgoing_s2s_families,[ipv4,ipv6]}. -{outgoing_s2s_port,5299}. -{outgoing_s2s_timeout,10000}. -{rdbms_server_type,generic}. -{registration_timeout,600}. -{routing_modules, - [mongoose_router_global,mongoose_router_localdomain, - mongoose_router_external_localnode,mongoose_router_external, - mongoose_router_dynamic_domains,ejabberd_s2s]}. -{s2s_certfile,"tools/ssl/mongooseim/server.pem"}. -{s2s_ciphers,"TLSv1.2:TLSv1.3"}. -{s2s_dns_options,[{retries,1},{timeout,30}]}. -{s2s_use_starttls,optional}. -{sm_backend,{mnesia,[]}}. -{domain_certfile,#{<<"example.com">> => "/path/to/example_com.pem", - <<"example.org">> => "/path/to/example_org.pem"}}. -{{auth,<<"dummy_host">>}, - #{methods => [], - sasl_external => [standard], - sasl_mechanisms => - [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{auth,<<"localhost">>}, - #{methods => [], - sasl_external => [standard], - sasl_mechanisms => - [cyrsasl_scram_sha512_plus,cyrsasl_scram_sha512, - cyrsasl_scram_sha384_plus,cyrsasl_scram_sha384, - cyrsasl_scram_sha256_plus,cyrsasl_scram_sha256, - cyrsasl_scram_sha224_plus,cyrsasl_scram_sha224, - cyrsasl_scram_sha1_plus,cyrsasl_scram_sha1,cyrsasl_plain, - cyrsasl_anonymous,cyrsasl_oauth]}}. -{{replaced_wait_timeout,<<"dummy_host">>},2000}. -{{replaced_wait_timeout,<<"localhost">>},2000}. -{s2s_address,#{<<"fed1">> => "127.0.0.1", - <<"fed2">> => {"127.0.0.1",8765}}}. -{{s2s_default_policy,<<"dummy_host">>},allow}. -{{s2s_default_policy,<<"localhost">>},allow}. -{{s2s_max_retry_delay,<<"dummy_host">>},30}. -{{s2s_max_retry_delay,<<"localhost">>},30}. -{{s2s_shared,<<"dummy_host">>},<<"shared secret">>}. -{{s2s_shared,<<"localhost">>},<<"shared secret">>}. -{{s2s_host_policy,<<"dummy_host">>},#{<<"fed1">> => allow, - <<"reg1">> => deny}}. -{{s2s_host_policy,<<"localhost">>},#{<<"fed1">> => allow, - <<"reg1">> => deny}}. diff --git a/test/config_parser_helper.erl b/test/config_parser_helper.erl new file mode 100644 index 0000000000..bbcac42781 --- /dev/null +++ b/test/config_parser_helper.erl @@ -0,0 +1,693 @@ +%% @doc Expected parsed and processed options for TOML parser tests + +-module(config_parser_helper). + +-compile([export_all, nowarn_export_all]). + +%% Expected configuration options for predefined configurations. +%% For each clause there is a corresponding TOML file in config_parser_SUITE_data. +options("host_types") -> + [{all_metrics_are_global, false}, + {default_server_domain, <<"localhost">>}, + {hide_service_name, false}, + {host_types, + [<<"this is host type">>, <<"some host type">>, + <<"another host type">>, <<"yet another host type">>]}, + {hosts, [<<"localhost">>]}, + {language, <<"en">>}, + {loglevel, warning}, + {mongooseimctl_access_commands, []}, + {rdbms_server_type, generic}, + {registration_timeout, 600}, + {routing_modules, ejabberd_router:default_routing_modules()}, + {sm_backend, {mnesia, []}}, + {{auth, <<"another host type">>}, auth_with_methods([])}, + {{auth, <<"localhost">>}, auth_with_methods([test3])}, + {{auth, <<"some host type">>}, auth_with_methods([test2])}, + {{auth, <<"this is host type">>}, auth_with_methods([test1])}, + {{auth, <<"yet another host type">>}, auth_with_methods([test1, test2])}, + {{modules, <<"another host type">>}, [{test_mim_module2, []}]}, + {{modules, <<"localhost">>}, [{test_mim_module3, []}]}, + {{modules, <<"some host type">>}, []}, + {{modules, <<"this is host type">>}, []}, + {{modules, <<"yet another host type">>}, [{test_mim_module1, []}]}, + {{replaced_wait_timeout, <<"another host type">>}, 2000}, + {{replaced_wait_timeout, <<"localhost">>}, 2000}, + {{replaced_wait_timeout, <<"some host type">>}, 2000}, + {{replaced_wait_timeout, <<"this is host type">>}, 2000}, + {{replaced_wait_timeout, <<"yet another host type">>}, 2000}]; +options("miscellaneous") -> + [{all_metrics_are_global, false}, + {cowboy_server_name, "Apache"}, + {default_server_domain, <<"localhost">>}, + {hide_service_name, true}, + {host_types, []}, + {hosts, [<<"localhost">>, <<"anonymous.localhost">>]}, + {language, <<"en">>}, + {listen, + [{{5280, {0, 0, 0, 0}, tcp}, + ejabberd_cowboy, + [{modules, + [{"_", "/ws-xmpp", mod_websockets, + [{ejabberd_service, + [{access, all}, + {max_fsm_queue, 1000}, + {password, "secret"}, + {shaper_rule, fast}]}]}]}, + {transport_options, [{max_connections, 1024}, {num_acceptors, 10}]}]}]}, + {loglevel, warning}, + {mongooseimctl_access_commands, + [{local, ["join_cluster"], [{node, "mongooseim@prime"}]}]}, + {rdbms_server_type, mssql}, + {registration_timeout, 600}, + {routing_modules, + [mongoose_router_global, mongoose_router_localdomain]}, + {services, + [{service_mongoose_system_metrics, + [{initial_report, 300000}, + {periodic_report, 10800000}, + report, + {tracking_id, "UA-123456789"}]}]}, + {sm_backend, {mnesia, []}}, + {{auth, <<"anonymous.localhost">>}, custom_auth()}, + {{auth, <<"localhost">>}, custom_auth()}, + {{replaced_wait_timeout, <<"anonymous.localhost">>}, 2000}, + {{replaced_wait_timeout, <<"localhost">>}, 2000}, + {{route_subdomains, <<"anonymous.localhost">>}, s2s}, + {{route_subdomains, <<"localhost">>}, s2s}]; +options("modules") -> + [{all_metrics_are_global, false}, + {default_server_domain, <<"localhost">>}, + {hide_service_name, false}, + {host_types, []}, + {hosts, [<<"localhost">>, <<"dummy_host">>]}, + {language, <<"en">>}, + {loglevel, warning}, + {mongooseimctl_access_commands, []}, + {rdbms_server_type, generic}, + {registration_timeout, 600}, + {routing_modules, ejabberd_router:default_routing_modules()}, + {sm_backend, {mnesia, []}}, + {{auth, <<"dummy_host">>}, default_auth()}, + {{auth, <<"localhost">>}, default_auth()}, + {{modules, <<"dummy_host">>}, all_modules()}, + {{modules, <<"localhost">>}, all_modules()}, + {{replaced_wait_timeout, <<"dummy_host">>}, 2000}, + {{replaced_wait_timeout, <<"localhost">>}, 2000}]; +options("mongooseim-pgsql") -> + [{all_metrics_are_global, false}, + {default_server_domain, <<"localhost">>}, + {hide_service_name, false}, + {host_types, []}, + {hosts, + [<<"localhost">>, <<"anonymous.localhost">>, <<"localhost.bis">>]}, + {language, <<"en">>}, + {listen, + [{{5222, {0, 0, 0, 0}, tcp}, + ejabberd_c2s, + [{access, c2s}, + {max_stanza_size, 65536}, + {shaper, c2s_shaper}, + {certfile, "tools/ssl/mongooseim/server.pem"}, + {dhfile, "tools/ssl/mongooseim/dh_server.pem"}, + starttls, + {zlib, 10000}]}, + {{5223, {0, 0, 0, 0}, tcp}, + ejabberd_c2s, + [{access, c2s}, {max_stanza_size, 65536}, {shaper, c2s_shaper}, {zlib, 4096}]}, + {{5280, {0, 0, 0, 0}, tcp}, + ejabberd_cowboy, + [{modules, + [{"_", "/http-bind", mod_bosh, []}, + {"_", "/ws-xmpp", mod_websockets, + [{ejabberd_service, + [{access, all}, {password, "secret"}, {shaper_rule, fast}]}]}]}, + {transport_options, [{max_connections, 1024}, {num_acceptors, 10}]}]}, + {{5285, {0, 0, 0, 0}, tcp}, + ejabberd_cowboy, + [{modules, + [{"_", "/http-bind", mod_bosh, []}, + {"_", "/ws-xmpp", mod_websockets, + [{max_stanza_size, 100}, {ping_rate, 120000}, {timeout, infinity}]}, + {"localhost", "/api", mongoose_api_admin, + [{auth, {<<"ala">>, <<"makotaipsa">>}}]}, + {"localhost", "/api/contacts/{:jid}", mongoose_api_client, []}]}, + {ssl, + [{certfile, "tools/ssl/mongooseim/cert.pem"}, + {keyfile, "tools/ssl/mongooseim/key.pem"}, + {password, []}]}, + {transport_options, [{max_connections, 1024}, {num_acceptors, 10}]}]}, + {{8088, {127, 0, 0, 1}, tcp}, + ejabberd_cowboy, + [{modules, [{"localhost", "/api", mongoose_api_admin, []}]}, + {transport_options, [{max_connections, 1024}, {num_acceptors, 10}]}]}, + {{8089, {0, 0, 0, 0}, tcp}, + ejabberd_cowboy, + [{modules, + [{"_", "/api-docs/[...]", cowboy_static, + {priv_dir, cowboy_swagger, "swagger", + [{mimetypes, cow_mimetypes, all}]}}, + {"_", "/api-docs/swagger.json", cowboy_swagger_json_handler, #{}}, + {"_", "/api-docs", cowboy_swagger_redirect_handler, #{}}, + {"_", "/api/sse", lasse_handler, [mongoose_client_api_sse]}, + {"_", "/api/contacts/[:jid]", mongoose_client_api_contacts, []}, + {"_", "/api/messages/[:with]", mongoose_client_api_messages, []}, + {"_", "/api/rooms/[:id]", mongoose_client_api_rooms, []}, + {"_", "/api/rooms/[:id]/config", mongoose_client_api_rooms_config, + []}, + {"_", "/api/rooms/[:id]/messages", + mongoose_client_api_rooms_messages, []}, + {"_", "/api/rooms/:id/users/[:user]", + mongoose_client_api_rooms_users, []}]}, + {protocol_options, [{compress, true}]}, + {ssl, + [{certfile, "tools/ssl/mongooseim/cert.pem"}, + {keyfile, "tools/ssl/mongooseim/key.pem"}, + {password, []}]}, + {transport_options, [{max_connections, 1024}, {num_acceptors, 10}]}]}, + {{5288, {127, 0, 0, 1}, tcp}, + ejabberd_cowboy, + [{modules, + [{"localhost", "/api", mongoose_api, + [{handlers, [mongoose_api_metrics, mongoose_api_users]}]}]}, + {transport_options, [{max_connections, 1024}, {num_acceptors, 10}]}]}, + {{5269, {0, 0, 0, 0}, tcp}, + ejabberd_s2s_in, + [{max_stanza_size, 131072}, + {shaper, s2s_shaper}, + {dhfile, "tools/ssl/mongooseim/dh_server.pem"}]}, + {{8888, {127, 0, 0, 1}, tcp}, + ejabberd_service, + [{access, all}, {password, "secret"}, {shaper_rule, fast}]}, + {{8666, {127, 0, 0, 1}, tcp}, + ejabberd_service, + [{access, all}, + {conflict_behaviour, kick_old}, + {password, "secret"}, + {shaper_rule, fast}]}, + {{8189, {127, 0, 0, 1}, tcp}, + ejabberd_service, + [{access, all}, + {hidden_components, true}, + {password, "secret"}, + {shaper_rule, fast}]}]}, + {loglevel, warning}, + {max_fsm_queue, 1000}, + {mongooseimctl_access_commands, []}, + {outgoing_pools, + [{rdbms, global, default, + [{workers, 5}], + [{server, + {pgsql, "localhost", "ejabberd", "ejabberd", "mongooseim_secret", + [{ssl, required}, + {ssl_opts, + [{cacertfile, "priv/ssl/cacert.pem"}, + {server_name_indication, disable}, + {verify, verify_peer}]}]}}]}, + {redis, <<"localhost">>, global_distrib, [{workers, 10}], []}]}, + {outgoing_s2s_port, 5299}, + {rdbms_server_type, generic}, + {registration_timeout, infinity}, + {routing_modules, ejabberd_router:default_routing_modules()}, + {s2s_certfile, "tools/ssl/mongooseim/server.pem"}, + {s2s_use_starttls, optional}, + {services, + [{service_admin_extra, + [{submods, + [node, accounts, sessions, vcard, gdpr, upload, roster, last, private, + stanza, stats]}]}, + {service_mongoose_system_metrics, + [{initial_report, 300000}, {periodic_report, 10800000}]}]}, + {sm_backend, {mnesia, []}}, + {{auth, <<"anonymous.localhost">>}, + (default_auth())#{anonymous => #{allow_multiple_connections => true, + protocol => both}, + methods => [anonymous]}}, + {{auth, <<"localhost">>}, + (default_auth())#{methods => [rdbms], + password_format => {scram, [sha256]}, + scram_iterations => 64}}, + {{auth, <<"localhost.bis">>}, + (default_auth())#{methods => [rdbms], + password_format => {scram, [sha256]}, + scram_iterations => 64}}, + {{modules, <<"anonymous.localhost">>}, pgsql_modules()}, + {{modules, <<"localhost">>}, pgsql_modules()}, + {{modules, <<"localhost.bis">>}, pgsql_modules()}, + {{replaced_wait_timeout, <<"anonymous.localhost">>}, 2000}, + {{replaced_wait_timeout, <<"localhost">>}, 2000}, + {{replaced_wait_timeout, <<"localhost.bis">>}, 2000}, + {s2s_address, #{<<"fed1">> => "127.0.0.1"}}, + {{s2s_default_policy, <<"anonymous.localhost">>}, allow}, + {{s2s_default_policy, <<"localhost">>}, allow}, + {{s2s_default_policy, <<"localhost.bis">>}, allow}, + {{access, c2s, global}, [{deny, blocked}, {allow, all}]}, + {{access, c2s_shaper, global}, [{none, admin}, {normal, all}]}, + {{access, local, global}, [{allow, local}]}, + {{access, mam_get_prefs, global}, [{default, all}]}, + {{access, mam_get_prefs_global_shaper, global}, + [{mam_global_shaper, all}]}, + {{access, mam_get_prefs_shaper, global}, [{mam_shaper, all}]}, + {{access, mam_lookup_messages, global}, [{default, all}]}, + {{access, mam_lookup_messages_global_shaper, global}, + [{mam_global_shaper, all}]}, + {{access, mam_lookup_messages_shaper, global}, [{mam_shaper, all}]}, + {{access, mam_set_prefs, global}, [{default, all}]}, + {{access, mam_set_prefs_global_shaper, global}, + [{mam_global_shaper, all}]}, + {{access, mam_set_prefs_shaper, global}, [{mam_shaper, all}]}, + {{access, max_user_offline_messages, global}, + [{5000, admin}, {100, all}]}, + {{access, max_user_sessions, global}, [{10, all}]}, + {{access, muc, global}, [{allow, all}]}, + {{access, muc_admin, global}, [{allow, admin}]}, + {{access, muc_create, global}, [{allow, local}]}, + {{access, register, global}, [{allow, all}]}, + {{access, s2s_shaper, global}, [{fast, all}]}, + {{acl, local, global}, [{user_regexp, <<>>}]}, + {{shaper, fast, global}, {maxrate, 50000}}, + {{shaper, mam_global_shaper, global}, {maxrate, 1000}}, + {{shaper, mam_shaper, global}, {maxrate, 1}}, + {{shaper, normal, global}, {maxrate, 1000}}]; +options("outgoing_pools") -> + [{all_metrics_are_global, false}, + {default_server_domain, <<"localhost">>}, + {hide_service_name, false}, + {host_types, []}, + {hosts, + [<<"localhost">>, <<"anonymous.localhost">>, <<"localhost.bis">>]}, + {language, <<"en">>}, + {loglevel, warning}, + {mongooseimctl_access_commands, []}, + {outgoing_pools, + [{cassandra, global, default, [], + [{keyspace, "big_mongooseim"}, + {servers, + [{"cassandra_server1.example.com", 9042}, + {"cassandra_server2.example.com", 9042}]}]}, + {elastic, global, default, [], [{host, "localhost"}]}, + {http, global, mongoose_push_http, + [{workers, 50}], + [{server, "https://localhost:8443"}, + {path_prefix, "/"}, + {request_timeout, 2000}]}, + {ldap, host, default, + [{workers, 5}], + [{password, "ldap-admin-password"}, + {rootdn, "cn=admin,dc=example,dc=com"}, + {servers, ["ldap-server.example.com"]}]}, + {rabbit, host, event_pusher, + [{workers, 20}], + [{amqp_host, "localhost"}, + {amqp_password, "guest"}, + {amqp_port, 5672}, + {amqp_username, "guest"}, + {confirms_enabled, true}, + {max_worker_queue_len, 100}]}, + {rdbms, global, default, + [{workers, 5}], + [{server, + {pgsql, "localhost", "ejabberd", "ejabberd", "mongooseim_secret", + [{ssl, required}, + {ssl_opts, + [{cacertfile, "priv/ssl/cacert.pem"}, + {server_name_indication, disable}, + {verify, verify_peer}]}]}}, + {keepalive_interval, 30}]}, + {redis, <<"localhost">>, global_distrib, [{workers, 10}], []}, + {riak, global, default, + [{strategy, next_worker}, {workers, 20}], + [{address, "127.0.0.1"}, + {credentials, "username", "pass"}, + {port, 8087}, + {ssl_opts, + [{certfile, "path/to/cert.pem"}, + {keyfile, "path/to/key.pem"}, + {verify, verify_peer}]}, + {cacertfile, "path/to/cacert.pem"}]}]}, + {rdbms_server_type, generic}, + {registration_timeout, 600}, + {routing_modules, ejabberd_router:default_routing_modules()}, + {sm_backend, {mnesia, []}}, + {{auth, <<"anonymous.localhost">>}, default_auth()}, + {{auth, <<"localhost">>}, default_auth()}, + {{auth, <<"localhost.bis">>}, default_auth()}, + {{replaced_wait_timeout, <<"anonymous.localhost">>}, 2000}, + {{replaced_wait_timeout, <<"localhost">>}, 2000}, + {{replaced_wait_timeout, <<"localhost.bis">>}, 2000}]; +options("s2s_only") -> + [{all_metrics_are_global, false}, + {default_server_domain, <<"localhost">>}, + {hide_service_name, false}, + {host_types, []}, + {hosts, [<<"localhost">>, <<"dummy_host">>]}, + {language, <<"en">>}, + {loglevel, warning}, + {mongooseimctl_access_commands, []}, + {outgoing_s2s_families, [ipv4, ipv6]}, + {outgoing_s2s_port, 5299}, + {outgoing_s2s_timeout, 10000}, + {rdbms_server_type, generic}, + {registration_timeout, 600}, + {routing_modules, ejabberd_router:default_routing_modules()}, + {s2s_certfile, "tools/ssl/mongooseim/server.pem"}, + {s2s_ciphers, "TLSv1.2:TLSv1.3"}, + {s2s_dns_options, [{retries, 1}, {timeout, 30}]}, + {s2s_use_starttls, optional}, + {sm_backend, {mnesia, []}}, + {domain_certfile, #{<<"example.com">> => "/path/to/example_com.pem", + <<"example.org">> => "/path/to/example_org.pem"}}, + {{auth, <<"dummy_host">>}, default_auth()}, + {{auth, <<"localhost">>}, default_auth()}, + {{replaced_wait_timeout, <<"dummy_host">>}, 2000}, + {{replaced_wait_timeout, <<"localhost">>}, 2000}, + {s2s_address, #{<<"fed1">> => "127.0.0.1", + <<"fed2">> => {"127.0.0.1", 8765}}}, + {{s2s_default_policy, <<"dummy_host">>}, allow}, + {{s2s_default_policy, <<"localhost">>}, allow}, + {{s2s_max_retry_delay, <<"dummy_host">>}, 30}, + {{s2s_max_retry_delay, <<"localhost">>}, 30}, + {{s2s_shared, <<"dummy_host">>}, <<"shared secret">>}, + {{s2s_shared, <<"localhost">>}, <<"shared secret">>}, + {{s2s_host_policy, <<"dummy_host">>}, #{<<"fed1">> => allow, + <<"reg1">> => deny}}, + {{s2s_host_policy, <<"localhost">>}, #{<<"fed1">> => allow, + <<"reg1">> => deny}}]. + +all_modules() -> + [{mod_jingle_sip, + [{listen_port, 5600}, + {local_host, "localhost"}, + {proxy_host, "localhost"}, + {proxy_port, 5600}, + {sdp_origin, "127.0.0.1"}]}, + {mod_shared_roster_ldap, + [{ldap_base, "ou=Users,dc=ejd,dc=com"}, + {ldap_filter, "(objectClass=inetOrgPerson)"}, + {ldap_group_cache_validity, 1}, + {ldap_groupattr, "ou"}, + {ldap_memberattr, "cn"}, + {ldap_rfilter, "(objectClass=inetOrgPerson)"}, + {ldap_user_cache_validity, 1}, + {ldap_userdesc, "cn"}]}, + {mod_mam_rdbms_user, [muc, pm]}, + {mod_global_distrib, + [{bounce, [{max_retries, 3}, {resend_after_ms, 300}]}, + {cache, [{domain_lifetime_seconds, 60}]}, + {connections, + [{advertised_endpoints, [{"172.16.0.2", 5555}]}, + {connections_per_endpoint, 30}, + {endpoints, [{"172.16.0.2", 5555}]}, + {tls_opts, [{cafile, "priv/ca.pem"}, {certfile, "priv/dc1.pem"}]}]}, + {global_host, "example.com"}, + {local_host, "datacenter1.example.com"}, + {redis, [{pool, global_distrib}]}]}, + {mod_register, + [{access, all}, + {password_strength, 32}, + {registration_watchers, [<<"JID1">>, <<"JID2">>]}, + {welcome_message, {"Subject", "Body"}}]}, + {mod_mam_rdbms_async_pool_writer, [pm]}, + {mod_adhoc, [{iqdisc, one_queue}, {report_commands_node, true}]}, + {mod_event_pusher_sns, + [{access_key_id, "AKIAIOSFODNN7EXAMPLE"}, + {account_id, "123456789012"}, + {muc_messages_topic, "user_messagegroup_sent"}, + {plugin_module, mod_event_pusher_sns_defaults}, + {pm_messages_topic, "user_message_sent"}, + {pool_size, 100}, + {presence_updates_topic, "user_presence_updated"}, + {publish_retry_count, 2}, + {publish_retry_time_ms, 50}, + {region, "eu-west-1"}, + {secret_access_key, "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, + {sns_host, "sns.eu-west-1.amazonaws.com"}]}, + {mod_muc, + [{access, muc}, + {access_create, muc_create}, + {default_room_options, + [{affiliations, + [{{<<"alice">>, <<"localhost">>, <<"resource1">>}, member}, + {{<<"bob">>, <<"localhost">>, <<"resource2">>}, owner}]}, + {password_protected, true}]}, + {host, {fqdn, <<"muc.example.com">>}}, + {http_auth_pool, my_auth_pool}]}, + {mod_ping, + [{ping_interval, 60000}, + {ping_req_timeout, 32000}, + {send_pings, true}, + {timeout_action, none}]}, + {mod_mam, + [{archive_chat_markers, true}, + {full_text_search, false}, + {is_archivable_message, mod_mam_utils}, + {no_stanzaid_element, true}]}, + {mod_disco, + [{extra_domains, [<<"some_domain">>, <<"another_domain">>]}, + {iqdisc, one_queue}, + {server_info, + [[{name, <<"abuse-address">>}, {urls, [<<"admin@example.com">>]}], + [{modules, [mod_muc, mod_disco]}, + {name, <<"friendly-spirits">>}, + {urls, [<<"spirit1@localhost">>, <<"spirit2@localhost">>]}]]}, + {users_can_see_hidden_services, true}]}, + {mod_event_pusher_http, + [{configs, + [[{callback_module, mod_event_pusher_http_defaults}, + {path, "/notifications"}, + {pool_name, http_pool}]]}]}, + {mod_event_pusher_hook_translator, []}, + {mod_mam_mnesia_prefs, [muc]}, + {mod_mam_muc, + [{archive_chat_markers, true}, + {full_text_search, true}, + {host, {fqdn, <<"muc.example.com">>}}, + {is_archivable_message, mod_mam_utils}]}, + {mod_event_pusher_rabbit, + [{chat_msg_exchange, + [{name, <<"chat_msg">>}, + {recv_topic, <<"chat_msg_recv">>}, + {sent_topic, <<"chat_msg_sent">>}]}, + {groupchat_msg_exchange, + [{name, <<"groupchat_msg">>}, + {recv_topic, <<"groupchat_msg_recv">>}, + {sent_topic, <<"groupchat_msg_sent">>}]}, + {presence_exchange, [{name, <<"presence">>}, {type, <<"topic">>}]}]}, + {mod_vcard, + [{host, {fqdn, <<"directory.example.com">>}}, + {ldap_search_fields, + [{<<"User">>, <<"%u">>}, {<<"Full Name">>, <<"displayName">>}]}, + {ldap_search_reported, + [{<<"Full Name">>, <<"FN">>}, {<<"Given Name">>, <<"FIRST">>}]}, + {ldap_vcard_map, + [{<<"FAMILY">>, <<"%s">>, [<<"sn">>]}, + {<<"FN">>, <<"%s">>, [<<"displayName">>]}]}, + {matches, 1}, + {search, true}]}, + {mod_keystore, + [{keys, + [{access_secret, ram}, + {access_psk, {file, "priv/access_psk"}}, + {provision_psk, {file, "priv/provision_psk"}}]}, + {ram_key_size, 1000}]}, + {mod_mam_rdbms_arch, [no_writer, pm]}, + {mod_bosh, + [{inactivity, 20}, + {maxpause, 120}, + {max_wait, infinity}, + {server_acks, true}]}, + {mod_push_service_mongoosepush, + [{api_version, "v3"}, + {max_http_connections, 100}, + {pool_name, mongoose_push_http}]}, + {mod_auth_token, + [{{validity_period, access}, {13, minutes}}, + {{validity_period, refresh}, {13, days}}]}, + {mod_extdisco, + [[{host, "stun1"}, + {password, "password"}, + {port, 3478}, + {transport, "udp"}, + {type, stun}, + {username, "username"}], + [{host, "stun2"}, + {password, "password"}, + {port, 2222}, + {transport, "tcp"}, + {type, stun}, + {username, "username"}], + [{host, "192.168.0.1"}, {type, turn}]]}, + {mod_mam_cache_user, [muc, pm]}, + {mod_roster, [{store_current_id, true}, {versioning, true}]}, + {mod_http_upload, + [{backend, s3}, + {expiration_time, 120}, + {host, {prefix, <<"upload.">>}}, + {s3, [{access_key_id, "AKIAIOSFODNN7EXAMPLE"}, + {add_acl, true}, + {bucket_url, "https://s3-eu-west-1.amazonaws.com/mybucket"}, + {region, "eu-west-1"}, + {secret_access_key, + "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}]}]}, + {mod_last, [{backend, mnesia}, {iqdisc, {queues, 10}}]}, + {mod_offline, + [{access_max_user_messages, max_user_offline_messages}, + {backend, riak}, + {bucket_type, <<"offline">>}]}, + {mod_mam_muc_rdbms_arch, + [muc, + {db_jid_format, mam_jid_rfc}, + {db_message_format, mam_message_xml}]}, + {mod_csi, [{buffer_max, 40}]}, + {mod_caps, [{cache_life_time, 86}, {cache_size, 1000}]}, + {mod_pubsub, + [{access_createnode, pubsub_createnode}, + {backend, rdbms}, + {ignore_pep_from_offline, false}, + {last_item_cache, mnesia}, + {max_items_node, 1000}, + {pep_mapping, [{<<"urn:xmpp:microblog:0">>, <<"mb">>}]}, + {plugins, [<<"flat">>, <<"pep">>]}]}, + {mod_mam_rdbms_prefs, [pm]}, + {mod_mam_meta, + [{archive_chat_markers, true}, + {backend, rdbms}, + {full_text_search, true}, + {is_archivable_message, mod_mam_utils}, + {muc, + [{async_writer, false}, + {host, {fqdn, <<"muc.example.com">>}}, + {rdbms_message_format, simple}, + {user_prefs_store, mnesia}]}, + {no_stanzaid_element, true}, + {pm, [{full_text_search, false}, {user_prefs_store, rdbms}]}]}, + {mod_muc_light, + [{rooms_per_user, 10}, + {rooms_per_page, 5}, + {rooms_in_rosters, true}, + {max_occupants, 50}, + {legacy_mode, true}, + {host, {fqdn, <<"muclight.example.com">>}}, + {equal_occupants, true}, + {config_schema, + [{<<"display-lines">>, 30, display_lines, integer}, + {<<"roomname">>, <<"The Room">>, roomname, binary}]}, + {blocking, false}, + {all_can_invite, true}, + {all_can_configure, true}]}, + {mod_stream_management, + [{ack_freq, 1}, + {buffer_max, 30}, + {resume_timeout, 600}, + {stale_h, + [{enabled, true}, + {stale_h_geriatric, 3600}, + {stale_h_repeat_after, 1800}]}]}, + {mod_muc_log, + [{access_log, muc}, + {cssfile, <<"path/to/css/file">>}, + {outdir, "www/muc"}, + {top_link, {"/", "Home"}}]}, + {mod_inbox, + [{aff_changes, true}, + {groupchat, [muclight]}, + {remove_on_kicked, true}, + {reset_markers, [<<"displayed">>]}]}, + {mod_event_pusher_push, + [{backend, mnesia}, + {plugin_module, mod_event_pusher_push_plugin_defaults}, + {virtual_pubsub_hosts, [{fqdn, <<"host1">>}, {fqdn, <<"host2">>}]}, + {wpool, [{workers, 200}]}]}, + {mod_event_pusher, + [{backends, + [{http, + [{callback_module, mod_event_pusher_http_defaults}, + {path, "/notifications"}, + {pool_name, http_pool}]}, + {push, + [{backend, mnesia}, + {plugin_module, mod_event_pusher_push_plugin_defaults}, + {virtual_pubsub_hosts, + [{fqdn, <<"host1">>}, {fqdn, <<"host2">>}]}, + {wpool, [{workers, 200}]}]}, + {rabbit, + [{chat_msg_exchange, + [{name, <<"chat_msg">>}, + {recv_topic, <<"chat_msg_recv">>}, + {sent_topic, <<"chat_msg_sent">>}]}, + {groupchat_msg_exchange, + [{name, <<"groupchat_msg">>}, + {recv_topic, <<"groupchat_msg_recv">>}, + {sent_topic, <<"groupchat_msg_sent">>}]}, + {presence_exchange, + [{name, <<"presence">>}, {type, <<"topic">>}]}]}, + {sns, + [{access_key_id, "AKIAIOSFODNN7EXAMPLE"}, + {account_id, "123456789012"}, + {muc_messages_topic, "user_messagegroup_sent"}, + {plugin_module, mod_event_pusher_sns_defaults}, + {pm_messages_topic, "user_message_sent"}, + {pool_size, 100}, + {presence_updates_topic, "user_presence_updated"}, + {publish_retry_count, 2}, + {publish_retry_time_ms, 50}, + {region, "eu-west-1"}, + {secret_access_key, + "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, + {sns_host, "sns.eu-west-1.amazonaws.com"}]}]}]}, + {mod_carboncopy, [{iqdisc, no_queue}]}, + {mod_version, [{os_info, true}]}]. + +pgsql_modules() -> + [{mod_register, + [{access, register}, + {ip_access, [{allow, "127.0.0.0/8"}, {deny, "0.0.0.0/0"}]}, + {welcome_message, {"Hello", "I am MongooseIM"}}]}, + {mod_adhoc, []}, + {mod_sic, []}, + {mod_private, [{backend, rdbms}]}, + {mod_privacy, [{backend, rdbms}]}, + {mod_disco, [{users_can_see_hidden_services, false}]}, + {mod_commands, []}, + {mod_muc_light_commands, []}, + {mod_vcard, [{backend, rdbms}, {host, {prefix, <<"vjud.">>}}]}, + {mod_blocking, []}, + {mod_bosh, []}, + {mod_roster, [{backend, rdbms}]}, + {mod_last, [{backend, rdbms}]}, + {mod_offline, [{backend, rdbms}]}, + {mod_amp, []}, + {mod_muc_commands, []}, + {mod_stream_management, []}, + {mod_carboncopy, []}]. + +auth_with_methods(Methods) -> + maps:merge(default_auth(), #{methods => Methods}). + +custom_auth() -> + maps:merge(default_auth(), extra_auth()). + +extra_auth() -> + #{anonymous => #{allow_multiple_connections => true, + protocol => sasl_anon}, + http => #{basic_auth => "admin:admin"}, + external => #{instances => 1, + program => "/usr/bin/authenticator"}, + jwt => #{algorithm => <<"RS256">>, + secret => {value, "secret123"}, + username_key => user}, + ldap => #{base => <<"ou=Users,dc=esl,dc=com">>, + bind_pool_tag => bind, + deref => never, + dn_filter => {<<"(&(name=%s)(owner=%D)(user=%u@%d))">>, [<<"sn">>]}, + filter => <<"(&(objectClass=shadowAccount)(memberOf=Jabber Users))">>, + local_filter => {equal, {"accountStatus", ["enabled"]}}, + pool_tag => default, + uids => [<<"uid">>, {<<"uid2">>, <<"%u">>}]}, + rdbms => #{users_number_estimate => true}, + riak => #{bucket_type => <<"user_bucket">>}}. + +default_auth() -> + #{methods => [], + sasl_external => [standard], + sasl_mechanisms => cyrsasl:default_modules()}. diff --git a/test/mongoose_config_SUITE.erl b/test/mongoose_config_SUITE.erl index c229c47bfb..dc3651dfc0 100644 --- a/test/mongoose_config_SUITE.erl +++ b/test/mongoose_config_SUITE.erl @@ -128,9 +128,7 @@ minimal_config_opts() -> {registration_timeout, 600}, {routing_modules, ejabberd_router:default_routing_modules()}, {sm_backend, {mnesia, []}}, - {{auth,<<"localhost">>}, #{methods => [], - sasl_external => [standard], - sasl_mechanisms => cyrsasl:default_modules()}}, + {{auth,<<"localhost">>}, config_parser_helper:default_auth()}, {{replaced_wait_timeout, <<"localhost">>}, 2000}]. start_slave_node(Config) ->