分散処理のセキュリティとCookie
マジックCookie、ノード名、TLS分散を使って、分散Erlangノード間の通信を保護します。
「分散処理のセキュリティとCookie」はCoddyKit上の無料Erlang OTP: Distributed & Fault-Tolerant Systems Programmingレッスンです。 これはレッスン4/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはErlang OTP: Distributed & Fault-Tolerant Systems Programming学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Erlang OTP: Distributed & Fault-Tolerant Systems Programmingコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
Trust in a Cluster
Connected Erlang nodes fully trust each other: any node can run code on any other. That power makes securing distribution essential.
The Magic Cookie
Each node has a secret cookie. Two nodes can only connect if their cookies match. It is the basic authentication mechanism for clustering.
erlang:get_cookie().
% => 'SECRETCOOKIE'Setting the Cookie
You can set the cookie at startup or at runtime. All nodes that should cluster must share the same value.
% at startup:
% erl -setcookie SECRET -name node1@host
erlang:set_cookie(node(), 'SECRET').The .erlang.cookie File
If not set explicitly, the VM reads ~/.erlang.cookie. It must have restrictive permissions or the VM refuses to start.
% chmod 400 ~/.erlang.cookieShort vs Long Names
Nodes use -sname (short hostname) or -name (fully qualified). Both nodes must use the same scheme to connect.
% erl -sname worker
% erl -name worker@10.0.0.5Cookies Are Not Encryption
A matching cookie only authenticates the connection. By default, traffic between nodes is unencrypted. On untrusted networks you need TLS.
TLS Distribution
Erlang can tunnel all inter-node traffic over TLS using the inet_tls_dist module, configured via a proto_dist flag and a certificate file.
% erl -proto_dist inet_tls \
% -ssl_dist_optfile ssl_dist.conf \
% -name node1@hostThe ssl_dist Config
The config file points to your certificate, key, and CA so nodes mutually authenticate and encrypt.
[{server, [{certfile, "node.pem"},
{keyfile, "node.key"},
{cacertfile, "ca.pem"}]},
{client, [{cacertfile, "ca.pem"}]}].Restricting epmd Exposure
The Erlang Port Mapper Daemon (epmd) registers node ports. Never expose epmd or distribution ports to the public internet; firewall them or use a VPN.
Hidden Nodes
A node started with -hidden connects without joining the global mesh, useful for tools that should not be part of the cluster's full-trust topology.
% erl -hidden -name monitor@hostSecurity Checklist
For safe distribution:
- Use a strong, unique cookie
- Protect the cookie file (chmod 400)
- Enable TLS on untrusted networks
- Firewall epmd and distribution ports
Quick Check
Test your distribution security knowledge.
Recap
You learned to secure distributed Erlang.
- Matching cookies authenticate nodes
- Protect the
.erlang.cookiefile - Use TLS distribution for encryption
- Firewall epmd and distribution ports
よくある質問
「分散処理のセキュリティとCookie」レッスンは無料ですか?
はい。「分散処理のセキュリティとCookie」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Erlang OTP: Distributed & Fault-Tolerant Systems Programmingコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Erlang OTP: Distributed & Fault-Tolerant Systems Programmingコースには全4レッスンが含まれています。
「分散処理のセキュリティとCookie」で何を学びますか?
マジックCookie、ノード名、TLS分散を使って、分散Erlangノード間の通信を保護します。 ブラウザで直接実行するハンズオンコードでErlang OTP: Distributed & Fault-Tolerant Systems Programmingを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Erlang OTP: Distributed & Fault-Tolerant Systems Programmingを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのErlang OTP: Distributed & Fault-Tolerant Systems Programmingは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン4/4です。
「分散処理のセキュリティとCookie」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このErlang OTP: Distributed & Fault-Tolerant Systems Programmingレッスンでコードを書いて実行できますか?
はい。すべてのErlang OTP: Distributed & Fault-Tolerant Systems Programmingレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。
このコースのすべてのレッスン
- ノード間通信とセットアップ
- リモートプロシージャコール(RPC)
- グローバルプロセス登録
- 分散処理のセキュリティとCookie