Kastell

io.github.kastelldev由 GitHub 帳號 kastelldev 發布v1.14.0更新於 Oct 24, 2026

Server security audit (413 checks), hardening, and fleet management across 4 cloud providers.

概覽

AI 產生的概覽

讓助理透過本機 MCP 伺服器,對四家雲端廠商的伺服器進行安全稽核、加固、開通、備份與監控。

可以做什麼
Kastell 提供 17 個 MCP 工具,涵蓋伺服器資訊查詢、日誌與指標、開通、維護、安全加固、防火牆與網域設定、備份與快照、安全稽核、證據收集、監控守護程序、診斷、機群總覽以及安全自動修復。稽核包含數百項檢查並可依合規框架篩選,lock 工具會執行多步驟的正式環境加固流程。破壞性操作受安全模式限制。
適用情境
當你管理 Hetzner、DigitalOcean、Vultr 或 Linode 上的自架 Linux 伺服器,並希望助理透過提示完成稽核、加固、備份、更新與健康檢查時使用。適合想用單一工具同時處理開通與持續安全的維運人員。
執行需求
透過 npx 或全域 npm 安裝後在本機執行,需要 Node.js 20 或更新版本。雲端廠商 API 權杖透過環境變數提供:DIGITALOCEAN_TOKEN、HETZNER_TOKEN、LINODE_TOKEN、VULTR_TOKEN,各自僅用於對應廠商。需要目標伺服器的 SSH 存取權限以及連往雲端廠商的網路連線。未聲明需要廠商帳號。
安裝前請注意
此伺服器可以建立、重啟、銷毀與還原雲端伺服器,修改防火牆與 SSH 設定,並刪除快照;破壞性操作需要關閉安全模式。雲端廠商 API 權杖以環境變數傳入,可控制雲端資源,開通伺服器或建立快照可能產生廠商費用。加固與修復會變更伺服器設定,建議先以 dry-run 預覽。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Kastell,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

[Kastell]

Kastell

Your infrastructure, fortified.

English | Türkçe

[Tests] [Coverage] [npm] [Downloads] [License] [GitHub stars] [Socket Badge] [Snyk] [Website] [DeepWiki] [Zero Telemetry]

Why Kastell?

Server security is fragmented. Lynis scans but doesn't fix. OpenSCAP is powerful but complex. Custom scripts work until they don't -- and nobody maintains them. Each tool has its own output format, its own update cycle, its own learning curve.

Kastell takes a different approach: one CLI that audits, fixes, hardens, and monitors. Scan your server, apply safe fixes, lock it down to production standards, and keep watching -- all with the same tool.

AI-native from day one. Kastell ships with a built-in MCP server, so Claude, Cursor, or any MCP-compatible AI agent can manage your servers directly. Go from a prompt to production hardening in seconds.

You don't need four separate tools to secure a server.

Quick Start

bash
# Interactive mode -- no commands to memorizenpx kastell

Running kastell without any arguments launches an interactive search menu with a gradient ASCII banner and quick-start examples. Browse actions by emoji-categorized groups, type to filter results instantly, and configure options step by step -- no need to remember any command names or flags.

 ██╗  ██╗  ██████╗  ███████╗████████╗███████╗██╗     ██╗ ██║ ██╔╝  ██╔══██╗ ██╔════╝╚══██╔══╝██╔════╝██║     ██║ █████╔╝   ███████║ ███████╗   ██║   █████╗  ██║     ██║ ██╔═██╗   ██╔══██║ ╚════██║   ██║   ██╔══╝  ██║     ██║ ██║  ██╗  ██║  ██║ ███████║   ██║   ███████╗███████╗███████╗ ╚═╝  ╚═╝  ╚═╝  ╚═╝ ╚══════╝   ╚═╝   ╚══════╝╚══════╝╚══════╝
  KASTELL  v2.3.1  ·  Your infrastructure, fortified.
  $ kastell init --template production  → deploy a new server  $ kastell status --all                → check all servers  $ kastell secure setup                → harden SSH + fail2ban  $ kastell maintain --all              → full maintenance cycle
