summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2019-11-28 10:28:12 +0000
committerRobert Newson <rnewson@apache.org>2019-12-02 17:51:44 +0000
commitaab05b67a335ece30105a6d59384e9ab6dce08cd (patch)
tree55e89ee0a88f63be3cf2a74c544863b6a75bb29b
parentf8b1b4a0ed717651ebd018bed61321e811fcb6b2 (diff)
downloadcouchdb-aab05b67a335ece30105a6d59384e9ab6dce08cd.tar.gz
disable port 5986 by default
-rw-r--r--src/couch/src/couch_httpd.erl2
-rw-r--r--src/couch/src/couch_secondary_sup.erl13
2 files changed, 11 insertions, 4 deletions
diff --git a/src/couch/src/couch_httpd.erl b/src/couch/src/couch_httpd.erl
index 73d3c1704..65291e3da 100644
--- a/src/couch/src/couch_httpd.erl
+++ b/src/couch/src/couch_httpd.erl
@@ -38,7 +38,7 @@
-export([validate_bind_address/1]).
-export([check_max_request_length/1]).
-export([handle_request/1]).
-
+-export([set_auth_handlers/0]).
-define(HANDLER_NAME_IN_MODULE_POS, 6).
-define(MAX_DRAIN_BYTES, 1048576).
diff --git a/src/couch/src/couch_secondary_sup.erl b/src/couch/src/couch_secondary_sup.erl
index 0f46ec85f..9c7d414d0 100644
--- a/src/couch/src/couch_secondary_sup.erl
+++ b/src/couch/src/couch_secondary_sup.erl
@@ -30,14 +30,18 @@ init([]) ->
{index_server, {couch_index_server, start_link, []}},
{query_servers, {couch_proc_manager, start_link, []}},
{vhosts, {couch_httpd_vhost, start_link, []}},
- {httpd, {couch_httpd, start_link, []}},
{uuids, {couch_uuids, start, []}},
{auth_cache, {couch_auth_cache, start_link, []}}
],
+ MaybeHttp = case http_enabled() of
+ true -> [{httpd, {couch_httpd, start_link, []}}];
+ false -> couch_httpd:set_auth_handlers(), []
+ end,
+
MaybeHttps = case https_enabled() of
true -> [{httpsd, {chttpd, start_link, [https]}}];
- _False -> []
+ false -> []
end,
Children = SecondarySupervisors ++ [
@@ -52,10 +56,13 @@ init([]) ->
[Module]}
end
|| {Name, Spec}
- <- Daemons ++ MaybeHttps, Spec /= ""],
+ <- Daemons ++ MaybeHttp ++ MaybeHttps, Spec /= ""],
{ok, {{one_for_one, 50, 3600},
couch_epi:register_service(couch_db_epi, Children)}}.
+http_enabled() ->
+ config:get_boolean("httpd", "enable", false).
+
https_enabled() ->
% 1. [ssl] enable = true | false
% 2. if [daemons] httpsd == {chttpd, start_link, [https]} -> pretend true as well