ROAMSWITCH FOR LINUX · OPERATIONS REFERENCE
CLI / Headless Operations Guide
A reference for operating RoamSwitch for Linux without the GUI: from cloud VPSs, over SSH, from cron, from monitoring scripts, and from AI agents (MCP).
- Client edition (
roamswitch): for laptops. Switches nftables profiles according to how much the network you connect to is trusted. This is the main subject of this guide. - Server edition (
roamswitch-server): for VPSs and servers. Provides default deny-all, FIM, eBPF integration, emergency notifications, and more. See the RoamSwitch Server Edition Operations Manual for details.
1. Components
| Component | Runs as | Role |
|---|---|---|
roamswitch-daemon (Client) |
root (systemd Type=notify + WatchdogSec=30) |
All of the client's privileged work: nftables control, network assessment, ransomware/malware monitoring, fanotify, ARP/NDP pinning, DNS enforcement, and so on. Opens no TCP/UDP sockets |
roamswitch-server-daemon (Server) |
root (systemd Type=notify + WatchdogSec=30) |
All of the server's privileged work: default drop of all inbound traffic, protection of exceptions for SSH / management source IPs, FIM (tamper detection over a set of critical files and directories), receiving Falco eBPF events over a UNIX socket, process freezing (SIGSTOP), the exec recorder, event forwarding (opt-in), and sending notifications |
roamswitch (CLI) |
login user (some actions require sudo) | Thin client reading daemon state. Uses /run/roamswitch/roamswitch.sock IPC on Client Edition, or provides --server, server, fim, and emergency-restore subcommands on Server Edition. |
roamswitch-mcp |
spawned by AI clients | MCP server (stdio / JSON-RPC) for programmatic status retrieval by AI agents. No tool changes settings. See MCP setup |
roamswitch-ransomware-rollback |
root (watch runs as the systemd unit roamswitch-ransomware-rollback-watch.service) |
Ransomware recovery tool. Takes snapshots of btrfs subvolumes and LVM logical volumes and extracts only the files you need. Included in the client package; also available from the GUI’s Incident Response tab |
roamswitch-app |
login user | GTK GUI (Client Edition only). Not needed in headless environments. |
A headless deployment runs on the daemon + roamswitch CLI (plus roamswitch-mcp if desired). All autonomous defense mechanisms work without any GUI.
roamswitch) and Server Edition (roamswitch-server) are mutually exclusive packages (Conflicts). Deploy roamswitch-server on server environments.2. Daemon (systemd services)
Client Edition
sudo systemctl status roamswitch.service # Status
sudo systemctl enable roamswitch.service # Auto-start at boot (enabled at install)
sudo systemctl restart roamswitch.service # Restart
journalctl -u roamswitch.service -f # Follow logs
journalctl -u roamswitch.service --since "1h ago"
The daemon autonomously performs the following at startup and every cycle (3-second interval).
- Identifies the connected gateway MAC and applies nftables profiles (
open/balanced/lockdown) againsttrusted_networks - Behavioural ransomware detection (fanotify + Shannon entropy + canaries)
- On-access malware scanning (fanotify, optionally ClamAV)
- ARP spoof monitoring and preventive gateway ARP/NDP pinning on untrusted networks
- Kernel hardening (sysctl / Yama / core dumps /
/tmpnoexec) per profile - Threat-protection DNS enforcement (
dns_enabled+dns_scope) - Link guard (NFQUEUE) for phishing interception
- Runtime state output to
/run/roamswitch/state.json
Server Edition
sudo systemctl status roamswitch-server.service # Status
sudo systemctl restart roamswitch-server.service # Restart
journalctl -u roamswitch-server.service -f # Follow logs
3. CLI Command Reference
Basic syntax: roamswitch <command> [options]. Running without arguments defaults to status. Output language automatically follows the OS locale (LC_ALL / LC_MESSAGES / LANG).
| Command | Permissions | Description |
|---|---|---|
status [--server] (alias report / server-status) |
User | Security health assessment (31 items normally, the 42-item server assessment with --server), score (0–100), grade and advice. --json prints the same report as machine-readable JSON on stdout |
server [status|config|setup|tui|test-notify|restart|ack|ebpf|bans|unban|allowlist] |
User/root | Server Edition management. config is configuration, setup is the wizard, tui is the TUI (read-only for regular users), test-notify tests notifications, and restart restarts (reloading configuration is not supported). ack acknowledges an emergency isolation, and ebpf shows isolation state and incident history. allowlist [list|add <rule> <process> [--exe <absolute path>] [--days N] <reason...>|renew <rule> <process> [--days N]|remove] is the false-positive allowlist (expiry 1 to 365 days, default 30). bans [--json] shows the state of the SSH brute-force guard, and unban <IP|IPv6 /64|--all> lifts bans (root) |
fim [verify|update] [--quiet|-q] |
User/root | Critical-Path File Integrity Monitoring verification (verify) and baseline hash database update (update). --quiet suppresses output for cron / systemd hooks |
bans [--json] |
User/root | Shows the state of the SSH brute-force guard (blocking / detect only / stopped, and why), the sources blocked right now with the time left, and the recent records. The ban list is readable by root only, so add sudo. --json is available. Same as server bans on the Server Edition |
unban <IP | IPv6 /64 | --all> |
root | Lifts SSH-guard and web-access-guard bans and clears the SSH failure count of that source. --all lifts every ban. Same as server unban on the Server Edition |
posture [status|ack] |
User | Client Edition. Shows how a network registered as Trusted (Open) is treated given this machine's state (status, optional). ack records that you looked at the detections and they are fine, and puts the level back (root only when the daemon is not running). A detection after that lowers it again. Not available in the Server Edition |
ssh-allow [status|check|add|remove|enable|disable] |
root | Server Edition. Lets only the sources in ssh_allow_only_sources (IP addresses and CIDRs) open a new SSH connection (ssh_allow_only_enabled, off by default). Established connections are not cut. It is not turned on while the list is empty or while a source connected over SSH right now is not on it. check only tells whether turning it on would be refused and changes nothing. disable removes the rule without waiting for the daemon |
emergency-restore |
root | Lift all emergency eBPF / firewall isolations and restore network baseline |
ports [-a|--all] |
User | Listening ports on 0.0.0.0, unauthenticated DBs, and dev servers. -a includes loopback-only ports |
guards |
User | Status of automatic defense guards (port anomaly, ARP, USB storage, download, DNS threat, canary, dev-server isolator, Bluetooth) |
wifi |
User | Wi-Fi encryption strength (Open / WEP / WPA / wired) and SSID |
sharing [status|on|off] |
User | Automatic stop and restore of shared services (SSH / Samba / RDP) on untrusted networks. on stops them automatically when connected to an untrusted network |
audit-url <URL> |
User | Inspect URL phishing and threat risk via local feed + heuristics (never fetches target); a defanged address such as hxxps://example[.]com is restored first |
audit-secrets [--text] <text|path|directory> |
User | Detect API keys, private keys, and tokens in text, a file, or a directory (recursive; skips .git/node_modules/etc.) — never transmits data. audit-secrets <FOLDER> does not look at dist and build. Use scan-frontend for the published side. It exits with 1 when something is found, and with 2 when there is no argument or an argument that looks like a path does not exist. Add --text to check a string as text. |
audit-logs [hours] |
User | Aggregate and classify system journald / auth logs from the last N hours (default 24). API keys and tokens are automatically masked. Also shows log-pattern anomaly detection results (new patterns and statistical frequency spikes) |
canary |
User | Ransomware canary decoy file status and integrity, and detected incident history (up to the most recent 50) |
port-anomaly (alias port-guard) |
general | The Port Anomaly Guard's baseline status, currently auto-isolated ports, and detected incident history (up to the most recent 50) |
quarantine [list] |
User | Contents of malware quarantine vault (sample, original path, threat name, date) |
knowledge [query] (alias faq) |
User | Search the offline knowledge base |
airgap [enable|disable] |
User/root | Trigger or lift emergency Air-Gap isolation (Client Edition only). enable drops all external traffic (connections that were already open are cut too) and disable restores it. See “Isolation (Air-Gap) policy” below for how automatic release works |
help (--help / -h) |
User | Show help (roamswitch <command> --help for subcommand help) |
scan-packages [FOLDER...] |
General | Checks installed OS packages (dpkg/pacman/dnf/zypper) against the known-CVE map. If you pass a folder, lockfiles (7 ecosystems) are checked too. On Ubuntu (20.04, 22.04, 24.04, 26.04), only CVEs rated CVSS 7.0 or higher that have a fixed version are checked. Makes no network connection at all |
scan-vulns [--confirm] |
General | Only runs when active_vuln_scan_enabled: true (off by default): 127.0.0.1-only unauthenticated-reachability checks against Redis/Memcached/MongoDB/dockerd, CORS misconfiguration/path traversal/open redirect/SSRF/reflected XSS (GET only, a harmless marker with no script) checks against detected dev servers, SMTP open-relay diagnostics, and proof-based exposure checks for Telnet/FTP/SSH. Without --confirm it's a dry run The exit code is 1 when there is at least one confirmed finding (✗). The SSH banner and nmap's reports (ℹ) are informational and are not counted. |
vuln-status |
General | Shows the latest result of each probe recorded by scan-vulns --confirm (vulnerable / no problem / undetermined) and how many days ago it was. If it has never been run, it prompts you to run it and exits; it never rescans automatically. Also viewable in the GUI (ports tab) and via the MCP tool get_vulnerability_scan_history |
notifications (alias notification-history) |
User | The history of notifications RoamSwitch has sent (log-audit anomalies, ClickFix detections and so on) for the past week, newest first. --json prints a JSON array and --export <FILE> writes JSON Lines |
frozen [list|resume <PID>|resume all] |
User / root | Lists the processes the guards (ransomware rapid-encryption detection, canary tampering, kernel-exploit detection, and the eBPF guard’s pinpoint containment) hold in SIGSTOP, and releases one (SIGCONT) that was a false positive. A freeze is not a kill, so a released process resumes exactly where it stopped. resume all releases every one. Releasing a process owned by root requires sudo |
resource-guard (alias leak-guard) |
User | The Resource Exhaustion / Process Anomaly Guard's (Server Edition only) detected incident history: sustained non-recovering RSS growth (memory leak / DoS) or crash-looping in network-exposed services, each with a confidence tier |
timeline (alias incident-timeline) |
User | Merges detections from the link guard (ARP spoofing), ransomware canary, eBPF runtime guard, and resource guard into one timeline, with process lineage and MITRE ATT&CK tags (experimental). --json writes a JSON array to standard output; --export <file> writes JSON Lines to a file. Under a detection whose evidence bundle was saved, the save lines are listed with └─. |
xdp-gate [status|enable|disable] |
User / root | Show or toggle the XDP boot-time gate (experimental). status reports whether roamswitch-xdp-gate.service is enabled and the program’s current state. Disabled by default |
sensor [key|list|pair|repin|unpair|request-audit|results] |
User / root | Establishes mutual trust with the network sensor “RoamSwitch Sensor” (installed on a separate device) using a pairing code. With pair --addr <IP> --code <code> --fingerprint <SHA-256>, enter the code issued by the Sensor and the fingerprint shown on the Sensor's screen (the Sensor must have a fixed IP). It pins the TLS 1.3 certificate, does not fetch it from the network, and never falls back to plaintext. Other commands include request-audit (requests an active vulnerability audit; results via results). Requires sensor_pairing_enabled: true (off by default). For details, see the Sensor Operations Manual |
port-scan (alias portscan) |
User | Shows the incoming-port-scan-detection guard's detection history (source IP, whether it was auto-blocked, and block duration). A different feature from port-anomaly, which detects newly “exposed” unknown ports |
lockfile-fim [verify|update] [--quiet|-q] |
root | Verify (verify) or reset (update) the dependency lockfile tamper-monitoring baseline. Requires root. The watched project folders are the targets (lockfile_watch_dirs on the server edition) |
scan-scripts <FOLDER...> |
User | Statically lists the preinstall / install / postinstall / prepare scripts from the package.json files in node_modules (an inventory, not a threat verdict). It also flags pip and uv extra-index-url settings and @scope packages whose source is not pinned in .npmrc. If there is no setting that avoids freshly published versions (such as pnpm's minimumReleaseAge), it is shown with severity “low”. It makes no network connections and does not read environment variables or settings elsewhere. Once you confirm with --accept (humans only; not available from MCP), packages that gain code running at install time are flagged from then on. The baseline is stored in ~/.config/roamswitch/package_install_baseline.json, digests only. |
scan-typosquat <FOLDER...> |
User | Compares the dependency names in package.json with a bundled list of well-known npm package names at edit distance 1 to 2, and shows suspected typosquatting (for reference; no network connection). Names ending in js or .js (such as nodemonjs and zustand.js) are also compared with that ending removed. |
web-scan [FOLDER...] [--quarantine] [--json] |
User/root | Checks for web shells (PHP, JavaScript, JSP, ASP), injected code, PHP disguised as images, and .htaccess abuse, using built-in rules, the signed daily feed and rules in /etc/roamswitch/rules.d. If omitted, it scans the document root and PHP sessions (sess_ files directly under it). It only checks by default; --quarantine (root) isolates findings. Exit codes: 0 = nothing detected, 2 = critical / high found, 1 = run failed |
web-rules [status|list|validate <file.json>|locked|unlock-account <user>|example] |
User/root | Shows the state of the web application layer rules (version, installed feed version, custom rules directory, quarantine level, account response, post-detection hook) (status), lists the loaded rules (list), validates a custom rule file (validate), shows login shells disabled by the account response (locked) and restores them (unlock-account, root), and prints examples of the configuration and hook (example) |
web-gate-config <PATH> [--proxy URL] |
User/root | Prints the nginx configuration of the web gate that guards an endpoint taking identifiers (receipt or order numbers). Nothing is changed. The gate runs on a Unix socket only and never reaches the network. |
web-id-check '<URL with {n}>' --start N [--count 3..10] [--yes] |
User/root | Asks your own site's identifier endpoint for consecutive numbers (up to 10) with GET and no login, and checks whether different contents come back per number. If they do, other people's data may be readable (exit code 2). A host outside this machine's own network needs --yes. |
web-guard-check [--hours N] |
User/root | Checks from the access logs and the web server configuration whether this environment is fit for the web access guard to block (changes nothing). It looks at the busiest addresses, the share of requests from private and from shared addresses, and whether a setting restores the visitor's address, and reports fit, works for part only, not fit, or cannot tell. Exit code 1 when not fit. Reading the logs needs root. |
roamswitch doctor [--json] |
User/root | Checks whether the machine can support RoamSwitch's defenses (changes nothing and makes no connections). It looks at whether required tools (nft, systemctl, etc.) are present, whether they and RoamSwitch's files are writable by anyone other than root, the results of dpkg --verify / rpm -V, manually installed CA certificates, and whether the daemon, ufw, fail2ban and similar are running. --json outputs JSON. Exit code 1 if there is even one failure (0 if only warnings). Also available from “Tools” in the Server TUI. |
roamswitch scan-frontend <FOLDER> |
User/root | Looks in public front-end files for API keys, private keys and the like (same detection as audit-secrets), JWTs and source maps (.map). It reads dist, build, public and similar, and if none exist, reads the folder itself (audit-secrets <folder> does not look at dist and build). Values are shown only as the first 4 characters and the length; exit code 1 if anything is found. Limits are 5 MB per file, 200 MB in total and 20,000 files, and symbolic links are not followed. |
kernel-modules [--json] [--apply [MODULE...]] [--remove] |
User/root | Checks, by reading only (no connections), whether the kernel modules used in Copy Fail, Dirty Frag and act_pedit (algif_aead, esp4, esp6, rxrpc, act_pedit) can be loaded. --apply (root) blocks unused ones via modprobe.d, and --remove reverts this. Not counted in the diagnostic score |
audit-agent-setup [FOLDER...] [--json | --format text|json|sarif] |
User/root | Inspects AI agent instruction files, skills and settings, read-only (no connections). Targets: ~/.claude, ~/.codex, ~/.cursor and the like; CLAUDE.md, AGENTS.md and similar in registered projects and in FOLDER; openclaw.json; agent memory; VS Code tasks; GitHub Actions workflows; and the settings of Claude Code, Gemini CLI, Codex, Cursor and OpenCode. It flags invisible Unicode characters, instruction overrides, secret exfiltration, hooks that run just by opening, and the like (content inside HTML comments is weighted more heavily). It does not output body text or secrets. Matches are places for a person to check, not a determination of malice. Output is available with --json and --format sarif (SARIF 2.1.0), and each finding carries OWASP LLM and ATT&CK tags. |
detection-coverage [--server | --client] [--json | --format json|navigator] |
User | lists, per MITRE ATT&CK technique that an intruder uses to weaken defenses, remove traces or stay on a host, whether RoamSwitch can notice it (detects / partial / none), what it does not see, and whether the guard that would notice is running now (on / off / partly on / unknown). It reads the code's own map and the local settings only: nothing is executed and nothing is sent. The tests check that the code behind each claim still exists, and a technique that is not listed was not assessed. The Client Edition lists 38 techniques (31 partial, 7 none) and the Server Edition 38 (25 partial, 13 none); none is rated detects. Choose with --server / --client (default: the installed edition). --json prints the same JSON as the MCP tool get_detection_coverage. --format navigator prints the same table as a MITRE ATT&CK Navigator layer (layer 4.5): detects green, partial yellow, none red; techniques that were not assessed are left uncoloured. |
vuln-accept <ECOSYSTEM> <PACKAGE> <CVE-ID> --version VERSION --reason TEXT [--days N] | --list | --revoke ... |
User | A person records a time-limited “acceptance” for a finding from package CVE matching. roamswitch vuln-accept <ecosystem> <package> <CVE-ID> --version VERSION --reason REASON [--days DAYS] (a reason is required; default 90 days, maximum 365 days), --list, --revoke. Accepted findings stay in the results and are counted separately from “action required”. They revert on expiry and remain in the notification history. It applies only to the specified version, and cannot be accepted from MCP |
sigma-check [RULE.yml] [--against-exec-history] [--json] |
User/root | Checks whether the Sigma rules you placed in /etc/roamswitch/sigma.d (a subset of process_creation rules) load. --against-exec-history tries them against the recorded exec events (the exec log is readable by root only). Rules that could not be loaded are listed with the reason. Only files owned by root and not writable by others are read. A match in the exec recorder produces a notification, a timeline entry and forwarding only, and never blocks anything. No network connection |
bluetooth-audit [--json] |
User | Checks the BlueZ configuration (/etc/bluetooth/input.conf and main.conf) for settings that let unpaired devices connect as keyboards, and lists the connected Bluetooth keyboards and mice (read-only) |
audit-npm-signatures <DIR> [--confirm] |
User | Verifies the signatures and provenance of installed packages with npm audit signatures (the only RoamSwitch command that talks to npmjs.com; without --confirm it is a dry run; the server edition also needs npm_audit_signatures_enabled) |
install [--pm npm|pnpm] [--yes] |
User | Wraps npm / pnpm install and confines only the execution of lifecycle scripts inside a bwrap sandbox (package downloads are made over the network as usual). In environments without a terminal (such as scripts), unless --yes is given, it stops with exit code 2 without running the scripts. |
forward status|test|queue (alias event-forward) |
User/root | Shows event-forwarding status (status), sends a test event (test) or lists the retry queue (queue) for syslog RFC 5424 / CEF, JSON Lines and an HMAC-signed structured webhook. Opt-in, off by default, and sends only to the destinations you configure (Server Operations Manual §16) |
events search|tree|export|verify|status (alias exec-events) |
root | Searching the exec recorder log (search: --since 2h --pid N --exe S --user U --parent P --text S --json), tree (tree <pid>), export (export), hash chain verification (verify; detects tampering, does not prevent it) and status (status). The log is root-only and normally needs sudo (Operations Manual §15) |
Isolation (Air-Gap) Policy
Releasing on a fixed timer alone lets a patient attacker wait it out, so the trigger of an isolation is classified by confidence (both editions).
- Low confidence (a manual Air-Gap, generic anomalies, eBPF Error / Warning and below): fully restored after a short timer (client:
airgap_low_confidence_secs, 600 s by default; server:safety_timer_secsinguard.yaml, 300 s by default;0disables the timer). - High confidence (canary tampering, mass rewrites, ARP spoofing during lockdown, eBPF Critical / Emergency / Alert, etc.): it does not recover silently, and releases with a notification only when the cause is confirmed to be gone. If the limit (
airgap_hard_cap_secs/isolation_hard_cap_secs, default 3600 seconds,0= no limit) is reached with no ack either, it moves to DEGRADED mode. - DEGRADED mode never opens automatically, however much time passes (clients allow loopback only; servers allow only the management path). It is lifted only by re-confirmation that the cause is gone,
roamswitch server ack, or a manual release (GUI /roamswitch emergency-restore). Clients also do not restore the Wi-Fi rfkill unlessairgap_degraded_lift_rfkillis set totrue. - Established connections other than the management path are cut (including C2 and reverse shells). A manual Air-Gap is low confidence, but when triggered from “Block now” on an ARP spoofing warning it becomes high confidence, and re-checks the gateway's MAC without sending anything (
arp_recheck_consecutivetimes, over at leastarp_recheck_min_secsseconds). Transitions are recorded in the timeline.
Ransomware Recovery (Snapshots & File Restore)
The following commands belong to roamswitch-ransomware-rollback (they are not roamswitch subcommands). Its state is stored in /var/lib/roamswitch.
| Command | Permissions | Description |
|---|---|---|
roamswitch-ransomware-rollback snapshot [--path PATH] [--label TEXT] |
root | Take a snapshot of the target (default $HOME) right now. Targets are btrfs subvolumes and LVM logical volumes |
roamswitch-ransomware-rollback watch [--path PATH] [--periodic-interval-secs N] |
root | Long-running. Takes a snapshot automatically on bursts of file rewrites and on Critical events recorded by other guards, and also takes pre-damage snapshots on a schedule (every 6 hours by default; keeps 4 generations on btrfs, 2 on LVM; after a detection-time snapshot, periodic snapshots pause for 7 days by default) |
roamswitch-ransomware-rollback list [--path PATH] [--json] |
root | List the snapshots this tool created (kind, whether it still exists, and the recommended pre-damage snapshot). --json for machine-readable output |
roamswitch-ransomware-rollback restore-files <ID> <PATH> [--dest DIR] |
root | Copy only the given file or directory out of a snapshot into a separate location without overwriting the current state (default <target>/RoamSwitch-Recovered/<ID>/). The first choice for recovery |
roamswitch-ransomware-rollback mount-for-browsing <ID> / unmount-browse <MOUNT_POINT> |
root | Make a snapshot’s contents visible so you can pick the path for restore-files (btrfs: as is; LVM: a temporary read-only mount). Unmount with unmount-browse when done |
roamswitch-ransomware-rollback config get|set --periodic-interval-secs N |
root | Pre-damage snapshot interval (seconds; 0 disables, otherwise at least 300). Applied to a running watch without a restart. There is no setting to turn off detection-time snapshots |
roamswitch-ransomware-rollback restore <ID> [--yes] [--accept-tampered] |
root | Roll the whole target back to a snapshot (destructive). A detection-time snapshot contains already-encrypted files, so it is refused without --accept-tampered. Try restore-files first |
Examples
sudo roamswitch status # Client full diagnostic (31 items)
sudo roamswitch status --server # Server Edition full diagnostic (42 items)
sudo roamswitch ports -a # All listening ports
roamswitch guards # Guard status
roamswitch audit-url https://examp1e-login.com
roamswitch audit-secrets ./deploy.env
roamswitch audit-secrets . # Recursively scan the current directory
roamswitch audit-logs 72 # Analyze logs from the last 72 hours
sudo roamswitch sharing on # Auto-stop SSH/Samba/RDP on untrusted networks
sudo roamswitch fim verify # FIM file integrity verification
sudo roamswitch fim update # Update FIM baseline
sudo roamswitch emergency-restore # Fully clear emergency lockdown and restore
sudo roamswitch airgap enable # Emergency lockdown
sudo roamswitch airgap disable # Disable
sudo roamswitch server ack # Acknowledge the emergency isolation (keeps a FULL isolation strict, releases a DEGRADED one)
roamswitch canary # Canary incident history
roamswitch vuln-status # Shows the last scan result and days elapsed (pass_age)
roamswitch port-anomaly # Port Anomaly Guard's incident history
roamswitch server ebpf # eBPF guard's containment status and incident history
roamswitch server bans # State of the SSH brute-force guard and the sources it has banned
sudo roamswitch server unban 203.0.113.9 # Lift an SSH-guard ban (needs root)
roamswitch notifications # Notification history from the past 7 days
roamswitch frozen # List processes held in SIGSTOP
sudo roamswitch frozen resume 12345 # Release a false-positive freeze
sudo roamswitch sensor pair --addr 192.168.1.50 --code AB3DFGH2 --fingerprint 3F:45:89:E1:...:36:10 # Pairs with Sensor using a pairing code
sudo roamswitch sensor key # Shows this endpoint's own public key/address
roamswitch port-scan # Port-scan detection history
roamswitch timeline --json # all incident-timeline records as JSON
roamswitch notifications --export n.jsonl # JSON Lines
sudo roamswitch events search --since 2h --exe curl
sudo roamswitch forward status
sudo roamswitch server allowlist add "<rule>" mytool --exe /usr/local/bin/mytool --days 30 reviewed false positive
sudo roamswitch sensor repin <PUBLIC_KEY> --fingerprint <NEW_FINGERPRINT>
sudo roamswitch server tui
The server edition runs as root, so without sudo, status / status --server / ports -a can wrongly report “not running” and miss process information. Commands that change settings, such as sharing / fim update / airgap / emergency-restore, also need sudo. Other read commands work accurately without sudo.
--helpis available for every subcommand (e.g.roamswitch ports --help).- Machine-readable output is available from
status --json, MCP (§6),/run/roamswitch/state.json(§5), and others. - In the client edition, the daemon decides the profile and the CLI does not switch it. To force one, use
manual_override(§5). statusalways exits with code 0. For monitoring, read the score line (example in §7).
4. Configuration Files
Client Edition (~/.config/roamswitch/config.json)
The daemon runs as root and scans /home/*/.config/roamswitch/config.json, using the first valid file it finds (or /root/.config/roamswitch/config.json in root-only environments).
| Key | Type / Default | Description |
|---|---|---|
language | string / OS locale | UI & CLI language (ja / en / ko / zh-Hans / zh-Hant / de / fr / es / it / pt-PT) |
trusted_networks | [{name, mac, level}] | Trusted networks; mac is gateway MAC, level is open / balanced / lockdown |
away_protection_level | string / lockdown | Default profile on unknown networks |
manual_override | string / null | Force open / balanced / lockdown (null for automatic) |
dns_enabled | bool / true | Threat-protection DNS enforcement |
dns_provider | string / quad9 | quad9 / cloudflare / adguard / cleanBrowsing |
dns_scope | string / untrusted_only | untrusted_only / always_on |
arp_spoof_guard_enabled | bool / true | ARP spoof monitoring |
gateway_arp_lock_enabled | bool / true | Preventive gateway ARP/NDP lock on untrusted networks |
port_anomaly_guard_enabled | bool / true | Auto-block new listening ports |
system_wide_fanotify_enabled | bool / true | System-wide fanotify malware guard |
pre_exec_blocking_enabled | bool / true | Pre-execution blocking (FAN_DENY) |
mount_hardening_enabled | bool / true | noexec on /tmp and /dev/shm (applied on non-open profiles) |
yama_memory_protect_enabled | bool / true | Yama ptrace restrictions |
usb_storage_guard_enabled / usb_keyboard_guard_enabled | bool / false | USB storage / BadUSB keyboard guard (off by default) |
usb_zero_trust_enabled | bool / false | USB bus authorized_default=0 |
bluetooth_guard_enabled | bool / true | Turns Bluetooth "discoverable" off on an untrusted network (on by default; the radio stays on and connected devices stay connected) |
device_posture_trust_enabled | bool / true | Run a network registered as Trusted (Open) at Balanced protection while a serious detection stands (Client Edition) |
device_posture_window_hours | int 1–72 / 6 | How long a detection counts for the lowering above (hours, 1–72) |
sharing_service_control_enabled | bool / true | Auto-stop/restore SSH / Samba / RDP |
scan_exclusions | [string] | Absolute paths excluded from scanning |
link_guard | object | {enabled, mode: "off"|"warn"|"block", allowlist, blocklist_extra, use_threat_dns} |
vpn_on_untrusted_enabled | bool / false | Auto-start VPN tunnel on untrusted networks |
vpn_backend | string / wireguard | wireguard / tailscale |
active_vuln_scan_enabled | bool / false | Allows scan-vulns to run (off by default). Requires explicit opt-in since it sends 127.0.0.1-only reachability probes |
pkgcve_watched_folders | [string] | Project folders (absolute paths) the GUI's dependency scan checks. The CLI's scan-packages ignores this setting and only uses folders given as command-line arguments |
sensor_pairing_enabled | bool / false | Allows pairing-code-based mutual trust with RoamSwitch Sensor (off by default). Required to use the sensor command |
port_scan_detect_enabled | bool / true | Incoming-port-scan-detection guard |
port_scan_detect_min_distinct_ports | int / 15 | A source connecting to at least this many distinct ports within the detection window is judged a scan |
port_scan_detect_window_secs | int / 300 | Aggregation window for scan detection (seconds) |
port_scan_block_enabled | bool / true | Auto-blocks the detected scan source IP |
port_scan_block_duration_secs | int / 600 | Duration of the automatic block (seconds) |
airgap_low_confidence_secs | int / 600 | Seconds until a low-confidence Air-Gap is restored automatically (0 = never automatically). Not applied to high-confidence isolations (§3, “Isolation (Air-Gap) policy”) |
airgap_hard_cap_secs | int / 3600 | Seconds before a high-confidence isolation moves to DEGRADED mode (0 = no cap). DEGRADED mode never opens on a timer |
airgap_degraded_lift_rfkill | bool / false | Whether DEGRADED mode also lifts the Wi-Fi rfkill (it does not by default) |
airgapAutoRfkill | bool / true | Whether Air-Gap also blocks the Wi-Fi radio with rfkill (restored on release) |
arp_recheck_consecutive | int / 3 | Number of consecutive checks in which the gateway MAC must match the trusted MAC before an ARP-spoofing isolation is considered cleared (1 or more) |
arp_recheck_min_secs | int / 60 | The minimum number of seconds that consecutive matching must span |
arp_recheck_active_probe | bool / true | For an ARP-triggered isolation, when the gateway has no neighbour-cache entry (and the link is up), send one direct ARP request to verify the gateway MAC. Any reply carrying a MAC other than the trusted one counts as a mismatch. At most one probe per 20 seconds |
credential_access_watch_enabled | bool / true | Notifies when an unexpected process opens private keys in ~/.ssh, ~/.aws/credentials, ~/.config/gcloud, browser credential stores and the like (notify only, ON by default; takes effect within about 30 seconds). Backups and indexers are already excluded, and others can be excluded with credential_access_watch_allow. AI agent sign-in files (excluding the owner's own reads), ~/.git-credentials, ~/.netrc, ~/.pgpass and the like are also covered, and no decoys are placed in the real locations. Very brief reads may not be notified. ~/.kube/config, ~/.docker/config.json and ~/.azure are not covered |
reverse_shell_watch_enabled | bool / true | Notifies when the input and output of a shell or interpreter are wired to a connection to an outside address; notify only, nothing is stopped. It checks every 2 seconds and reports only what two scans in a row agree on. An interactive shell wired by pipes or similar to a connection that openssl, telnet, ssh, nc, socat or the like holds is reported as a weaker warning. Changes apply within about 30 seconds. The app has a switch too |
reverse_shell_watch_include_private | bool / false | Also counts peers in private ranges (RFC 1918, CGNAT, link-local, IPv6 ULA). Off by default, because an ssh ProxyCommand, a container or local development puts legitimate processes there. Loopback is never watched, whatever this says |
reverse_shell_watch_allow | list / [] | Programs to leave out. Each entry is an executable name, a prefix ending in *, or an absolute path, written as a list or one comma-separated string (up to 256 entries). When the executable cannot be read, the process name is matched instead |
netconf_watch_enabled | bool / true | Checks DHCP leases and PAC / WPAD every minute, and notifies when a new DHCP server, gateway, DNS server, or PAC / WPAD appears on a known network (notify only; the first run only records). The baseline is /var/lib/roamswitch/netconf_baseline.json. Interfaces that cannot be queried with nmcli are not monitored and are listed in nm_unobservable. It takes effect within about 30 seconds |
netconf_watch_trusted | list / [] | Expected addresses (a DHCP server, gateway or DNS server), PAC host names and PAC URLs. What you write is recorded without a notification. Write a list or one comma-separated string (up to 256 entries) |
ssh_guard_* | — | The 10 keys of the SSH brute-force guard have the same defaults as the Server Edition (server.conf). The main ones are ssh_guard_max_failures (6), ssh_guard_window_secs (600), ssh_guard_ban_secs (3600), ssh_guard_ban_max_secs (604800), ssh_guard_trust_key_days (30), and ssh_guard_allow (empty; IP / CIDR). It works only while sshd is running, and out-of-range values revert to the defaults. Changes take effect within about 1 minute, with no restart. Use roamswitch bans / roamswitch unban to list and lift bans |
fim_intrusion_context_enabled | bool / true | Adds the account and executable of the process that wrote the file, and the SSH login that process belongs to (source, time, authentication method), to file-tampering (FIM) and lockfile-tampering notifications; to a credential-file notification only when the process belongs to an SSH login. Takes effect after a daemon restart. Nothing is sent anywhere |
forward_* | — | Settings for event forwarding (syslog / JSON Lines / signed Webhook). Opt-in, off by default. Keys include forward_enabled, forward_syslog_url, and forward_webhook_url (types and defaults are in the Server Edition operations manual §18) |
exec_recorder_* / exec_rule* | — | Settings for the local exec recorder and the notify-only correlation rules EXR-001 to EXR-016. Enabled by default (disabled on hosts with less than 1 GiB of memory; an explicit setting wins). The keys are exec_recorder_enabled, exec_recorder_retention_mb, exec_recorder_retention_days, exec_recorder_hash_chain, exec_recorder_hash_exe, exec_recorder_cpu_budget_pct, exec_rules_enabled, exec_rules_disabled, exec_rule_service_users, exec_rule_window_secs and exec_rules_isolation_optin (default false; only when true do high-severity rules trigger isolation). EXR-011 to EXR-016 never trigger isolation, even when exec_rules_isolation_optin is true. EXR-013 to EXR-015 can also be turned off individually with exec_rules_disabled. They only notify and never trigger isolation. |
sharing_service_control_enabled: true, connecting to an untrusted network disconnects running SSH sessions. Keeping it OFF is recommended for remote operation.Server Edition (/etc/roamswitch/server.conf)
The server edition's configuration is in INI format and is protected with 0600 (root only). The types and defaults of all keys are in Operations Manual §18. Change it with roamswitch server config show|get|set or roamswitch server tui (all 149 keys), and apply it with sudo roamswitch server restart.
Admin-only mode for shared machines
A shared machine can be set to “admin only” with sudo touch /etc/roamswitch/admin-only. Machine-wide changes such as the firewall and DNS are limited to root and the sudo / wheel / roamswitch groups. Actions on your own files and processes (isolation, kill, etc.) work as before. /etc/roamswitch/admin-only takes effect only when it is owned by root and not writable by other users; it is off by default.
5. Logs & Runtime State Files
| Path | Target | Description |
|---|---|---|
journalctl -u roamswitch.service | Client | Client daemon logs (profile switches, detections, errors) |
journalctl -u roamswitch-server.service | Server | Server daemon logs (FIM events, Falco detections, isolations) |
/run/roamswitch/roamswitch.sock | Client | Client daemon IPC Unix domain socket |
/run/roamswitch/events.sock | Server | The Falco / Tetragon eBPF integration socket (root:root, mode 0600; Falco also runs as root, so no extra permission setup is needed) |
/run/roamswitch/state.json | Client | Cycle state: {active_level, network_trusted, fanotify_ready} |
/run/roamswitch/alerts.json | Client | Recent alert queue |
/run/roamswitch/approvals.json | Client | Pending approval queue |
/run/roamswitch/fanotify.ready | Client | Flag file indicating fanotify guard is running |
/var/lib/roamswitch/fim.db | Server | FIM SHA-256 baseline hash database |
~/.local/share/roamswitch/quarantine/ | Both | Quarantine Vault (0700, samples 0400) + .metadata.json |
/var/lib/roamswitch/exec_log/ | Both | The exec recorder’s hash-chained JSON Lines (root only, 0600). Search and verify with roamswitch events |
/run/roamswitch/airgap_isolation.json / host_isolation.json | Both | The isolation (Air-Gap) state (FULL / DEGRADED) and trigger record; the isolation survives a daemon restart |
Calling IPC Directly (Advanced)
The daemon accepts newline-delimited JSON on /run/roamswitch/roamswitch.sock:
# Force-switch profile (Client Edition)
printf '{"id":1,"method":"set_security_level","params":{"level":"lockdown"}}\n' \
| sudo socat - UNIX-CONNECT:/run/roamswitch/roamswitch.sock
# Reconcile gateway ARP lock now
printf '{"id":1,"method":"reconcile_gateway_lock","params":null}\n' \
| sudo socat - UNIX-CONNECT:/run/roamswitch/roamswitch.sock
6. Programmatic Status (MCP)
roamswitch-mcp provides tools over stdio JSON-RPC (get_security_report / get_exposed_ports / audit_secrets, etc.). No tool changes settings. The only writes happen when run_active_vuln_scan, audit_security_logs and run_npm_audit_signatures update their own record files, and these three are also the only tools with readOnlyHint set to false. Every tool carries MCP annotations (readOnlyHint etc.), and openWorldHint is true only for run_npm_audit_signatures, which is disabled by default.
It does not connect to external hosts. It calls the daemon's Unix socket or roamswitch-core, and get_security_report and verify_security_findings send nothing to the LAN either. get_lan_sensor_overview and get_lan_network_threats send read requests to the Sensor on the same machine, and get_privilege_escalation_paths and get_access_log_report run the bundled PathScope and AccessScope with fixed arguments. For setup, see the MCP Integration Setup Guide
7. Automation Recipes
Daily cron health check → Email if score drops below threshold
#!/usr/bin/env bash
# /etc/cron.daily/roamswitch-health
out=$(runuser -u "$SUDO_USER" -- roamswitch status 2>&1)
score=$(printf '%s\n' "$out" | grep -oE '[0-9]+/100' | head -1 | cut -d/ -f1)
if [ -n "$score" ] && [ "$score" -lt 80 ]; then
printf '%s\n' "$out" | mail -s "RoamSwitch health: ${score}/100" root
fi
Monitor alerts queue (poll alerts.json)
#!/usr/bin/env bash
last=0
while :; do
ts=$(jq -r 'max_by(.timestamp).timestamp // 0' /run/roamswitch/alerts.json 2>/dev/null || echo 0)
if [ "$ts" -gt "$last" ]; then
jq -c ".[] | select(.timestamp > $last)" /run/roamswitch/alerts.json | logger -t roamswitch-alert
last=$ts
fi
sleep 10
done
Verify fanotify guard health (state.json)
jq -e '.fanotify_ready == true' /run/roamswitch/state.json >/dev/null \
|| echo "WARNING: fanotify guard is not running" >&2
8. Troubleshooting
| Symptom | Resolution |
|---|---|
roamswitch exits with "check that roamswitch-mcp is installed" |
Daemon is not running → sudo systemctl start roamswitch.service (or roamswitch-server.service). Verify socket exists |
roamswitch status shows fanotify 🔴 "guard stopped" |
Transient fs.fanotify.max_user_groups exhaustion. Restart with sudo systemctl restart roamswitch.service and verify in journal |
Profile stays in balanced, never reaches open |
Verify gateway MAC is registered in trusted_networks with level: open |
| SSH disconnects unexpectedly | Client edition has sharing_service_control_enabled: true on an untrusted network. Disable via roamswitch sharing off |
| Config changes do not take effect | The client daemon reads the first of /home/*/.config/…; apply with systemctl restart roamswitch.service. For the server edition, edit /etc/roamswitch/server.conf then run sudo roamswitch server restart (no reload). |
| Server communications accidentally blocked | Access cloud console (VNC / Serial) and run sudo roamswitch emergency-restore |