simtrunkDocs

Using simserve

Every simserve command, its state folder, running it as a service, updating, moving and uninstalling a SIM bank.

simserve turns a computer into a SIM bank. It links to your organization on simtrunk and serves the SIMs in every card reader and USB modem plugged in. This page is its reference; to set up a first bank, start with Connect a SIM bank.

Commands

CommandWhat it does
simserve enroll TOKENEnrols this computer with the one-time token from the dashboard: makes the bank's key, checks it reached your organization, and saves its certificate
simserve or simserve serveRuns the bank: links to simtrunk and serves every reader and modem
simserve readersLists the card readers and modems it can see
simserve service installInstalls simserve as a service that starts at boot
simserve service start|stop|restart|statusControls the service
simserve service uninstallRemoves the service (the enrolment stays)
simserve versionPrints the version

Every command takes -h for its options.

The state folder

enroll saves the bank's key, its certificate and how it links in a state folder. simserve reads it from there, so it needs no config file.

Run asState folder
root (and the system service)/var/lib/simserve
your own user~/.simserve

Set another one with -dir or SIMSERVE_DIR, on both enroll and serve. One folder is one bank: to run two banks on one computer, give each its own folder.

Warning

The folder holds the bank's private key. Don't copy it to another computer or share it: enrol the other computer instead.

Enrol

Terminal
sudo simserve enroll st1_…
OptionWhat it does
-name NAMEThe bank's name in the dashboard (default: the computer's name)
-dir PATHThe state folder to enrol into
-transport grpc|websocket|webrtcLink another way than the token says
-gateway-url https://…Use another address than the token says

You rarely need the last two: the dashboard puts the right link in the token. The bank renews its own certificate before it expires; you don't have to enrol again.

Run it as a service

Terminal
sudo simserve enroll st1_…sudo simserve service installsudo simserve service startsimserve service status

The service starts at boot and restarts 5 seconds after it stops. It uses systemd on Linux, launchd on macOS, and the Windows service manager on Windows. Options after install are passed to serve, for example sudo simserve service install -metrics 127.0.0.1:9100.

Without root, add -user to every service command to run it as your own user, on ~/.simserve:

Terminal
simserve enroll st1_…simserve service install -usersimserve service start -user

Logs:

  • Linux: journalctl -u simserve -f
  • macOS: /var/log/simserve.err.log (or ~/simserve.err.log with -user)

Serve options

OptionWhat it does
-dir PATHThe state folder (SIMSERVE_DIR)
-log-level debug|info|warn|errorHow much it logs
-metrics ADDRServes Prometheus /metrics and /healthz on this address, e.g. 127.0.0.1:9100
-modem-tty GLOBAlso look for modems on these serial ports, e.g. /dev/ttyUSB*

/healthz answers 200 while the bank is linked and serving, and 503 otherwise, which suits a monitoring check.

Plug in and out

Plug a reader, a modem or a SIM in or out while simserve runs: the dashboard shows it within seconds. A reader seen for the first time gets the next free slot and keeps it, so a line keeps its SIM whatever is plugged in later.

If the network drops, simserve retries on its own and is back within about 15 seconds of the network.

Update simserve

Download the new version (see Download simserve and simdoctor), replace the file, and restart:

Terminal
sudo install -m 0755 simserve /usr/local/bin/simservesudo simserve service restart

The enrolment stays in the state folder, so nothing else changes. With the one-line install, running it again with a new token also updates it.

Move a bank to another computer

Enrol the new computer with a new token: in the dashboard, open the bank and make a new enrolment command (the round button in its Enrolment card). The old computer's certificate stops working as soon as the new one enrols. Then uninstall it from the old computer.

Uninstall

Terminal
sudo simserve service stopsudo simserve service uninstallsudo rm /usr/local/bin/simservesudo rm -r /var/lib/simserve    # the bank's key and certificate

Then remove the bank in the dashboard.

Troubleshooting

  • It doesn't see a card reader: on Linux, install pcscd and run simserve as root, or allow its user to use the readers (Debian 13 and later refuse other users with "Access denied"). Check with simserve readers.
  • It doesn't see a modem: run it as root or as a user in dialout; try -modem-tty '/dev/ttyUSB*'; then check the modem with simdoctor.
  • "the gateway cannot be reached": check the computer's internet access and that outgoing HTTPS (or TCP 8443 for gRPC) is allowed. simserve keeps retrying on its own.
  • "not the gateway this bank enrolled with": the bank refused a gateway whose certificate it doesn't recognise. This protects you from an impostor. If your organization's gateway was reset, make a new enrolment command in the dashboard and enrol again.
  • The token is "wrong, used or expired": tokens work once and for a limited time. Make a new one in the dashboard.

How is this guide?

Last updated on

On this page