summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoan Touzet <wohali@users.noreply.github.com>2020-01-07 23:33:09 -0500
committerGitHub <noreply@github.com>2020-01-07 23:33:09 -0500
commit8f735af89c90e52797935eabc656a88c67133ca2 (patch)
tree336ecab747fafa16f2a3ee6953845a0f6bcb2487
parent3afac0bf2b7f3ab841c16e35a1f51eb9b201f352 (diff)
parentb54796f8e056b31e0ee723d9add953d5b4d8e2dc (diff)
downloadcouchdb-8f735af89c90e52797935eabc656a88c67133ca2.tar.gz
Merge branch 'master' into jenkins-el8-buster
-rw-r--r--rel/files/couchdb.cmd.in2
-rw-r--r--rel/overlay/etc/default.ini1
-rw-r--r--src/couch/src/couch_httpd_auth.erl5
-rw-r--r--src/couch/src/couch_sup.erl2
4 files changed, 8 insertions, 2 deletions
diff --git a/rel/files/couchdb.cmd.in b/rel/files/couchdb.cmd.in
index 0e9c3404a..05096886f 100644
--- a/rel/files/couchdb.cmd.in
+++ b/rel/files/couchdb.cmd.in
@@ -27,7 +27,7 @@ set PATH=%PATH%;%COUCHDB_BIN_DIR%
set COUCHDB_QUERY_SERVER_JAVASCRIPT="{{prefix}}/bin/couchjs {{prefix}}/share/server/main.js"
set COUCHDB_QUERY_SERVER_COFFEESCRIPT="{{prefix}}/bin/couchjs {{prefix}}/share/server/main-coffee.js"
-REM set COUCHDB_FAUXTON_DOCROOT="{{fauxton_root}}"
+set COUCHDB_FAUXTON_DOCROOT="{{fauxton_root}}"
"%BINDIR%\erl" -boot "%ROOTDIR%\releases\%APP_VSN%\couchdb" ^
-args_file "%ROOTDIR%\etc\vm.args" ^
diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini
index 669977ee0..5fc8e0761 100644
--- a/rel/overlay/etc/default.ini
+++ b/rel/overlay/etc/default.ini
@@ -118,6 +118,7 @@ backlog = 512
socket_options = [{sndbuf, 262144}, {nodelay, true}]
server_options = [{recbuf, undefined}]
require_valid_user = false
+; require_valid_user_except_for_up = false
; List of headers that will be kept when the header Prefer: return=minimal is included in a request.
; If Server header is left out, Mochiweb will add its own one in.
prefer_minimal = Cache-Control, Content-Length, Content-Range, Content-Type, ETag, Server, Transfer-Encoding, Vary
diff --git a/src/couch/src/couch_httpd_auth.erl b/src/couch/src/couch_httpd_auth.erl
index b5195349b..515ce6132 100644
--- a/src/couch/src/couch_httpd_auth.erl
+++ b/src/couch/src/couch_httpd_auth.erl
@@ -88,6 +88,11 @@ basic_name_pw(Req) ->
default_authentication_handler(Req) ->
default_authentication_handler(Req, couch_auth_cache).
+default_authentication_handler(#httpd{path_parts=[<<"_up">>]}=Req, AuthModule) ->
+ case config:get_boolean("chttpd", "require_valid_user_except_for_up", false) of
+ true -> Req#httpd{user_ctx=?ADMIN_USER};
+ _False -> default_authentication_handler(Req, AuthModule)
+ end;
default_authentication_handler(Req, AuthModule) ->
case basic_name_pw(Req) of
{User, Pass} ->
diff --git a/src/couch/src/couch_sup.erl b/src/couch/src/couch_sup.erl
index ac117ea43..c4a2e6303 100644
--- a/src/couch/src/couch_sup.erl
+++ b/src/couch/src/couch_sup.erl
@@ -99,7 +99,7 @@ assert_admins() ->
++ "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%~n", []),
% Wait a second so the log message can make it to the log
timer:sleep(500),
- throw(admin_account_required);
+ erlang:halt(1);
_ -> ok
end.