? What would you like to do?   Server Management❯    Deploy a new server     Add an existing server     List all servers     ...   Security     Harden SSH & fail2ban     Manage firewall (UFW)     ...

Each action includes sub-options (server mode, template, log source, port number, etc.) and a <- Back option to return to the main menu at any point.

If you already know the commands, you can still use them directly:

bash
kastell init                    # Deploy a new serverkastell status my-server        # Check server statuskastell backup --all            # Backup all servers

Kastell handles server provisioning, SSH key setup, firewall configuration, and platform installation automatically.

What Makes Kastell Different?

ProblemSolution
Broke your server with an update?Pre-update snapshot protection via maintain
No idea if your server is healthy?Built-in monitoring, health checks, and doctor diagnostics
Security is an afterthought?Firewall, SSH hardening, SSL, and security audits built-in
Backups? Maybe someday...One-command backup & restore with manifest tracking
Managing multiple servers?--all flag across backup, maintain, status, and health
Existing server not tracked?kastell add brings any server under management
Don't want to memorize commands?Just run kastell -- interactive menu guides you

Kastell vs Alternatives

FeatureKastellLynisOpenSCAP
Installationnpm i -g kastellPackage managerPackage manager
LanguageTypeScriptShellC/Python
Security Checks449300+Varies by profile
Auto-FixSafe tierSuggest onlySuggest only
MCP (AI Agent)17 tools----
ComplianceCIS, PCI-DSS, HIPAACIS, HIPAACIS, STIG, PCI-DSS
Cloud Provision4 providers----
Hardening (Lock)24-step----
Remote MonitoringGuard daemon----
Telegram BotBuilt-in----
Platform SupportLinux (SSH)Linux/macOS/BSDLinux
LicenseApache 2.0GPL-3.0LGPL-2.1

What Can You Do?

Deploy

bash
kastell                               # Interactive menu (recommended)kastell init                          # Interactive setup (direct)kastell init --provider hetzner       # Non-interactivekastell init --config kastell.yml     # From YAML configkastell init --template production    # Use a templatekastell init --mode bare              # Generic VPS (no platform)kastell init --mode dokploy           # Dokploy (Docker Swarm PaaS)

Manage

bash
kastell list                  # List all serverskastell status my-server      # Check server statuskastell status --all          # Check all serverskastell ssh my-server         # SSH into serverkastell restart my-server     # Restart serverkastell destroy my-server     # Destroy cloud server entirelykastell add                   # Add existing serverkastell remove my-server      # Remove from local configkastell config set key value  # Manage default configurationkastell config validate       # Validate servers.yaml structure and typeskastell export                # Export server list to JSONkastell import servers.json   # Import servers from JSON

Update & Maintain

bash
kastell update my-server              # Update platform (Coolify or Dokploy, auto-detected)kastell update my-server --dry-run    # Preview update without executingkastell maintain my-server            # Full maintenance (snapshot + update + health + reboot)kastell maintain my-server --dry-run  # Preview maintenance stepskastell maintain --all                # Maintain all servers

Back Up & Restore

bash
kastell backup my-server      # Backup DB + configkastell backup --all          # Backup all serverskastell restore my-server     # Restore from backup

Snapshots

bash
kastell snapshot create my-server   # Create VPS snapshot (with cost estimate)kastell snapshot list my-server     # List snapshotskastell snapshot list --all         # List all snapshots across serverskastell snapshot delete my-server   # Delete a snapshot

Security

bash
kastell firewall status my-server   # Check firewallkastell firewall setup my-server    # Configure UFWkastell secure audit my-server      # Security auditkastell secure setup my-server      # SSH hardening + fail2bankastell domain add my-server --domain example.com  # Set domain + SSL

Security Audit

