An operator running a fork has no honest way to upgrade: upgrade.sh downloads the Release tarball of one hard-coded third-party repository and rsyncs it over the tree, so "upgrade" means "overwrite yourself with somebody else's code", and the safe alternative is to pull by hand and remember the build command. internal/update drives the remote the directory already tracks: fetch, fast-forward, go build into .update-staging, atomic rename of the binary (the previous one kept as cyberstrike-ai.prev), and a .update-state.json so a rollback has a target that is not guessed at. Refusals are the point - local source edits and a diverged branch stop with the file names and commit counts in the error rather than being reset to match, and operator-owned content (roles/skills/tools/agents/data/config.yaml) is put aside before the merge and restored over it, with what was kept listed in keptContent instead of quietly dropped. Consumers: GET/POST /api/system/update* behind update:read / update:apply (mutations are process-global, so they need a global-scope session); a console page at #system-update with an apply button that names why it is blocked, a job polled from the server and a rollback control; the same three actions as -check-update / -update / -update-rollback on the binary; OpenAPI entries for all five endpoints. Permission gating no longer re-enables a control a page disabled for a reason of its own (data-state-disabled), which every state-disabled, permission-gated button in the console was subject to. upgrade.sh becomes a thin shell over the same implementation and only falls back to the tarball path for installs that are not git work trees. Docs and the zh/EN/RU dictionaries are updated. The package runs 13 tests against real temporary git repositories; the HTTP layer, RBAC and the console page each carry their own contract tests.
6.8 KiB
Deployment Guide
CyberStrikeAI can run as a local testing tool, an internal team service, or a production red-team platform. Treat it as a high-privilege security system: it can execute commands, call MCP tools, manage WebShell connections, and optionally run C2 listeners.
Prerequisites
- Go for source runs and binary builds.
- Python for some MCP servers and tool scripts.
- SQLite files under
data/; no external DB is required by default. - Actual security tools installed in PATH. YAML files under
tools/only describe commands. - At least one
ai.channelsentry. Useprovider: openai_compatiblefor OpenAI-compatible endpoints, orprovider: claudefor Eino's native Claude component.
Important persistent paths:
config.yaml
data/
tools/
roles/
skills/
agents/
knowledge_base/
chat_uploads/
Back these up before upgrades.
Startup Modes
Local quick start:
chmod +x run.sh && ./run.sh
run.sh is the most common startup path for local use, development, small temporary internal deployments, and quick post-upgrade verification.
For long-running service, boot-time startup, managed logs, and crash recovery, prefer a binary managed by systemd.
Source run:
go run ./cmd/server --config config.yaml
Binary build:
go build -o cyberstrike-ai ./cmd/server
./cyberstrike-ai --config config.yaml
The binary still needs web/templates, web/static, and the runtime resource directories.
HTTPS and Reverse Proxy
For local testing, self-signed HTTPS is acceptable:
server:
tls_enabled: true
tls_auto_self_sign: true
For production, use real certificates or terminate TLS at a reverse proxy. If the proxy terminates TLS and forwards HTTP to the app, avoid enabling app-side TLS on the same upstream unless proxy_pass uses HTTPS.
Nginx must not buffer SSE:
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
Upgrading
Prefer the platform's own one-click update (console Platform management -> One-click update,
POST /api/system/update/apply, or ./cyberstrike-ai -update at a keyboard). It pulls the remote
this install directory already tracks: fetch, fast-forward, go build, atomic binary swap (the old
binary is kept as cyberstrike-ai.prev), while operator content - roles/ skills/ tools/ agents/ knowledge_base/ data/ config.yaml - is put aside and restored, and the result names every file it
kept. For a fork this is the only path that does not overwrite you with somebody else's code; when
source is modified locally or the branch has diverged it refuses and says why instead of forcing.
See the developer guide for the full semantics.
upgrade.sh still works and is now a thin shell over that implementation, with two paths decided by
the installation kind:
- git work tree: calls
./cyberstrike-ai -updatedirectly (buildinggo build -o cyberstrike-ai ./cmd/serverfirst when there is no binary yet, and failing with instructions on installing Go when there is neither).--checkinspects only, through-check-update. - not a git work tree (Release tarball install): only here does it fall back to downloading a
Release tarball and
rsync --delete-ing it in. The source repository then comes from--repo owner/nameor theGITHUB_REPOenvironment variable, and the built-in default is used only when neither is given - with a warning naming which repository the code is coming from.config.yaml,data/,tools/,roles/,skills/,agents/,venv/(skippable with--no-venv) and the rollback points.update-backup/,.update-state.json,cyberstrike-ai.prevare on the rsync keep list, so--deletecannot remove them.
Recommended flow either way:
- Stop the service.
- Back up
config.yaml,data/and your custom directories. - Pull or replace the new code/binary.
- Keep your own configuration and add fields the new
config.yamlexample introduced. - Start the service and check login, model test, tool list and knowledge-base status.
The one-click update performs step 3 (plus the rebuild); 1, 2, 4 and 5 stay operator decisions - a
database migration does not become compatible just because the binary changed. upgrade.sh suits
quick upgrades without compatibility risk; in production still back up first. Python dependencies:
venv/ is created and managed by run.sh, and keeping it means an upgrade does not remove it - only
--no-venv deletes it and lets run.sh reinstall.
Rollback
The one-click update leaves its own rollback point: ./cyberstrike-ai -update-rollback, or the button
on the page, goes back to the commit before that update and puts cyberstrike-ai.prev back. It runs
only while HEAD is still the commit that update wrote, so work done afterwards is not discarded.
Content that was put aside also survives under .update-backup/<timestamp>/.
Beyond that, roll back together:
- The previous binary or code.
- The pre-upgrade
config.yaml. - The pre-upgrade
data/.
If the new version already wrote database schema changes, rolling back the binary alone may not be enough; restore the whole backup.
Deployment Decision Table
| Scenario | Recommended setup | Key settings | Avoid |
|---|---|---|---|
| Personal testing | ./run.sh + self-signed HTTPS |
tls_auto_self_sign: true |
Public exposure |
| Internal team | Binary + systemd + internal HTTPS | strong password, audit, backup, IP restrictions | Shared weak password |
| Production red-team platform | Reverse proxy + dedicated OS user + log collection | real certs, proxy auth, C2 only when needed | Direct public admin UI |
| Chat/KB only | Disable C2 and unnecessary MCP | c2.enabled: false |
All tools enabled by default |
| Tool automation | Isolated workspace + HITL | workspace_root_dir, hitl, monitor |
Shell tools globally allowlisted |
Acceptance Checklist
After startup:
- Open
/and verify no HTTP/HTTPS redirect loop. - Login and validate
/api/auth/validate. - Run model test in settings.
- Check tool list and schemas.
- If KB is enabled, check index status.
- If external MCP is enabled, verify connection and tool visibility.
- If C2 is enabled, start and stop a test listener only in an authorized network.
- Check audit logs for login and config activity.
Runtime File Layers
- Replaceable: binary,
web/, default docs/resources. - Preserve:
config.yaml,data/, custom tools/roles/skills/agents,knowledge_base, uploads. - Cleanup candidates: checkpoints, temporary workspaces, stale payloads, old tool execution records.
Source Anchors
- App wiring and routes:
internal/app/app.go - TLS bootstrap:
internal/app/main_server_tls.go - HTTP to HTTPS redirect:
internal/app/main_server_http_redirect.go - Config structs:
internal/config/config.go - Config apply:
internal/handler/config.go