RDP Session API is the central REST service of a lightweight remote-session monitoring stack. The production /api/v1 surface remains focused on Windows RDP, while the additive /api/v2 contract normalizes provider identity so the same domain can support RDP and SSH without forcing an immediate Windows Agent migration.
The project is intentionally infrastructure-agnostic. This repository does not contain environment-specific hostnames, credentials, private addresses, TLS material, or production reverse-proxy configuration.
The Windows collector is maintained separately in RDP-Session-Agent.
- Backward-compatible
/api/v1Windows/RDP contract. - Generic
/api/v2contract withplatform,protocol,boot_id,provider_session_idandprovider_event_id. - Internal normalization of v1 RDP payloads into the common session domain.
- Per-server Agent authentication with individually registered credentials.
- Administrative server registration and credential rotation.
- Idempotent event ingestion with v1 replay compatibility.
- Consolidated session states:
ACTIVE,DISCONNECTED, andCLOSED. - Snapshot reconciliation for current-state correction.
- Optional IPv4/IPv6 connection origin.
- Separate
X-API-Keyprotection for read/query endpoints. - Cross-server LOGON alert feeds.
- SQLAlchemy persistence with Alembic migrations.
- MariaDB / MySQL production support and SQLite-compatible tests.
- Managed Linux deployment through systemd.
- Loopback-only Uvicorn deployment behind an HTTPS reverse proxy.
- OpenAPI contract at
/openapi.json.
POST /api/v1/agent/eventsPOST /api/v1/agent/snapshotGET /api/v1/serversGET /api/v1/servers/{server_id}/summaryGET /api/v1/servers/{server_id}/sessions/activeGET /api/v1/servers/{server_id}/sessions/historyGET /api/v1/alerts/logons?lookback_minutes=5GET /api/v1/health
The v1 read surface remains RDP-only so future SSH telemetry cannot change existing Grafana behavior.
POST /api/v2/agent/eventsPOST /api/v2/agent/snapshotGET /api/v2/serversGET /api/v2/sessions/activeGET /api/v2/sessions/historyGET /api/v2/alerts/logonsGET /api/v2/health
Agent ingestion requires:
X-Server-ID: <server-id>
Authorization: Bearer <agent-secret>Read/query endpoints require:
X-API-Key: <query-api-key>- Documentation index
- Installation and configuration
- System architecture
- Grafana logon alerting
- systemd deployment and operations
- Phase 3 generic API v2 contract
- Every monitored server receives a unique Agent credential.
- The API stores only a hash of each Agent secret.
- Agent credentials cannot query session history.
- Read access uses a separate query API key.
- Production deployment keeps Uvicorn on loopback and exposes only the reverse proxy.
- Runtime secrets belong in a protected environment file outside the Git checkout.
- Session telemetry does not include commands, terminal contents, passwords or private keys.
Never commit:
- production
.envfiles; - real API keys or Agent secrets;
- private DNS names or addresses;
- TLS private keys or certificates;
- database passwords;
- environment-specific reverse-proxy configuration.
All documentation examples use fictitious values intentionally.
Released under the MIT License.