You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2023/11/06 11:11:40 UTC
(couchdb) 06/07: increase default password iterations to 50000
This is an automated email from the ASF dual-hosted git repository.
rnewson pushed a commit to branch decouple_offline_hash_strength_from_online
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit 91bd8842471db279cbf0b1f4269ed85830ae1f6e
Author: Robert Newson <rn...@apache.org>
AuthorDate: Thu Nov 2 11:07:58 2023 +0000
increase default password iterations to 50000
lower for test runs as creds are unavailable until hashed and
this would otherwise introduce test failures due to timing
---
Makefile | 6 +++---
rel/overlay/etc/default.ini | 2 +-
src/couch/src/couch_passwords.erl | 2 +-
src/couch/src/couch_users_db.erl | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 0d88199a9..20e8f00e1 100644
--- a/Makefile
+++ b/Makefile
@@ -92,7 +92,7 @@ DIALYZE_OPTS=$(shell echo "\
" | sed -e 's/[a-z]\{1,\}= / /g')
EXUNIT_OPTS=$(subst $(comma),$(space),$(tests))
-TEST_OPTS="-c 'startup_jitter=0' -c 'default_security=admin_local'"
+TEST_OPTS="-c 'startup_jitter=0' -c 'default_security=admin_local' -c 'iterations=9'"
################################################################################
# Main commands
@@ -343,7 +343,7 @@ mango-test: devclean all
.PHONY: weatherreport-test
# target: weatherreport-test - Run weatherreport against dev cluster
weatherreport-test: devclean escriptize
- @dev/run -n 1 -a adm:pass --no-eval \
+ @dev/run "$(TEST_OPTS)" -n 1 -a adm:pass --no-eval \
'bin/weatherreport --etc dev/lib/node1/etc --level error'
################################################################################
@@ -565,7 +565,7 @@ nouveau-test-elixir: export MIX_ENV=integration
nouveau-test-elixir: elixir-init devclean
nouveau-test-elixir: couch nouveau
ifeq ($(with_nouveau), 1)
- @dev/run -n 1 -q -a adm:pass --with-nouveau \
+ @dev/run "$(TEST_OPTS)" -n 1 -q -a adm:pass --with-nouveau \
--locald-config test/config/test-config.ini \
--no-eval 'mix test --trace --include test/elixir/test/config/nouveau.elixir'
endif
diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini
index 67920aa5b..ef818b567 100644
--- a/rel/overlay/etc/default.ini
+++ b/rel/overlay/etc/default.ini
@@ -321,7 +321,7 @@ bind_address = 127.0.0.1
;timeout = 600 ; number of seconds before automatic logout
;auth_cache_size = 50 ; size is number of cache entries
;allow_persistent_cookies = true ; set to false to disallow persistent cookies
-;iterations = 10 ; iterations for password hashing
+;iterations = 50000 ; iterations for password hashing
;min_iterations = 1
;max_iterations = 1000000000
;password_scheme = pbkdf2
diff --git a/src/couch/src/couch_passwords.erl b/src/couch/src/couch_passwords.erl
index 384a01d4a..b2f212a6d 100644
--- a/src/couch/src/couch_passwords.erl
+++ b/src/couch/src/couch_passwords.erl
@@ -44,7 +44,7 @@ hash_admin_password("simple", ClearPassword) ->
?l2b("-hashed-" ++ couch_util:to_hex(Hash) ++ "," ++ ?b2l(Salt));
hash_admin_password("pbkdf2", ClearPassword) ->
PRF = chttpd_util:get_chttpd_auth_config("pbkdf2_prf", "sha256"),
- Iterations = chttpd_util:get_chttpd_auth_config("iterations", "10"),
+ Iterations = chttpd_util:get_chttpd_auth_config("iterations", "50000"),
Salt = couch_uuids:random(),
DerivedKey = couch_passwords:pbkdf2(
list_to_existing_atom(PRF),
diff --git a/src/couch/src/couch_users_db.erl b/src/couch/src/couch_users_db.erl
index c6b730209..b4728f994 100644
--- a/src/couch/src/couch_users_db.erl
+++ b/src/couch/src/couch_users_db.erl
@@ -101,7 +101,7 @@ save_doc(#doc{body = {Body}} = Doc) ->
ok = validate_password(ClearPassword),
PRF = chttpd_util:get_chttpd_auth_config("pbkdf2_prf", "sha256"),
Iterations = chttpd_util:get_chttpd_auth_config_integer(
- "iterations", 10
+ "iterations", 50000
),
DerivedKey = couch_passwords:pbkdf2(
list_to_existing_atom(PRF), ClearPassword, Salt, Iterations