Configuration

On this page

starmole reads ~/.config/starmole/config.toml (or $XDG_CONFIG_HOME/starmole/config.toml, or the one in --config-dir). A daemon running as root reads /etc/starmole/config.toml. Every section is optional. The daemon notices edits within a couple of seconds and applies them without restarting (starmole reload does it right away); the tun device only restarts if its own settings changed. A file that doesn't parse is logged and the running config kept.

A full example:

[network]
id = "9a41c7f2b0e6d3a8c5f1b7e4d2a9c6f3b8e5d1a7c4f2b9e6d3a8c5f1b7e4d2a9"
issuer = "3b6f0d2e8c41a7e95d0c2f6b8e1a4d7c9f3b5e2a8d6c1f4e7b9a2d5c8e1f3a6b"

[[allow]]
from = ["tag:admin", "user:alice@example.com"]
caps = ["shell", "exec", "forward", "tun"]
as = ["john"]

[[allow]]
from = ["tag:ci"]
caps = ["exec"]
as = ["deploy"]

[expose]
forward = ["127.0.0.1:22", "127.0.0.1:8250", "192.168.1.0/24"]
routes = ["192.168.1.0/24"]

[tun]
enable = true
accept_routes = true

[daemon]
operators = ["john"]

[network]

Key Default What
id none The network to be in: the id starmole net init printed. Needed for certificates, [[allow]] and the tun device. starmole join sets it.
issuer none The node that renews this machine's certificate. starmole join sets it.
relays ["default"] Relays to use, in order: "default" for n0's public relays, or URLs of your own (iroh-relay). An empty list turns relaying off, and then machines behind NAT may not reach each other.
address_lookup true Where machines publish and find each other's addresses. true uses n0's DNS service, false turns lookup off (peers need addrs), and { pkarr = "https://dns.example.com/pkarr", dns = "dns.example.com" } uses your own iroh-dns-server. dns is optional.
port random UDP port to listen on. Only useful when peers dial this machine by address, or for a port forward on your router; port mapping over UPnP, PCP and NAT-PMP happens either way.
firewall true Let the UDP port in through the host firewall, so peers behind strict NATs can connect directly. Needs root or CAP_NET_ADMIN, and CAP_NET_RAW where the firewall's rules match ipsets; on Linux it uses iptables, on macOS the application firewall. See How it works.
ssh_ca none SSH certificate authorities to accept user certificates from, as OpenSSH public key lines, like sshd's TrustedUserCAKeys. A machine with a valid certificate from one of them for its key is a member here; principal: rules decide what it may do. See setup.

Every machine in a network should use the same relays and address_lookup.

[[allow]]

What members with certificates may do on this machine. A member gets the caps of every rule that matches it; nothing matches by default. starmole allow add, list and remove edit these from the command line.

Key What
from Selectors, any of which may match: tag:server, group:ops, user:alice@example.com, name:workstation, principal:deploy (a principal in an SSH certificate), node:<node id>, or member for any machine with a certificate this machine accepts.
caps shell, exec, forward, tun, and service:<name> to open one of this machine's services, or service:* for all of them. shell includes exec.
as Local users shells and commands may run as, when the daemon runs as root. The first is the default; starmole shell deploy@host picks another. Root is allowed only when listed, as in as = ["root"]. A daemon running as a normal user runs everything as itself and ignores this.

[[allow]] needs [network] id.

[expose]

What peers may reach through this machine.

Key What
forward Destinations for forwards and SOCKS from peers with the forward cap: ADDR:PORT for one port, or an address or CIDR for any port. Names aren't allowed here; the rules match the addresses names resolve to. Empty means nothing.
routes Subnets behind this machine that peers with the tun cap may reach over the tun device. This machine has to forward, and usually masquerade, for them.

[tun]

