-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathbasic.yaml
More file actions
278 lines (248 loc) · 8.17 KB
/
Copy pathbasic.yaml
File metadata and controls
278 lines (248 loc) · 8.17 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
/// Path: PanicMode/examples/basic.yaml
# PanicMode Configuration - Full Featured
# Replace all placeholder values with your actual credentials
# Performance limits for PanicMode itself
performance:
cpu_limit: 5.0 # Max 5% CPU usage
memory_limit_mb: 50 # Max 50MB RAM
check_interval: "5s" # Check metrics every 5 seconds
# Monitoring rules
monitors:
# Detect SSH bruteforce attempts
- name: "SSH Bruteforce Detection"
type: "auth_failures"
threshold: 5 # 5 failed attempts
window: "60s" # Within 60 seconds
actions:
- block_ip
- alert_critical
enabled: true
# Detect high CPU usage
- name: "High CPU Usage"
type: "cpu_usage"
threshold: 90 # 90% CPU
duration: "30s" # For at least 30 seconds
actions:
- freeze_top_process
- alert_warning
enabled: true
# Detect high memory usage
- name: "High Memory Usage"
type: "memory_usage"
threshold: 85 # 85% RAM
duration: "30s"
actions:
- alert_warning
enabled: true
# Detect port scanning
- name: "Port Scan Detection"
type: "connection_rate"
threshold: 100 # 100 connections
window: "10s" # Within 10 seconds
actions:
- rate_limit
- alert_critical
enabled: true
# Monitor critical files
- name: "Critical File Changes"
type: "file_monitor"
threshold: 1 # Any change
paths:
- "/etc/passwd"
- "/etc/shadow"
- "/etc/sudoers"
- "/root/.ssh/authorized_keys"
actions:
- snapshot
- alert_critical
enabled: true
# Detect disk space issues
- name: "Low Disk Space"
type: "disk_usage"
threshold: 90 # 90% full
actions:
- alert_warning
enabled: true
# Actions to execute when rules trigger
actions:
# Block IP address temporarily
block_ip:
type: "firewall"
duration: "1h" # Block for 1 hour
# Rate limit connections
rate_limit:
type: "firewall"
rate: "10/s" # Max 10 connections per second
# Freeze the top CPU-consuming process
freeze_top_process:
type: "process"
action: "freeze"
# Create system snapshot
snapshot:
type: "system"
capture:
- "logs"
- "processes"
- "connections"
- "files"
# Alert configurations - ALL CHANNELS ENABLED
alerts:
# Critical alerts - uses ALL channels for maximum reliability
critical:
# Telegram - Free, instant, reliable
- channel: "telegram"
chat_id: "YOUR_TELEGRAM_CHAT_ID"
retries: 3
timeout: "10s"
# Email - Free, always works, backup channel
- channel: "email"
email: "your.alert.email@example.com"
retries: 3
timeout: "15s"
# Ntfy - Free, persistent push notifications
- channel: "ntfy"
topic: "myserver-critical"
retries: 3
timeout: "10s"
# Discord - Free, good for teams
- channel: "discord"
webhook_url: "https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN"
retries: 3
timeout: "10s"
# Twilio Calls - Paid, for CRITICAL emergencies (wakes you up!)
- channel: "twilio_call"
contacts:
- name: "Primary Admin"
phone: "+1234567890" # Replace with your phone
retries: 3
timeout: "2m"
- name: "Secondary Admin"
phone: "+0987654321" # Replace with backup phone
retries: 3
timeout: "2m"
# Twilio SMS - Paid, backup for calls
- channel: "twilio_sms"
contacts:
- name: "Primary Admin"
phone: "+1234567890"
retries: 2
timeout: "30s"
# Generic Webhook - for custom integrations
- channel: "webhook"
webhook_url: "https://your-server.com/webhook/alerts"
retries: 2
timeout: "10s"
# Warning alerts - less aggressive, cheaper channels
warning:
- channel: "telegram"
chat_id: "YOUR_TELEGRAM_CHAT_ID"
retries: 2
- channel: "email"
email: "your.alert.email@example.com"
retries: 2
- channel: "discord"
webhook_url: "https://discord.com/api/webhooks/YOUR_WEBHOOK_ID/YOUR_WEBHOOK_TOKEN"
retries: 2
# No Twilio calls for warnings (save money)
# Only SMS if you want
# - channel: "twilio_sms"
# contacts:
# - name: "Primary Admin"
# phone: "+1234567890"
# retries: 1
# Info alerts - minimal channels
info:
- channel: "telegram"
chat_id: "YOUR_TELEGRAM_CHAT_ID"
retries: 1
- channel: "ntfy"
topic: "myserver-info"
retries: 1
# Integration credentials - ALL INTEGRATIONS CONFIGURED
integrations:
# ============================================================
# TELEGRAM (FREE) - Recommended as primary channel
# ============================================================
# Setup:
# 1. Message @BotFather on Telegram → /newbot
# 2. Save the bot token
# 3. Message your bot, then visit:
# https://api.telegram.org/bot<TOKEN>/getUpdates
# 4. Find your chat ID in the response
telegram:
enabled: true
bot_token: "1234567890:ABCdefGHIjklMNOpqrsTUVwxyz" # From @BotFather
chat_id: "123456789" # Your chat ID
# ============================================================
# EMAIL (FREE) - Excellent backup channel
# ============================================================
# Gmail setup:
# 1. Enable 2FA on your Google account
# 2. Go to: https://myaccount.google.com/apppasswords
# 3. Generate an "App Password"
# 4. Use that password below (NOT your regular password)
#
# For other providers, use their SMTP settings
email:
enabled: true
smtp_host: "smtp.gmail.com" # Gmail
smtp_port: 587 # TLS port
smtp_username: "your.email@gmail.com" # Your email
smtp_password: "abcd efgh ijkl mnop" # App password (16 chars)
from_email: "your.email@gmail.com" # Same as username
to_email: "your.alert.email@gmail.com" # Where to send alerts
use_tls: true
# Alternative email providers:
#
# Outlook/Hotmail:
# smtp_host: "smtp-mail.outlook.com"
# smtp_port: 587
#
# Yahoo:
# smtp_host: "smtp.mail.yahoo.com"
# smtp_port: 587
#
# Custom SMTP:
# smtp_host: "mail.yourdomain.com"
# smtp_port: 587 or 465
# ============================================================
# NTFY (FREE) - Persistent push notifications
# ============================================================
# Setup:
# 1. Visit https://ntfy.sh
# 2. Choose a unique topic (e.g., myserver-abc123)
# 3. Subscribe via app or web
# 4. Optional: Self-host ntfy for privacy
ntfy:
enabled: true
server: "https://ntfy.sh" # Or your self-hosted URL
topic: "myserver-alerts-abc123" # MUST be unique!
# token: "tk_abc123..." # Optional, if using auth
# ============================================================
# DISCORD (FREE) - Great for teams
# ============================================================
# Setup:
# 1. Go to your Discord server settings
# 2. Integrations → Webhooks → New Webhook
# 3. Copy the webhook URL
# 4. Paste below
discord:
enabled: true
webhook_url: "https://discord.com/api/webhooks/1234567890/abcdefghijklmnopqrstuvwxyz"
# ============================================================
# TWILIO (PAID ~$1/month + usage) - For phone calls/SMS
# ============================================================
# Setup:
# 1. Sign up at https://www.twilio.com
# 2. Get a phone number (~$1/month)
# 3. Find Account SID and Auth Token in console
# 4. Costs: ~$0.013/min for calls, ~$0.0075/SMS
#
# Budget estimate:
# - 10 critical alerts/month with 2 calls each = ~$0.26
# - Total with number: ~$1.26/month
twilio:
enabled: true # Set to false to disable
account_sid: "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" # From Twilio console
auth_token: "your_auth_token_here" # From Twilio console
from_number: "+12345678901" # Your Twilio number