-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.yaml.example
More file actions
385 lines (339 loc) · 17.4 KB
/
config.yaml.example
File metadata and controls
385 lines (339 loc) · 17.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# ============================================================================
# ocserv-agent Configuration Example
# ============================================================================
# Файл конфигурации агента для управления OpenConnect VPN (ocserv)
# Agent configuration file for managing OpenConnect VPN (ocserv)
#
# Формат: YAML
# Документация: https://github.com/dantte-lp/ocserv-agent/blob/main/docs/
#
# Переменные окружения (имеют приоритет над файлом):
# Environment variables (override file values):
# AGENT_ID - Идентификатор агента / Agent identifier
# CONTROL_SERVER_ADDRESS - Адрес control server / Control server address
# TLS_CERT_FILE - Путь к сертификату / Certificate path
# TLS_KEY_FILE - Путь к ключу / Key path
# TLS_CA_FILE - Путь к CA сертификату / CA certificate path
# LOG_LEVEL - Уровень логов / Log level
# TELEMETRY_ENDPOINT - Endpoint телеметрии / Telemetry endpoint
# ============================================================================
# ----------------------------------------------------------------------------
# Agent Identification / Идентификация агента
# ----------------------------------------------------------------------------
# Уникальный идентификатор агента (обязательно)
# Unique agent identifier (required)
# Используется для регистрации в control server
# Used for registration with control server
agent_id: "server-01"
# Имя хоста (опционально, автоопределяется если пусто)
# Hostname (optional, auto-detected if empty)
# Используется в сертификатах и логах
# Used in certificates and logs
hostname: "" # Auto-detect from system
# ----------------------------------------------------------------------------
# Control Server Connection / Подключение к Control Server
# ----------------------------------------------------------------------------
control_server:
# Адрес control server (host:port, обязательно)
# Control server address (host:port, required)
# Примеры / Examples:
# - "control.example.com:9090"
# - "203.0.113.10:9090" (RFC 5737 test address)
# - "localhost:9090" (для тестирования / for testing)
address: "control.example.com:9090"
# Настройки переподключения при разрыве связи
# Reconnection settings on connection loss
reconnect:
# Начальная задержка перед первой попыткой переподключения
# Initial delay before first reconnection attempt
initial_delay: 1s
# Максимальная задержка между попытками
# Maximum delay between attempts
max_delay: 60s
# Множитель увеличения задержки (exponential backoff)
# Delay multiplier (exponential backoff)
# Формула: delay = min(initial_delay * multiplier^attempt, max_delay)
multiplier: 2
# Максимальное количество попыток переподключения (0 = бесконечно)
# Maximum reconnection attempts (0 = infinite)
max_attempts: 5
# Circuit Breaker - защита от cascade failures
# Circuit Breaker - protection against cascade failures
circuit_breaker:
# Количество последовательных ошибок для открытия circuit
# Number of consecutive failures to open circuit
failure_threshold: 5
# Таймаут перед попыткой закрыть circuit (half-open state)
# Timeout before trying to close circuit (half-open state)
timeout: 5m
# ----------------------------------------------------------------------------
# TLS Configuration / Конфигурация TLS
# ----------------------------------------------------------------------------
tls:
# Включить mTLS аутентификацию (рекомендуется для production)
# Enable mTLS authentication (recommended for production)
enabled: true
# Автогенерация self-signed сертификатов при отсутствии
# Auto-generate self-signed certificates if missing
#
# ВНИМАНИЕ / WARNING:
# true - Bootstrap режим: автосоздание сертификатов для автономной работы
# Bootstrap mode: auto-create certs for autonomous operation
# false - Production режим: требуются настоящие CA-подписанные сертификаты
# Production mode: require real CA-signed certificates
#
# Для production используйте false и создайте сертификаты вручную:
# For production use false and create certificates manually:
# ocserv-agent gencert --output /etc/ocserv-agent/certs
#
# См. документацию: docs/CERTIFICATES.md
# See documentation: docs/CERTIFICATES.md
auto_generate: true
# Путь к сертификату агента (обязательно при enabled: true)
# Path to agent certificate (required when enabled: true)
cert_file: "/etc/ocserv-agent/certs/agent.crt"
# Путь к приватному ключу агента (обязательно при enabled: true)
# Path to agent private key (required when enabled: true)
# ВАЖНО: права доступа должны быть 0600 (только root read)
# IMPORTANT: permissions must be 0600 (root read only)
key_file: "/etc/ocserv-agent/certs/agent.key"
# Путь к CA сертификату control server (обязательно при enabled: true)
# Path to control server CA certificate (required when enabled: true)
ca_file: "/etc/ocserv-agent/certs/ca.crt"
# Ожидаемое Common Name (CN) в сертификате control server
# Expected Common Name (CN) in control server certificate
# Используется для валидации сертификата сервера
# Used for server certificate validation
server_name: "control-server"
# Минимальная версия TLS (TLS1.2 или TLS1.3)
# Minimum TLS version (TLS1.2 or TLS1.3)
# Рекомендуется TLS1.3 для максимальной безопасности
# TLS1.3 recommended for maximum security
min_version: "TLS1.3"
# ----------------------------------------------------------------------------
# ocserv Configuration / Конфигурация ocserv
# ----------------------------------------------------------------------------
ocserv:
# Путь к главному конфигу ocserv (обязательно)
# Path to main ocserv config (required)
config_path: "/etc/ocserv/ocserv.conf"
# Директория для per-user конфигов (опционально)
# Directory for per-user configs (optional)
# Используется командами UpdateConfig для пользовательских настроек
# Used by UpdateConfig commands for user-specific settings
config_per_user_dir: "/etc/ocserv/config-per-user"
# Директория для per-group конфигов (опционально)
# Directory for per-group configs (optional)
config_per_group_dir: "/etc/ocserv/config-per-group"
# Путь к Unix socket occtl (обязательно)
# Path to occtl Unix socket (required)
# Используется для выполнения команд occtl
# Used for executing occtl commands
ctl_socket: "/var/run/occtl.socket"
# Имя systemd сервиса ocserv (обязательно)
# ocserv systemd service name (required)
# Default: "ocserv"
systemd_service: "ocserv"
# Директория для backup конфигов (обязательно)
# Directory for config backups (required)
# Используется перед изменением конфигурации для rollback
# Used before config changes for rollback capability
backup_dir: "/var/backups/ocserv-agent"
# ----------------------------------------------------------------------------
# Health Checks / Проверки работоспособности
# ----------------------------------------------------------------------------
health:
# Интервал отправки heartbeat в control server
# Heartbeat interval to control server
# Показывает что агент активен и доступен
# Shows that agent is alive and available
heartbeat_interval: 15s
# Интервал глубоких проверок (Tier 2)
# Deep health checks interval (Tier 2)
# Проверка: ocserv socket, systemd service, config validity
# Checks: ocserv socket, systemd service, config validity
deep_check_interval: 2m
# Интервал сбора метрик (Tier 3)
# Metrics collection interval (Tier 3)
# Сбор: количество пользователей, трафик, статистика
# Collects: user count, traffic, statistics
metrics_interval: 30s
# ----------------------------------------------------------------------------
# Telemetry (OpenTelemetry) / Телеметрия
# ----------------------------------------------------------------------------
telemetry:
# Включить OpenTelemetry tracing и metrics
# Enable OpenTelemetry tracing and metrics
enabled: true
# OTLP endpoint для экспорта телеметрии
# OTLP endpoint for telemetry export
# Примеры / Examples:
# - "http://uptrace:14318" (Uptrace)
# - "http://jaeger:4318" (Jaeger)
# - "http://localhost:4318" (OpenTelemetry Collector)
# - "https://api.honeycomb.io:443" (Honeycomb)
endpoint: "http://uptrace:14318"
# Имя сервиса в телеметрии
# Service name in telemetry
# Default: "ocserv-agent"
service_name: "ocserv-agent"
# Версия сервиса (автоопределяется из build info)
# Service version (auto-detected from build info)
service_version: "0.6.0"
# Sample rate для traces (0.0 - 1.0)
# Sample rate for traces (0.0 - 1.0)
# 1.0 = все traces, 0.1 = 10% traces
# 1.0 = all traces, 0.1 = 10% of traces
sample_rate: 1.0
# ----------------------------------------------------------------------------
# Logging / Логирование
# ----------------------------------------------------------------------------
logging:
# Уровень логирования (debug, info, warn, error)
# Logging level (debug, info, warn, error)
# Рекомендации / Recommendations:
# debug - разработка и отладка / development and debugging
# info - production (по умолчанию / default)
# warn - только предупреждения и ошибки / warnings and errors only
# error - только ошибки / errors only
level: "info"
# Формат вывода логов (json, text)
# Log output format (json, text)
# json - structured logging, удобен для парсинга / good for parsing
# text - human-readable, удобен для чтения / good for reading
format: "json"
# Куда выводить логи (stdout, file)
# Where to output logs (stdout, file)
# stdout - в контейнерах и systemd / for containers and systemd
# file - в файл (требуется file_path) / to file (requires file_path)
output: "stdout"
# Путь к файлу логов (используется при output: file)
# Path to log file (used when output: file)
file_path: "/var/log/ocserv-agent/agent.log"
# Максимальный размер файла логов в МБ (rotation)
# Maximum log file size in MB (rotation)
max_size_mb: 100
# Количество backup файлов (после rotation)
# Number of backup files (after rotation)
max_backups: 3
# Максимальный возраст backup файлов в днях
# Maximum age of backup files in days
max_age_days: 30
# ----------------------------------------------------------------------------
# Security / Безопасность
# ----------------------------------------------------------------------------
security:
# Список разрешённых команд (whitelist, обязательно)
# List of allowed commands (whitelist, required)
# ВАЖНО: Только эти команды могут быть выполнены через gRPC API
# IMPORTANT: Only these commands can be executed via gRPC API
#
# Безопасность:
# Security:
# - Используется строгая валидация аргументов
# Strict argument validation is used
# - Блокируются command injection попытки (`;`, `|`, `&&`, и т.д.)
# Command injection attempts are blocked (`;`, `|`, `&&`, etc.)
# - Невалидные аргументы отклоняются
# Invalid arguments are rejected
allowed_commands:
- "occtl" # ocserv control commands / команды управления ocserv
- "systemctl" # systemd service management / управление systemd сервисами
# Пользователь для sudo (опционально)
# User for sudo execution (optional)
# Если указан, команды выполняются через sudo -u <user>
# If specified, commands are executed via sudo -u <user>
# По умолчанию команды выполняются от имени агента
# By default commands run as agent user
sudo_user: "ocserv-agent"
# Максимальный таймаут выполнения команды
# Maximum command execution timeout
# Команды прерываются после этого времени
# Commands are terminated after this time
# Default: 300s (5 минут / 5 minutes)
max_command_timeout: 300s
# ============================================================================
# Примеры конфигураций / Configuration Examples
# ============================================================================
# --- Bootstrap режим (автономная работа без control server) ---
# --- Bootstrap mode (autonomous operation without control server) ---
#
# agent_id: "standalone-agent"
# control_server:
# address: "localhost:9090" # Не используется / Not used
# tls:
# enabled: true
# auto_generate: true # Автосоздание self-signed сертификатов
# ocserv:
# config_path: "/etc/ocserv/ocserv.conf"
# ctl_socket: "/var/run/occtl.socket"
# systemd_service: "ocserv"
# backup_dir: "/var/backups/ocserv-agent"
# security:
# allowed_commands: ["occtl", "systemctl"]
# max_command_timeout: 300s
# --- Production режим (с control server и CA-подписанными сертификатами) ---
# --- Production mode (with control server and CA-signed certificates) ---
#
# agent_id: "prod-server-01"
# control_server:
# address: "control.example.com:9090"
# reconnect:
# initial_delay: 1s
# max_delay: 60s
# multiplier: 2
# max_attempts: 0 # Infinite retry
# tls:
# enabled: true
# auto_generate: false # Требуются настоящие сертификаты / Require real certs
# cert_file: "/etc/ocserv-agent/certs/agent.crt"
# key_file: "/etc/ocserv-agent/certs/agent.key"
# ca_file: "/etc/ocserv-agent/certs/ca.crt"
# server_name: "control-server"
# min_version: "TLS1.3"
# logging:
# level: "info"
# format: "json"
# output: "stdout"
# telemetry:
# enabled: true
# endpoint: "https://telemetry.example.com:4318"
# --- Development режим (отладка, verbose логи) ---
# --- Development mode (debugging, verbose logs) ---
#
# agent_id: "dev-agent"
# tls:
# enabled: false # Небезопасно! Только для dev / Insecure! Dev only
# logging:
# level: "debug"
# format: "text"
# output: "stdout"
# health:
# heartbeat_interval: 5s
# deep_check_interval: 30s
# metrics_interval: 10s
# telemetry:
# enabled: false # Отключить для dev / Disable for dev
# ============================================================================
# Дополнительная информация / Additional Information
# ============================================================================
#
# 📚 Документация / Documentation:
# - README.md - Общая информация / General information
# - docs/CERTIFICATES.md - Управление сертификатами / Certificate management
# - docs/GRPC_TESTING.md - Тестирование gRPC API / gRPC API testing
# - docs/OCCTL_COMMANDS.md - Команды occtl / occtl commands reference
#
# 🔧 Проверка конфигурации / Configuration validation:
# ocserv-agent --config config.yaml --validate
#
# 🏃 Запуск агента / Running the agent:
# ocserv-agent --config /etc/ocserv-agent/config.yaml
#
# 📝 Логирование в systemd / Systemd logging:
# journalctl -u ocserv-agent -f
#
# 🔐 Генерация сертификатов / Certificate generation:
# ocserv-agent gencert --output /etc/ocserv-agent/certs
#
# ============================================================================