;
This commit is contained in:
1 parent
9268833a3c
commit
314b7445a1
27 files changed
+1830
No files matched your search
@@ -0,0 +1,409 @@
|
||||
# Chronos API Documentation
|
||||
|
||||
This document describes the REST API endpoints available in Chronos.
|
||||
|
||||
## Versioning
|
||||
|
||||
All API endpoints are prefixed with `/api/v1/`.
|
||||
|
||||
## Authentication
|
||||
|
||||
All API requests require authentication. Include an `Authorization` header with a valid session token:
|
||||
|
||||
```
|
||||
Authorization: Bearer <session_token>
|
||||
```
|
||||
|
||||
## Error Responses
|
||||
|
||||
All error responses use standard HTTP status codes and include a JSON body with error details:
|
||||
|
||||
```json
|
||||
{
|
||||
"error": {
|
||||
"code": "VALIDATION_ERROR",
|
||||
"message": "Validation failed",
|
||||
"details": [
|
||||
{
|
||||
"field": "name",
|
||||
"reason": "Name is required"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Endpoints
|
||||
|
||||
### Authentication
|
||||
|
||||
#### POST `/api/v1/auth/login`
|
||||
Authenticate a user.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"username": "admin",
|
||||
"password": "secret"
|
||||
}
|
||||
```
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
{
|
||||
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
|
||||
}
|
||||
```
|
||||
|
||||
#### POST `/api/v1/auth/logout`
|
||||
Logout the current user.
|
||||
|
||||
**Response (204):**
|
||||
|
||||
#### GET `/api/v1/auth/me`
|
||||
Get current user information.
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
{
|
||||
"id": "1",
|
||||
"username": "admin",
|
||||
"role": "administrator"
|
||||
}
|
||||
```
|
||||
|
||||
### Users
|
||||
|
||||
#### GET `/api/v1/users`
|
||||
List all users.
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": "1",
|
||||
"username": "admin",
|
||||
"role": "administrator",
|
||||
"created_at": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
#### POST `/api/v1/users`
|
||||
Create a new user.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"username": "operator",
|
||||
"password": "secret",
|
||||
"role": "operator"
|
||||
}
|
||||
```
|
||||
|
||||
**Response (201):**
|
||||
```json
|
||||
{
|
||||
"id": "2",
|
||||
"username": "operator",
|
||||
"role": "operator",
|
||||
"created_at": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
#### GET `/api/v1/users/{id}`
|
||||
Get a specific user.
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
{
|
||||
"id": "2",
|
||||
"username": "operator",
|
||||
"role": "operator",
|
||||
"created_at": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
#### PUT `/api/v1/users/{id}`
|
||||
Update a user.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"role": "administrator"
|
||||
}
|
||||
```
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
{
|
||||
"id": "2",
|
||||
"username": "operator",
|
||||
"role": "administrator",
|
||||
"created_at": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
#### DELETE `/api/v1/users/{id}`
|
||||
Delete a user.
|
||||
|
||||
**Response (204):**
|
||||
|
||||
### Workflows
|
||||
|
||||
#### GET `/api/v1/workflows`
|
||||
List all workflows.
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": "1",
|
||||
"name": "Backup Workflow",
|
||||
"description": "Daily backup job",
|
||||
"created_at": "2023-01-01T00:00:00Z",
|
||||
"updated_at": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
#### POST `/api/v1/workflows`
|
||||
Create a new workflow.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"name": "Backup Workflow",
|
||||
"description": "Daily backup job",
|
||||
"nodes": [
|
||||
{
|
||||
"id": "1",
|
||||
"type": "command",
|
||||
"config": {
|
||||
"command": "tar -czf /backups/backup-$(date +\\%Y\\%m\\%d).tar.gz /home"
|
||||
}
|
||||
}
|
||||
],
|
||||
"edges": []
|
||||
}
|
||||
```
|
||||
|
||||
**Response (201):**
|
||||
```json
|
||||
{
|
||||
"id": "1",
|
||||
"name": "Backup Workflow",
|
||||
"description": "Daily backup job",
|
||||
"created_at": "2023-01-01T00:00:00Z",
|
||||
"updated_at": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
#### GET `/api/v1/workflows/{id}`
|
||||
Get a specific workflow.
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
{
|
||||
"id": "1",
|
||||
"name": "Backup Workflow",
|
||||
"description": "Daily backup job",
|
||||
"nodes": [
|
||||
{
|
||||
"id": "1",
|
||||
"type": "command",
|
||||
"config": {
|
||||
"command": "tar -czf /backups/backup-$(date +\\%Y\\%m\\%d).tar.gz /home"
|
||||
}
|
||||
}
|
||||
],
|
||||
"edges": [],
|
||||
"created_at": "2023-01-01T00:00:00Z",
|
||||
"updated_at": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
#### PUT `/api/v1/workflows/{id}`
|
||||
Update a workflow.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"name": "Updated Backup Workflow",
|
||||
"description": "Daily backup job with better compression"
|
||||
}
|
||||
```
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
{
|
||||
"id": "1",
|
||||
"name": "Updated Backup Workflow",
|
||||
"description": "Daily backup job with better compression",
|
||||
"created_at": "2023-01-01T00:00:00Z",
|
||||
"updated_at": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
#### DELETE `/api/v1/workflows/{id}`
|
||||
Delete a workflow.
|
||||
|
||||
**Response (204):**
|
||||
|
||||
### Schedules
|
||||
|
||||
#### GET `/api/v1/schedules`
|
||||
List all schedules.
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": "1",
|
||||
"workflow_id": "1",
|
||||
"name": "Daily Backup",
|
||||
"cron_expression": "0 0 * * *",
|
||||
"enabled": true,
|
||||
"created_at": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
#### POST `/api/v1/schedules`
|
||||
Create a new schedule.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"workflow_id": "1",
|
||||
"name": "Daily Backup",
|
||||
"cron_expression": "0 0 * * *",
|
||||
"enabled": true
|
||||
}
|
||||
```
|
||||
|
||||
**Response (201):**
|
||||
```json
|
||||
{
|
||||
"id": "1",
|
||||
"workflow_id": "1",
|
||||
"name": "Daily Backup",
|
||||
"cron_expression": "0 0 * * *",
|
||||
"enabled": true,
|
||||
"created_at": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
#### GET `/api/v1/schedules/{id}`
|
||||
Get a specific schedule.
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
{
|
||||
"id": "1",
|
||||
"workflow_id": "1",
|
||||
"name": "Daily Backup",
|
||||
"cron_expression": "0 0 * * *",
|
||||
"enabled": true,
|
||||
"created_at": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
#### PUT `/api/v1/schedules/{id}`
|
||||
Update a schedule.
|
||||
|
||||
**Request:**
|
||||
```json
|
||||
{
|
||||
"name": "Weekly Backup",
|
||||
"cron_expression": "0 0 * * 0"
|
||||
}
|
||||
```
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
{
|
||||
"id": "1",
|
||||
"workflow_id": "1",
|
||||
"name": "Weekly Backup",
|
||||
"cron_expression": "0 0 * * 0",
|
||||
"enabled": true,
|
||||
"created_at": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
```
|
||||
|
||||
#### DELETE `/api/v1/schedules/{id}`
|
||||
Delete a schedule.
|
||||
|
||||
**Response (204):**
|
||||
|
||||
### Executions
|
||||
|
||||
#### GET `/api/v1/executions`
|
||||
List all executions.
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": "1",
|
||||
"workflow_id": "1",
|
||||
"schedule_id": "1",
|
||||
"status": "completed",
|
||||
"started_at": "2023-01-01T00:00:00Z",
|
||||
"finished_at": "2023-01-01T00:00:05Z"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
#### GET `/api/v1/executions/{id}`
|
||||
Get a specific execution.
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
{
|
||||
"id": "1",
|
||||
"workflow_id": "1",
|
||||
"schedule_id": "1",
|
||||
"status": "completed",
|
||||
"started_at": "2023-01-01T00:00:00Z",
|
||||
"finished_at": "2023-01-01T00:00:05Z",
|
||||
"logs": [
|
||||
{
|
||||
"timestamp": "2023-01-01T00:00:00Z",
|
||||
"level": "info",
|
||||
"message": "Starting backup job"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### Workers
|
||||
|
||||
#### GET `/api/v1/workers`
|
||||
List all workers.
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
[
|
||||
{
|
||||
"id": "1",
|
||||
"name": "worker-1",
|
||||
"status": "online",
|
||||
"last_heartbeat": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
]
|
||||
```
|
||||
|
||||
### Health
|
||||
|
||||
#### GET `/api/v1/health`
|
||||
Check service health.
|
||||
|
||||
**Response (200):**
|
||||
```json
|
||||
{
|
||||
"status": "healthy",
|
||||
"timestamp": "2023-01-01T00:00:00Z"
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,74 @@
|
||||
# Chronos Architecture
|
||||
|
||||
This document outlines the high-level architecture of Chronos, a Rust-based workflow automation platform.
|
||||
|
||||
## Overview
|
||||
|
||||
Chronos is built as a Cargo workspace with multiple crates that implement different components:
|
||||
|
||||
- `chronos-core`: Shared data models and utilities
|
||||
- `chronos-api`: HTTP API server using Axum
|
||||
- `chronos-scheduler`: Scheduling service
|
||||
- `chronos-worker`: Worker execution service
|
||||
- `chronos-workflow`: Workflow engine
|
||||
- `chronos-database`: Database interface
|
||||
- `chronos-auth`: Authentication system
|
||||
- `chronos-executor`: Native process execution engine
|
||||
- `chronos-notifications`: Notification delivery system
|
||||
- `chronos-metrics`: Metrics collection
|
||||
- `chronos-cli`: Command-line interface
|
||||
|
||||
## Component Interactions
|
||||
|
||||
```
|
||||
┌─────────────┐ ┌──────────────┐ ┌─────────────┐
|
||||
│ Browser │ │ Chronos │ │ Database │
|
||||
└───────────┘ │ (API) │ └───────────┘
|
||||
│ │ │ │
|
||||
│ │ │ │
|
||||
┌─────────────┐ │ │ │
|
||||
│ Workflow│ │ │ │
|
||||
│ Editor│ │ │ │
|
||||
└───────────┘ │ │ │
|
||||
│ │ │ │
|
||||
│ │ │ │
|
||||
┌─────────────┐ │ │ │
|
||||
│ Scheduler │ │ │ │
|
||||
│ │ │ │ │
|
||||
└───────────┘ │ │ │
|
||||
│ │ │ │
|
||||
│ │ │ │
|
||||
┌─────────────┐ │ │ │
|
||||
│ Worker │ │ │ │
|
||||
│ Executor│ │ │ │
|
||||
└───────────┘ │ │ │
|
||||
│ │ │ │
|
||||
│ │ │ │
|
||||
┌─────────────┐ │ │ │
|
||||
│ Executor │ │ │ │
|
||||
│ (Native)│ │ │ │
|
||||
└───────────┘ │ │ │
|
||||
│ │ │ │
|
||||
│ │ │ │
|
||||
┌─────────────┐ │ │ │
|
||||
│ Executor │ │ │ │
|
||||
│ (Native)│ │ │ │
|
||||
└───────────┘ │ │ │
|
||||
```
|
||||
|
||||
## Core Data Flow
|
||||
|
||||
1. **User Interface**: Users interact with the web dashboard to create and manage workflows
|
||||
2. **API Layer**: The Axum API server receives requests, validates them, and dispatches to appropriate services
|
||||
3. **Scheduler**: Handles scheduling decisions and job creation in the database
|
||||
4. **Worker Pool**: Workers pick up scheduled jobs and execute them via the executor
|
||||
5. **Executor**: Runs actual commands in isolated processes with resource limits
|
||||
6. **Database**: Stores all persistent state including workflows, schedules, executions, and user data
|
||||
|
||||
## Security Model
|
||||
|
||||
- All user inputs are validated and sanitized
|
||||
- Authentication is enforced at API layer
|
||||
- Workers execute tasks in isolated native processes
|
||||
- Sensitive credentials are encrypted at rest
|
||||
- Access control is implemented through role-based permissions
|
||||
@@ -0,0 +1,83 @@
|
||||
# Chronos Configuration
|
||||
|
||||
Chronos uses a TOML configuration file for its settings. The configuration file is located at `config/chronos.toml` by default.
|
||||
|
||||
## Example Configuration
|
||||
|
||||
```toml
|
||||
[server]
|
||||
host = "127.0.0.1"
|
||||
port = 8080
|
||||
ssl_enabled = false
|
||||
|
||||
[database]
|
||||
url = "postgres://chronos:password@localhost/chronos"
|
||||
max_connections = 20
|
||||
|
||||
[redis]
|
||||
enabled = true
|
||||
url = "redis://localhost:6379"
|
||||
|
||||
[scheduler]
|
||||
enabled = true
|
||||
poll_interval_seconds = 5
|
||||
|
||||
[workers]
|
||||
concurrency = 8
|
||||
heartbeat_interval_seconds = 10
|
||||
|
||||
[execution]
|
||||
default_timeout_seconds = 300
|
||||
max_output_bytes = 10485760
|
||||
max_processes = 100
|
||||
|
||||
[logging]
|
||||
level = "info"
|
||||
format = "json"
|
||||
|
||||
[security]
|
||||
session_secret = "your-secret-here"
|
||||
```
|
||||
|
||||
## Configuration Sections
|
||||
|
||||
### `[server]`
|
||||
|
||||
- `host`: Host address to bind the API server (default: "127.0.0.1")
|
||||
- `port`: Port number for the API server (default: 8080)
|
||||
- `ssl_enabled`: Enable HTTPS (default: false)
|
||||
|
||||
### `[database]`
|
||||
|
||||
- `url`: PostgreSQL connection string
|
||||
- `max_connections`: Maximum concurrent database connections (default: 20)
|
||||
|
||||
### `[redis]`
|
||||
|
||||
- `enabled`: Enable Redis caching (default: true)
|
||||
- `url`: Redis server connection URL
|
||||
|
||||
### `[scheduler]`
|
||||
|
||||
- `enabled`: Enable the scheduler service (default: true)
|
||||
- `poll_interval_seconds`: How often to check for scheduled jobs (default: 5)
|
||||
|
||||
### `[workers]`
|
||||
|
||||
- `concurrency`: Number of concurrent worker threads (default: 8)
|
||||
- `heartbeat_interval_seconds`: Interval for worker heartbeat updates (default: 10)
|
||||
|
||||
### `[execution]`
|
||||
|
||||
- `default_timeout_seconds`: Default timeout for job execution in seconds (default: 300)
|
||||
- `max_output_bytes`: Maximum output size for job execution (default: 10485760)
|
||||
- `max_processes`: Maximum number of processes that can be spawned per execution (default: 100)
|
||||
|
||||
### `[logging]`
|
||||
|
||||
- `level`: Log level ("trace", "debug", "info", "warn", "error") (default: "info")
|
||||
- `format`: Log format ("json" or "text") (default: "json")
|
||||
|
||||
### `[security]`
|
||||
|
||||
- `session_secret`: Secret key for session encryption (required)
|
||||
@@ -0,0 +1,184 @@
|
||||
# Chronos Installation Guide
|
||||
|
||||
This document provides instructions for installing Chronos on supported Linux distributions.
|
||||
|
||||
## System Requirements
|
||||
|
||||
- Linux kernel 5.0 or newer
|
||||
- Rust 1.70 or newer (stable toolchain)
|
||||
- PostgreSQL 13 or newer
|
||||
- Redis 6 or newer (optional, for caching)
|
||||
- Node.js 18 or newer (for frontend build)
|
||||
|
||||
## Supported Distributions
|
||||
|
||||
Chronos is officially supported on:
|
||||
- Debian 12 (Bookworm) and newer
|
||||
- Ubuntu 22.04 LTS (Jammy) and newer
|
||||
- Arch Linux
|
||||
|
||||
Other distributions may work but are not officially tested.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
Before installing Chronos, ensure the following packages are installed:
|
||||
|
||||
### Debian/Ubuntu:
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential postgresql redis-server nodejs npm
|
||||
```
|
||||
|
||||
### Arch Linux:
|
||||
```bash
|
||||
sudo pacman -Syu --needed base-devel postgresql redis nodejs npm
|
||||
```
|
||||
|
||||
## Installation Steps
|
||||
|
||||
1. **Clone the repository:**
|
||||
```bash
|
||||
git clone https://github.com/chronos/chronos.git
|
||||
cd chronos
|
||||
```
|
||||
|
||||
2. **Install Rust (if not already installed):**
|
||||
```bash
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
source ~/.cargo/env
|
||||
```
|
||||
|
||||
3. **Set up PostgreSQL database:**
|
||||
```bash
|
||||
sudo systemctl start postgresql
|
||||
sudo systemctl enable postgresql
|
||||
sudo -u postgres createuser chronos
|
||||
sudo -u postgres createdb chronos
|
||||
```
|
||||
|
||||
4. **Create Chronos system users:**
|
||||
```bash
|
||||
sudo useradd -r -s /bin/false chronos-api
|
||||
sudo useradd -r -s /bin/false chronos-scheduler
|
||||
sudo useradd -r -s /bin/false chronos-worker
|
||||
```
|
||||
|
||||
5. **Build the application:**
|
||||
```bash
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
6. **Install systemd service files:**
|
||||
```bash
|
||||
sudo cp systemd/*.service /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
7. **Configure the application:**
|
||||
```bash
|
||||
cp config/chronos.example.toml config/chronos.toml
|
||||
# Edit config/chronos.toml with your settings
|
||||
```
|
||||
|
||||
8. **Run database migrations:**
|
||||
```bash
|
||||
cargo run --bin chronos-cli -- migrate
|
||||
```
|
||||
|
||||
9. **Start services:**
|
||||
```bash
|
||||
sudo systemctl enable chronos-api.service
|
||||
sudo systemctl enable chronos-scheduler.service
|
||||
sudo systemctl enable chronos-worker.service
|
||||
sudo systemctl start chronos-api.service
|
||||
sudo systemctl start chronos-scheduler.service
|
||||
sudo systemctl start chronos-worker.service
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Chronos uses a TOML configuration file. The example configuration is located at `config/chronos.example.toml`.
|
||||
|
||||
Key configuration sections:
|
||||
- `[server]` - API server settings
|
||||
- `[database]` - PostgreSQL connection details
|
||||
- `[redis]` - Redis cache settings (optional)
|
||||
- `[scheduler]` - Scheduling behavior
|
||||
- `[workers]` - Worker pool configuration
|
||||
- `[execution]` - Execution environment settings
|
||||
|
||||
## Verification
|
||||
|
||||
Check that services are running:
|
||||
```bash
|
||||
sudo systemctl status chronos-api.service
|
||||
sudo systemctl status chronos-scheduler.service
|
||||
sudo systemctl status chronos-worker.service
|
||||
```
|
||||
|
||||
Verify the API is accessible:
|
||||
```bash
|
||||
curl http://localhost:8080/api/v1/health
|
||||
```
|
||||
|
||||
## Updating
|
||||
|
||||
To update Chronos:
|
||||
|
||||
1. Pull latest changes:
|
||||
```bash
|
||||
git pull origin master
|
||||
```
|
||||
|
||||
2. Rebuild:
|
||||
```bash
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
3. Run migrations if needed:
|
||||
```bash
|
||||
cargo run --bin chronos-cli -- migrate
|
||||
```
|
||||
|
||||
4. Restart services:
|
||||
```bash
|
||||
sudo systemctl restart chronos-api.service
|
||||
sudo systemctl restart chronos-scheduler.service
|
||||
sudo systemctl restart chronos-worker.service
|
||||
```
|
||||
|
||||
## Uninstalling
|
||||
|
||||
To uninstall Chronos:
|
||||
|
||||
1. Stop services:
|
||||
```bash
|
||||
sudo systemctl stop chronos-api.service
|
||||
sudo systemctl stop chronos-scheduler.service
|
||||
sudo systemctl stop chronos-worker.service
|
||||
```
|
||||
|
||||
2. Disable services:
|
||||
```bash
|
||||
sudo systemctl disable chronos-api.service
|
||||
sudo systemctl disable chronos-scheduler.service
|
||||
sudo systemctl disable chronos-worker.service
|
||||
```
|
||||
|
||||
3. Remove systemd service files:
|
||||
```bash
|
||||
sudo rm /etc/systemd/system/chronos-*.service
|
||||
sudo systemctl daemon-reload
|
||||
```
|
||||
|
||||
4. Remove system users:
|
||||
```bash
|
||||
sudo userdel chronos-api
|
||||
sudo userdel chronos-scheduler
|
||||
sudo userdel chronos-worker
|
||||
```
|
||||
|
||||
5. Remove application files:
|
||||
```bash
|
||||
sudo rm -rf /path/to/chronos
|
||||
```
|
||||
@@ -0,0 +1,94 @@
|
||||
# Chronos Security Model
|
||||
|
||||
This document outlines the security considerations and design decisions for Chronos, a Rust-based workflow automation platform.
|
||||
|
||||
## Overview
|
||||
|
||||
Chronos implements a multi-layered security approach to protect against common threats while maintaining usability for legitimate users. The system is designed with defense-in-depth principles, where multiple controls work together to provide comprehensive protection.
|
||||
|
||||
## Authentication and Authorization
|
||||
|
||||
### User Accounts
|
||||
- Users are stored in the database with hashed passwords using Argon2id
|
||||
- Passwords must meet minimum complexity requirements
|
||||
- Session management uses secure server-side sessions with automatic expiration
|
||||
- Login rate limiting prevents brute-force attacks
|
||||
|
||||
### Role-Based Access Control
|
||||
Chronos implements a role-based system with three primary roles:
|
||||
1. **Administrator**: Full access to all system functionality
|
||||
2. **Operator**: Can create and manage workflows within granted permissions
|
||||
3. **Viewer**: Can view authorized workflows and execution records
|
||||
|
||||
Access controls are enforced at the API layer for all endpoints.
|
||||
|
||||
## Data Protection
|
||||
|
||||
### Secrets Management
|
||||
- All sensitive data (API keys, passwords, tokens) are encrypted at rest using authenticated encryption
|
||||
- Encryption keys are stored separately from the database
|
||||
- Secrets are redacted from logs and API responses
|
||||
- Credential management is handled through dedicated credential stores
|
||||
|
||||
### Input Validation
|
||||
All user inputs are validated and sanitized to prevent:
|
||||
- SQL injection
|
||||
- Cross-site scripting (XSS)
|
||||
- Command injection
|
||||
- Path traversal attacks
|
||||
|
||||
## Process Execution Security
|
||||
|
||||
### Native Execution Isolation
|
||||
Chronos implements secure native process execution with multiple isolation layers:
|
||||
|
||||
1. **User Context Isolation**: Tasks execute under dedicated unprivileged system users
|
||||
2. **Resource Limiting**: CPU, memory, and execution time limits enforced via cgroups v2
|
||||
3. **Filesystem Restrictions**: Access to sensitive directories is restricted
|
||||
4. **Process Limits**: Maximum number of processes per execution is enforced
|
||||
5. **Network Isolation**: Outbound network access can be restricted by configuration
|
||||
|
||||
### Security Boundaries
|
||||
The system explicitly documents security boundaries:
|
||||
- Execution environment cannot access application secrets without explicit permission
|
||||
- Regular users cannot configure unrestricted execution of privileged commands
|
||||
- Administrative execution policies are separate from ordinary workflow configuration
|
||||
|
||||
## Network Security
|
||||
|
||||
### API Security
|
||||
- All API endpoints require authentication
|
||||
- HTTPS is required for all API communications
|
||||
- CSRF protection is implemented for web forms
|
||||
- Rate limiting is applied to prevent abuse
|
||||
|
||||
### Communication Protocols
|
||||
- Internal service communication uses local Unix sockets where possible
|
||||
- External communications use secure protocols with certificate validation
|
||||
|
||||
## Infrastructure Security
|
||||
|
||||
### System Integration
|
||||
- Chronos integrates with systemd for service management and security hardening
|
||||
- Dedicated service accounts are used for each component
|
||||
- Filesystem permissions are configured appropriately
|
||||
- Journald integration provides audit logging
|
||||
|
||||
### Container Exclusion
|
||||
Chronos explicitly excludes container technologies:
|
||||
- No Docker, Kubernetes, or other container runtimes
|
||||
- All execution happens in native Linux processes
|
||||
- This reduces attack surface by eliminating container escape vectors
|
||||
|
||||
## Audit and Logging
|
||||
|
||||
### Security Logging
|
||||
- All authentication attempts are logged
|
||||
- Access to sensitive data is recorded
|
||||
- Administrative actions are audited
|
||||
- Failed security events trigger alerts when configured
|
||||
|
||||
### Log Management
|
||||
- Logs are structured for easy parsing and analysis
|
||||
- Sensitive information is redacted from logs
|
||||
- Log retention policies are configurable
|
||||
Reference in new issue
Block a user