RoamSwitch Server Edition Operations Manual
Official installation, deployment, and operational reference for Cloud VPS (AWS, GCP, Azure, Linode, DigitalOcean), bare-metal data centers, and container hosts.
1. Overview & Requirements
RoamSwitch Server Edition is a fully headless (zero GUI dependency), autonomous security and integrity protection suite for Linux servers that are always exposed to the internet.
Unlike the client edition, which switches profiles according to the Wi-Fi network you connect to, the server edition is built around "Inbound Default Drop", "critical-path tamper monitoring (FIM)", "preventive blocking of the kernel LPE (Frag Gap)", "eBPF runtime threat monitoring", "SSH lockout prevention failsafe", and "autonomous emergency alerts to Telegram / LINE / Webhook".
Apart from package updates, the only outbound traffic by default is the anonymous fetch of signed data (
cve_kernel_map_updates_enabled, on by default). It receives Ed25519-signed CVE data, web rules, KEV, EPSS and more from lafine.net by HTTPS GET (the manifest and KEV daily, CVE data weekly). There is no query string and no cookie, and nothing about the host is sent other than the fixed User-Agent: RoamSwitch-Updater. If you turn it off, audits still run on the built-in baseline, but the Ubuntu OS package CVE matching shows "CVE data not fetched".Everything else happens only when the operator enables it: notifications (Telegram / LINE / Webhook), npm signature verification, DNS and RDAP checks of your own domains (
domain_check_domains), event forwarding to your own organization's destination (forward_enabled, off by default), Sensor pairing, the accessscope LLM integration (only when --llm is given), and the signed map for language dependencies (package_cve_map_languages_enabled, weekly, receive-only). The list of exceptions is in the Zero Telemetry section of the Server Edition security design document.System Requirements
- Supported Distributions: Ubuntu 22.04 / 24.04 LTS, Debian 12+, AlmaLinux / Rocky Linux / RHEL 9+, Fedora 39+, openSUSE Leap 15.5+, Raspberry Pi OS (64-bit)
- Architectures:
x86_64(amd64) oraarch64(arm64) - Kernel: Linux 5.10+ (
nftables,cgroups v2, eBPF BTF recommended) - Footprint: 20–30 MB resident memory, <0.1% CPU during idle/normal workloads
2. Installation Procedures
With the official signed package repository, dependencies are resolved automatically, and you can update safely and automatically with the system's update command.
2.1 APT (Ubuntu / Debian / Raspberry Pi OS)
# 1. Register the repository signing key
curl -fsSL https://lafine.net/apt/roamswitch-archive-keyring.asc \
| sudo gpg --dearmor -o /usr/share/keyrings/roamswitch-archive-keyring.gpg
# 2. Add the repository
echo "deb [arch=amd64,arm64 signed-by=/usr/share/keyrings/roamswitch-archive-keyring.gpg] https://lafine.net/apt stable main" \
| sudo tee /etc/apt/sources.list.d/roamswitch.list
# 3. Install
sudo apt update && sudo apt install roamswitch-server
2.2 DNF / RPM (Fedora / RHEL / AlmaLinux / Rocky Linux)
# 1. Import the GPG key
sudo rpm --import https://lafine.net/rpm/RPM-GPG-KEY-roamswitch
# 2. Add the repository config file
sudo curl -fsSL -o /etc/yum.repos.d/roamswitch.repo https://lafine.net/rpm/fedora/roamswitch.repo
# 3. Install
sudo dnf install roamswitch-server
2.3 openSUSE (zypper)
sudo rpm --import https://lafine.net/rpm/RPM-GPG-KEY-roamswitch
sudo zypper addrepo https://lafine.net/rpm/opensuse/roamswitch.repo
sudo zypper refresh && sudo zypper install roamswitch-server
On Fedora, RHEL, AlmaLinux, and Rocky Linux with SELinux enabled, installation labels the daemon (/usr/lib/roamswitch/roamswitch-server-daemon) with initrc_exec_t and runs it with initrc_t privileges. Without the label it runs as init_t, and reading authorized_keys and the like is denied. If semanage is present, the rule persists; if not, only chcon is used, so reinstall the package after a relabel. You can check the context with sudo ps -eZ | grep roamswitch-serv.
roamswitch) and the server edition (roamswitch-server) are marked as mutually exclusive (Conflicts) in the package manager metadata, to prevent installing both on the same host. For server use, always specify roamswitch-server.3. Initial Setup & Service Verification
3.1 Service Status
Following installation, roamswitch-server.service starts immediately and is enabled at system boot.
sudo systemctl status roamswitch-server.service
On first install, run sudo roamswitch server setup next. Until then, the SSH maintenance source, the notification channels, agent_users and the file scan targets are not set.
When the package is updated, the update timer (roamswitch-update.timer) is enabled if it is disabled and server.conf has not turned updates off. On machines where updates are turned off, the timer stays stopped.
3.2 Interactive Setup Wizard
Run the following command to start the setup wizard, which interactively configures ports, maintenance source IPs, notification destinations, and containment behavior (press Enter to accept the default).
sudo roamswitch server setup
- Ports: enter the SSH maintenance ports (default
22) and the public service ports (default80,443), each comma-separated. - Maintenance source IPs: SSH bastion / monitoring IPs or CIDRs (e.g.
203.0.113.50/32). The wizard requires an answer and does not accept a blank. To allow SSH from any source, typeANYWHERE(the admin SSH path then stays open to the whole internet during isolation as well). - Notification channels: enable Telegram bot, LINE Messaging API and/or a generic webhook (Slack / Discord / Teams).
- Response to a critical eBPF event: choose
isolate(isolate host),freeze(freeze the process) oralert_only(notify only). After saving, you are prompted to send a test notification and restart the service. - Automatic CVE data updates (default
y): choose whether the kernel CVE database used by the container-isolation audit, the web rules, the KEV list, the EPSS scores, the Node.js vulnerability data and, on Ubuntu servers, the Ubuntu package CVE data used by the OS-package CVE check are fetched anonymously from lafine.net (the signed manifest is checked daily, the CVE data itself about once a week, the KEV list daily and the web rules only when the manifest has a newer version; HTTPS GET only, no query string or cookies, a fixedUser-Agent: RoamSwitch-Updateras the only header that names the software, Ed25519 signature verified). Nothing about this host is sent. It is the only external communication that is on by default in the Server Edition, and answeringnturns it off (the audit itself still works from the built-in baseline, but the OS-package CVE check on an Ubuntu server then reports no local CVE data). If it is already disabled in an existingserver.conf, the default answer staysn. - File Scan Guard settings: choose whether to enable virus scanning for mail relays, shared folders and upload destinations (§13), and set the target directories. Optional, off by default.
- Resource Guard settings: enable the resource-exhaustion guard that detects sustained RSS growth (memory leaks/DoS) or crash loops in network-exposed services.
- Overview of always-on core protections: displays the core defenses that run at all times regardless of the wizard — inbound default-drop, FIM, eBPF integration, and so on (no input required).
- Investigation-agent hand-off (investigation) settings: choose whether to automatically delegate first-pass investigation — for critical eBPF events, or Critical-Path FIM / dependency-lockfile tampering detections, whenever they were judged notify-only — to an external AI agent CLI (Claude Code / agy / Codex CLI / OpenCode, or a custom command) (§10.1). Off by default.
The next steps of the wizard check the current state before asking, and tell you what is missing.
- Step 7 (action on eBPF critical events): If neither Falco nor Tetragon is installed, the wizard asks nothing and shows how to install one. Without a sensor, eBPF critical events do not arrive.
- Step 9 (File Scan Guard): The wizard first asks which directories to scan. If you leave it empty, it shows “Nothing will be scanned”. It warns about places that do not exist and places the service cannot write to. Only the directories you specify are scanned.
- Step 11 (always-on core protections): The wizard lists the protections that work by default, based on the current settings. It also shows the locations of
web_rules.confandweb_guard.conf. - Step 13 (accounts for AI agents): The wizard explains decoys, outbound restriction and the baseline. It warns about administrator accounts. It audits the account, and after you have read the result, asks whether to approve the baseline. The default for approval is
N; it never approves silently (§20). - Notification channels: If there is no notification channel, or a channel is enabled but its token, destination or URL is empty, the wizard shows a warning. It sends a test notification to each channel that can deliver.
At the end of the wizard, it shows the commands to check the result. roamswitch guards cannot be used on the Server Edition, so check with the following commands.
sudo roamswitch status --server
sudo roamswitch doctor
sudo roamswitch detection-coverage
sudo roamswitch server config show
-100 (e.g. -1001234567890). Confirm the correct value from the "chat":{"id":...} field in curl -s "https://api.telegram.org/bot<token>/getUpdates".3.3 42-Item Server Security Audit
sudo roamswitch status --server
Performs an instantaneous 42-check audit of firewall rules, Frag Gap mitigation, Yama LSM restrictions, permissions, and Docker port exposure, producing a 0–100 security score and grade (S to C). The audit also covers Docker's daemon.json (user namespace, icc, live-restore, no-new-privileges, TCP listeners without TLS; not applicable on hosts without Docker), the last backup run (more than 7 days fails; whether a backup can be restored is not tested) and the expiry of the TLS certificates the web server really serves (fewer than 30 days left fails). The name-resolution exposure item (server_name_resolution_exposure) fails when this host is running as a responder for LLMNR (UDP 5355) or NBNS (UDP 137). mDNS (UDP 5353) is only shown. 42 is the number of fixed items; depending on the host, items such as whether each protection is actually working are added. Items that do not apply are left out of the score.
Highly exploitable vulnerabilities (installed software) (server_package_cve_exposure). Checks OS packages, PHP found on PATH and elsewhere, and GitLab servers against the vulnerability data on the machine, and looks for unpatched ones that are in KEV or have an EPSS of 0.9 or higher (no network access). Other software outside package management, and vulnerabilities not in the data, are not visible. In the hourly diagnosis, one alert (with hostname and IP) is sent when an item newly fails, when a new KEV flag appears, or when it stays the same for 24 hours. No notification is sent when it returns to pass.
Each check item is tagged with a NIST CSF 2.0 function/category (always, where applicable) for use in compliance reports. CIS Controls v8 control numbers are added only where there is a high-confidence mapping.
Web server security headers and cookies: requests the top page (/) of TLS sites on nginx, Apache and Caddy from the host itself and looks only at the headers. It checks HSTS (30 days or more), nosniff, framing protection, and the Secure and HttpOnly flags of cookies; it does not judge CSP or Referrer-Policy. It makes no external connections and does not record the body or cookie values.
SPF, DMARC, MTA-STS and expiry for your own domains: runs only when you list domains (up to 5) in domain_check_domains. It checks SPF and DMARC, whether SPF allows anyone to send, whether at least 30 days remain until registration expires, and MTA-STS if there is an MX (CAA and DNSSEC are shown for reference).
External communication happens only then, and is limited to these 3 things. (1) dig queries the resolver in /etc/resolv.conf for TXT, CAA, DS and MX. (2) curl looks up the registry from IANA's public list (the domain name is not included) and sends the domain name to that registry's RDAP server. (3) curl reads /.well-known/mta-sts.txt on the domain's mta-sts host (certificate verified, redirects not followed, no cookies). Results are cached for 6 hours.
Protections that are not working are shown with the reason. You can check them with roamswitch detection-coverage, roamswitch doctor and the MCP get_guard_status (effectiveState and inactiveReason). Except for reasons that come from the installation state, the check runs 2 minutes after start and then every 5 minutes, and the same reason is sent to the emergency notification channel once every 24 hours.
4. Firewall & Port Rules
/etc/roamswitch/server.conf is forced to 0600 permissions (root read/write only). The format is flat key=value; section headers such as [network] are ignored.
# --- Firewall ---
ssh_ports=22 # SSH management port (kept even during emergency isolation)
allowed_ports=80,443 # Ports for public services (TCP only; UDP goes in allowed_udp_ports)
whitelist_ips=203.0.113.10/32 # Maintenance source IP / CIDR (blank = allow all, formerly admin_source_ips)
protect_docker_ports=true # DOCKER-USER protection (blocks containers from bypassing the firewall)
preserve_ssh_on_isolation=true # Preserve the SSH management path even during emergency isolation (false = full cutoff)
# --- eBPF runtime guard ---
action_on_critical=isolate # isolate | freeze (SIGSTOP + network cutoff) | alert_only
ebpf_socket_path=/run/roamswitch/events.sock
# --- Egress / C2 blocking & DNS sinkhole ---
egress_ip_blocklist_enabled=true # Default true. The seed bundled with the package lists only the three attack servers JPCERT/CC published; nothing else is blocked until a feed is installed
metadata_watch_enabled=true # Default true. Notify when a non-root program or container connects to cloud metadata (log-only, never blocks; detects SSRF)
metadata_watch_allow_users= # Accounts that legitimately use the metadata service (names or numeric ids, comma-separated; root is always exempt)
dns_sinkhole_enabled=false # Default false (to avoid breaking internal DNS / split-horizon setups)
dns_sinkhole_provider=quad9 # quad9 | cloudflare | adguard | cleanbrowsing
# --- Container-isolation CVE data (enabled by default) ---
cve_kernel_map_updates_enabled=true # Default true. The only external communication on by default (signed kernel CVE data, web rules, the KEV list, the EPSS scores, the Node.js vulnerability data and, on Ubuntu servers, Ubuntu package CVE data; manifest daily, CVE data about once a week, the KEV list daily; anonymous, receive-only, signature-verified). Set false to stop it
# --- Notifications ---
telegram_enabled=false
telegram_bot_token=
telegram_chat_id=
line_enabled=false
webhook_enabled=false
webhook_url=
webhook_block_private_addresses=false # opt-in SSRF guard
webhook_allow_addresses=
# --- System ---
language=ja
fim_check_interval_secs=300 # Formerly named scan_interval
isolation_hard_cap_secs=3600 # Seconds before a high-confidence isolation moves to DEGRADED mode (0 = hold until released)
allowed_ports covers TCP ports only. Incoming UDP (WireGuard, DNS and NTP servers, 443/udp for HTTP/3 and so on) is not accepted unless you write it in allowed_udp_ports. For example: allowed_udp_ports=51820,443. The default is empty, and all UDP other than replies to established traffic is dropped.
All forward_* keys are in /etc/roamswitch/server.conf.example. Invalid values and misspelled keys are ignored, and a warning appears in server config show and elsewhere. If /etc/roamswitch/server.json exists, server.conf is not read. Run config show as root.
If you edit the settings directly, restart the service to apply them (roamswitch-server does not support reload).
sudo roamswitch server restart
4.1 Per-Severity Policy (guard.yaml, optional)
If action_on_critical alone isn't granular enough, create /etc/roamswitch/guard.yaml (a template ships at /etc/roamswitch/guard.yaml.example). When absent, an equivalent policy is synthesized automatically from server.conf's action_on_critical, so existing deployments are unaffected.
policies:
on_warning:
action: log_and_notify
on_critical:
server_action: isolate_process
kill_process: true
fallback_to_host_isolation_after_retries: 3 # Auto-escalates to host isolation if the same process recurs
on_emergency:
action: isolate_host_all
kill_process: true
server_safeguards:
maintenance_ssh_ports: [22]
safety_timer_secs: 300 # Seconds until a low-confidence isolation is restored automatically (0 disables). Not applied to high-confidence isolations (see below)
Automatic release of isolation (by confidence): To avoid being defeated by an attacker who simply waits, triggers are split by confidence. Low-confidence triggers (eBPF Error / Warning and below, generic port anomalies, etc.) fully recover after safety_timer_secs (default 300 seconds). High-confidence triggers (canary tampering, mass rewrites, eBPF Critical / Emergency / Alert, etc.) are released with a notification only when the cause is confirmed gone; if they reach isolation_hard_cap_secs (default 3600 seconds, 0 = no limit) without an ack, they move to DEGRADED mode.
DEGRADED mode keeps blocking new traffic other than the management path and never opens automatically as time passes. It is released only by re-confirming that the cause is gone, an ack, or sudo roamswitch emergency-restore. In every isolation, established connections other than the management path (maintenance_ssh_ports and whitelist_ips) are cut, and each transition is notified in 10 languages.
sudo roamswitch server ack
roamswitch server ack acknowledges a FULL isolation while keeping it strict (the operator has taken ownership, so no move to DEGRADED and no automatic release) and releases a DEGRADED one.
4.2 Egress / C2 Blocking and DNS Sinkhole
With egress_ip_blocklist_enabled=true (default), outbound connections to known malicious IPs are stopped with nftables. The list uses /var/lib/roamswitch/threatfeed/malicious_ips.txt if it exists, otherwise the bundled seed (one or the other). The seed contains only the 3 addresses of attack servers that JPCERT/CC published on October 15, 2026 (210.149.87.120, 118.26.36.16, 69.10.51.162). If a legitimate destination is blocked, check the corresponding line.
Setting dns_sinkhole_enabled=true forces resolution through a filtering DNS resolver (Quad9 / Cloudflare / AdGuard / CleanBrowsing), blocking known-malicious domain resolution. It defaults to false since it can break internal DNS or split-horizon setups.
With metadata_watch_enabled (enabled by default), when a non-root program or container newly connects to a cloud metadata address (such as 169.254.169.254), inet roamswitch_metadata_watch records it in the kernel log, and the daemon notifies once per day per account. It does not block the traffic. A technique that uses a 302 redirect to point inward is not visible in access logs, and is caught by this outbound traffic. Legitimate use can be excluded with metadata_watch_allow_users (not possible for containers).
4.3 Incoming-Port-Scan-Detection Guard
Detects source IPs that connect to many different ports in a short time, by matching nftables log rules against journald (enabled by default). Source IPs identified as scanners with high confidence can be blocked automatically for a set time. When used with RoamSwitch Sensor, the Sensor's IP is automatically excluded (this detection is separate from §10.1; full-port audit probes from a paired Sensor are excluded to avoid false positives).
# --- Incoming port-scan detection (enabled by default) ---
port_scan_detect_enabled=true # false to disable
port_scan_detect_min_distinct_ports=15 # Judged a scan when connections reach this many distinct ports
port_scan_detect_window_secs=300 # Aggregation window for detection (seconds)
port_scan_block_enabled=true # Auto-blocks the detected scan source IP
port_scan_block_duration_secs=600 # Duration of the automatic block (seconds)
You can review detection history with the roamswitch port-scan command.
4.4 DNS Tunnel Detection Guard
DNS sent by the host itself (port 53, UDP / TCP) is inspected with NFQUEUE. A notification is sent when queries with a label longer than 40 bytes and entropy above 3.8, or with qtype TXT / NULL, reach 10 in 60 seconds (300 seconds until the next notification). DNS tunneling such as iodine and dnscat2 is the target. It is set with bypass, so name resolution is never hindered even if the guard stops. It is notification-only and does not block automatically. dns_tunnel_detect_enabled takes effect on restart.
# --- DNS tunnel detection (enabled by default) ---
dns_tunnel_detect_enabled=true # false to disable
Subdomain brute-forcing is also watched. A notification is sent when 40 or more distinct names under the same domain all return NXDOMAIN within 60 seconds (once per hour per domain, with up to 5 example names; ATT&CK T1590.002). For this reason, UDP DNS responses (source port 53) are also received through NFQUEUE, but with bypass, nothing is sent, and name resolution is not stopped.
Reverse lookups, internal names such as .local, and domains in dns_tunnel_entropy_allowlist are not counted. The switch is dns_tunnel_detect_enabled. TCP responses, DoH and DoT, containers in other namespaces, and IPv6 with extension headers are not visible. It is notification-only and does not block.
4.5 SSH brute-force guard
Failed sshd logins are counted per source the moment they are written to the log (enabled by default). When a source reaches 6 failures in 600 seconds (default), inet roamswitch_sshguard in nftables drops only new connections to SSH and also cuts any SSH connections already established. The ban starts at 1 hour, quadruples with each repeat, and is capped at 7 days. Authenticated sessions, public-key successes and exempt sources are not affected. It does not communicate externally; it only runs journalctl, nft and the like locally.
The log is read with journalctl -f, and only lines written by sshd are used. Without journald it follows /var/log/auth.log or /var/log/secure, but because forged lines could make it block a third party, leave ssh_guard_log_source at the default auto.
It counts password failures, nonexistent users and the like, and does not count public-key failures (Failed publickey). The source is read from from <IP> port <N> at the end of the line, so a forged user name cannot get a third party banned. IPv6 is handled per /64 (in a /64 that contains an address to protect, only that one address).
Sources that are not banned: the gateway, DNS resolvers, the host itself, loopback, whitelist_ips, ssh_guard_allow, sources currently logged in, sources that succeeded with a public key within 30 days (ssh_guard_trust_key_days), and paired Sensors. Failures are only recorded. Private addresses are not exempt (because a compromised internal machine can also be a source).
If fail2ban (with the sshd jail enabled) or CrowdSec (with the firewall bouncer running) is protecting the host, blocking is left to it and only detection and notification are done (ssh_guard_yield_to_fail2ban, default true). ssh_guard_block_enabled=false works the same way. Notifications are sent only for a ban (reaching the threshold, if detection only) and for a successful login from a source with many failures (critical; the session is not cut). Sources exceeding 10 per hour are combined into one message.
The list is shown with roamswitch server bans (with --json, sudo required), and a ban is lifted with sudo roamswitch server unban <IP | IPv6 /64 | --all>, which also clears the failure count. Bans come back after a restart, with the remaining time. roamswitch emergency-restore does not lift them, while roamswitch recover and uninstalling delete the whole table. The MCP tool get_ssh_guard_incidents is read-only. You can also check and lift bans in the Server TUI under “SSH brute force” (as root; §17).
roamswitch server bans
sudo roamswitch server unban 203.0.113.9
sudo roamswitch server unban --all
There are 10 settings, all starting with ssh_guard_ (§18.1). Change one with, for example, sudo roamswitch server config set ssh_guard_max_failures 10, and apply it with sudo roamswitch server restart. Set ssh_guard_enabled=false to stop the guard altogether, or ssh_guard_block_enabled=false to make it detect and notify only. The "SSH Brute-force Protection" item of the 42-item diagnostic also passes while this guard is running and banning.
Limits: attempts that only fail public-key authentication are not counted. A brute-force run spread over many source addresses is counted per source, so it is not stopped until one source reaches the threshold. The fundamental remedy is to disable password authentication and allow public keys only.
Restricting sources (opt-in): set ssh_allow_only_enabled=true and write IPs or CIDRs, comma-separated, in ssh_allow_only_sources, and new SSH connections from any other source are cut from the first packet in the roamswitch_sshallow table. Established connections, loopback, and the host's own addresses pass. IPv6 needs IPv6 entries. If the list is empty, or the current SSH source is not in the list, the rules are not loaded (check with sudo roamswitch ssh-allow check). If even one entry cannot be read, the whole value is rejected. The setting is re-read every 30 seconds, and sudo roamswitch ssh-allow disable removes the rules immediately. emergency-restore keeps the rules, and roamswitch recover removes them. This is separate from the brute-force block (ssh_guard_*).
4.6 Boot-time safeguard (xdp-gate)
sudo roamswitch xdp-gate enable enables a gate that protects the period from right after boot until the firewall is loaded. If the eBPF object is missing, it changes nothing, stops and shows the reason. The standard package does not include this object.
When enabling, it enables the safeguard timer first and the gate after it. If this fails, it rolls back. It takes effect from the next boot, and only when the timer is enabled does it release the gate 60 seconds after boot. You can check the state with sudo roamswitch xdp-gate status.
5. SSH Lockout Prevention Failsafe
The most serious accident in running a remote server is an SSH lockout caused by a firewall misconfiguration. RoamSwitch Server Edition has multiple layers of safeguards.
- ESTABLISHED / RELATED Unconditional Pass: Active sessions are never dropped during rule reloads.
- Keeping SSH during Air-Gap isolation: With
preserve_ssh_on_isolation = true, the management path of the maintenance SSH port and the management source IPs (whitelist_ips) stays open during isolation, so you can recover without going on site. Other established connections (C2, data exfiltration, reverse shells) are cut. If the management source list is empty, the maintenance SSH port accepts new connections from all sources, so a warning is shown at startup. Withpreserve_ssh_on_isolation=false, SSH is cut as well. A defect in 1.10.4 and earlier was fixed in 1.10.5. - Atomic nftables Loading with Rollback: Rule syntax errors instantly trigger a zero-downtime rollback to the preceding verified ruleset.
6. Container Protection (Docker / Podman)
By default, when Docker publishes a container port (-p 8080:8080, etc.), it creates its own iptables rules that bypass (punch through) the host's standard firewall and expose the port directly to the whole world. This is a known issue.
With protect_docker_ports=true (default), traffic to containers is also unreachable from outside except on the ssh_ports and allowed_ports ports. It installs inspection rules in the DOCKER-USER chain for iptables, and in the inet roamswitch_docker_guard table for the nftables mode of Docker 29 and later (and for IPv6 too, if Docker's IPv6 is enabled). The decision uses the destination port before DNAT and covers only traffic from outside. Outbound traffic from containers and traffic between containers are not affected. This is a second layer: even with false, the default-deny firewall still drops published ports from outside. To use a port from outside, add the host-side port to allowed_ports (allowed_udp_ports for UDP) and run sudo roamswitch server restart.
The guard is idempotent and self-heals every minute: if dockerd starts after RoamSwitch, if a Docker restart or reload rewrites the rules, or after a manual nft flush or the loss of the nftables table, it is re-applied, while a guard that is already current is left untouched.
Watches docker events and notifies right after a container starts with --privileged or with /var/run/docker.sock mounted (escape risk). The container exec guard (container_exec_guard_enabled, on by default) reads binaries executed inside containers from the open file descriptor, even if they have been deleted, and scans them with YARA. Containers that are already running are covered too. Both only notify and do not block automatically. Works on Docker 29 as well.
7. Critical Path File Integrity Monitoring (FIM)
Critical files — critical binaries such as /bin/login, /usr/bin/sudo and /usr/sbin/sshd, authentication configuration such as /etc/shadow and /etc/sudoers, and systemd units — are monitored by SHA-256.
In important directories (/etc/pam.d, /etc/sudoers.d, /etc/systemd/system, /root/.ssh, etc.), it also detects the appearance of new files. The authorized_keys of every account that can log in, /etc/ld.so.preload (its appearance is a sign of a rootkit), and RoamSwitch's own binaries are covered too. New-file detection needs a baseline that includes this scope, so run sudo roamswitch fim update once after upgrading. Files that a non-root fim verify cannot read are "skipped as unreadable", not treated as tampering.
7.1 Manual Hash Verification
sudo roamswitch fim verify
7.2 Event-Driven Detection (Instant)
Monitored files are watched with fanotify (FAN_CLASS_NOTIF), and the hash is checked as soon as a write completes. The periodic scan (default fim_check_interval_secs=300 seconds) is a safeguard against missed events. Replacements such as sed -i are also detected, and the notification includes the process that changed the file and the SSH login (§7.5).
7.3 Automatic Baseline Sync on OS Updates
On Debian / Ubuntu, package installation auto-configures the DPkg::Post-Invoke hook at /etc/apt/apt.conf.d/99roamswitch-fim. On Fedora / RHEL / Rocky / AlmaLinux / openSUSE, a systemd.path unit (roamswitch-fim-update.path) watching /var/lib/rpm plays the same role.
As a result, when an administrator runs sudo apt upgrade (or dnf upgrade / zypper update) and a binary is legitimately updated, RoamSwitch detects it automatically and quietly resynchronizes the hash baseline (preventing false-positive alerts). To apply an update manually, run the following.
sudo roamswitch fim update
When creating the baseline for the first time, if package management (apt/dpkg, dnf/rpm, zypper, pacman) is working, it waits up to 120 seconds. Even right after apt install, it does not mistake dpkg temporary files (such as *.dpkg-new) for tampering (1.11.18 and later). If it is not finished within 120 seconds, it logs a warning and creates the baseline anyway.
7.4 Honeytokens (Credential Decoys)
When the daemon starts, it places 3 kinds of decoys (honey tokens) in /root: .aws/credentials, .ssh/id_rsa and .docker/config.json. It never overwrites a real file that already exists. When inotify sees one of these being read, it is treated as credential hunting (MITRE ATT&CK T1552), and a Critical notification and an incident timeline entry are made immediately.
It is enabled by default. It can be changed with honeytokens_enabled (false stops placing and watching; decoys already placed remain) and honeytokens_home (default /root). RoamSwitch's own docker commands use an empty directory for DOCKER_CONFIG, so they do not trigger the decoys. Decoys are also placed in the home of each agent_users entry in server.conf (§20). The MCP tool get_honeytoken_status reads the status and the latest 50 accesses (read-only).
When a decoy is actually accessed, related decoys are added (.aws/config for .aws/credentials, .ssh/config for .ssh/id_rsa, and so on). Up to 2 at a time and up to 6 in total. If unfamiliar files appear in /root, that is expected.
7.5 Intrusion path (who made the change, and through which SSH login)
File-change notifications (critical-path FIM and lock-file FIM) include the process that made the change (account, executable, command) and the SSH login (source IP and port, time, authentication method, key fingerprint) (enabled by default; fim_intrusion_context_enabled). To cope with short-lived processes, it takes a snapshot of /proc/<pid> right when the event is read, and falls back on the execution recorder when that fails. It works even when the SSH guard is disabled, and sends nothing externally.
Only values reported by the kernel are used for the decision (/proc/<pid>/exe, loginuid, and the cgroup's session-N.scope). Values a process can change, such as comm, are only displayed; claiming to be sshd is not enough to count as an SSH login. The notification distinguishes found, “No SSH login was found”, and “The login path could not be determined”, and it is always sent even if retrieval fails.
/etc/ssh/sshd_config: modified
Process: root (logged in as admin) / /usr/bin/tee / command: tee /etc/ssh/sshd_config (pid 4121)
SSH login: the session admin opened from 203.0.113.25:51544 at 2026-10-17 03:12:08 (authentication: publickey, key SHA256:AbCdEf0123456789)
/etc/sudoers: modified
The login path could not be determined (the change was found by the periodic scan, so the process that made it is not known)
Edits that put a new file in place under the same name, such as install, sed -i, and cp or mv within the same directory, are also detected, using a mark set on the directory. Limitation: a file brought in with mv from another directory is not noticed until the periodic scan (fim_check_interval_secs), and the process that wrote it is not known.
Besides the notification, the record is kept in the timeline (type fim) and in /var/lib/roamswitch/fim_intrusions.json (root only, latest 100 entries), and MCP's verify_fim shows it in recentIntrusionContext (only when running as root). The tamper verdict does not change. Limitation: it is not attached to persistence_watch notifications. What it tells you is the modifying process and the login; the entry point of the intrusion (such as the vulnerability exploited) is not known. Set fim_intrusion_context_enabled=false to turn it off.
7.6 SUID / SGID file inventory
Finds new SUID files in places outside FIM's fixed list, and SUID bits added later. Every suid_watch_interval_secs (default 600 seconds) it walks the local filesystems and records the mode, owner, size, and SHA-256 of SUID and SGID executables (enabled by default; suid_watch_enabled). It compares them with the initial list in /var/lib/roamswitch/suid_baseline.json and notifies once, at Critical, about a new file, a SUID grant, or a change in mode, owner, or content (ATT&CK T1548.001).
A change to a file that belongs to a package (dpkg -S, rpm -qf, etc.) and whose ctime is not later than the package database's latest update is not notified and is taken into the baseline. A chmod u+s after an update is notified. Check with sudo roamswitch fim verify; accept with sudo roamswitch fim update.
Limitation: it does not walk container layers (such as /var/lib/docker), snaps, or network, FUSE, overlay, and squashfs mounts. It cannot see a bit set and removed during a walk, or changes made while a package manager is running (deferred up to 3 times). A walk that exceeds 300 seconds is discarded for that round.
7.7 Log tamper detection
Watches for log clearing (ATT&CK T1070.002). Every 30 seconds it remembers the inode and size of auth.log, syslog, wtmp, and similar files, and notifies at Critical when one has shrunk (from 1024 bytes or more), disappeared, or been replaced (enabled by default; log_tamper_watch_enabled). For the journal, it notifies when the archive total drops to less than one fifth from 4 MiB or more (for example journalctl --vacuum-time=1s).
Log rotation is excluded (a different file starting with the same name has the same inode or was changed within 120 seconds, or the logrotate state file was updated within 120 seconds). Limitation: it cannot see rewriting wtmp, btmp, or lastlog without changing the size, emptying and then writing back up to the original size, or changes made while the daemon is stopped.
7.8 Ransomware entropy watch (entropy_watch_enabled)
Finds file encryption in places where decoys cannot be placed (application data, document roots). It examines the first 256 KiB of files in entropy_watch_dirs (when empty, /var/www, /srv, database locations, and so on; up to 32), and notifies when the same writer writes 20 files that look random within 5 seconds. It also watches for the pattern that deletes the original and the one that overwrites with rename. entropy_watch_enabled is enabled by default and only notifies.
It is built not to stop production. It does not use blocking fanotify; it reads at most entropy_watch_max_files_per_sec files per second (5 to 2000, default 50), only the first 256 KiB, and when that is exceeded it switches to “partially active”. The writer is stopped (SIGSTOP) only when entropy_watch_freeze=true, or, in a document root with entropy_docroot_action=freeze_writer, when a web service replaces existing files; protected_processes are not stopped, and roamswitch frozen resume restores them.
On an Ubuntu 24.04 VM, encryption of 150 files was detected at the 20th file (1 notification), cp -r, tar, and similar produced 0 notifications, and at 434 files per second the CPU use was about 2% of one core. The latest 50 entries are kept in /var/lib/roamswitch/entropy_incidents.json (command lines are not stored) and are read by MCP's get_ransomware_entropy_guard_status.
8. eBPF Runtime Guard & Falco / Tetragon Integration
Hooks into kernel-space eBPF events to detect Frag Gap kernel privilege escalation, container escapes, and unauthorized reverse shells. The default sensor is Falco (JSONL over a UNIX domain socket). Selecting sensor.type: tetragon in guard.yaml lets you use Cilium Tetragon as the sensor instead — it simply subscribes to Tetragon's native gRPC API over the same UNIX socket, adding no new listening port.
8.1 Anti-Bloat Architecture
To avoid the “syslog bloat” and disk pressure that plague conventional security tools, RoamSwitch connects to Falco directly over the UNIX domain socket /run/roamswitch/events.sock. The socket is created root-only (0600), so only Falco running as root can write to it (no extra permission setup is needed).
- With the package-bundled
/etc/falco/config.d/99-roamswitch-optimized.yaml, alerts are not written to disk but streamed directly to the daemon. Because this configuration hands Falco's output to a socket viasocat, the Server Edition deb / rpm installssocatas a recommended package (Recommends). It is not needed if you do not use Falco. - Daily rotation and compressed retention (
/etc/logrotate.d/roamswitch-falco) protect the disk even in the unlikely case that output goes to a file.
8.2 Autonomous Containment
When it detects malicious code execution or suspicious traffic, the daemon immediately sends SIGSTOP to that process's PID to freeze its execution, and blocks its traffic with nftables rules (Air-Gap).
8.3 Automatic Forensic Evidence Capture
When the eBPF runtime guard contains a process (freezing it with SIGSTOP and cutting its network), it automatically creates an evidence preservation bundle (at Critical-equivalent in the default of §4.1; Emergency-equivalent is before isolation). It contains a packet capture limited to about 30 seconds (skipped if tshark is absent) and a snapshot of /proc/<pid>, in which the values of names containing KEY/TOKEN/SECRET/PASSWORD in environ become [REDACTED]. manifest.json records the SHA-256 of every file.
For a containment that force-kills, the /proc snapshot is saved before the kill (up to 3 seconds). A manual --pid follows the same order, and --no-packets skips the packets.
They are stored in /var/lib/roamswitch/incident-evidence/<timestamp>-<ID>/. Bundles are not deleted automatically. To delete old bundles past the retention period (default 30 days) so they do not fill the disk, run the following:
sudo roamswitch-incident-capture prune [--keep-days N]
Without waiting for containment, you can also take a manual snapshot at any time:
sudo roamswitch-incident-capture snapshot [--pid PID] [--reason TEXT] [--trigger-event-id ID] [--json]
Detections that saved an evidence bundle are linked in the timeline. roamswitch timeline shows the saved line under the detection with └─, adding the bundle name and the manifest's SHA-256. --json and MCP's get_incident_timeline include evidence_refs (up to 8 entries; only names and SHA-256, never the contents) and more. It links only when the triggering ID is known and never joins by closeness in time. For a manual snapshot, pass it with --trigger-event-id ID.
8.4 Measuring how fast containment is, and the heartbeat of the alert path
How accurate and how fast eBPF containment is depends on the rules of the sensor (Falco or Tetragon). In fact, the standard rules of Falco 0.45.0 (29 of them) include none that detects a reverse shell on the host: the reverse-shell rules are for containers only, and some of them are dropped by RoamSwitch's priority: warning condition. RoamSwitch does not assume the rules are good; it makes up for that in three ways: it measures how long containment takes, it checks regularly that the alert path is alive, and it detects reverse shells by itself.
Measuring isolation latency: for each eBPF incident, detect_to_receive_ms (detection to receipt), receive_to_action_ms (receipt to action), and detect_to_action_ms (total) are recorded in ebpf_incidents.json and in MCP's get_ebpf_incidents, and the process isolation notification also states “N milliseconds from detection to action”. Measured on an Ubuntu 24.04 VM (Falco 0.45.0, modern eBPF), the total was 42 to 64 milliseconds (1 to 2 up to receipt, 41 to 62 up to isolation and SIGKILL), and host Air-Gap was 109 milliseconds, within the 150 millisecond target. Tetragon has no detect_to_receive_ms.
The heartbeat (ebpf_heartbeat_interval_secs; default 600 seconds, 0 disables, 60 to 86400 when enabled) opens a throwaway path that only root can use and measures the time until the alert of the bundled rule 96-roamswitch-heartbeat.yaml comes back from Falco. Only when it fails to come back twice in a row (the recheck is 1 minute later) does it warn, at most once per 24 hours. Heartbeat lines are discarded without passing through isolation or notification, and nothing is sent outside. The measured round trip was 2 to 6 milliseconds; with the rule removed it warned after about 164 seconds, and after the rule was restored it returned to normal in about 75 seconds.
The state is kept in /var/lib/roamswitch/ebpf_heartbeat.json and is read by the heartbeat field of the MCP tool get_ebpf_incidents and by the diagnostic K-04 (the eBPF runtime agent; the number of diagnostic items stays at 42). Even when Falco is running, K-04 fails if the heartbeat does not come back. Limits: it checks one round trip of one rule (the open-family system calls) and cannot tell that another rule is broken on its own. Something that breaks between two checks (10 minutes by default) is not seen until the next one. It is not done for Tetragon. On a host where Falco is not running, or where the rule file is missing, it checks nothing and warns about nothing (the existing "guard stopped" notification covers that). Falco writes one warning line to syslog per check (144 lines a day at the default).
8.5 Reverse-shell detection (RoamSwitch's own)
Separately from Falco's rules, every 2 seconds it reads /proc and looks for shells and interpreters (bash, python, and so on) whose standard input and output are connected to a single outbound TCP connection. Something seen twice in a row is reported once per process. Destinations at private addresses are counted only when reverse_shell_watch_include_private=true; loopback and accepted connections are not examined.
On an Ubuntu 24.04 VM it detected bash's /dev/tcp, python, perl, nc -e, and socat exec: in about 2.4 seconds, and did not detect ssh, ssh with ProxyCommand, git over ssh, or an nc client.
A detection enters the same path as Falco's alerts (allowlist, guard.yaml, and so on) as the Critical eBPF event RoamSwitch Reverse Shell, and by default isolates and kills the process. A reverse shell owned by root fails per-process isolation, so it proceeds to a host-wide Air-Gap. Handle false positives with reverse_shell_watch_notify_only=true (default false; Warning notification only) or sudo roamswitch server allowlist add "RoamSwitch Reverse Shell" <process name>. reverse_shell_watch_enabled defaults to true and reverse_shell_watch_include_private to false.
Processes in the built-in list (init, sshd, RoamSwitch itself, and so on) and in protected_processes of server.conf (comma-separated) are neither SIGSTOPped nor SIGKILLed by the guard; they are only recorded and notified. A name takes effect only when the executable is in a system location such as /usr/ or /bin/, and a same-named fake in /tmp is not protected. Write software installed elsewhere with an absolute path and make it owned by root. When the path cannot be read, the name protects it.roamswitch server allowlist test <rule> <process> [--exe path] changes nothing and shows whether the case falls under the allowlist or the freeze/kill protection. It takes effect after sudo roamswitch server restart.
Entries in server allowlist have an expiry, and an expired entry counts as nonexistent to the guard (the list keeps it as “Expired: the allowance is not in effect”). Entries from before expiry was introduced keep working as “No expiry (old entry)” and are notified once a day. The Server daemon checks every 5 minutes and notifies once at 7 days before expiry and once at expiry. Setting the clock back does not undo an expiry (the mark is /var/lib/roamswitch/allowlist_clock; it is not a defense against an attacker with root). Only a person adds entries; neither the guard nor MCP does. Blocks have no expiry. In the Server TUI, the e key extends by 30 days.
Limits: it narrows by name (process name and executable name), so a home-made binary under a name other than a shell or interpreter that ties its standard input and output to a socket is not found. Connections through loopback (such as the turn-back of ssh -R) and connections shorter than 2 seconds are not seen, and neither are processes that cannot be seen from the host's process space. The Linux Client Edition has the same detection and only notifies.
Two cases where standard I/O is not connected to a connection are also checked. The first is an outbound connection from an interpreter, openssl s_client, nc or similar, joined bidirectionally to an interactive shell without -c by a pipe, FIFO or pty. This only notifies and records as a Warning (no isolation and no kill, regardless of guard.yaml; processes that also listen are excluded). The second is a connected UDP socket, which is Critical, the same as TCP.
9. Emergency Alerts (Telegram / LINE / Webhook)
When a serious incident occurs (unauthorized port exposure, FIM tampering, eBPF threat detection, emergency isolation triggered), it immediately delivers the situation to external notification platforms.
[notifications]
language = ja
# Telegram: bot token and chat ID
telegram_bot_token = "123456789:ABCdefGHIjklMNOpqrSTUvwxYZ"
telegram_chat_id = "-1001234567890"
# LINE: Messaging API channel access token and user ID
line_channel_access_token = "YOUR_LINE_ACCESS_TOKEN"
line_user_id = "U1234567890abcdef1234567890abcdef"
# Generic webhook (Slack, Discord, Teams, your own monitoring platform)
webhook_url = "https://hooks.slack.com/services/T00/B00/XXXXX"
Even without any of these external channels configured, every alert sent is also kept locally for the past 7 days. Check it with roamswitch notifications.
If there is no notification channel, or a channel is enabled but its token, destination or URL is empty, urgent detections reach no one. They are recorded only in journalctl and roamswitch notifications. If there is no route at all, the “Emergency notification route” item of the diagnosis fails and the score drops. The same applies when you do not use notifications and operate only with the Server TUI.
roamswitch notifications is a record of the notifications that were sent. It does not show whether they arrived. To check delivery, run sudo roamswitch server test-notify. It sends a real test message to the configured channels.
For notifications (Telegram, LINE, Webhook), a 2xx response counts as delivered; 408, 429, 5xx and connection failures are retried; other 4xx are not retried. Retries happen immediately, 3 times (at 1-second and 5-second intervals). If delivery still fails, the notification is put in /var/lib/roamswitch/pending_deliveries.json (owned by root, 0600, up to 50 entries) and resent every 5 minutes, and abandoned after 24 hours or 24 attempts. Resent notifications carry a mark such as “[Delayed delivery]” (following language). Tokens, URL secrets (user:pass@) and Authorization are not written to the log.
When a protection cannot read its input for 2 minutes or more, or when a gap (log rotation, queue overflow, etc.) is recorded, the notification destinations above are also notified (at most once per day for the same protection and type). During that time, detection may not be working. The count and time remain in collectors of get_guard_status and in /run/roamswitch/collectors.json.
When the Server itself ends abnormally: if the daemon ends abnormally (a crash, an OOM kill, SIGKILL) and systemd starts it again, it tells the destinations above after the restart (the notification history and the timeline keep it too). If it keeps failing, the notices are combined into one per hour with the count. Nothing is sent after systemctl stop or restart, a package update, an OS reboot or a power cut. If it stops responding, systemd restarts it after 30 seconds (WatchdogSec=30), and that is reported too. See why it ended with the sudo journalctl -u roamswitch-server --since "…" command given in the notice.
Rejecting internal Webhook destinations (opt-in): With webhook_block_private_addresses=true (default false), sending is refused when the destination is loopback, private (10/8, 172.16/12, 192.168/16), link-local (169.254/16), ULA (fc00::/7) or CGNAT (100.64/10). For a hostname, it is refused if any one of the resolved addresses matches, and alternative notations are also checked. Because the connection is pinned to the resolved address, DNS rebinding is also prevented. Legitimate destinations can be allowed with webhook_allow_addresses, and event forwarding has the same setting. When an HTTP proxy environment variable is set, this check does not apply.
10. AI Agent / MCP Integration (Model Context Protocol)
RoamSwitch Server Edition includes roamswitch-mcp, allowing AI agents (Claude, Gemini, Cursor) to monitor infrastructure health and posture.
If a diagnostic result contains strings that outsiders can rewrite (such as log text), a notice "untrusted external data" is attached. If there is wording that resembles instructions to an AI, a WARNING with only the type and count is attached as well. get_detection_coverage returns, per technique, whether it can be detected, the blind spots, and whether the responsible guard is running (select the Edition with isServer).
Annotations are attached to every MCP tool. readOnlyHint is false only for run_active_vuln_scan, audit_security_logs, and run_npm_audit_signatures, which update their own record files; openWorldHint is true only for run_npm_audit_signatures, which is disabled by default. DNS and RDAP queries for domains happen only for what you write in domain_check_domains, which is empty by default. get_vulnerability_scan_history returns what the probes leave on the target (sideEffects), and run_active_vuln_scan returns evidenceKind, which shows whether a finding is confirmed or only a version match.
Configuration Example (`claude_desktop_config.json`)
{
"mcpServers": {
"roamswitch": {
"command": "/usr/bin/roamswitch-mcp",
"args": []
}
}
}
10.1 Investigation-Agent Hand-off (investigation — delegating first-pass automated investigation to an AI agent)
Whereas roamswitch-mcp in §10 is for human queries, the investigation integration has the daemon autonomously launch an external AI agent CLI, triggered by a detection. It applies to eBPF severe events that ended with a notification only, and to FIM and lock-file tampering detections. The CLI is launched with the first-pass report the daemon produced, and is given the follow-up investigation and summary. It is disabled by default.
# Append to /etc/roamswitch/guard.yaml (a separate file from server.conf)
investigation:
enabled: true
command: "claude" # "claude" | "agy" | "codex" | "opencode" | any custom command
args: ["-p"] # The prompt is automatically appended as the final argument
timeout_secs: 180
It can also be set up in the sudo roamswitch server setup wizard (§3.2). The tool is a preset for Claude Code (claude -p), agy (agy -p --dangerously-skip-permissions), Codex CLI (codex exec) or OpenCode (opencode run), or any command. When run again, the saved setting is selected.
For that reason it cannot run as root; a setting with no regular user in
run_as is not saved by the wizard, and the daemon does not start it. Skipping permission checks with --dangerously-skip-permissions or similar raises the risk. In environments where untrusted logs come in, we recommend a setting that does not skip them.The investigation hand-off is never invoked while the network is cut off (e.g. during an active Air-Gap, or any state equivalent to isolate_host_all).
11. CLI Command Cheat Sheet
| Command | Privileges | Description |
|---|---|---|
sudo roamswitch status --server |
root | Show the 42-item server security score and status (--json prints the same report as JSON) |
sudo roamswitch ports |
root | Audit open listening ports and bound processes |
sudo roamswitch fim verify |
root | Verify SHA-256 integrity of critical path system files |
roamswitch notifications |
User | Show the notification history of the past week (every alert sent); --json and --export FILE are supported |
sudo roamswitch server setup |
root | Launch interactive initial configuration wizard |
sudo roamswitch fim update |
root | Refresh FIM SHA-256 baseline database |
sudo roamswitch server config set <key> <value> |
root | Change and persist a single setting (see §18 for the key list) |
sudo roamswitch emergency-restore |
Root | Disarm all eBPF / firewall isolation and restore the initial baseline |
roamswitch port-scan |
User | Shows the incoming-port-scan-detection guard's (§4.3) detection history (source IP, whether it was auto-blocked, and block duration) |
roamswitch sensor [key|list|pair|unpair|request-audit|results] |
User / root | Mutual trust with a Sensor using a pairing code. Pair with pair --addr <IP> --code <code> --fingerprint <SHA-256>, update the pin after the certificate is regenerated with repin, and request an audit with request-audit (results via results). Requires sensor_pairing_enabled: true (OFF by default). Details in the Sensor Operations Manual |
roamswitch server tui |
User / root | Start the TUI that covers every function (read-only for ordinary users, full control as root; §17) |
sudo roamswitch server ack |
root | Acknowledge the current emergency isolation (keeps a FULL isolation strict, releases a DEGRADED one; §4.1) |
roamswitch server ebpf |
User | Show the eBPF runtime guard’s current containment state and detected incident history |
roamswitch server bans [--json] |
User / root | Shows the SSH brute-force guard (§4.5): its state and the sources banned right now with the time left. --json is available. The list of bans is readable by root only |
sudo roamswitch server unban <IP | IPv6 /64 | --all> |
root | Lifts an SSH-guard ban and clears that source's failure count (give an IPv6 source as its /64; --all lifts every ban) |
sudo roamswitch server allowlist [list|add <rule> <process> [--exe <path>] [--days N] <reason...>|renew <rule> <process> [--days N]|remove <rule> <process>] |
root | Manages the eBPF guard allowlist (allowing false positives). add requires a reason and carries an expiry of --days N (1 to 365, default 30). Binding an entry to a path with --exe prevents evasion by spoofing a name. renew resets the expiry, and list shows the expiry, days remaining, who added it and the reason |
roamswitch server allowlist test <rule> <process> [--exe <path>] |
User / root | Shows, without changing anything, whether the rule and process pair is allowlisted and whether the process is protected from freeze and kill (including protected_processes). --pid PID works in place of the name and path. When an ended entry is why the guards act, it says so. |
roamswitch frozen [list|resume <PID>|resume all] |
User / root | List the processes the guards hold in SIGSTOP and release one that was a false positive (SIGCONT); resume all releases every one |
sudo roamswitch events search|tree|export|verify|status |
root | Search the exec recorder (--since 2h --pid --exe --user --parent --text --json), print a process tree, export, verify the hash chain and show status (§15) |
sudo roamswitch forward status|test|queue |
root | Show event-forwarding status, send a test event and list the retry queue (§16) |
roamswitch timeline / notifications [--json] [--export FILE] |
User | Show the unified incident timeline (experimental) or the notification history; --json prints a JSON array and --export FILE writes JSON Lines. Under a detection that saved an evidence bundle, the capture row is drawn with └─ and the bundle name is shown. With --json, parent_event_id, root_event_id and evidence_refs appear only on rows that have a link. |
roamswitch audit-agent-setup [--json | --format text|json|sarif] |
User | Inspects dangerous entries in AI agent instruction files, skills, memory and OpenClaw settings, read-only (home folder only; no network communication). Findings carry OWASP LLM and ATT&CK tags and can be output with --json or --format sarif (SARIF 2.1.0). It also reads ~/.claude/settings.json, the settings of Gemini CLI, Codex, Cursor and OpenCode (.gemini/settings.json, .codex/hooks.json, .codex/config.toml, .cursor/hooks.json, opencode.json, .opencode/plugins/) for hooks that run just by opening, and the MCP settings of Codex and OpenCode. |
roamswitch 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. It can also be run from the Tools screen of the Server TUI. --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. |
roamswitch 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 |
roamswitch 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 |
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. |
12. Troubleshooting & FAQ
Q1. Will RoamSwitch unexpectedly disconnect my SSH session?
No. In normal operation, established connections and ssh_ports (default 22) are always allowed, and even during an Air-Gap emergency isolation, preserve_ssh_on_isolation=true (default) keeps the management session on the maintenance SSH port from the admin IP (other established connections are cut). The bug in Server versions 1.10.4 and earlier where SSH did not get through during isolation was fixed in 1.10.5.
Q2. How do I regain access if accidentally locked out?
Log in through your cloud provider's web console (VNC / serial), then run sudo roamswitch emergency-restore to disarm the isolation, or sudo systemctl stop roamswitch-server to stop the service.
Q3. How do I expose ports for newly added web services (e.g. Nginx)?
Run sudo roamswitch server config set allowed_ports 80,443,3000 (or edit /etc/roamswitch/server.conf directly), then run sudo roamswitch server restart. allowed_ports covers TCP ports. To accept UDP, write it in allowed_udp_ports.
13. File Scan Guard (protecting mail relays, shared folders, and upload endpoints)
An optional feature relevant only if this host has a directory that stores files for others — a mail relay, a Samba/NFS share, a file upload endpoint. The embedded YARA engine always scans clamav_scan_dirs with no external dependency; setting clamav_enabled=true adds ClamAV as a second opinion. Confirmed threats are automatically quarantined to /var/lib/roamswitch/quarantine and the operator is notified.
# --- File Scan Guard (ClamAV, opt-in) ---
# The embedded YARA engine always scans clamav_scan_dirs unconditionally.
clamav_enabled=false # true enables additional inspection via clamdscan
clamav_scan_dirs= # Absolute paths to scan (comma-separated)
clamav_scan_interval_secs=86400 # Scan interval (seconds, minimum 3600)
clamav_freshclam_interval_secs=7200 # Signature DB auto-update interval (seconds, minimum 1800)
Also configurable via the interactive sudo roamswitch server setup wizard; check its configuration and quarantine status via the get_file_scan_guard_status MCP tool.
The service can write only to places such as inside /var/www, /srv, /root, /opt and /etc/roamswitch; outside them, placing decoys and quarantining files from file scans fail. For other places, add ReadWritePaths=-/path under [Service] with sudo systemctl edit roamswitch-server and restart. roamswitch doctor warns about places that cannot be written to.
If YARA or ClamAV finds a file but it cannot be quarantined, the notification includes the file name and the reason.
14. Log Audit (Log Pattern Anomaly Detection & Notification)
Scans journalctl periodically, groups log messages into templates, and detects new patterns (log shapes not seen before) and frequency anomalies (statistical spikes, Z-score > 3.0). It is a lightweight mechanism that needs no extra daemon or external dependency, so it is enabled by default. On detection, it notifies the same destinations as File Scan Guard and FIM (Telegram / LINE / Webhook). API keys and tokens that logs may contain are masked automatically before going into the notification body.
# --- Log Audit (enabled by default) ---
log_audit_enabled=true # false to disable
log_audit_interval_secs=1800 # Scan interval in seconds (minimum 300)
It can also be configured with the interactive wizard sudo roamswitch server setup. The latest detection results can be checked with the roamswitch audit-logs command or the audit_security_logs MCP tool.
AccessScope, an access-log diagnostic tool (separate tool): the Server Edition deb / rpm includes the accessscope command, which diagnoses web server and SSH access logs read-only (no GUI app). Analysis uses neither an LLM nor the network. LLM analysis is optional and off by default (running it as an unprivileged user is recommended). accessscope scan --auto runs the diagnosis, and accessscope discover lists the log locations (AccessScope page). PersonalSOC and PathScope (personalsoc, pathscope) in the same package also make no connections themselves, and PersonalSOC's LLM analysis runs only with --llm.
15. Exec Recorder & Correlation Rules (Local, Notify-Only)
Records process executions via the netlink proc connector (executable, arguments, parent lineage, UID, cwd, container ID, SHA-256; on by default). The record is kept in the root-only /var/lib/roamswitch/exec_log as hash-chained JSON Lines (0600, default 200 MB / 14 days) and is not sent outside. It only detects tampering (events verify) and does not prevent it. CPU is kept within a budget (default 3%).
The record being written is protected by a checkpoint line every 10 seconds; anything after that (up to about 10 seconds' worth) cannot be verified, and verify shows that count.
Search and export locally (the log is root-only, so sudo is normally required).
sudo roamswitch events status
sudo roamswitch events search --since 2h --exe curl
sudo roamswitch events tree 4242
sudo roamswitch events export --since 1d > exec-events.jsonl
sudo roamswitch events verify
Correlation rules EXR-001 to EXR-015 (notify-only, each with a MITRE ATT&CK technique ID): EXR-001 a shell spawned by a web service / EXR-002 execution from /tmp, a deleted file or memfd / EXR-003 execution right after a download / EXR-004 an interpreter one-liner using base64 or eval / EXR-005 obtaining uid 0 without setuid / EXR-006 execution of a binary just placed by cron or systemd / EXR-007 execution after ld.so.preload changed. Each rule has a deliberately quiet default and never isolates by itself. Silence individual rules with exec_rules_disabled (for example EXR-003,EXR-004) and adjust the users EXR-001 watches with exec_rule_service_users.
EXR-008 deleting snapshots (btrfs, LVM) by anything other than known management tools / EXR-009 looking for 8 or more kinds of attack tools within 30 seconds / EXR-010 a script interpreter launching 3 or more kinds of attack tools within 2 minutes / EXR-011 a command-line reverse shell pattern (severity High) / EXR-012 a non-root process under a service launching gdb, strace or ltrace with a PID (severity Medium). EXR-011 and EXR-012 are judged by command text, so they do not isolate even if exec_rules_isolation_optin is set to true.
EXR-013 notifies when a process started from a service (such as nginx), or running under that account, runs with LD_PRELOAD or LD_AUDIT pointing to a library outside the system (severity High), or with LD_LIBRARY_PATH pointing to /tmp or similar (Medium; does not trigger isolation). It targets the technique of bypassing PHP's disable_functions with putenv("LD_PRELOAD=…") and mail(). root and logged-in users are excluded. Only the values of these 3 variables are recorded (up to 200 characters); other environment variables are not read. chisel, mimikatz and others were added to EXR-009 and EXR-010, and EXR-010 now also covers programs in /home, /root and /tmp.
EXR-014 notifies when a child process of an AI agent (claude, codex, etc.) runs a command that sends credentials or secret values outside (High for files, Medium for values only), and EXR-015 when credentials are read and sent outside within 5 minutes (Medium) (both T1048, notification only). Only the child process's commands are visible; reads by built-in tools, communication by python or node itself, and agents whose process name is node are not visible.
Only when exec_rules_isolation_optin (default false) is explicitly set to true are high-severity rules treated as high-confidence isolation triggers (§4.1). By default, rules only notify. They can also be queried through the read-only MCP tools search_exec_events / get_process_tree.
16. Event Forwarding (SIEM / syslog / Webhook, Opt-In)
Detection events can be forwarded to your own organization's destinations, as specified by the operator. It is off by default. Nothing is sent until you set forward_enabled=true and configure at least one destination, and no vendor destination is built in. What is forwarded is the incident timeline, notification history, eBPF guard, isolation state transitions, FIM, canary and exec rule alerts; the raw exec log itself is not forwarded. There are 3 kinds of destination.
- syslog (
forward_syslog_url:udp://host:514/tcp://host:port/tls://host:port): RFC 5424 or CEF (forward_syslog_format). The TCP / TLS delimiter isoctet(RFC 6587, default) orlf. The CA can be specified withforward_tls_ca_file, and TLS is sent viaopenssl s_client. - JSON Lines file (
forward_file_path): one event per line. Rotated byforward_file_max_mb(default 50) andforward_file_keep(default 5). The default is0600, readable only by root. If you write a group inforward_file_groupinserver.conf, the mode becomes0640(removing it returns to0600) and that group can read the file. Do not let that group write to the parent directory. It cannot be set fromconfig.json. - Structured webhook (
forward_webhook_url): POSTs JSON and puts an HMAC-SHA256 signature, made with a secret (forward_webhook_secret, orforward_webhook_secret_filepointing to a0600file), inX-RoamSwitch-Signature. Sending uses the systemcurl, and the secret is never put in the arguments.
Events that could not be sent (TCP / TLS / Webhook) go into an on-disk retry queue (0600, capped by forward_queue_max_mb, default 20, and forward_queue_max_age_hours, default 72) and are resent with exponential backoff, even after a restart. The minimum severity to send is set by forward_min_severity (default low). To avoid blocking the hot path, sending runs in a dedicated thread, and when the queue overflows, the oldest entries are discarded first.
Use the following commands to check the status, test connectivity, and inspect the retry queue (restart the service after changing the settings).
# /etc/roamswitch/server.conf
forward_enabled=true
forward_syslog_url=tls://siem.example.org:6514
forward_syslog_format=rfc5424
forward_tls_ca_file=/etc/ssl/certs/corp-ca.pem
forward_min_severity=medium
sudo roamswitch server restart
sudo roamswitch forward status
sudo roamswitch forward test
sudo roamswitch forward queue
17. Server TUI (a Terminal UI for Every Function)
roamswitch-server-tui (also started with roamswitch server tui) is a TUI that lets you operate every Server Edition feature, spread across the CLI verbs and the two configuration files (server.conf and guard.yaml), over SSH using only the keyboard (works at 80x24, 10 languages). If a CLI verb or configuration key is added without a matching TUI operation, the development tests fail.
- Permission mode: started as a regular user, it is read-only (it cannot make changes or privileged operations, and instead shows the
sudo roamswitch …command to run). Started as root, it can operate; high-impact operations show their content first, and the most dangerous ones require typingyes. It does not start the daemon and does not open network sockets itself. - Screens (switch with the number keys):
1Dashboard /2Defense /3Incidents (blocking and unblocking SSH brute force, etc.) /4Notifications and forwarding /5Sensor /6Settings /7Services /8Tools /9Log audit /0Info and help.?lists the keys,Lswitches among the 10 languages,rreloads, andqquits (with a confirmation if there are unsaved changes). - Settings editor: an editor generated from the schema that lets you edit all 168 keys (§18) of
server.confandguard.yaml, validating type, range, and enumerated values. Before saving you can review the diff (secrets are hidden), and on save it takes a timestamped backup and then writes atomically. Keys that need a restart, and keys that would cost you the management path or weaken defenses if set wrongly, are marked as such. The settings for the investigation agent integration (§10.1) can also be written after choosing a preset and previewing it.
Start it with:
sudo roamswitch-server-tui # full control
roamswitch-server-tui # read-only
roamswitch server tui # same as roamswitch-server-tui
18. Configuration Key Reference (server.conf / guard.yaml)
roamswitch-server does not support reload, so every key needs a restart to take effect (sudo roamswitch server restart). Change server.conf with roamswitch server config set <key> <value> or the editor in §17, and guard.yaml with the editor or by hand.
As an exception, ssh_allow_only_enabled and ssh_allow_only_sources take effect without a restart, within about 30 seconds of saving.
18.1 server.conf (131 keys)
| Key | Type / values | Default | Restart |
|---|---|---|---|
language | system | ja | en | zh-hans | zh-hant | ko | de | fr | es | it | pt | ja | Yes |
ssh_ports | port list | 22 | Yes |
allowed_ports | port list | 80,443 | Yes |
allowed_udp_ports | port list | — | Yes |
whitelist_ips | list | — | Yes |
preserve_ssh_on_isolation | bool | true | Yes |
telegram_enabled | bool | false | Yes |
telegram_bot_token | string | — | Yes |
telegram_chat_id | string | — | Yes |
line_enabled | bool | false | Yes |
line_channel_access_token | string | — | Yes |
line_user_id | string | — | Yes |
webhook_enabled | bool | false | Yes |
webhook_url | URL | — | Yes |
webhook_block_private_addresses | bool | false | Yes |
webhook_allow_addresses | CIDR list | — | Yes |
action_on_critical | isolate | freeze | alert_only | isolate | Yes |
ebpf_socket_path | abs path | /run/roamswitch/events.sock | Yes |
ebpf_heartbeat_interval_secs | 0 (off) | int 60–86400 | 600 | Yes |
isolation_hard_cap_secs | int ≥ 0 | 3600 | Yes |
protected_processes | list | — | Yes |
fim_check_interval_secs | int ≥ 10 | 300 | Yes |
fim_intrusion_context_enabled | bool | true | Yes |
protect_docker_ports | bool | true | Yes |
dns_sinkhole_enabled | bool | false | Yes |
dns_sinkhole_provider | quad9 | cloudflare | adguard | cleanbrowsing | quad9 | Yes |
egress_ip_blocklist_enabled | bool | true | Yes |
metadata_watch_enabled | bool | true | Yes |
metadata_watch_allow_users | list | — | Yes |
cve_kernel_map_updates_enabled | bool | true | Yes |
clamav_enabled | bool | false | Yes |
clamav_scan_dirs | abs path list | — | Yes |
clamav_scan_interval_secs | int ≥ 3600 | 86400 | Yes |
clamav_freshclam_interval_secs | int ≥ 1800 | 7200 | Yes |
lockfile_watch_dirs | abs path list | — | Yes |
domain_check_domains | domain list (max 5) | — | Yes |
npm_audit_signatures_enabled | bool | false | Yes |
log_audit_enabled | bool | true | Yes |
log_audit_interval_secs | int ≥ 300 | 1800 | Yes |
resource_guard_enabled | bool | true | Yes |
resource_guard_rss_sample_interval_secs | int ≥ 10 | 60 | Yes |
resource_guard_rss_window_secs | int ≥ 300 | 1800 | Yes |
resource_guard_rss_min_samples | int ≥ 3 | 10 | Yes |
resource_guard_rss_min_growth_pct | int ≥ 10 | 50 | Yes |
resource_guard_rss_recovery_drop_pct | int ≥ 1 | 10 | Yes |
resource_guard_rss_min_kb | int ≥ 0 | 20000 | Yes |
resource_guard_crash_loop_window_secs | int ≥ 60 | 300 | Yes |
resource_guard_crash_loop_min_restarts | int ≥ 2 | 3 | Yes |
resource_guard_correlation_window_secs | int ≥ 60 | 600 | Yes |
resource_guard_zombie_min_count | int ≥ 0 | 20 | Yes |
resource_guard_load_min_normalized | float ≥ 0.0 | 0.5 | Yes |
resource_guard_load_enabled | bool | true | Yes |
resource_guard_cpu_enabled | bool | true | Yes |
resource_guard_cpu_sample_interval_secs | int ≥ 0 | 60 | Yes |
resource_guard_cpu_window_secs | int ≥ 0 | 600 | Yes |
resource_guard_cpu_min_samples | int ≥ 0 | 8 | Yes |
resource_guard_cpu_pct_threshold | float 0.0–1000.0 | 80.0 | Yes |
container_exec_guard_enabled | bool | true | Yes |
port_scan_detect_enabled | bool | true | Yes |
port_scan_detect_min_distinct_ports | int ≥ 0 | 15 | Yes |
port_scan_detect_window_secs | int ≥ 0 | 300 | Yes |
port_scan_block_enabled | bool | true | Yes |
port_scan_block_duration_secs | int ≥ 0 | 600 | Yes |
ssh_guard_enabled | bool | true | Yes |
ssh_guard_block_enabled | bool | true | Yes |
ssh_guard_max_failures | int 2–1000 | 6 | Yes |
ssh_guard_window_secs | int 10–86400 | 600 | Yes |
ssh_guard_ban_secs | int 60–2592000 | 3600 | Yes |
ssh_guard_ban_max_secs | int 60–31536000 | 604800 | Yes |
ssh_guard_allow | IP/CIDR list | — | Yes |
ssh_guard_log_source | auto | journal | abs path | auto | Yes |
ssh_guard_yield_to_fail2ban | bool | true | Yes |
ssh_guard_trust_key_days | int 0–3650 | 30 | Yes |
ssh_allow_only_enabled | bool | false | No (about 30 s) |
ssh_allow_only_sources | IP/CIDR list | — | No (about 30 s) |
agent_users | name list | — | Yes |
agent_egress_allow | addr[:port] list | — | Yes |
agent_setup_watch_secs | int 0, 30–86400 | 300 | Yes |
prn_record | bool | false | Yes |
prn_retention_hours | int 1–168 | 24 | Yes |
prn_max_mib | int 16–4096 | 256 | Yes |
dns_tunnel_detect_enabled | bool | true | Yes |
reverse_shell_watch_enabled | bool | true | Yes |
reverse_shell_watch_include_private | bool | false | Yes |
reverse_shell_watch_notify_only | bool | false | Yes |
suid_watch_enabled | bool | true | Yes |
suid_watch_interval_secs | 60 – 86400 | 600 | Yes |
log_tamper_watch_enabled | bool | true | Yes |
sensor_pairing_enabled | bool | false | Yes |
sensor_colocated | bool | false | Yes |
forward_enabled | bool | false | Yes |
forward_syslog_url | URL | — | Yes |
forward_syslog_format | rfc5424 | cef | rfc5424 | Yes |
forward_syslog_framing | octet | lf | octet | Yes |
forward_tls_ca_file | abs path | — | Yes |
forward_file_path | abs path | — | Yes |
forward_file_max_mb | int 1–10000 | 50 | Yes |
forward_file_keep | int 1–100 | 5 | Yes |
forward_file_group | group name | gid | — | Yes |
forward_webhook_url | URL | — | Yes |
forward_webhook_secret | string | — | Yes |
forward_webhook_secret_file | abs path | — | Yes |
forward_webhook_block_private_addresses | bool | false | Yes |
forward_webhook_allow_addresses | CIDR list | — | Yes |
forward_min_severity | info | low | medium | high | critical | low | Yes |
forward_queue_max_mb | int 1–10000 | 20 | Yes |
forward_queue_max_age_hours | int 1–8760 | 72 | Yes |
exec_recorder_enabled | bool | true | Yes |
exec_recorder_retention_mb | int 1–100000 | 200 | Yes |
exec_recorder_retention_days | int 1–3650 | 14 | Yes |
exec_recorder_hash_chain | bool | true | Yes |
exec_recorder_hash_exe | bool | true | Yes |
exec_recorder_cpu_budget_pct | int 1–50 | 3 | Yes |
exec_rules_enabled | bool | true | Yes |
exec_rules_disabled | string | — | Yes |
exec_rule_service_users | string | — | Yes |
exec_rule_window_secs | int 5–3600 | 120 | Yes |
exec_rules_isolation_optin | bool | false | Yes |
config_regression_notice_enabled | bool | true | Yes |
honeytokens_enabled | bool | true | Yes |
honeytokens_home | abs path | /root | Yes |
harden_userns_enabled | bool | true | Yes |
dns_tunnel_entropy_allowlist | list | — | Yes |
fleet_forwarding_allowed_hosts | list | — | Yes |
fleet_forwarding_allow_plaintext | bool | false | Yes |
entropy_watch_enabled | bool | true | Yes |
entropy_watch_dirs | list (max 32) | — | Yes |
entropy_watch_freeze | bool | false | Yes |
entropy_docroot_action | notify | freeze_writer | notify | Yes |
entropy_watch_max_files_per_sec | int 5–2000 | 50 | Yes |
package_cve_map_languages_enabled | bool | false | Yes |
18.2 guard.yaml (37 keys)
| Key | Type / values | Default | Restart |
|---|---|---|---|
sensor.type | falco | tetragon | falco | Yes |
sensor.transport | string | unix_socket | Yes |
sensor.socket_path | abs path | /run/roamswitch/events.sock | Yes |
sensor.reconnect_interval_ms | int 100–3600000 | 1000 | Yes |
policies.on_warning.action | log_and_notify | isolate_process | isolate_host_all | log_and_notify | Yes |
policies.on_warning.server_action | log_and_notify | isolate_process | isolate_host_all | — | Yes |
policies.on_warning.kill_process | bool | false | Yes |
policies.on_warning.freeze_process | bool | false | Yes |
policies.on_warning.fallback_to_host_isolation_after_retries | int 0–1000 | — | Yes |
policies.on_error.action | log_and_notify | isolate_process | isolate_host_all | isolate_process | Yes |
policies.on_error.server_action | log_and_notify | isolate_process | isolate_host_all | — | Yes |
policies.on_error.kill_process | bool | false | Yes |
policies.on_error.freeze_process | bool | false | Yes |
policies.on_error.fallback_to_host_isolation_after_retries | int 0–1000 | — | Yes |
policies.on_critical.action | log_and_notify | isolate_process | isolate_host_all | isolate_process | Yes |
policies.on_critical.server_action | log_and_notify | isolate_process | isolate_host_all | — | Yes |
policies.on_critical.kill_process | bool | true | Yes |
policies.on_critical.freeze_process | bool | false | Yes |
policies.on_critical.fallback_to_host_isolation_after_retries | int 0–1000 | 3 | Yes |
policies.on_emergency.action | log_and_notify | isolate_process | isolate_host_all | isolate_host_all | Yes |
policies.on_emergency.server_action | log_and_notify | isolate_process | isolate_host_all | — | Yes |
policies.on_emergency.kill_process | bool | true | Yes |
policies.on_emergency.freeze_process | bool | false | Yes |
policies.on_emergency.fallback_to_host_isolation_after_retries | int 0–1000 | — | Yes |
server_safeguards.allow_established_connections | bool | true | Yes |
server_safeguards.maintenance_ssh_ports | port list | 22 | Yes |
server_safeguards.whitelist_cidrs | list | — | Yes |
server_safeguards.whitelist_dns_servers | list | — | Yes |
server_safeguards.safety_timer_secs | int ≥ 0 | 300 | Yes |
adaptive_security.enabled | bool | true | Yes |
adaptive_security.untrusted_network_actions.elevate_falco_profile | string | — | Yes |
adaptive_security.untrusted_network_actions.auto_enable_userns_restriction | bool | false | Yes |
investigation.enabled | bool | false | Yes |
investigation.command | abs path | — | Yes |
investigation.args | list | — | Yes |
investigation.run_as | string | — | Yes |
investigation.timeout_secs | int 1–86400 | 180 | Yes |
19. Web shell and injected-code detection (Web Rules)
Detects PHP, JavaScript, JSP and ASP web shells and injected code on web servers, PHP disguised as images, and .htaccess abuse (Linux 1.11.23 and later). No configuration is needed: it finds document roots automatically from the Apache, nginx and Caddy configuration, and scans a file right after it is written and closed. It uses notification-only fanotify, so it does not block other processes. It also runs a periodic scan every 6 hours, and ClamAV is not required.
Behaviour is set in /etc/roamswitch/web_rules.conf (root-owned, mode 0644; a file others can write is ignored). Apply a change with sudo roamswitch server restart. A template is printed by roamswitch web-rules example conf.
| Key | Meaning (default) |
|---|---|
quarantine | Automatic quarantine level. off never quarantines, critical only critical, high critical and high (default: critical). A high finding at the critical level only notifies and fires the hook; the file is left alone. |
account_action | Whether to revoke the login shell of the owner of a detected file. off / revoke_shell / lock (default: off). Only critical or high findings that were quarantined count. Root, UIDs below account_min_uid, logged-in users and the daemon's own user are never touched. The previous shell is recorded and sudo roamswitch web-rules unlock-account <user> restores it. |
account_min_uid | account_min_uid: the lowest UID the account response may act on (default 1000; it cannot go below 100). |
scan_dirs, auto_docroots, watch, scan_interval_secs | scan_dirs (comma-separated absolute paths), auto_docroots (default true; false stops the automatic discovery from the web server configuration), watch (default true; false turns off the write watcher and keeps only the periodic scan) and scan_interval_secs (default 21600, minimum 3600). |
# /etc/roamswitch/web_rules.conf
quarantine=critical
account_action=off
account_min_uid=1000
#scan_dirs=/srv/sites/a,/srv/sites/b
auto_docroots=true
watch=true
scan_interval_secs=21600
PHP session files (files starting with sess_) are checked through the same path. The locations are session.save_path in php.ini and the FPM pools, /var/lib/php/sessions, /var/lib/php/session, /tmp, /var/tmp, and the private temporary folders of php, apache, httpd and nginx units that use PrivateTmp=. Only files directly in these folders are read. If a session.upload_progress marker and an opening tag appear together, it is php-session-upload-progress-code (critical); with an opening tag only, it is php-session-code (high).
With account_action=lock, the login shell of the owner of a detected file is revoked, and the account's outbound traffic is also blocked with nftables (the roamswitch_web_account_block table), because a running web shell is not stopped by revoking the shell. For an account that listens on a public address, only new outbound connections are blocked (loopback is allowed). With account_stop_processes=on (default off), the account's processes are stopped with SIGSTOP (except protected_processes and system-protected ones). unlock-account restores everything at once.
On detection, it notifies the rule name and whether the file was quarantined (Telegram, LINE, Webhook). To only check, use sudo roamswitch web-scan <folder> (--quarantine to quarantine) or the “Tools” screen of the Server TUI. Custom rules go in /etc/roamswitch/rules.d/*.json, and the post-detection script is /etc/roamswitch/hooks/post-detection (only root-owned, safe ones are run, without a shell, and are cut off after 30 seconds). Rules are updated by the daily receive-only update. If you disable cve_kernel_map_updates_enabled, no communication happens at all and it runs with the bundled rules.
roamswitch web-rules status shows the number and the list of document roots being watched now. When the count is 0, web shell detection is watching nothing. Write the folders in scan_dirs of web_rules.conf. Apps behind a reverse proxy and non-standard nginx layouts may not be found automatically. When the count is 0, a warning is also shown once at startup.
20. Accounts that run AI agents (agent_users)
A feature for running AI agents (Claude Code, Codex CLI, etc.) under a dedicated account (Linux 1.12.7 and later). It corresponds to the items that can be implemented on a single server among the 10 practices in the guidance on AI agent incident response issued by NIST, NSA and CISA on October 16, 2026. With a dedicated account, the agent cannot rewrite root's files or firewall rules.
Three keys in server.conf control it. A restart applies them (sudo roamswitch server restart).
| Key | Meaning (default) |
|---|---|
agent_users | The accounts that run agents (names or numeric uids, comma-separated; empty by default). root is refused. Names that do not exist and accounts without a home folder are ignored, with a warning at start-up. |
agent_egress_allow | Where agent_users may connect (empty by default = no limit): ADDR, ADDR/PREFIX, ADDR:PORT, ADDR/PREFIX:PORT, or [ADDR]:PORT for IPv6. Names cannot be written. With any entry, every other new outbound packet of those accounts is dropped. A blanket allow without a port, such as 0.0.0.0/0, is refused (0.0.0.0/0:443 is accepted). |
agent_setup_watch_secs | Seconds between two audits of each account's instruction files, skills and MCP definitions against the baseline held by root (default 300; 0 = off; 30 to 86400). |
# /etc/roamswitch/server.conf
agent_users=agent
agent_egress_allow=10.0.0.5:3128
agent_setup_watch_secs=300
Outbound allowlist: the nftables inet roamswitch_agent_egress table (output hook, priority -145) passes only loopback, established connections and the listed destinations (with a port, both TCP and UDP) from the target account's traffic, and drops the rest with a log entry rs_agent_egress_drop: (up to 10 per minute). Dropped traffic is collected every 60 seconds and notified once per hour per account and destination. The list is matched by address and cannot be narrowed by name. Use it either to allow just one proxy (agent_egress_allow=10.0.0.5:3128) or with network ranges.
Baseline held by root: the verified state of instruction files (CLAUDE.md, AGENTS.md, etc.), skills and MCP server definitions is stored as SHA-256 only in /var/lib/roamswitch/agent_setup/<account>.json (owned by root, 0600). The account can neither rewrite nor delete it. Create and update it with the following command as root, and add --accept-with-findings when findings remain.
sudo roamswitch audit-agent-setup --user agent # check only
sudo roamswitch audit-agent-setup --user agent --accept # make this state the baseline
The daemon detects changes to configuration files with inotify within about 1 second, and picks up anything missed with a check every agent_setup_watch_secs. It compares the home folder and the working copies directly under it (folders containing any of .git, .mcp.json, CLAUDE.md or AGENTS.md, up to 50) with the baseline, notifies a change or addition only once, and records it in the incident timeline. For an account with no baseline, it checks at startup and every 5 minutes, and notifies with the command to create one (at most once per 24 hours per account).
Decoy credentials: the decoys of §7.4 are also planted in the home of each agent_users account, with one watcher per account. The decoys under /root cannot be opened by an agent running as another account.
What it cannot do: the allowlist looks only at the sockets of the listed accounts, so an agent that can become root, or that has a root-owned service connect on its behalf, is not held. UDP does not wait for an answer, so the sender does not notice a drop. The Mac edition and the Linux Client Edition do not have this feature.
Do not include accounts that people log in to and use. A fake key is placed in an account that has no .ssh/id_rsa. ssh tries it as a default key, so false alarms can occur.
The service sees /home as read-only. So unless a drop-in adds ReadWritePaths=-/home/<account>, decoys are not placed. Step 13 of sudo roamswitch server setup writes it after asking for confirmation (/etc/systemd/system/roamswitch-server.service.d/agent-users.conf).
Setup steps: (1) Set agent_users. (2) Run sudo roamswitch server restart. (3) Check with sudo roamswitch audit-agent-setup --user NAME. (4) Read the result and create the baseline with --accept. (5) Confirm with roamswitch detection-coverage. Until the baseline is created, changes to that account are not watched. Changes made after it is created are notified within about 1 second.
The places audited are only ~/.claude, ~/.codex, ~/.cursor, ~/.gemini (including antigravity-cli), ~/.agents, ~/.openclaw and the working copies directly under the home directory. Nothing else is audited or watched for changes. An empty state can also be made the baseline.
21. Web access guard and web gate (detecting and blocking identifier walking)
This finds, in the web server's access log, receipt numbers, order numbers or user IDs being swapped in one after another. Attack tools that use AI spread the work over many IPs, so per-IP counts and the User-Agent show nothing. What it looks at is the way the numbers are asked for, which a person using the site never produces. The nginx and Apache access logs are found automatically and read as they are written.
Four things are watched. (1) A question for a reserved number (a canary, never issued). (2) Five 404 answers for numbers that do not exist from one client. (3) One client asking for 20 or more different numbers at the same endpoint. (4) Several clients walking the numbers in arrival order (recognised after 100 values; after that, a new client that asks for the next numbers is found on its first request). An address behind which three or more different browsers show up (a CDN, a company proxy, a carrier's shared address) is never blocked.
Behaviour is set in /etc/roamswitch/web_guard.conf (root-owned). The default is mode=warn (notify and record only; nothing is blocked). Changes take effect within 30 seconds.
| Key | Meaning (default) |
|---|---|
mode | mode: off / warn / block (default: warn). block blocks new connections to ports 80/443 from a matching source for ban_secs seconds. The allowlist (whitelist_ips), the gateway, DNS, this host itself, and shared addresses where three or more kinds of browser are seen are not blocked. Private addresses are also not blocked by default (block them with ban_private=yes). |
ban_secs, window_secs, not_found_limit, distinct_limit, ban_private | ban_secs (default 3600), window_secs (default 600), not_found_limit (default 5), distinct_limit (default 20), ban_private (default no). |
canary | canary: a range of numbers you never issue, with its endpoint (as many lines as you like). Examples: canary=/loan/status?receiptNo=2026100090-2026100099, canary=/api/orders/{n}=5000001-5000009. A client that asks for one is caught on the first request. |
gate_* | gate_budget_floor (default 30), gate_budget_factor (default 3), gate_learn_secs (default 3600), gate_socket (default /run/roamswitch/webgate.sock): settings of the web gate (see below). |
recon_notify, summary_hour | recon_notify (default summary) sets how site-structure probing is announced: summary is one summary a day, immediate is one message per client, and off sends none. summary_hour (0 to 23, default 9) is the hour the summary goes out (the server's local time). Blocking, the log and the incident record do not change with either key. |
# /etc/roamswitch/web_guard.conf
mode=warn
canary=/loan/status?receiptNo=2026100090-2026100099
#ban_secs=3600
#ban_private=no
Detecting identifier walking sends a notification (Telegram, LINE, Webhook): one message per endpoint (path and number parameter) per pass. It says why, and whether the client was blocked or only reported. A block (mode=block) can be lifted with roamswitch emergency-restore. To only look, leave mode=warn.
The Web Gate (roamswitch-webgate) is an optional component placed in front of nginx that protects only the places that accept ID numbers. To counter attacks that keep changing IPs, it holds a per-minute budget of new-number lookups for each place (it learns the normal volume for 1 hour after startup, then allows 3 times the normal maximum per minute, at least 30). Beyond it, unknown numbers get 429, and the four judgments above get 403 from the first request.
It runs only on a Unix socket, does not go out to the network, and passes requests through while stopped. Start it with sudo systemctl enable --now roamswitch-webgate, and add the nginx configuration printed by roamswitch web-gate-config /loan/status (this command changes nothing). While mode=warn, it only records.
sudo systemctl enable --now roamswitch-webgate
roamswitch web-gate-config /loan/status --proxy http://127.0.0.1:8080
sudo nginx -t && sudo nginx -s reload
Even if the gate stops, nginx keeps passing requests, so you do not notice that it stopped. Check whether it is running with the following commands. The gate updates /run/roamswitch/webgate.status every 10 seconds, and if its ts is older than 60 seconds, the server daemon sends a notification. If you forget to run enable after a reboot, is-enabled shows it.
systemctl is-active roamswitch-webgate
systemctl is-enabled roamswitch-webgate
sudo cat /run/roamswitch/webgate.status
In a local test (simulated brute force, 5 requests per second), 700 sequential-number requests were blocked for all IPs after 100 requests even when spread over 9 IPs (new IPs after that were blocked on the first request). With the gate, it stopped at 30. An attack that changes IPs every time and queries at random was held to 30 per minute by the gate (without the gate, it is not stopped). A slow attack at the normal volume cannot be stopped, and the fundamental countermeasure is per-user authorization in the application. roamswitch web-id-check 'http://127.0.0.1/loan/status?receiptNo={n}' --start 202610060001 checks whether content per number is returned without login (it only sends GET for up to 10 consecutive numbers).
A notification is also sent when nginx, Apache or PHP-FPM workers die of a crash signal (SIGSEGV, SIGABRT and the like) three times within five minutes (the error log is read). The master process replaces each worker, so this is never counted as a service restart. It points to an attempt to exploit a vulnerability, or to a bug in the program. One notification per server per hour; nothing is stopped or blocked.
Activity that probes the site structure is also found from the same access log (a detection separate from identifier brute force). One source is counted for window_secs (default 600 seconds) under 5 reasons. (1) path_walk: 12 or more kinds of nonexistent paths (404), excluding paths that contain identifiers. (2) asset_harvest: 40 or more requests for .js, .css and similar without a Referer. (3) api_probe: 20 or more kinds of different paths under /api/ with 401, 403 or 404. (4) param_fuzz: 30 or more different queries on the same path, with more than half being 4xx. (5) probe_walk: 6 or more kinds of secret/configuration paths such as .env and .git or admin screen paths, or 12 or more kinds of different secret paths (regardless of the response). (5) finds crawling on sites that return 200 for every path.
Settings go in the same /etc/roamswitch/web_guard.conf. They are recon=off|warn|block (default warn), five limits (such as path_walk_limit, 3 to 10000; the default of probe_walk_limit is 6), and the exclusions exempt_path=/health (prefix match) and exempt_ua=uptimerobot (partial match, lowercase, 3 characters or more). Blocking happens only when mode=block and recon=block, and shared addresses where three or more kinds of browser are seen are not blocked.
Notification is, by default, a once-a-day summary. At the first check at or after summary_hour (default 9, server local time), it sends the number of sources, the number of detections and blocks, and the top 10 sources (nothing is sent on days without detections). recon_notify=immediate notifies per source, and recon_notify=off sends no notification. Blocking, logs and incident records do not change. The tally is kept in /var/lib/roamswitch/web_recon_summary.json (up to 500 sources). Exclude search-engine and monitoring crawls with exempt_ua or exempt_path. The Web Gate cannot see the Referer or response codes, so it does not check these four.
In my own tests, real access logs written by nginx in Docker were passed through the actual parser and guard. A client crawling with python-requests was detected as path_walk at the 12th 404, as asset_harvest at the 40th JavaScript request (70th overall), as api_probe at the 20th API request (110th), and as param_fuzz at the 30th query request (145th). Normal browser use of 120 requests (20 pages, 60 JavaScript files with a Referer, 40 searches) produced no detections. This is the only range that was measured.
You can check whether the environment is suitable for blocking with roamswitch web-guard-check [--hours N] (root; changes nothing). From the access log and the web server configuration, it examines the share of requests coming from private or shared addresses and whether the settings that restore the visitor's address are present (RemoteIPHeader, real_ip_header and set_real_ip_from), among others. The result is “suitable”, “effective only in part”, “not suitable”, or “cannot be determined (fewer than 200 requests)”; when not suitable, the exit code is 1. If a CDN or proxy does not pass on the visitor's address, everyone appears as one address, and blocking stops many people. An address where fewer than 1 in 5 requests succeed (2xx, 304) is not treated as shared, even if it changes its User-Agent.
A notice-only alert (other than the daily summary) carries guidance only where the state and this check disagree: how to switch blocking on when it is off although the check says it fits, and how to stop blocking when it is on although the check says it does not fit (the check is worked out from the logs and reused for six hours). Otherwise the alert says only that nothing was blocked. Blocked addresses are released with roamswitch unban <IP> (--all for every one), which lifts both the SSH guard's and the web access guard's bans.
22. Random-byte record (prn_record, with a deadline)
Ransomware generates file keys inside the victim machine from the OS random number generator. With prn_record=true, random numbers returned by getrandom and reads of /dev/urandom and /dev/random (8 bytes or more, up to the first 128 bytes) are recorded with an expiry. This is the material that decryption tools (such as Memento from KDDI Research) use to regenerate the keys. RoamSwitch does not decrypt. It is off by default and not available in the Mac version or the Linux client version.
| Key | Meaning (default) |
|---|---|
prn_record | prn_record: record the random bytes (default false). Turning it off removes what was recorded when the daemon starts. |
prn_retention_hours | prn_retention_hours: how long a record is kept (1 to 168 hours, default 24). |
prn_max_mib | prn_max_mib: the most disk the record may use (MiB, 16 to 4096, default 256). |
# /etc/roamswitch/server.conf
prn_record=true
prn_retention_hours=24
prn_max_mib=256
Records are not kept beyond their expiry. Records older than prn_retention_hours are overwritten with zeros and deleted per file every 10 minutes (up to 10 minutes late). When prn_max_mib is exceeded, the oldest are deleted first, so the retention time can only get shorter, never longer. Out-of-range values are rejected, and a wrong clock does not extend the expiry. While the daemon is stopped, /usr/lib/tmpfiles.d/roamswitch-prn.conf deletes files not written to for 7 days (the maximum retention) once a day (systemd 247 and later).
Records are taken with fentry/fexit on the kernel random functions (get_random_bytes_user, urandom_read_iter, random_read_iter), so other reads and system calls bear no load. In measurements, the difference over 1 million reads was within the margin of error, and a record took about 1.2 microseconds and about 67 bytes (Linux 7.0, aarch64). On kernels where fentry is unavailable (x86-64 before 5.5, arm64 before 6.0) and similar cases, it notifies with the reason. Setting RS_PRN_HOOK=syscall lets it record with a tracepoint, at the cost of slightly slowing all system calls.
The record lives in /var/lib/roamswitch/prn/ (0700, files 0600, owned by root) and never appears in notifications, evidence bundles, MCP or event forwarding. Some things are not seen: a path that returns random bytes without a system call (glibc 2.41 and newer using the vDSO for getrandom()) and RDRAND executed in user space. On x86-64 the kernel parameter vdso=0 turns the vDSO path off.
Check the state with sudo roamswitch-prn-recorder status. sudo roamswitch-prn-recorder export --output FILE [--since-hours N] [--pid PID] writes the unexpired records as memento.prn/v1 JSON Lines to a new 0600 file. The expiry does not apply to the exported file, so delete it securely when you are done. sudo roamswitch-prn-recorder purge deletes all records right now.
The record also holds the secrets of TLS and SSH sessions the host made. If root is taken, the keys of the traffic inside the limit can be rebuilt. Set the retention and the size limit to no more than you need.
23. Bundled separate tools (AccessScope, PersonalSOC, PathScope)
The Server Edition deb and rpm install the commands of three tools that are separate from RoamSwitch (AccessScope, PersonalSOC and PathScope) into /usr/bin/. The window apps and WebKitGTK are not included. The tools are licensed under the Apache License 2.0 and are not covered by the RoamSwitch End User License Agreement (EULA). They are updated through updates to the RoamSwitch package.
| Command | What it does |
|---|---|
accessscope | Finds attack attempts from web server and SSH access logs, with the log lines as evidence. It is read-only, and diagnosis uses neither an LLM nor the network. accessscope discover lists the log locations, accessscope scan --auto diagnoses, and accessscope fleet combines multiple hosts. For details, see the AccessScope Operation Manual. |
personalsoc | Checks this host's logs and RoamSwitch (MCP) detections, and produces a list of findings or a report. Run it as root, like sudo personalsoc scan. personalsoc scan --report gives a Markdown report, and --format json and --format sarif give machine-readable output. --fail-on high exits with code 3 on a high finding. Only when you add --llm, the summary and evidence lines are passed to the LLM command you chose (outside Zero Telemetry). For details, see the PersonalSOC Operation Manual. |
pathscope | Finds the paths from ordinary users to root and sensitive data, and shows the order in which to fix them. It is read-only and does not call an LLM. pathscope analyzes the paths from the current user to root. pathscope --baseline=previous.json --fail-on=new exits with code 1 if paths have increased. sudo pathscope --check-agent-users analyzes the agent_users accounts together. For details, see the PathScope Operation Manual. |
The window apps (accessscope-app, personalsoc-app and pathscope-gui) are included only in the Client Edition packages.