Key Default What
enable false Bring the device up when the daemon starts. starmole up and starmole down work either way.
ipv4 from certificate This machine's IPv4 address on the device. Without it, the ipv4 in its certificate is used, if there is one.
accept_routes false Install routes for subnets peers expose.
congestion "fixed" Congestion control for tun connections: "fixed" (a fixed 8 MiB window, best on lossy links), "cubic" or "bbr".

The device is starmole0 on Linux and a utunN on macOS. It needs CAP_NET_ADMIN on Linux (see setup) and root on macOS.

[[peer]]

Peers listed by node id, the way to connect machines without certificates. A listed peer is a member and gets its caps on top of anything [[allow]] grants.

[[peer]]
name = "nas"
node = "c07e4b1d9a2f6e8b3d5c1a7f4e9b2d6c8a3f5e1b7d9c2a4f6e8b1d3c5a7f9e2b"
caps = ["shell", "forward"]
ipv4 = "100.64.0.9"
addrs = ["192.168.1.20:4433"]
forward = ["8250:localhost:8250", "2222:127.0.0.1:22"]
socks = "1080"
Key What
name What to call it in commands. Can't look like a node id.
node Its node id.
caps What it may do here: shell, exec, forward, tun, service:<name>, service:*.
as Local users it may run as, as in [[allow]].
ipv4 Its IPv4 address on the tun device, if it has one.
addrs Addresses to dial it at directly, e.g. on a LAN without address lookup.
forward Always-on local forwards through it: [BIND:]LPORT:HOST:RPORT, as in ssh -L. A port that's taken shows as an error in starmole status and is retried until it frees up.
socks An always-on SOCKS5 proxy through it, on PORT or ADDR:PORT.

[services.<name>]

Something this machine offers peers by name, like grafana. Peers need a service:<name> cap to open it, with starmole open thismachine/grafana. One that may not open it is told the same as for a service that doesn't exist, and starmole services only lists what the asker may open.

Key What
connect Where connections go: IP:PORT, like 127.0.0.1:3000, or the path of a Unix socket.
identity true to send who's connecting as one line of JSON before their data: node, and from their certificate name, tags, user, groups, principals and ipv4. A peer listed under [[peer]] without a certificate gets just node. Default false. Only use it with a program that expects the line, and that only listens on loopback or a Unix socket, so nobody else can send one.
[services.grafana]
connect = "127.0.0.1:3000"

[[allow]]
from = ["group:eng"]
caps = ["service:grafana"]

[policy]

Key Default What
follow true Whether this machine acts on the network policy, such as a requirement to sign in. false keeps only this machine's own rules.
signed_rules false Whether this machine takes the rules signed into the network policy that are on it, after its own. They let whoever holds the network key grant access here. See setup.

[exchange]

On an auth service: how machines sign in. See Extending starmole.

Key Default What
ttl 12h The longest certificate a sign-in gets. The auth service's limits and what the verifier says can make it shorter.
verifiers none The command that checks each kind of proof, by kind, run with sh -c: ssh = "starmole-verify-ssh --ca /etc/starmole/user_ca.pub", oidc = "starmole-oidc --issuer ... --client-id ...".

[daemon]

Key What
operators Local users who may use and change the daemon, besides root and the user it runs as. Only matters for a daemon running as root, whose socket every local user can reach: anyone else may only run starmole status and starmole ping.

[credential]

Key What
helper A command starmole login runs, with sh -c, to get this machine a credential. It gets the machine's key as an OpenSSH public key on stdin and STARMOLE_NODE_ID and STARMOLE_NETWORK in its environment, and prints anything starmole cert install takes. When the network has an auth service, what it prints is the proof sent there instead. See setup.
renew false by default. When true, the daemon runs the helper and signs in by itself: when it has no certificate, and before the one it got runs out. For servers nobody signs in at. See setup.

Environment

Variable What
STARMOLE_CONFIG_DIR Same as --config-dir.
STARMOLE_SOCKET Same as --socket: where the CLI finds the daemon.
RUST_LOG Log level for starmole daemon, e.g. info or starmole=debug.

Edit this page on GitHub