Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Use client certificates when replicating #132

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 17 additions & 8 deletions apps/couch/src/couch_rep_httpc.erl
Expand Up @@ -290,14 +290,23 @@ ssl_options(#http_db{url = Url}) ->
Depth = list_to_integer(
couch_config:get("replicator", "ssl_certificate_max_depth", "3")
),
SslOpts = [{depth, Depth} |
case couch_config:get("replicator", "verify_ssl_certificates") of
"true" ->
ssl_verify_options(true);
_ ->
ssl_verify_options(false)
end],
[{is_ssl, true}, {ssl_options, SslOpts}];
VerifyCerts = couch_config:get("replicator", "verify_ssl_certificates"),
CertFile = couch_config:get("replicator", "cert_file", nil),
KeyFile = couch_config:get("replicator", "key_file", nil),
Password = couch_config:get("replicator", "password", nil),
SslOpts = [{depth, Depth} | ssl_verify_options(VerifyCerts =:= "true")],
SslOpts1 = case CertFile /= nil andalso KeyFile /= nil of
true ->
case Password of
nil ->
[{certfile, CertFile}, {keyfile, KeyFile}] ++ SslOpts;
_ ->
[{certfile, CertFile}, {keyfile, KeyFile},
{password, Password}] ++ SslOpts
end;
false -> SslOpts
end,
[{is_ssl, true}, {ssl_options, SslOpts1}];
#url{protocol = http} ->
[]
end.
Expand Down