Commit Graph
19 Commits
Author SHA1 Message Date
Juan Denis ef4993c28f Add file access handlers (read/write/list)
Register file handlers under the FileAccess feature flag and implement handlers for file read, write and directory listing. handleFileRead validates params, reads a file and returns base64-encoded content, path and size. handleFileWrite accepts base64-encoded content and optional mode, decodes and writes the file, and returns success/path/size. handleFileList lists directory entries and returns name, is_dir, size and modified timestamp (ms). Basic param validation and error wrapping are included; feature flag check updated from Features.Files to Features.FileAccess.
2026-03-24 16:50:29 -04:00
Juan Denis f6f08ae9d1 Fleet monitor + security and agent hardening
Adds cross-server Fleet Monitor endpoints and models, plus broad security and robustness improvements across agent, backend, and tooling.

Key changes:
- New fleet monitor API (endpoints for heatmap, comparison, alerts, thresholds, anomalies, forecast, search, exports, and Prometheus) and service skeleton.
- New DB models for ServerAlertThreshold and MetricAlert to support metric alerts.
- Agent discovery/registration hardening: HMAC-signed discovery requests, signature/timestamp validation, minimal discovery responses, HMAC-based unregister headers, and enforced command timeout cap in agent command handling.
- WebSocket and agent client TLS handling gated by SERVERKIT_INSECURE_TLS env var; added auth rate limiting on agent gateway.
- Docker-compose: parameterize agent image via AGENT_VERSION and avoid running as root by adding docker group access.
- Backend security & policy: tightened CSP script/style sources, request size limit, 2FA pending-token rejection on non-2FA endpoints, registration flow/guards, admin-only SSO admin routes via middleware, rate limits on sensitive endpoints, and logging for auth/2FA events.
- Database service hardening: identifier validation, avoid passing passwords on CLI (use env vars), safer subprocess usage, and docker exec handling improvements.
- CronService: command validation to prevent shell injection and run commands without shell=True; build_service and other subprocess usages updated similarly.
- Misc: .env.example notes clarified for encryption key generation, invitation token generation improved, agent registry timestamp window reduced, various logging and input validations added, frontend FleetMonitor page and styles stubbed in, and Vite/config/style updates.

