-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.kdl.example
More file actions
329 lines (302 loc) · 9.09 KB
/
Copy pathconfig.kdl.example
File metadata and controls
329 lines (302 loc) · 9.09 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
// Example Overseer Configuration
//
// CONDITION SYNTAX:
// Overseer supports two ways to write conditions:
//
// 1. Simple syntax:
// sensor "value" - Single value
// sensor "val1" "val2" - Multiple values (OR logic)
//
// 2. Structured syntax:
// any { ... } - OR logic (at least one must match)
// all { ... } - AND logic (all must match)
// Supports nesting for complex conditions
//
// Use simple syntax for basic conditions. Use structured syntax when you need
// explicit AND logic or complex nested conditions.
// Verbosity level (0=quiet, 1=normal, 2=verbose)
verbose 1
// SSH connection settings
ssh {
server_alive_interval 15
server_alive_count_max 3
reconnect_enabled true
initial_backoff "1s"
max_backoff "5m"
backoff_factor 2
max_retries 10
}
// Export configuration - write context information to files
exports {
dotenv "~/.local/var/overseer.env"
context "~/.local/var/overseer_context"
location "~/.local/var/overseer_location"
public_ip "~/.local/var/overseer_ip"
}
// ============================================================================
// TUNNELS - Per-tunnel configuration with companion scripts
// ============================================================================
// Tunnel names must match SSH config aliases.
// Companion scripts run before the tunnel connects and are terminated when
// the tunnel disconnects.
// Simple companion - wait for script to complete before connecting
tunnel "work-vpn" {
companion "vpn-client" {
command = ["/usr/local/bin/start-vpn.sh", "--profile", "work"]
workdir = "~/.config/vpn"
wait_mode = "completion" // Wait for script to exit successfully
timeout = "30s"
on_failure = "block" // Don't connect tunnel if companion fails
}
}
// Companion that stays running - wait for specific output string
tunnel "home-server" {
companion "socks-proxy" {
command = ["ssh", "-D", "1080", "-N", "proxy-host"]
wait_mode = "string" // Wait for specific string in output
wait_for = "Entering interactive session"
timeout = "60s"
on_failure = "block"
keep_alive = true // Keep running after tunnel connects (default)
persistent = true // Keep running when tunnel stops (survives disconnect)
environment = {
"SSH_AUTH_SOCK" = "/tmp/ssh-agent.sock"
}
}
}
// Companion with background daemon - use SIGTERM for clean shutdown
tunnel "vpn-tunnel" {
companion "daemon" {
command = ["/usr/local/bin/start-daemon.sh"]
wait_mode = "string"
wait_for = "Ready"
timeout = "30s"
on_failure = "block"
keep_alive = true
stop_signal = "TERM" // Send SIGTERM instead of SIGINT (default is INT)
}
}
// Multiple companions - run sequentially
tunnel "database-tunnel" {
companion "start-docker" {
command = ["docker", "compose", "up", "-d", "postgres"]
wait_mode = "completion"
timeout = "120s"
on_failure = "block"
}
companion "wait-healthy" {
command = ["docker", "compose", "exec", "postgres", "pg_isready"]
wait_mode = "completion"
timeout = "30s"
on_failure = "continue" // Proceed even if health check fails
}
}
// ============================================================================
// LOCATIONS - Reusable network/physical location definitions
// ============================================================================
// Simple syntax - single condition
location "home_simple" {
display_name "Home (Simple)"
conditions {
public_ip "192.168.1.0/24"
}
environment {
TRUST_LEVEL "high"
}
}
// Simple syntax - multiple values = OR
location "office" {
display_name "Office"
conditions {
public_ip "10.0.1.0/24" "10.0.2.0/24" // Matches either IP range
}
environment {
TRUST_LEVEL "high"
OFFICE_NETWORK "true"
}
}
// Structured syntax - explicit any{} (OR logic)
// Useful when mixing different sensors or for clarity
location "home" {
display_name "Home Network"
conditions {
any {
public_ip "192.168.1.0/24"
public_ip "192.168.2.0/24"
env "HOME_ZONE" "yes"
}
}
environment {
TRUST_LEVEL "high"
HOME_NETWORK "true"
}
}
// Structured syntax - all{} (AND logic)
// All conditions must be true
location "secure_office" {
display_name "Secure Office Network"
conditions {
all {
public_ip "10.0.1.0/24"
online true
env "VPN_CONNECTED" "yes"
}
}
environment {
TRUST_LEVEL "very_high"
SECURE_ACCESS "true"
}
}
// Structured syntax - nested groups (all + any)
location "trusted_network" {
display_name "Any Trusted Network"
conditions {
all {
online true
any {
public_ip "192.168.1.0/24" // Home
public_ip "10.0.1.0/24" // Office
env "TRUSTED_NETWORK" "yes"
}
}
}
environment {
TRUST_LEVEL "high"
}
}
// Coffee shop (public WiFi)
location "public_wifi" {
display_name "Public WiFi"
conditions {
all {
online true
// Not home and not office
env "PUBLIC_NETWORK" "yes"
}
}
environment {
TRUST_LEVEL "low"
PUBLIC_WIFI "true"
}
}
// ============================================================================
// CONTEXTS - Security contexts that trigger actions
// ============================================================================
// Context using location reference
context "home_context" {
display_name "At Home"
location "home"
actions {
connect "home-server" "nas"
disconnect "work-vpn"
}
environment {
CONTEXT_TYPE "home"
}
}
// Context using location reference
context "office_context" {
display_name "At Office"
location "office" "secure_office" // Match either location
actions {
connect "work-vpn" "internal-db"
disconnect "home-server"
}
environment {
CONTEXT_TYPE "office"
}
}
// Context with direct conditions - simple syntax
context "mobile_hotspot" {
display_name "Mobile Hotspot"
conditions {
env "MOBILE_HOTSPOT" "yes"
}
actions {
connect "work-vpn"
}
environment {
CONTEXT_TYPE "mobile"
}
}
// Context with direct conditions - simple syntax
context "vpn_connected" {
display_name "VPN Connected"
conditions {
env "VPN_CONNECTED" "yes"
}
actions {
connect "internal-services"
}
environment {
CONTEXT_TYPE "vpn"
}
}
// Context with structured syntax - complex nested conditions
context "remote_work" {
display_name "Remote Work"
conditions {
all {
online true
any {
env "MOBILE_HOTSPOT" "yes"
env "CAFE_WIFI" "yes"
location "public_wifi"
}
}
}
actions {
connect "work-vpn"
disconnect "home-server"
}
environment {
CONTEXT_TYPE "remote"
VPN_REQUIRED "true"
}
}
// ============================================================================
// DEFAULT LOCATIONS - These are auto-generated but can be customized
// ============================================================================
// Default locations (offline, unknown) are special:
// - "offline": Matches when online = false
// - "unknown": Fallback when no location matches
//
// You can customize them to add environment variables or change display names.
// Default "offline" location (auto-generated if not defined)
// Matches when: online = false
location "offline" {
display_name "Offline"
// Core condition (online = false) is always preserved
environment {
OVERSEER_LOCATION_BG_COLOR "#999999"
OVERSEER_LOCATION_COLOR "#ffffff"
}
}
// Default "unknown" location (auto-generated if not defined)
// Matches when: no other location matches (fallback)
location "unknown" {
display_name "Unknown Location"
// Core condition (no conditions = fallback) is always preserved
environment {
OVERSEER_LOCATION_BG_COLOR "#aa0000"
OVERSEER_LOCATION_COLOR "#ffffff"
}
}
// ============================================================================
// DEFAULT CONTEXTS - These are auto-generated but can be customized
// ============================================================================
// Default "untrusted" fallback context (auto-generated if not defined)
// Matches when: nothing else matches (no conditions)
// Always appears LAST, regardless of where you define it in your config
context "untrusted" {
display_name "Untrusted Network"
// Core condition (no conditions = fallback) is always preserved
actions {
connect "work-vpn"
disconnect "home-server" "nas"
}
environment {
CONTEXT_TYPE "untrusted"
TRUST_LEVEL "low"
}
}