bash
kastell audit my-server                  # Full security audit (31 categories, 449 checks)kastell audit my-server --json           # JSON output for automationkastell audit my-server --threshold 70   # Exit code 1 if score below thresholdkastell audit my-server --fix            # Interactive fix mode (prompts per severity)kastell audit my-server --fix --dry-run  # Preview fixes without executingkastell audit my-server --watch          # Re-audit every 5 min, show only changeskastell audit my-server --watch 60       # Custom interval (60 seconds)kastell audit --host [email protected]       # Audit unregistered serverkastell audit my-server --badge          # SVG badge outputkastell audit my-server --report html    # Full HTML reportkastell audit my-server --score-only     # Just the score (CI-friendly)kastell audit my-server --summary        # Compact dashboard viewkastell audit my-server --explain        # Explain failed checks with remediation guidancekastell audit my-server --compliance cis # Filter by compliance framework (cis-level1, cis-level2, pci-dss, hipaa)

Security Hardening

bash
kastell lock my-server                        # 24-step production hardening (SSH + UFW + sysctl + auditd + AIDE + Docker)kastell lock my-server --dry-run              # Preview hardening steps without applying

Monitor & Debug

bash
kastell monitor my-server             # CPU, RAM, disk usagekastell logs my-server                 # View platform logs (Coolify or Dokploy)kastell logs my-server -f              # Follow logskastell health                         # Health check all serverskastell doctor                         # Check local environment

Supported Providers

ProviderStatusRegionsStarting Price
Hetzner CloudStableEU, US~€4/mo
DigitalOceanStableGlobal~$18/mo
VultrStableGlobal~$12/mo
Linode (Akamai)BetaGlobal~$12/mo

Prices reflect the cheapest plan with at least 2 GB RAM (required by Coolify and Dokploy). Bare mode has no minimum requirements -- plans start from ~$2.50/mo depending on provider. You can choose a different size during setup. Linode support is in beta -- community testing welcome.

Supported Platforms

PlatformMode FlagMin RAMMin CPUDescription
Coolify--mode coolify (default)2 GB2 vCPUDocker-based PaaS (port 8000)
Dokploy--mode dokploy2 GB2 vCPUDocker Swarm-based PaaS (port 3000)
Bare--mode bare——Generic VPS, no platform overhead

Kastell uses a PlatformAdapter architecture -- the same commands (update, maintain, logs, health) work across all platforms. The platform is stored in your server record and auto-detected on each command.

Developer Experience

FeatureCommand / FlagDescription
Dry Run--dry-runPreview destructive commands without executing. Available on: destroy, update, restart, remove, maintain, restore, firewall, domain, backup, snapshot, secure.
Shell Completionskastell completions bash|zsh|fishGenerate shell completion scripts for tab-completion of commands and options.
Config Validationkastell config validateCheck servers.yaml for structural and type errors using Zod strict schemas.
Version Checkkastell --versionShows current version and notifies if a newer version is available on npm.

YAML Config

Deploy with a single config file:

yaml
# kastell.ymlprovider: hetznerregion: nbg1size: cax11name: my-coolifyfullSetup: truedomain: coolify.example.com
bash
kastell init --config kastell.yml

Templates

TemplateBest ForIncludes
starterTesting, side projects1-2 vCPU, 2-4 GB RAM
productionLive applications2-4 vCPU, 4-8 GB RAM, full hardening
devDevelopment & CI/CDSame as starter, no hardening
bash
kastell init --template production --provider hetzner

Security