Overall this commit implements fleet monitoring scaffolding and a set of security, validation, and operational improvements to make agent discovery, registration, command execution, and backend services safer and more robust.
2026-03-23 01:58:28 -04:00
Juan Denis d9dfc4d611 Add agent fleet management, discovery & updates
Introduce full agent fleet management and discovery features across backend, agent, and frontend. Backend: add AgentVersion and AgentRollout models, extend Server/ServerGroup/ServerCommand/AgentSession with fleet, queue and latency fields; implement AgentFleetService (bulk upgrades, staged rollouts, queued commands, retries, diagnostics) and DiscoveryService (UDP broadcast scan); add new servers API endpoints for fleet operations. Agent: add UDP discovery responder, agent:update handler to trigger updater, and wire updater.UpdateTo to install specific versions; extend protocol messages with discovery and agent:update types. Registry: deliver queued commands on agent connect and track heartbeat latency. Frontend: add AgentFleet page and route, plus API client updates. Also add SECURITY_AUDIT.md to .gitignore. These changes enable discovery, staged rollouts, offline command queuing with retries, and fleet health/diagnostics.
2026-03-23 01:46:41 -04:00
Juan Denis 5ed03e6749 Migrate agent to Socket.IO; update endpoints
Replace raw WebSocket handling with Socket.IO/Engine.IO protocol support in agent/internal/ws: build Socket.IO URL, perform Engine.IO OPEN handshake, connect to namespace, emit/parse Socket.IO events for auth, adapt read/write loops, add ping loop and reconnection handling, and map events to protocol messages. Update agent registration endpoint to /api/v1/servers/register. Add config file handling in cmd/agent (respect --config flag, set key file relative to config path) and import filepath. Update install scripts to new download API paths for Windows and *nix. Adjust frontend servers page copy to show registration tokens expire in 24 hours. Also add a Contributors section to the create-pr skill guidance.
2026-03-03 20:06:11 -05:00
Juan Denis f0eb8b8cd9 Update GitHub repo references and install params
Replace hardcoded repository URL from serverkit/serverkit to jhd3197/ServerKit across agent Dockerfile, README, packaging scripts (deb/rpm) and install scripts so downloads and metadata point to the correct repo. Backend install endpoints now replace the repo placeholder with the GITHUB_REPO constant, and the frontend Windows install command was adjusted to use the -Server parameter instead of -ServerUrl. These changes ensure install scripts, packages, and generated docs reference the intended repository and that generated installer commands match the agent's expected flags.
2026-03-01 13:39:03 -05:00
Juan Denis 4dbda1b092 Add system tray app and IPC server to agent
Introduces a cross-platform system tray application for the agent, accessible via the new 'tray' command. Implements a local IPC HTTP server for tray/agent communication, exposes agent status, metrics, logs, and restart functionality. Updates build scripts, configuration, and documentation to support the tray app and IPC integration.
2026-01-25 13:03:23 -05:00
Juan Denis b02cd9a919 Update agent image in docker-compose.yml
Changed the agent service image from 'serverkit/agent:latest' to 'jhd3197/serverkit-agent:latest' to use the updated repository.
2026-01-24 12:46:33 -05:00
Juan DenisandClaude Opus 4.5 7ac4b9f36a Fix RPM build for cross-architecture and output path
- Convert paths to absolute before changing directories
- Use --target flag for cross-architecture builds (arm64 on x86_64)
- Remove hardcoded BuildArch from spec (let --target handle it)
- Fix permission denied error when creating output directory

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 12:34:07 -05:00
Juan DenisandClaude Opus 4.5 423bbcce91 Remove test binary and add agent .gitignore
- Remove accidentally committed serverkit-agent.exe
- Add .gitignore to prevent committing binaries

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 12:29:11 -05:00
Juan DenisandClaude Opus 4.5 49f8d8054f Simplify MSI installer for WiX v4 compatibility
- Use version variable instead of file version binding (Go binaries lack version resources)
- Remove WixUI extension dependency for simpler build
- Fix duplicate file reference issue
- Consolidate service install into main executable component

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 12:26:22 -05:00
Juan DenisandClaude Opus 4.5 95d9e6f2c4 Fix agent packaging build errors
- MSI: Fix WiX v4 syntax - use Condition attribute instead of inner text
- RPM: Disable build-id links for Go binaries to suppress warning

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 12:11:47 -05:00
Juan DenisandClaude Opus 4.5 e0235bb912 Fix missing base64 import in agent
Add encoding/base64 import that was missing, causing build failures.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 11:34:02 -05:00
Juan Denis bca7e29b57 Implement security features: key rotation, IP allowlist, anomaly detection
Adds API key rotation, IP allowlisting, anomaly detection, and replay protection to the ServerKit agent system. Backend changes include new endpoints, models, and services for security alerts, nonce tracking, and anomaly detection, as well as updates to the server model and agent authentication logic. The agent now supports credential rotation and replay protection via nonces. Frontend updates add UI and API methods for managing allowed IPs, viewing security alerts, and rotating API keys. Documentation and environment setup instructions are included.
2026-01-22 18:11:22 -05:00
Juan Denis fd90e2eead Add full-stack remote terminal/PTY support
Implements remote terminal functionality across agent, backend, and frontend. Adds PTY session management in the agent using creack/pty, new protocol actions, and terminal manager. Backend exposes terminal session APIs and session tracking via TerminalService. Frontend introduces a RemoteTerminal component using xterm.js and related APIs for interactive remote shell access.
2026-01-22 16:44:06 -05:00
Juan Denis 81c200fee2 Add Docker and package build support for agent
Introduces Dockerfile, .dockerignore, and docker-compose.yml for containerized deployment of the agent. Adds packaging scripts for .deb, .rpm, and .msi installers, and updates the GitHub Actions workflow to build and release these formats. The Makefile and README are updated with Docker and package build instructions. The integration plan is updated to reflect completion of installation and distribution features.
2026-01-22 08:46:36 -05:00
Juan Denis 4a34349ed4 Add remote Docker Compose management support
Implements full remote Docker Compose project management, including listing, starting, stopping, restarting, pulling images, and viewing logs for compose projects. Updates the agent, backend API, service layer, frontend UI, and API client to support these operations for both local and remote servers.
2026-01-22 08:31:27 -05:00
Juan Denis 35deeb8882 Add remote Docker container logs streaming support
Implements backend and frontend support for streaming Docker container logs from remote servers. Adds new API endpoints, agent handler, and UI controls for selecting log line count. Updates documentation to reflect the completed feature.
2026-01-21 23:23:29 -05:00
Juan Denis 4e9767a6ca Add agent auto-update mechanism and backend endpoints
Implemented agent auto-update functionality, including periodic update checks, manual update command, and configuration options. Added backend API endpoints for agent version checking, update triggering, and download redirection. Updated documentation to reflect completion of the auto-update system.
2026-01-21 23:07:20 -05:00
Juan Denis 3020b24728 Add ServerKit agent and multi-server integration plan
Introduces the initial Go-based ServerKit agent implementation, supporting Docker and system metrics collection, with supporting scripts and documentation. Adds a comprehensive multi-server management integration plan, including architecture, security model, database schema, API design, frontend updates, installation methods, and phased implementation roadmap. Updates ROADMAP.md to mark advanced security phase as completed.
2026-01-21 22:27:17 -05:00