mcl_core_lan_secrets (mcl_core v1.0.0)
View SourceThe cluster's two secrets, in a node's LAN data dir (docs/DESIGN.md §2.1, DECIDED 2026-12-02 "Shared cookie + secret (Recommended)").
.erlang.cookie is the Erlang cookie: distribution lets in only a node that holds it. gossip.secret keys the HMAC on every gossip packet: a node with another secret hears the cluster and is never dialled. A device that holds both owns the cluster, since distributed Erlang runs any code on any node; the secrets, not the LAN, are the guard.
The cluster's FIRST node generates both, once. Every other node gets the two files copied into its own data dir at install, and refuses to start without them. Nothing here ever overwrites a secret: a data dir holding one of the two and not the other is refused, first node or not.
Summary
Functions
The secrets in Dir; on the first node (First), generated first when neither exists yet.
Both secrets from Dir, each refused when group or others may read it or when it is shorter than 32 bytes.
Types
Functions
-spec cookie_file(file:filename_all()) -> file:filename_all().
-spec ensure(file:filename_all(), boolean()) -> {ok, secrets()} | {error, term()}.
The secrets in Dir; on the first node (First), generated first when neither exists yet.
-spec load(file:filename_all()) -> {ok, secrets()} | {error, term()}.
Both secrets from Dir, each refused when group or others may read it or when it is shorter than 32 bytes.
-spec secret_file(file:filename_all()) -> file:filename_all().