Docs: getting started
Requirements
- To run sfm: a Mac (Apple Silicon or Intel) or a Linux machine (x64 or arm64). There is no Windows build.
- Hosts to watch: reachable over SSH with public-key sign-in, running macOS, Debian, Ubuntu or a derivative, or Arch Linux or a derivative.
- Known host keys: each host's key in your
~/.ssh/known_hosts. sfm never trusts a key on first use: connect once withsshand accept the fingerprint yourself. - Only for pasted or generated keys: the OS keychain. On Linux that means
secret-tool(thelibsecret-toolspackage) and an unlocked keyring in a desktop session.
Install
sfm is a single binary, and nothing is installed on your hosts. Builds are not public yet: request early access to be told when one is available.
First run
sfm hosts import
sfm hosts test --all
sfm web
sfm hosts import reads your ~/.ssh/config. sfm hosts test --all signs in to each host and explains any failure. sfm web then prints:
sfm web: listening on http://127.0.0.1:PORT/ (Ctrl-C to stop)
Open http://127.0.0.1:PORT/#token=TOKEN
Open the link. The token is new on every start.
Two other ways to add a host:
sfm hosts add admin@server.example.com
sfm hosts add --local
--local adds the machine sfm runs on. It needs no SSH server and no key.
Configure
| Setting | Effect | Default |
|---|---|---|
SFM_DATA_DIR (environment) | Where sfm keeps its database, session token and encrypted keys | $XDG_DATA_HOME/sfm, else ~/.local/share/sfm |
sfm web --port N | The port the dashboard listens on, always on 127.0.0.1 | 0: any free port |
sfm web --offline or SFM_OFFLINE=1 | Use cached vulnerability data only and send no request | Off |
sfm hosts report ALIAS --every DURATION | How often sfm web runs a status scan of the host, from 1m to 24h; --off stops it, --default restores the default | 5m |
sfm hosts key ALIAS | The host's key: ssh-agent or IdentityFile (--existing), a key file (--path FILE), a key pasted on stdin (--paste) or a new ed25519 key (--generate) | --existing |
sfm hosts consent ALIAS --grant | Allow the Lynis audit on the host; --revoke withdraws it | Not granted |
sfm hosts public-ip ALIAS IP | Set the host's public IP for the report and the topology; sfm never looks it up online | A public address found on the host's own interfaces, if any |
Commands
| Command | What it does |
|---|---|
sfm web | Serve the local web UI on 127.0.0.1 with a new session token |
sfm web --rotate-token | Issue a new token; a running sfm web rejects the old one |
sfm hosts import [--file PATH] | Import hosts from ~/.ssh/config, or from another file |
sfm hosts add [USER@]HOST[:PORT] | Add a host by hand; --jump USER@HOST[:PORT],... goes through jump hosts, --alias NAME and --tag TAG name and tag it |
sfm hosts list | List the hosts in the inventory |
sfm hosts tag ALIAS TAG... | Tag a host, or remove its tags with --remove |
sfm hosts test ALIAS... | --all | Test the connection to hosts and explain any failure |
sfm hosts keys | List each host's key: type, fingerprint and reference only |
sfm hosts key ALIAS --show-public | Print a pasted or generated key's public line and setup steps again |
sfm hosts disable ALIAS | Stop monitoring a host and keep its stored data; sfm hosts enable ALIAS turns it back on |
sfm hosts remove ALIAS --yes | Remove a host and delete everything sfm stored about it; cannot be undone |
sfm report --format ecs|prometheus | Print the fleet report from the stored scans as ECS NDJSON (Wazuh) or Prometheus text (Grafana); --output PATH writes a file, --host ALIAS limits it |
sfm mcp | Serve the read-only MCP tools on stdio for an AI agent |
sfm list-hosts --json | The MCP tools from the command line: also get-host-status, list-findings, get-finding, get-fix-steps and refresh-host-status, with the same arguments and the same JSON answer |
sfm licenses | Print the third-party notices and the Lynis license (GPL-3.0) |
sfm --version, sfm --help | Print the version, or the usage text |
AI agents
sfm mcp lets Claude Code, Codex or any other stdio MCP client answer questions about your fleet from stored scan data, with no shell. For Claude Code, put this in a project's .mcp.json:
{
"mcpServers": {
"sfm": {
"command": "sfm",
"args": ["mcp"],
"env": {
"SFM_DATA_DIR": "/home/you/.local/share/sfm",
"SSH_AUTH_SOCK": "/run/user/1000/ssh-agent.socket"
}
}
}
}
For Codex, in ~/.codex/config.toml:
[mcp_servers.sfm]
command = "sfm"
args = ["mcp"]
env = { SFM_DATA_DIR = "/home/you/.local/share/sfm", SSH_AUTH_SOCK = "/run/user/1000/ssh-agent.socket" }
Use the full path to the binary if sfm is not on the client's PATH, and your own agent socket (echo $SSH_AUTH_SOCK).
Troubleshooting
| Symptom | Fix |
|---|---|
sfm mcp exits with status 1 and names a path | There is no database at that path, and sfm mcp never creates one. Add hosts and run sfm web first, and set SFM_DATA_DIR in the MCP client's env block: clients often start servers with a reduced environment. |
| A connection test stops at a new or changed host key | sfm reads known_hosts and never writes it. Check the fingerprint and accept the key with ssh, as sfm hosts test explains. |
--paste and --generate are disabled on a headless Linux server | They need the Secret Service through secret-tool and an unlocked keyring. Use ssh-agent or a key path instead. |
refresh_host_status cannot sign in from an MCP client | It needs SSH_AUTH_SOCK in the client's env block for ssh-agent keys, and it never asks for a passphrase. |
| macOS shows privacy prompts for your terminal while this machine is scanned | Expected when sfm is started from a GUI terminal: the scan's commands run as that terminal's child processes. |
| The Lynis audit will not run on this machine | It refuses to run as root. Run sfm as a normal user to audit the machine it runs on. |