4.6. TLS Erlang分布¶
其主要目的特别是允许在节点之间使用TLS进行Erlang分发,同时还可以使用TCP连接到一些节点。TLS分发将增强节点间数据迁移过程中的数据安全性。
本节介绍如何启用TLS分发以实现额外的验证和安全性。
参考资料: Using TLS for Erlang Distribution
4.6.1. 生成证书¶
要使TLS正常工作,必须至少指定一个公钥和一个证书。在下面的示例(Couch_ssl_Dist.conf)中,PEM文件包含 certificate
以及它的 private key
。
[{server, [{certfile, "</path/to/erlserver.pem>"}, {secure_renegotiate, true}]}, {client, [{secure_renegotiate, true}]}].
以下命令是生成证书(PEM)文件的示例。
$ openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem $ cat key.pem cert.pem > erlserver.pem && rm key.pem cert.pem注解
这是 not 对特定到期限制、密钥大小或算法的认可。
4.6.2. 配置设置¶
要启用TLS分布,请确保在中设置自定义参数 vm.args
。
# Don't forget to override the paths to point to your cert and conf file! -proto_dist couch -couch_dist no_tls \"clouseau@127.0.0.1\" -ssl_dist_optfile <path/to/couch_ssl_dist.conf>注解
- 的默认值
no_tls
是false
。如果用户未设置任何no_tls
标志,则所有节点都将使用TCP
。- 要确保“search”正常工作,请确保设置
no_tls
选项,用于clouseau
节点。默认情况下,这将是"clouseau@127.0.0.1"
。
这个 no_tls
标志可以具有以下值:
使用
TLS
仅限,设置为false
(默认值),例如:-couch_dist no_tls false
使用
TCP
仅限,设置为true
,例如:-couch_dist no_tls true
指定要使用的一些节点
TCP
,其他要使用的TLS
,例如:# Specify node1 and node2 to use TCP, others use TLS -couch_dist no_tls \"node1@127.0.0.1\" -couch_dist no_tls \"node2@127.0.0.1\"
# Any nodes end with "@127.0.0.1" will use TCP, others use TLS -couch_dist no_tls \"*@127.0.0.1\"
注解
Asterisk(*) :匹配零次或多次出现正则表达式的序列。
问号(?) :匹配零个或一个正则表达式匹配项。
4.6.3. 连接到Remsh¶
使用连接到Node的远程shell启动Erlang。
如果节点使用
TCP
:$ ./remsh
如果节点使用
TLS
:$ ./remsh -t <path/to/couch_ssl_dist.conf>