Skip to content
Dashboard

Joining a network with consent

View as Markdown

A server joins a network when the registry puts its key into the network. That happens only with consent from both sides: the network’s owner agrees, and the server shows something that only it has.

Let servers in shows the commands. This page explains why joining works this way, and what each way in means.

  • The owner agrees, because membership is trust. A member gets player streams from the network and may open streams to other members. Nobody should be able to put their server into your network.
  • The server agrees, because members run the network’s code. A network’s owner deploys bundles to its members. An owner who could add any key could run code on servers that never asked for it.
  • A key alone proves nothing. An instance’s public key is its ID, and it appears in lists and key sets. Anyone can copy it, so the registry never lets an owner add a server by its key.

Each of the three ways in below pairs something the owner made with something the server shows.

An invite is a one-time token for one server. The owner makes it, and the server shows it once.

  • It works once, and it runs out. After one server has used it, or after its lifetime, it lets nobody in. A leaked unused invite brings in at most one server, and only until it runs out.
  • The registry keeps only its hash, so a copy of the registry’s storage contains no usable invite.
  • It can carry labels. Every server it lets in gets these labels from the registry, over its own.
  • After that, the key is the identity. A restart with the same, now used invite stays in the network, because a key that is in a network stays in it. Once the server is removed (mk instances remove), the used invite lets it in no more: it needs a new code, invite or token.

Invites fit any server whose environment gives it no token of its own: a plain VPS, a hosting panel, or a cluster without a public token issuer.

A trust rule lets every server whose environment vouches for it join without an invite. It is OpenID Connect federation: the network trusts another issuer’s tokens, under conditions.

  • The server already has a token. A Kubernetes pod has a projected service account token, and a CI job can have an OpenID Connect token. Its connector.json names the file, and the connector reads it fresh on every attempt, because such tokens rotate.
  • The rule names what to accept: the issuer, the audience, and the subject, exactly or by prefix. For an issuer the registry cannot reach, such as a private cluster’s, the rule carries that issuer’s public keys.
  • The server proves both things at once. It sends the token in a request signed with its own key. The registry checks the token against the issuer’s published keys, and when a rule matches, the key becomes a member.
  • No Minekube secret lives on the server. The token comes from the environment, and the key never leaves the server.
  • It can carry labels, like an invite. One rule then decides which servers a deployment reaches.

The environment’s token is not bound to the instance’s key, so whoever holds a valid token can bring a key in while the token lasts. Keep rules narrow: an audience of its own, such as minekube, and short-lived tokens, as Kubernetes projects them.

A connector whose key belongs to no network logs a short code and renews it when it runs out. The owner enters that code to put this server into the network.

The code is the server’s consent: it appears only in the server’s own log, so only someone who can read that log can claim the server. It is the way in when you have the server in front of you and made no invite in advance.

mk server --join makes an invite for your dev server and uses it, so playing your game with friends takes one flag. The dev network that mk server --network runs on your machine is different: there, mk runs the Minekube API itself and puts its own servers into the network directly, as the API’s admin. Only an admin of the API can add a key without the server’s consent.

A key belongs to one network at a time. When a member joins another network, the registry moves its key there, and the first network lets it go: it is no longer a member, and its connections there close.

Was this helpful?