Setting up a network
On this page
- 1. Install
- 2. Give each machine a key
- 3. Create the network
- 4. Run the daemon
- 5. Certify the first machine
- 6. Invite the other machines
- 7. Decide who may do what
- 8. The tun device (optional)
- Programs that run ssh
- Always-on forwards
- Offering services
- Running the daemon as root
- Firewalls
- Changing a machine's tags
- Removing a machine
- Sharing the work of inviting
- Moving from
[[peer]]entries - Using an SSH certificate authority
- Signing in at an auth service
- Rules for many machines
- Using your own relay and lookup servers
- Upgrading
- When something doesn't work
This walks through a small network: a Linux machine at home that holds the network key, a Linux workstation behind a NAT you don't control, and a Mac. Neither side needs open ports. The same steps work for any number of machines.
1. Install
Download a release from GitHub and
copy the binaries somewhere on your PATH. The Linux builds
are static, for x86_64 and aarch64, and the macOS one is signed and runs
on Apple silicon and Intel:
curl -LO https://github.com/starmole-dev/starmole/releases/latest/download/starmole-x86_64-linux.tar.gz
curl -LO https://github.com/starmole-dev/starmole/releases/latest/download/SHA256SUMS
sha256sum --ignore-missing -c SHA256SUMS
tar xzf starmole-x86_64-linux.tar.gz
cp -P starmole-x86_64-linux/bin/* ~/.local/bin/Swap in aarch64-linux or macos for other
machines (on a Mac, check with
shasum -a 256 --ignore-missing -c SHA256SUMS). Each tarball
also holds starmole-ssh and the systemd and launchd files
used further down.
To build it yourself instead, with Rust 1.91 or later:
cargo build --release -p starmole-cli
install -m 755 target/release/starmole ~/.local/bin/starmoleOn NixOS, use the module in Nix.
2. Give each machine a key
On every machine:
starmole initThis writes ~/.config/starmole/identity.key and prints
the node id, the public half. The key never leaves the machine; it is
the machine's address and identity. starmole id prints it
again.
3. Create the network
On the machine that will hold the network key, home here:
starmole net initThat writes ~/.config/starmole/network.key and prints
the network id. The network key signs certificates, and whoever has it
can let anything into the network, so keep it on one machine you trust
and back it up somewhere offline. If it's lost, you start a new
network.
Only one machine's config directory may hold
network.key: any daemon that finds it there becomes an
issuer, and two would sign competing revocation lists. If you copied it
around while experimenting, move the other copies out of
~/.config/starmole.
Add the network id to ~/.config/starmole/config.toml on
home:
[network]
id = "9a41c7f2b0e6d3a8c5f1b7e4d2a9c6f3b8e5d1a7c4f2b9e6d3a8c5f1b7e4d2a9"4. Run the daemon
The daemon owns the connections; the CLI talks to it over a Unix
socket. Run it in the foreground to try things
(starmole daemon), or as a service.
On Linux, as a systemd user service:
cp contrib/systemd/starmole.service ~/.config/systemd/user/
systemctl --user enable --now starmole
loginctl enable-linger "$USER" # keep it running while you're logged out
journalctl --user -u starmole -f # logsOn macOS, as a launchd agent:
sed "s|HOME|$HOME|g" contrib/launchd/dev.starmole.plist > ~/Library/LaunchAgents/dev.starmole.plist
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/dev.starmole.plist
tail -f ~/Library/Logs/starmole.logOn a machine you mostly reach remotely, linger matters: without it,
systemd stops your user services when your last session ends, and the
machine drops off the network until you log in again.
loginctl show-user "$USER" -p Linger tells you whether it's
on.
You can also run it as root, which lets sessions run as other local users and brings the tun device to macOS; see Running the daemon as root.
starmole status shows whether it's up.
5. Certify the first machine
Home needs a certificate of its own before others will talk to it. Since it holds the network key, it can sign one directly:
starmole net sign --name home --tags admin --ipv4 100.64.0.1 | starmole cert install -
starmole reload--name is how other machines refer to it,
--tags are what access rules match on, and
--ipv4 is its address on the tun device, if you'll use IPv4
there. This certificate lasts 30 days and the daemon renews it on its
own.
6. Invite the other machines
On home:
$ starmole invite --name workstation --tags server --ipv4 100.64.0.2
invite for workstation, valid 1h 0m; on the new node run:
starmole join starmole1:4ba8edda0c...
On the workstation, with its daemon running and nothing in its config yet:
$ starmole join starmole1:4ba8edda0c...
joined network 9a41c7f2b0... as workstation
The invite holds home's node id and relay, so the workstation finds
home without any address. It works once, within the hour
(--expires changes that), and the name and tags stay with
home: editing the token can't get you more. starmole join
writes the certificate, sets [network] id and
issuer in config.toml (keeping whatever else
is in there), and reloads the daemon.
Do the same for the Mac with --name mac and whatever
tags fit.
Joined machines renew their certificates with home at two thirds of their lifetime. Home only has to be reachable now and then: with the default 30 days, it can be gone for a week and nobody notices.
7. Decide who may do what
A valid certificate makes a machine a member: it can connect, and it
learns about the others. What it may do on each machine is up to that
machine's [[allow]] rules. Nothing is allowed by
default.
On the workstation, to let admins open shells and forward ports:
[[allow]]
from = ["tag:admin"]
caps = ["shell", "exec", "forward"]
# What forwards and SOCKS may reach on this side. Nothing, unless listed.
[expose]
forward = ["127.0.0.1:80", "192.168.1.0/24"]Then starmole reload. The rule can also come from the
command line, which edits config.toml for you (keeping your
comments) and reloads the daemon:
starmole allow add --from tag:admin --caps shell,exec,forward
starmole allow list # numbered
starmole allow remove 1From home:
starmole shell workstation
starmole exec workstation 'df -h /'
starmole forward workstation 8080:localhost:80
starmole socks workstation # SOCKS5 on localhost:1080Selectors are tag:, group:,
user:, name: and node:. Caps are
shell, exec (commands without a terminal, also
granted by shell), forward (forwards and
SOCKS) and tun. See config.md for
all of it.
8. The tun device (optional)
With the tun device up, each machine gets an IPv6 address in the
network's own range and, if its certificate has one, an IPv4 address.
Normal programs reach peers by those addresses: ssh,
curl, iperf3, anything.
Let members use it, in config.toml on each machine:
[tun]
enable = true
[[allow]]
from = ["tag:admin", "tag:server"]
caps = ["tun"]A daemon running as root can create the device. One running as you on
Linux needs CAP_NET_ADMIN, and CAP_NET_RAW as
well to open the firewall when its rules match ipsets. The easiest way
to get them is a system service that runs the daemon as you, with the
capabilities from systemd. It keeps using your
~/.config/starmole:
sudo install -m 755 ~/.local/bin/starmole /usr/local/bin/starmole
sudo cp contrib/systemd/starmole@.service /etc/systemd/system/
systemctl --user disable --now starmole
sudo systemctl enable --now starmole@$USEROn NixOS, where /etc/systemd/system is read-only, use
the module instead (see Nix).
To stay with the user service, put the capabilities on the binary instead. That has to be done again whenever you replace the binary:
sudo setcap cap_net_admin,cap_net_raw+ep ~/.local/bin/starmole
systemctl --user restart starmoleEither way, the programs the daemon starts, like your shells, don't
get them. starmole status shows the device, its addresses,
routes and per-peer links; starmole id prints this
machine's overlay address.
Machines only know each other's IPv4 addresses from their
certificates, so for IPv4 between two machines, both need
--ipv4 in their certificates (or ipv4 in
[tun] plus a [[peer]] entry on the other
side). IPv6 works without it.
To reach a LAN behind a machine, list it in that machine's
[expose] routes and turn on accept_routes in
[tun] on the others. The exposing machine has to forward
and usually masquerade for that subnet.
macOS
The device on macOS is a utunN that the system names.
Creating it needs root, so it stays off under the launchd agent above,
which runs as you. Run the daemon as root to get it (see below). I haven't tried tun on a
Mac yet.
Programs that run ssh
Some programs start ssh themselves and talk to the remote side over
its stdin and stdout: rsync, git, greed. Point them at
starmole-ssh, which comes in the release tarball. If you
built starmole yourself, link it under that name first:
ln -s ~/.local/bin/starmole ~/.local/bin/starmole-ssh
rsync -av -e starmole-ssh ./notes/ workstation:notes/
GIT_SSH=starmole-ssh git clone workstation:src/repo.git
GREED_SSH=starmole-ssh greed ssh workstationstarmole-ssh reads ssh's command line, runs the command
through starmole exec, or opens a shell when there is none.
Options that only tune ssh's connection (-p,
-i, -o ConnectTimeout=..., -T)
are ignored; -A and -o ForwardAgent=yes
forward your agent. starmole-ssh -G host runs
ssh -G host, so a program asking what your ssh config says
about a host gets the real answer. Greed does that to decide whether to
forward your agent, so ForwardAgent yes in
~/.ssh/config works with
GREED_SSH=starmole-ssh. A user, as in
deploy@workstation or -l deploy, is passed on:
a daemon running as root starts the session as that user if a rule
allows it, and one running as a normal user refuses anyone but itself.
Port forwarding options (-L, -R,
-D) are refused: forwards come from
config.toml or starmole forward, as below.
Always-on forwards
starmole forward lasts until you stop it. For forwards
that should always be there, such as the ports a login flow calls back
on, add a [[peer]] entry for the target machine on the
machine that wants the ports, with an empty caps so it
grants nothing:
[[peer]]
name = "workstation"
node = "51f8a2c9e3d7b1f5a8c2e6d4b9f3a7c1e5d8b2f6a4c9e3d7b1f5a8c2e6d4b9f3"
caps = []
forward = [
"8250:127.0.0.1:8250", # vault login callback
"8000:127.0.0.1:8000",
"12222:127.0.0.1:22", # ssh to the workstation: ssh -p 12222 localhost
]
socks = "1080" # like ssh -D 1080starmole id on the target prints its node id. The target
has to allow forward for this machine and expose the
destinations; for a SOCKS proxy that reaches anything the target can,
that's forward = ["0.0.0.0/0", "::/0"] in its
[expose].
If an ssh session already holds those ports
(LocalForward lines), starmole status lists
the forwards as not listening. Close the session, or drop the lines from
your ssh config, and run starmole reload.
Offering services
A service is something on a machine that others reach by name instead of by port. On the workstation, to offer the Grafana that listens on its loopback to my own machines:
[services.grafana]
connect = "127.0.0.1:3000"
[[allow]]
from = ["tag:admin"]
caps = ["service:grafana"]From the laptop:
$ starmole services workstation
grafana
$ starmole open workstation/grafana --port 3000
grafana on workstation at 127.0.0.1:3000 (Ctrl-C to stop)
The difference from a forward is that the workstation decides what's reachable and under which name, per service, and nothing else behind it is. A machine without the cap is told there's no such service, the same as for one that doesn't exist.
--stdio connects stdin and stdout to the service instead
of listening on a port, once, like ssh -W. That's for
programs that run starmole themselves, and for ssh's ProxyCommand. With
sshd offered as a service called ssh, plain
ssh, scp and agent forwarding work over
starmole without the tun device:
Host workstation.mole
ProxyCommand starmole open --stdio workstation/ssh
Programs deciding whether to go through starmole can ask with
starmole services workstation --json, which prints
{"peer":"workstation","services":["grafana","ssh"]} and
exits non-zero, with the reason on stderr, when the peer is unknown or
can't be reached.
Both open a stream through the daemon, which goes out as this
machine, so they're for root, the daemon's own user and
[daemon] operators, like starmole shell.
A service can also learn who's connecting. With
identity = true, the program behind it gets one line of
JSON before anything else:
{"node":"8ef4e52d...","name":"laptop","tags":["admin"],"user":null,"groups":[],"principals":[],"ipv4":null}A machine let in by a [[peer]] entry rather than a
certificate only gets its node. That's how a program can
tell people apart without passwords of its own. Only point it at a
program that expects the line and listens on loopback or a Unix socket,
so nothing else can connect to it and send a line of its own.
Running the daemon as root
A daemon running as you can only start sessions as you. Running it as
root, it starts sessions as whichever local users you allow, and the tun
device works on macOS too. Sessions never run as root unless a rule
lists root.
Its config directory is /etc/starmole. To move a machine
over, keeping its node id:
systemctl --user disable --now starmole
sudo mkdir -p /etc/starmole
sudo cp -a ~/.config/starmole/. /etc/starmole/
sudo chown -R root:root /etc/starmole
mv ~/.config/starmole ~/.config/starmole.moved # so nothing uses the old copy by mistake
sudo install -m 755 ~/.local/bin/starmole /usr/local/bin/starmole
sudo cp contrib/systemd/starmole-root.service /etc/systemd/system/starmole.service
sudo systemctl enable --now starmole
journalctl -u starmole -f # logsOn a Mac, unload the agent
(launchctl bootout gui/$(id -u)/dev.starmole) and load
contrib/launchd/dev.starmole-root.plist instead; its
comment says how. Logs go to /var/log/starmole.log.
Then say who sessions run as, and let yourself use the daemon without
sudo, in /etc/starmole/config.toml:
[daemon]
operators = ["john"]
[[allow]]
from = ["tag:admin"]
caps = ["shell", "exec", "forward", "tun"]
as = ["john"]and sudo starmole reload. Now
starmole shell workstation opens a shell as john there.
With as = ["john", "deploy"],
starmole shell deploy@workstation gets you deploy instead,
and starmole-ssh passes on deploy@workstation
and -l deploy the same way. A rule without as
grants no sessions on a root daemon.
The CLI finds the root daemon at
/var/run/starmole/daemon.sock when you don't run one of
your own. Everyone on the machine can run starmole status
and starmole ping; everything else is for root and the
operators. Commands that work on the config directory, like
starmole allow, starmole cert install and
starmole net sign, use /etc/starmole when you
have no directory of your own, and need sudo to read or
change it. Rules there need --as: a root daemon never picks
a user for a session on its own.
On NixOS, use the module with runAsRoot = true (see Nix).
Sessions get the daemon's PATH, as with sshd. They also
get XDG_RUNTIME_DIR when the user has a
/run/user directory, so systemctl --user
works. Interactive shells are login shells and set up the rest
themselves.
Keeping the key sealed
With systemd 254 or later the key can be encrypted at rest, with the TPM when the machine has one, so a copy of the disk doesn't carry it:
sudo systemd-creds encrypt --name=starmole.identity /etc/starmole/identity.key \
/etc/credstore.encrypted/starmole.identity
sudo rm /etc/starmole/identity.keyThen add LoadCredentialEncrypted=starmole.identity to
the daemon's unit, with systemctl edit starmole. The daemon
reads its key from that credential whenever the unit passes one, and
from identity.key otherwise. Commands that need the node id
ask the daemon for it. Don't run starmole init again
afterwards: it would make a new identity.key that the
daemon ignores.
Firewalls
You don't open any ports. A daemon running as root, or with the capabilities from the tun section above, lets its own UDP port through the host firewall, so peers behind strict NATs can reach it directly (see How it works). Without that, those peers use the relay.
If a host firewall drops traffic on the tun device, allow it there. With ufw on the workstation:
sudo ufw allow in on starmole0Changing a machine's tags
On the machine that invited it:
starmole retag workstation --tags server,prodThe tags replace the ones it had, and --tags '' clears
them. The workstation gets a new certificate with them right away, and
so does every other machine, so rules that match tag:prod
apply to it within seconds. Its renewals keep the new tags. A delegated
issuer can only give tags its issuer certificate allows.
This is how a machine that joined with a placeholder tag, like
pending, gets its role once someone has looked at it.
A laptop that signed in at an auth service loses its sign-in when retagged, since the new certificate replaces that one. Its user signs in again.
Removing a machine
On home:
starmole revoke workstationHome signs a new revocation list and sends it to a few members right away, and each one passes it on as soon as it has it. A member that was offline catches up when it next syncs. Each member drops the workstation and closes its connections as soon as it has the list. The workstation can't renew either.
To move a name to a new machine, invite it with
--replace. The old machine is revoked as the new one
joins.
Sharing the work of inviting
If one machine shouldn't be the only one that can invite, give another one an issuer certificate. On home:
starmole net sign-issuer 51f8a2c9e3... --names 'server-*' --tags 'server-*' --max-ttl 7dInstall the printed starmoleissuer1: text on that
machine with starmole cert install and
starmole reload. It can then starmole invite
and renew machines, but only with names and tags matching
server-* and certificates of at most 7 days.
--names is required: rules can match names, so an issuer
that could hand out any name could hand out home. Use
'*' if you trust it with any name. It can't revoke;
starmole revoke stays with the network key.
Moving from [[peer]]
entries
Older configs list each peer with its node id and caps. Those keep
working next to certificates, and a peer gets whatever either grants.
Once every machine has a certificate and your [[allow]]
rules cover what the [[peer]] entries granted, delete the
entries and starmole reload.
Using an SSH certificate authority
If you already hand out short-lived SSH certificates (Vault's SSH
secrets engine, step-ca, Teleport, or plain ssh-keygen -s),
starmole can use them. A machine's starmole key is an ed25519 key like
any SSH key, so your CA can sign it, and machines that trust the CA
accept the certificate the way sshd does with
TrustedUserCAKeys. Logins, roles and lifetimes stay in the
system you already have; starmole only checks the result.
On the machine that wants in, print its key in SSH form and have your CA sign it:
starmole id --ssh > ~/.ssh/starmole.pub
ssh-keygen -s ca_key -I alice@example.com -n dev -V +10h ~/.ssh/starmole.pub # or your CA's way
starmole cert install - < ~/.ssh/starmole-cert.pubssh cert alice@example.com
principals dev
signed by SHA256:uNrLQaXuJEc/L69m1W+451+D0wcF/tc+vLyDQEx1Z0c
expires in 9h 59m
On the machines it should reach, trust the CA and say what each principal may do:
[network]
id = "<network id>"
ssh_ca = ["ssh-ed25519 AAAA… vault"] # the CA's public key, as for TrustedUserCAKeys
[[allow]]
from = ["principal:dev"]
caps = ["shell", "exec", "forward"]
as = ["john"]The certificate's key id shows up as the machine's name in
starmole status and starmole log. When it
expires, peers drop it; nothing renews it, so getting back in means a
fresh certificate from your CA, with whatever login that takes.
starmole revoke works on these machines too.
Signing in with a credential helper
Doing the three steps above every morning gets old. Put the signing
in a command and starmole login does all of it:
[credential]
helper = "vault login -method=oidc -no-print >&2 && vault write -field=signed_key ssh/sign/starmole public_key=-"$ starmole login
Complete the login via your OIDC provider. Launching browser to: …
ssh cert vault-oidc-alice
principals alice
signed by SHA256:uNrLQaXuJEc/L69m1W+451+D0wcF/tc+vLyDQEx1Z0c
expires in 9h 59m
installed /etc/starmole/ssh.cert
The helper gets the machine's key on stdin (what
starmole id --ssh prints), and
STARMOLE_NODE_ID and STARMOLE_NETWORK in its
environment. Whatever it prints on stdout gets installed, so it can be
any script that ends up with a certificate: your CA's CLI, an
ssh-keygen -s on a box you trust, a curl to an internal
service. What it prints on stderr goes to your terminal, which is where
a browser sign-in or a prompt ends up.
It runs as you, so it uses your tokens and your browser. With the
daemon running as root, starmole login,
starmole cert install and starmole id --ssh
work without sudo for root and [daemon] operators: the
daemon installs the certificate. You can put the helper in your own
~/.config/starmole/config.toml or in the daemon's.
The helper is the first of a few places I want things to plug in; extending starmole has the rest.
A few things to know:
- Only user certificates for the machine's own key count. Certificates
with critical options such as
force-commandorsource-addressare refused, since starmole can't enforce them the way sshd would. - An SSH certificate doesn't name a starmole network. Every machine that trusts the CA accepts it, so use principals that mean something for starmole (a separate Vault role works well), rather than ones your jump host also accepts.
- A machine with both a starmole certificate and an SSH one uses the starmole one.
Signing in at an auth service
Trusting a CA on every machine works for a few machines. Past that, it's easier to have one machine check SSH certificates and hand out short starmole certificates in return: an auth service. The other machines only need to trust the network key, as before, and the rules match users and groups instead of principals.
On home, which holds the network key, make the workstation an auth
service that may hand out users and the groups alice and
eng, for up to 12 hours:
starmole net auth add workstation --kinds ssh --names '*' --users --groups alice,eng --max-ttl 12hOn the workstation, point it at the CA:
[exchange.verifiers]
ssh = "starmole-verify-ssh --ca /etc/starmole/user_ca.pub"starmole-verify-ssh comes with starmole. It accepts an
SSH certificate for the key signing in, from one of the CAs in the file,
and turns its principals into groups, the first one also the user. The
starmole certificate lasts no longer than the SSH one.
On the laptop, keep the same [credential] helper as
above and run starmole login. It finds the auth service in
the network policy, sends the SSH certificate from the helper as the
proof, and installs the certificate it gets back:
$ starmole login
Complete the login via your OIDC provider. Launching browser to: …
cert 3f0c9a1d7e2b4c58a6e1f0b2d9c4a7e3
network 9a41c7f2b0e6d3a8c5f1b7e4d2a9c6f3b8e5d1a7c4f2b9e6d3a8c5f1b7e4d2a9
node c07e4b1d9a2f6e8b3d5c1a7f4e9b2d6c8a3f5e1b7d9c2a4f6e8b1d3c5a7f9e2b
name laptop
groups alice, eng
user alice
signed by issuer 51f8a2c9e3 (8d2e4f6a1c3b5d7e9f0a2c4e6b8d0f1a)
expires in 9h 59m
installed /home/alice/.config/starmole/cert
The laptop keeps its name, and its tags if the auth service may hand
them out (--tags on net auth add); the user
and groups come from the sign-in. The name has to match
--names, or the sign-in is refused; '*' lets
every machine sign in under the name it already has. A certificate from
a sign-in isn't renewed. When it runs out, starmole login
again.
Servers that sign in by themselves
A server can prove itself with a key of its own, like a fleet machine
whose identity key signs an SSH certificate for its starmole key. Nobody
is there to run starmole login, so let the daemon do
it:
[credential]
helper = "/usr/local/bin/sign-node-key"
renew = trueThe daemon then runs the helper and signs in when it has no certificate, and again before the one it got runs out. A verifier that asks a question fails the sign-in, since nobody is there to answer.
A person's laptop with the same setting gets nothing it couldn't before: each renewal still needs a proof the verifier takes. Keep machines apart from people with a separate auth service for machines, whose issuer certificate can't name users or groups, only the tags and names of the fleet:
$ starmole net auth add coordinator --kinds machine --names 'node-*' --tags 'k8s-*' --max-ttl 1d
A certificate from it has tags and no user, so rules for people never match it. Short certificates also mean a machine taken out of the fleet's records is off the network once its certificate runs out, without revoking it.
Signing in at your identity provider
starmole-oidc also comes with starmole. It signs people
in at an OpenID Connect provider (Keycloak, Zitadel, Authentik, Entra
ID, Google and so on) with the device flow: starmole login
shows a link and a code, you sign in there in any browser, and the auth
service gets the ID token. The token stays on the auth service.
At the provider, register a client for starmole with the device flow allowed and a claim that lists groups. In Keycloak that's a client with "OAuth 2.0 Device Authorization Grant" turned on and a "Group Membership" mapper with "Full group path" off. Then, on home:
starmole net auth add workstation --kinds oidc --names '*' --users --groups 'eng,oncall' --max-ttl 12hAnd on the workstation:
[exchange.verifiers]
oidc = "starmole-oidc --issuer https://sso.example.com/realms/eng --client-id starmole --require-group eng"On the laptop:
$ starmole login
Sign in at https://sso.example.com/realms/eng/device?user_code=WDJB-MJHT and check the code is WDJB-MJHT
cert 7d1e...
groups eng
user alice
...
The user is the preferred_username claim and the groups
come from groups. --user-claim email or
--groups-claim roles pick others; a claim that's an object,
the way Zitadel lists project roles, counts its keys as the groups.
--require-group turns away anyone outside those groups
before a certificate is signed. Leave it out and everyone who can sign
in at the provider gets one, with whatever groups they have. A provider
that wants a client secret gets it from
--client-secret-file.
Only sign in with a code you started yourself. Someone who gets you
to enter their code gets a certificate with your user and groups for
their machine. That's how the device flow works everywhere, and
--require-group limits how much it's worth.
An auth service can check other kinds of proof with other programs. How to write one is in Extending starmole.
Requiring sign-in
Once people can sign in, you can make it the only way their user and groups count. On home:
starmole net auth require --from 2026-12-01Until then nothing changes, except that machines log
policy.would_refuse whenever something allowed now would be
refused after the date, so starmole log shows who still
hasn't signed in. starmole status on those machines tells
their users:
sign-in required from 2026-12-01 00:00: run `starmole login` before then
From the date, user:, group: and
principal: rules only match certificates from an auth
service. Names, tags, node: rules and [[peer]]
entries keep working as before, so servers that rules match by tag don't
notice. Leave out --from to require it right away, and
starmole net auth require --off stops requiring it.
A machine that should keep to its own rules whatever the network says
sets [policy] follow = false.
Rules for many machines
With a handful of machines, starmole allow add on each
is fine. With more, you can write a rule once on the machine holding the
network key and let it spread:
starmole net rules add --on tag:server --from tag:admin --caps shell,exec,forward
starmole net rules list
starmole net rules remove 1--on says which machines it's for, matched against their
certificates (member for all), and the rest is the same as
in [[allow]]. The rule is signed into the network policy
and reaches every member within seconds, but a machine only takes it
when its config.toml says so:
[policy]
signed_rules = trueIt then adds the signed rules that are on it after its own. With that line, whoever holds the network key can grant access on that machine without touching it, so leave it out where only the machine's own config should decide. A signed rule can't run sessions as root.
Using your own relay and lookup servers
By default machines publish their addresses to n0's public DNS
service and use n0's relays. Both are open source and self-hostable
(iroh-relay and iroh-dns-server):
[network]
relays = ["https://relay.example.com"]
address_lookup = { pkarr = "https://dns.example.com/pkarr", dns = "dns.example.com" }All machines in a network need the same settings to find each other.
Upgrading
Download the latest release as in Install,
copy the binaries over the old ones, restart the daemon, and check that
it's back. With the user service and ~/.local/bin:
cp -P starmole-x86_64-linux/bin/* ~/.local/bin/
systemctl --user restart starmole
starmole checkIf you use tun this way, run setcap again before the
restart. If the daemon runs from /usr/local/bin (for tun,
or as root), replace it there and restart its unit,
starmole@$USER or starmole:
sudo install -m 755 starmole-x86_64-linux/bin/starmole /usr/local/bin/starmole
sudo systemctl restart starmole@$USEROn a Mac running as root, it's
sudo launchctl kickstart -k system/dev.starmole.
starmole check waits until the daemon answers and
reaches another member, and says which:
$ starmole check
reached home: direct 192.168.20.120:39099 (6.1ms)
After a minute (--timeout changes that) it gives up,
prints why and exits non-zero, so a script can put the old binary
back:
cp /usr/local/bin/starmole /usr/local/bin/starmole.prev
install -m 755 starmole.new /usr/local/bin/starmole
systemctl restart starmole
if ! starmole check; then
install -m 755 /usr/local/bin/starmole.prev /usr/local/bin/starmole
systemctl restart starmole
fiWhen you upgrade a machine you're reaching over starmole, run that
script with
sudo systemd-run --unit starmole-upgrade ./upgrade.sh.
Restarting the daemon ends your session, and systemd stops whatever the
session started, the script included, unless it runs as its own
unit.
Upgrade one machine first and check it still reaches the others before doing the rest.
When something doesn't work
When a machine turns yours away, starmole shell,
exec, forward and socks say why
and what to do, for example:
workstation turned this machine away: this machine's key is revoked. `starmole cert show`
shows this machine's certificate.
When your own machine can tell what's wrong, such as having no certificate at all, it says so. Otherwise it asks the machine that said no, which answers with its reason: an expired or revoked certificate, one for another network, or one it has no reason to trust.
starmole statuson both machines: is the peer connected, and over which path?starmole ping workstationshows the round trip and whether it's direct or relayed.starmole netcheckreports the NAT type, public addresses and relay latency.- A pair of machines that stays on
relayusually has a hard NAT on one side and no port mapping on the other. It still works, only slower; turning on UPnP, PCP or NAT-PMP on either router usually gets it direct. The other usual cause is a host firewall dropping what the router forwards, when the daemon can't open it: the daemon log says "firewall opened" or why not. starmole logon the machine being connected to lists denials next to the sessions that worked, by peer name:starmole log --peer laptop --since 1h.- The daemon logs say why a connection was refused: unknown peer, no certificate, a cert for another network, or no rule granting the cap.
starmole cert showprints this machine's certificate and whether it's valid.- Certificates allow five minutes of difference between clocks. A machine whose clock is further behind than that when it joins is told so: it keeps the certificate, which starts counting within seconds of the clock being set right, by NTP or by hand.