Skip to content

Commit

Permalink
Set default password strentgh to a recommended value
Browse files Browse the repository at this point in the history
  • Loading branch information
gustawlippa committed Mar 22, 2022
1 parent 4b73b3d commit e19d3cf
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
10 changes: 8 additions & 2 deletions big_tests/tests/accounts_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,15 @@ mod_register_options() ->
init_per_group(bad_cancelation, Config) ->
escalus:create_users(Config, escalus:get_users([alice]));
init_per_group(change_account_details, Config) ->
[{escalus_user_db, {module, escalus_ejabberd}} |Config];
Opts = maps:merge(mod_register_options(), #{password_strength => 0}),
ok = dynamic_modules:ensure_modules(host_type(), [{mod_register, Opts}]),
[{escalus_user_db, {module, escalus_ejabberd}}, {mod_register, Opts} |Config];
init_per_group(change_account_details_store_plain, Config) ->
AuthOpts = mongoose_helper:auth_opts_with_password_format(plain),
Config1 = mongoose_helper:backup_and_set_config_option(Config, auth, AuthOpts),
[{escalus_user_db, {module, escalus_ejabberd}} |Config1];
RegisterOpts = maps:merge(mod_register_options(), #{password_strength => 0}),
ok = dynamic_modules:ensure_modules(host_type(), [{mod_register, RegisterOpts}]),
[{escalus_user_db, {module, escalus_ejabberd}}, {mod_register, RegisterOpts} |Config1];
init_per_group(registration_timeout, Config) ->
set_registration_timeout(Config);
init_per_group(utilities, Config) ->
Expand All @@ -104,9 +108,11 @@ init_per_group(_GroupName, Config) ->
Config.

end_per_group(change_account_details, Config) ->
restore_mod_register_options(Config),
escalus_fresh:clean(),
[{escalus_user_db, xmpp} | Config];
end_per_group(change_account_details_store_plain, Config) ->
restore_mod_register_options(Config),
escalus_fresh:clean(),
mongoose_helper:restore_config(Config),
[{escalus_user_db, xmpp} | Config];
Expand Down
4 changes: 2 additions & 2 deletions doc/modules/mod_register.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ List of JIDs, which should receive a `<message>` notification about every succes

### `modules.mod_register.password_strength`
* **Syntax:** non-negative integer
* **Default:** `0`
* **Example:** `password_strength = 32`
* **Default:** `32`
* **Example:** `password_strength = 44`

Specifies minimal entropy of allowed password.
Entropy is measured with `ejabberd_auth:entropy/1`.
Expand Down
2 changes: 1 addition & 1 deletion src/mod_register.erl
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ config_spec() ->
defaults = #{<<"iqdisc">> => one_queue,
<<"access">> => all,
<<"registration_watchers">> => [],
<<"password_strength">> => 0,
<<"password_strength">> => 32,
<<"ip_access">> => []}
}.

Expand Down
4 changes: 2 additions & 2 deletions test/common/config_parser_helper.erl
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ all_modules() ->
same_mam_id_for_peers => false,
user_prefs_store => rdbms}}),
mod_register => mod_config(mod_register, #{access => all,
password_strength => 32,
password_strength => 33,
registration_watchers => [<<"JID1">>, <<"JID2">>],
welcome_message => {"Subject", "Body"}}),
mod_mam_rdbms_arch =>
Expand Down Expand Up @@ -966,7 +966,7 @@ default_mod_config(mod_push_service_mongoosepush) ->
#{pool_name => undefined, api_version => <<"v3">>, max_http_connections => 100};
default_mod_config(mod_register) ->
#{iqdisc => one_queue, access => all, registration_watchers => [],
password_strength => 0, ip_access => []};
password_strength => 32, ip_access => []};
default_mod_config(mod_roster) ->
#{iqdisc => one_queue, versioning => false, store_current_id => false, backend => mnesia};
default_mod_config(mod_shared_roster_ldap) ->
Expand Down
2 changes: 1 addition & 1 deletion test/config_parser_SUITE_data/modules.toml
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
welcome_message = {subject = "Subject", body = "Body"}
access = "all"
registration_watchers = ["JID1", "JID2"]
password_strength = 32
password_strength = 33

[modules.mod_roster]
versioning = true
Expand Down

0 comments on commit e19d3cf

Please sign in to comment.