All docsStellar ControlMission control · by Stellar Systems v1.1.0

Security

TLS, Encryption and Secrets

Transport security of NATS, the API and the leaf nodes, encryption at rest of JetStream, and where the secrets live.

Stellar Control protects its data in transit with TLS on every hop, at rest with JetStream encryption and encrypted disks, and keeps its secrets out of any repository. Between deployments sharing a NATS server, NATS accounts do the isolation (see NATS Accounts and Credentials); encryption protects disks and backups.

Layers#

LayerProtection
Clients ↔ NATSTLS required (tls://), CA given by the deployment; client certificate optional (mTLS)
Leaf nodes, cluster routesTLS; leaf nodes also over WebSocket on 443
API, web console, editorHTTPS and WSS, terminated by a reverse proxy (ACME certificates, or those of your CA); the CLI speaks HTTPS and WSS
Data at restJetStream encryption (streams, KV buckets, object stores), one key per server; encrypted disks for the rest
SecretsOperator key offline; the account signing key, OIDC secrets and the JetStream key in a secret store (Nomad variables, Kubernetes Secrets, Vault); never in a repository

TLS to NATS#

Services of the core#

YAML
nats:
  url: tls://nats.mcs.example.org:4222
  tls:
    ca: /etc/stellar/tls/ca.pem          # TLS required, server checked against this CA
    cert: /etc/stellar/tls/client.pem    # with key: mTLS
    key: /etc/stellar/tls/client-key.pem
  • With tls.ca, the connection requires TLS and checks the server against that CA.
  • With tls.cert and tls.key (always together), the component presents a client certificate.
  • A tls:// URL without tls.ca checks the server against the system roots.
  • A wss:// URL goes through the NATS WebSocket port, for networks that only let HTTPS out.

A certificate or credentials the server refuses are logged at the first connection attempt, with the reason, then retried in the background.

Components of the SDKs and the CLI#

Drivers, transports, gateways and connectors (Rust and Python SDKs) read the same settings from their environment; the CLI takes them as options, for its commands that talk to NATS (stellar compile --publish, stellar sim):

EnvironmentCLI optionMeaning
STELLAR_NATS_CA--nats-caCA certificates (PEM): TLS only
STELLAR_NATS_CERT--nats-certClient certificate (PEM), for mTLS; goes with the key
STELLAR_NATS_KEY--nats-keyIts private key (PEM)
STELLAR_NATS_CREDENTIALS--nats-credentialsCredentials file (JWT and seed)

Server side#

The NATS server requires TLS with a tls block in its configuration, with the certificates of your CA:

text
tls {
  cert_file: /etc/nats/secrets/tls/server.pem
  key_file: /etc/nats/secrets/tls/server-key.pem
  ca_file: /etc/nats/secrets/tls/ca.pem
  verify: false        # true: client certificates required (mTLS)
}

In the Nomad deployment, the nats job requires TLS on every port with tls_dir (the certificates of your CA) and client certificates with tls_verify; leafnode_port and websocket_port open the ports of the benches.

Leaf nodes of the benches#

A bench joins its deployment through a NATS leaf node bound to the account of the deployment. Leaf node connections use TLS, and can also run over the NATS WebSocket on 443 when the bench network only lets HTTPS out. Cluster routes between NATS servers use TLS too.

HTTPS for the API#

The API itself serves plain HTTP on api.listen: HTTPS and WSS are terminated by a reverse proxy in front of it (Traefik, the Ingress controller of a Kubernetes cluster…), with ACME certificates or those of your CA.

The CLI speaks HTTPS and WSS to an https:// API, and checks its certificate against the system roots, or against the CA given with --api-ca (STELLAR_API_CA):

Shell
stellar send cam-sim-1 camera.ping --api https://demo.mcs.example.org
STELLAR_API_CA=/etc/stellar/tls/ca.pem stellar alarms --api https://localhost:8443

Encryption at rest#

JetStream#

NATS encrypts its streams, KV buckets and object stores with a key per server (ChaCha20-Poly1305 in the Nomad deployment, encrypt=true of the nats job, in a container or as a process). The key comes from a secret store, never from a file of the repository: the Nomad variable nomad/jobs/nats (item jetstream_key) in the Nomad deployment.

Rotating the key loses nothing: give the new key together with the old one as prev_key. The server restarts, reads the existing data with the old key and writes with the new one. Once everything is rewritten, drop prev_key. In the Nomad deployment:

  1. set jetstream_prev_key to the current key and jetstream_key to the new one in the Nomad variable nomad/jobs/nats;
  2. let the nats job restart;
  3. remove jetstream_prev_key later.

Everything else#

What JetStream does not hold belongs on encrypted disks (LUKS, or the encrypted volumes of the provider): the configuration repositories and the working copies of the editor, the database of an output connector (TimescaleDB), the data directory of Nomad.

Secrets#

SecretWhereWho reads it
Operator key of NATSOffline, between two changes of the accountsWhoever makes the accounts (nsc)
Account signing keyA secret of the deployment, readable by the services only: the Nomad variable of their job, a Kubernetes Secret, or VaultThe reconciler (reconciler.signing_key_file) and the API
Credentials of the services and bootstrap credentialsSame storeThe services; the benches get the bootstrap credentials from the operator of the deployment
OIDC key set, issuer, audienceDeployment configurationAPI, executor, editor
Forge token of the editorSame store, given in the variable named by editor.forge.token_envThe editor
JetStream keyNomad variable nomad/jobs/natsNATS
TLS keysFiles on the hosts, or ACMENATS, the reverse proxy

Encryption and authentication of the space link itself (SDLS, CCSDS 355.0) are not a NATS matter: they belong to a transport of the link, which frames the units of the driver for the medium.

↑↓ to moveEnter to open