Skip to content

Commit 70941ba

Browse files
timofey-barminabhinavdangeti
authored andcommitted
MB-47177: Give FTS the caFile as a new command line argument
Change-Id: I5d709dcffbb5f016c36004f4b665f099fb8894a2 Reviewed-on: http://review.couchbase.org/c/ns_server/+/160639 Well-Formed: Build Bot <[email protected]> Reviewed-by: Artem Stemkovski <[email protected]> Reviewed-by: Abhinav Dangeti <[email protected]> Tested-by: Timofey Barmin <[email protected]>
1 parent 317dc20 commit 70941ba

File tree

1 file changed

+20
-12
lines changed

1 file changed

+20
-12
lines changed

src/ns_ports_setup.erl

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,25 @@ format(Config, Name, Format, Keys) ->
242242
end, Keys),
243243
lists:flatten(io_lib:format(Format, Values)).
244244

245-
build_https_args(PortName, PortArg, CertArg, KeyArg, Config) ->
246-
build_https_args(PortName, PortArg, "", CertArg, KeyArg, Config).
245+
build_https_args(PortName, PortArg, CertArg, KeyArg, CAArg, Config) ->
246+
build_https_args(PortName, PortArg, "", CertArg, KeyArg, CAArg, Config).
247247

248-
build_https_args(PortName, PortArg, PortPrefix, CertArg, KeyArg, Config) ->
248+
build_https_args(PortName, PortArg, PortPrefix, CertArg, KeyArg, CAArg,
249+
Config) ->
249250
case service_ports:get_port(PortName, Config) of
250251
undefined ->
251252
[];
252-
Port ->
253+
%% pass old style chain file to the services that haven't added support
254+
%% for ca file yet
255+
Port when CAArg == undefined ->
253256
[PortArg ++ "=" ++ PortPrefix ++ integer_to_list(Port),
254257
CertArg ++ "=" ++ ns_ssl_services_setup:legacy_cert_path(),
255-
KeyArg ++ "=" ++ ns_ssl_services_setup:pkey_file_path()]
258+
KeyArg ++ "=" ++ ns_ssl_services_setup:pkey_file_path()];
259+
Port ->
260+
[PortArg ++ "=" ++ PortPrefix ++ integer_to_list(Port),
261+
CertArg ++ "=" ++ ns_ssl_services_setup:chain_file_path(),
262+
KeyArg ++ "=" ++ ns_ssl_services_setup:pkey_file_path(),
263+
CAArg ++ "=" ++ ns_ssl_services_setup:ca_file_path()]
256264
end.
257265

258266
build_port_arg(ArgName, PortName, Config) ->
@@ -363,7 +371,7 @@ goport_args('query', Config, _Cmd, _NodeUUID) ->
363371
atom_to_list(cluster_compat_mode:is_enterprise()),
364372

365373
HttpsArgs = build_https_args(ssl_query_port, "--https", ":",
366-
"--certfile", "--keyfile", Config),
374+
"--certfile", "--keyfile", undefined, Config),
367375
[DataStoreArg, HttpArg, CnfgStoreArg, EntArg] ++
368376
build_afamily_requirement("--") ++ HttpsArgs;
369377

@@ -374,7 +382,7 @@ goport_args(projector, Config, _Cmd, _NodeUUID) ->
374382
MinidumpDir = path_config:minidump_dir(),
375383

376384
build_https_args(projector_ssl_port, "--httpsPort", "--certFile",
377-
"--keyFile", Config) ++
385+
"--keyFile", undefined, Config) ++
378386
build_afamily_requirement("-") ++
379387
["-kvaddrs=" ++ misc:local_url(LocalMemcachedPort, [no_scheme]),
380388
build_port_arg("-adminport", ":", projector_port, Config),
@@ -403,7 +411,7 @@ goport_args(indexer, Config, _Cmd, NodeUUID) ->
403411
{"-streamMaintPort", indexer_stmaint_port}], Config) ++
404412

405413
build_https_args(indexer_https_port, "--httpsPort",
406-
"--certFile", "--keyFile", Config) ++
414+
"--certFile", "--keyFile", undefined, Config) ++
407415

408416
build_afamily_requirement("-") ++
409417

@@ -420,7 +428,7 @@ goport_args(backup, Config, _Cmd, NodeUUID) ->
420428
{"-grpc-port", backup_grpc_port}], Config) ++
421429

422430
build_https_args(backup_https_port, "-https-port", "-cert-path",
423-
"-key-path", Config) ++
431+
"-key-path", undefined, Config) ++
424432

425433
build_afamily_requirement("-") ++
426434

@@ -466,7 +474,7 @@ goport_args(fts, Config, _Cmd, NodeUUID) ->
466474
BindHttp = BuildHostPortArgs("-bindHttp", fts_http_port),
467475
BindHttps =
468476
build_https_args(fts_ssl_port, "-bindHttps", ":",
469-
"-tlsCertFile", "-tlsKeyFile", Config),
477+
"-tlsCertFile", "-tlsKeyFile", "-tlsCAFile", Config),
470478

471479
BindGrpc = BuildHostPortArgs("-bindGrpc", fts_grpc_port),
472480
BindGrpcSsl = BuildHostPortArgs("-bindGrpcSsl", fts_grpc_ssl_port),
@@ -520,7 +528,7 @@ goport_args(eventing, Config, _Cmd, NodeUUID) ->
520528
{"-debugPort", eventing_debug_port}], Config) ++
521529

522530
build_https_args(eventing_https_port, "-adminsslport",
523-
"-certfile", "-keyfile", Config) ++
531+
"-certfile", "-keyfile", undefined, Config) ++
524532

525533
build_afamily_requirement("-") ++
526534

@@ -569,7 +577,7 @@ goport_args(cbas, Config, Cmd, NodeUUID) ->
569577
{"-bindReplicationPort", cbas_replication_port}],
570578
Config) ++
571579
build_https_args(cbas_ssl_port, "-bindHttpsPort",
572-
"-tlsCertFile", "-tlsKeyFile", Config) ++
580+
"-tlsCertFile", "-tlsKeyFile", undefined, Config) ++
573581
[
574582
"-uuid=" ++ NodeUUID,
575583
"-serverAddress=" ++ misc:localhost(),

0 commit comments

Comments
 (0)