Kastell is built with security as a priority -- 12,132 tests across 380 suites, including dedicated security test suites.

  • API tokens are never stored on disk -- prompted at runtime or via environment variables
  • SSH keys are auto-generated if needed (Ed25519)
  • All SSH connections use StrictHostKeyChecking=accept-new with IP validation (octet range) and environment filtering
  • Shell injection protection on all user-facing inputs (spawn/spawnSync, no execSync)
  • Provider error messages are sanitized to prevent token leakage
  • stderr sanitization redacts IPs, home paths, tokens, and secrets from error output
  • Config file token detection (22+ key patterns, case-insensitive, nested)
  • Import/export operations strip sensitive fields and enforce strict file permissions (0o600)
  • --full-setup enables UFW firewall and SSH hardening automatically
  • MCP: SAFE_MODE (default: on) blocks all destructive operations, Zod schema validation on all inputs, path traversal protection on backup restore
  • Claude Code hooks: destroy-block prevents accidental kastell destroy without --force, pre-commit audit guard warns on score drops
  • Zero Telemetry — Kastell collects no usage data, analytics, or telemetry. Your server data never leaves your machine.

Security behavior (v2.3.1)

This section documents security contracts shipped in v2.3.1. Future work is described elsewhere (see CHANGELOG.md for upcoming entries).

  • KASTELL_STRICT_HOST_KEY=true — when set, Kastell rejects unknown SSH host keys outright. Direct SSH connections (i.e. those that go through accept-new) emit a one-time Trust-On-First-Use (TOFU) warning so operators see the risk; combined with KASTELL_STRICT_HOST_KEY=true, the warning is promoted to a hard error.
  • Non-TTY destructive commands — in non-interactive environments (CI, scripts, automation), destructive operations require an explicit --force flag or the command's documented opt-in flag. Without one, the command exits with a non-zero status and a clear error.
  • Structured skipped checks — checks that are skipped (e.g. VPS-irrelevant, platform-mismatch, missing prerequisite) appear in audit output as a neutral, visible result rather than being silently dropped. Operators can see exactly which checks did not run and why.
  • Windows secret files — secret-bearing files written by Kastell on Windows receive restrictive ACLs (owner-only access). 0o600 POSIX permissions remain the source of truth on Linux/macOS; Windows uses the equivalent DACL.
  • QuickWin JSON shape — audit --json QuickWin entries now include a stable id (check ID) and severity field, in addition to the existing description and commands. This makes QuickWins programmatically consumable without parsing the human-readable description.
  • FORBIDDEN previews include reasons — when previewing fixes with --dry-run (or via server_fix MCP dry-run), each FORBIDDEN-tier fix now renders a short reason explaining why the fix is classified FORBIDDEN (e.g. "requires reboot", "disrupts active SSH sessions"). The reason is sourced from the check's forbiddenReason field.

Installation

bash
# Run directly (recommended)npx kastell <command>
# Or install globallynpm install -g kastellkastell <command>

Requires Node.js 20 or later.

Safety Modes

KASTELL_SAFE_MODE environment variable controls destructive operations:

  • MCP default: true — provision, destroy, restore are blocked
  • CLI default: false — all operations are enabled
  • Override: KASTELL_SAFE_MODE=true kastell destroy <server> → rejected

Affected commands: init, destroy, backup-restore, snapshot-restore, snapshot-delete, restart, maintain.

Troubleshooting

Server creation fails? Run kastell doctor --check-tokens to verify your API token and local environment.

Server not responding? Use kastell status my-server --autostart to check platform status and auto-restart if needed, or kastell health to check all servers at once.

Need to start fresh? kastell destroy my-server removes the cloud server entirely.

Contributing

See CONTRIBUTING.md for development setup, testing, and contribution guidelines.

Kastell uses 11,206 tests across 344 suites. Run npm test before submitting PRs.

MCP Server (AI Integration)

Kastell includes a built-in Model Context Protocol server for AI-powered server management. Works with Claude Code, Cursor, Windsurf, and other MCP-compatible clients.

json
{  "mcpServers": {    "kastell": {      "command": "npx",      "args": ["-y", "-p", "kastell", "kastell-mcp"],      "env": {        "HETZNER_TOKEN": "your-token",        "DIGITALOCEAN_TOKEN": "your-token",        "VULTR_TOKEN": "your-token",        "LINODE_TOKEN": "your-token"      }    }  }}

Available tools:

ToolActionsDescription
server_infolist, status, health, sizesQuery server information, check cloud provider and platform status
server_logslogs, monitorFetch platform/Docker logs and system metrics via SSH
server_manageadd, remove, destroyRegister, unregister, or destroy cloud servers
server_maintainupdate, restart, maintainUpdate platform, restart servers, run full maintenance
server_securesecure, firewall, domainSSH hardening, firewall rules, domain/SSL management (10 subcommands)
server_backupbackup, snapshotBackup/restore databases and create/manage VPS snapshots
server_provisioncreateProvision new servers on cloud providers
server_auditaudit449-check security audit with compliance framework filtering; use --explain for remediation guidance
server_evidencecollectCollect forensic evidence package with checksums
server_guardstart, stop, statusManage autonomous security monitoring daemon
server_doctordiagnoseProactive health analysis with remediation commands
server_lockharden24-step production hardening (SSH, UFW, sysctl, auditd, AIDE, Docker)
server_fleetoverviewFleet-wide health and security posture dashboard
server_fixfix --safeApply safe auto-fixes with backup (SAFE tier only, dryRun default)

All destructive operations (destroy, restore, snapshot-delete, provision, restart, maintain, snapshot-create) require SAFE_MODE=false to execute.

Claude Code Plugin

Kastell is available as a Claude Code plugin for the Anthropic marketplace. The plugin bundles:

  • 4 skills: kastell-ops (architecture reference), kastell-scaffold (component generation), kastell-careful (destructive op guard), kastell-research (codebase exploration)
  • 2 agents: kastell-auditor (parallel audit analyzer), kastell-fixer (worktree-isolated auto-fix)
  • 5 hooks: destroy-block, session-audit, session-log, pre-commit-audit-guard, stop-quality-check

Install via Claude Code plugin manager or use directly with claude --plugin-dir kastell-plugin.

MCP Platform Setup

PlatformConfig LocationGuide
Claude Codeclaude mcp add or .mcp.jsonSetup Guide
Claude Desktopclaude_desktop_config.jsonSetup Guide
VS Code / Copilot.vscode/mcp.jsonSetup Guide
Cursor.cursor/mcp.jsonSetup Guide

More platforms (JetBrains, Windsurf, Gemini, and others) coming in v2.0.

AI Discoverability

Kastell provides llms.txt for AI crawlers and is listed in the MCP Registry as io.github.kastelldev/kastell.

v2.3 Reliability Contracts

These contracts apply to the CLI and the MCP server.

Provisioning behavior

server_provision returns after the provider creates the server and Kastell durably registers it. readiness.status may be pending; follow with server_info status or server_info health. The interactive kastell init command continues waiting through its existing readiness checks.

Automation contracts

  • Unsupported and failed CLI operations return exit code 1.
  • Valid empty results and user cancellation return 0.
  • Mixed --all failures return 1.
  • audit --json and audit --ci reserve stdout for one JSON payload.

CI/CD Integration

Use kastell audit in your CI pipeline to enforce security baselines:

yaml
# .github/workflows/security-audit.ymlname: Security Auditon:  schedule:    - cron: '0 6 * * 1'  # Weekly Monday 6 AM  workflow_dispatch:jobs:  audit:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v4      - run: npm install -g kastell      - run: kastell audit --host root@${{ secrets.SERVER_IP }} --threshold 70 --json > audit-result.json      - uses: actions/upload-artifact@v4        with:          name: audit-report          path: audit-result.json

The --threshold flag causes a non-zero exit code when the score falls below the target, failing the CI job automatically.

What's Next

  • Test Excellence: Mutation testing, coverage gaps, integration tests (v1.14)
  • Plugin ecosystem with marketplace distribution (v2.0)
  • Dashboard and managed service (v3.0)

Philosophy

Infrastructure should be boring, predictable, and safe.

Kastell is not a script. It's your DevOps safety layer for self-hosted infrastructure.

License

Apache 2.0 -- see LICENSE

Support


Built by @omrfc

來源:README.md,提交 2d77c61

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.14.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分