@poolzin/pool-bot 2026.4.32 → 2026.4.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/poolbot-tools.d.ts.map +1 -1
- package/dist/agents/poolbot-tools.js +2 -0
- package/dist/agents/system-prompt.d.ts.map +1 -1
- package/dist/agents/system-prompt.js +2 -0
- package/dist/agents/tools/skill-evolve-tool.d.ts.map +1 -1
- package/dist/agents/tools/skill-evolve-tool.js +18 -7
- package/dist/agents/tools/vps-security-tool.d.ts +8 -0
- package/dist/agents/tools/vps-security-tool.d.ts.map +1 -0
- package/dist/agents/tools/vps-security-tool.js +264 -0
- package/dist/build-info.json +3 -3
- package/dist/cli/mcp-cli.d.ts +10 -0
- package/dist/cli/mcp-cli.d.ts.map +1 -0
- package/dist/cli/mcp-cli.js +44 -0
- package/dist/mcp/server.d.ts +39 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +463 -0
- package/docs/mcp-server.md +171 -0
- package/docs/security/vps-hardening.md +309 -0
- package/docs/skills/vps-security.md +140 -0
- package/package.json +1 -1
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
# VPS Security Hardening Guide
|
|
2
|
+
|
|
3
|
+
## Security Measures Applied (Gentle - Non-Breaking)
|
|
4
|
+
|
|
5
|
+
### 1. fail2ban
|
|
6
|
+
**Status:** ✅ Active
|
|
7
|
+
|
|
8
|
+
**Configuration:**
|
|
9
|
+
- 5 failed login attempts = 1 hour ban
|
|
10
|
+
- Monitors SSH only
|
|
11
|
+
- Does NOT block legitimate users
|
|
12
|
+
|
|
13
|
+
**Check status:**
|
|
14
|
+
```bash
|
|
15
|
+
fail2ban-client status sshd
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
**Unban an IP:**
|
|
19
|
+
```bash
|
|
20
|
+
fail2ban-client set sshd unbanip <IP>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
### 2. UFW Rate Limit (SSH)
|
|
26
|
+
**Status:** ✅ Active
|
|
27
|
+
|
|
28
|
+
**Configuration:**
|
|
29
|
+
- SSH (port 22) rate limited per IP
|
|
30
|
+
- Allows normal connections
|
|
31
|
+
- Blocks aggressive connection attempts
|
|
32
|
+
|
|
33
|
+
**Check status:**
|
|
34
|
+
```bash
|
|
35
|
+
ufw status | grep 22
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
### 3. SSH Hardening
|
|
41
|
+
**Status:** ✅ Active
|
|
42
|
+
|
|
43
|
+
**Configuration:**
|
|
44
|
+
- `LoginGraceTime 60` — Disconnect after 60s without auth
|
|
45
|
+
- `MaxAuthTries 6` — 6 password attempts per connection
|
|
46
|
+
- `ClientAliveInterval 300` — Keep-alive every 5 min
|
|
47
|
+
- `ClientAliveCountMax 2` — Disconnect after 2 missed keep-alives
|
|
48
|
+
|
|
49
|
+
**What's NOT changed:**
|
|
50
|
+
- `PermitRootLogin yes` — Root login still allowed
|
|
51
|
+
- `PasswordAuthentication yes` — Password auth still enabled
|
|
52
|
+
|
|
53
|
+
**Check config:**
|
|
54
|
+
```bash
|
|
55
|
+
grep -E 'LoginGraceTime|MaxAuthTries' /etc/ssh/sshd_config
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
### 4. Honeypot (endlessh)
|
|
61
|
+
**Status:** ✅ Active on port 2222
|
|
62
|
+
|
|
63
|
+
**What it does:**
|
|
64
|
+
- Simulates an SSH server on port 2222
|
|
65
|
+
- Traps bots that scan for SSH on non-standard ports
|
|
66
|
+
- Logs attacker IPs and commands
|
|
67
|
+
- Does NOT affect real SSH (port 22)
|
|
68
|
+
|
|
69
|
+
**Check status:**
|
|
70
|
+
```bash
|
|
71
|
+
systemctl is-active endlessh
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**View honeypot logs:**
|
|
75
|
+
```bash
|
|
76
|
+
journalctl -u endlessh -f
|
|
77
|
+
# Or check /var/log/endlessh.log
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**How it works:**
|
|
81
|
+
- Real SSH: port 22
|
|
82
|
+
- Honeypot: port 2222
|
|
83
|
+
- Bots scanning port 2222 get trapped and logged
|
|
84
|
+
- You connect to port 22 (unaffected)
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### 5. Port 9999 (glance API)
|
|
89
|
+
**Status:** ✅ Identified as legitimate
|
|
90
|
+
|
|
91
|
+
**What it is:**
|
|
92
|
+
- PoolBot skill: `/root/pool/skills/glance/api/ecosystem-api.py`
|
|
93
|
+
- Used by PoolBot for glance functionality
|
|
94
|
+
- NOT a security risk
|
|
95
|
+
|
|
96
|
+
**No action needed.**
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## How PoolBot Uses Security Features
|
|
101
|
+
|
|
102
|
+
### security-audit Skill
|
|
103
|
+
|
|
104
|
+
**What it does:**
|
|
105
|
+
- Runs daily security audit
|
|
106
|
+
- Checks for:
|
|
107
|
+
- Failed login attempts
|
|
108
|
+
- Suspicious processes
|
|
109
|
+
- Open ports
|
|
110
|
+
- SSL certificate expiry
|
|
111
|
+
- System updates
|
|
112
|
+
|
|
113
|
+
**Manual trigger:**
|
|
114
|
+
```bash
|
|
115
|
+
poolbot message send "Run security audit"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**Output:**
|
|
119
|
+
- Security score (0-100)
|
|
120
|
+
- List of issues found
|
|
121
|
+
- Recommended actions
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
### self-healing Skill
|
|
126
|
+
|
|
127
|
+
**What it does:**
|
|
128
|
+
- Automatically fixes common issues
|
|
129
|
+
- Restarts failed services
|
|
130
|
+
- Clears stuck processes
|
|
131
|
+
- Recovers from errors
|
|
132
|
+
|
|
133
|
+
**Manual trigger:**
|
|
134
|
+
```bash
|
|
135
|
+
poolbot message send "Self-heal the system"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
### Fail2ban Monitoring via PoolBot
|
|
141
|
+
|
|
142
|
+
**Ask PoolBot:**
|
|
143
|
+
```bash
|
|
144
|
+
poolbot message send "How many failed login attempts?"
|
|
145
|
+
poolbot message send "Show me banned IPs"
|
|
146
|
+
poolbot message send "Unban IP 1.2.3.4"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### Honeypot Monitoring via PoolBot
|
|
152
|
+
|
|
153
|
+
**Ask PoolBot:**
|
|
154
|
+
```bash
|
|
155
|
+
poolbot message send "Show honeypot activity"
|
|
156
|
+
poolbot message send "How many bots tried to connect?"
|
|
157
|
+
poolbot message send "Show recent attacker IPs"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Security Commands Reference
|
|
163
|
+
|
|
164
|
+
### fail2ban
|
|
165
|
+
```bash
|
|
166
|
+
# Status
|
|
167
|
+
fail2ban-client status
|
|
168
|
+
fail2ban-client status sshd
|
|
169
|
+
|
|
170
|
+
# Unban IP
|
|
171
|
+
fail2ban-client set sshd unbanip <IP>
|
|
172
|
+
|
|
173
|
+
# Restart
|
|
174
|
+
systemctl restart fail2ban
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### UFW
|
|
178
|
+
```bash
|
|
179
|
+
# Status
|
|
180
|
+
ufw status
|
|
181
|
+
|
|
182
|
+
# Add rate limit
|
|
183
|
+
ufw limit 22/tcp
|
|
184
|
+
|
|
185
|
+
# Allow specific IP
|
|
186
|
+
ufw allow from 1.2.3.4 to any port 22
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### SSH
|
|
190
|
+
```bash
|
|
191
|
+
# Check config
|
|
192
|
+
sshd -t # Test config validity
|
|
193
|
+
|
|
194
|
+
# Reload
|
|
195
|
+
systemctl reload ssh
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
### Honeypot
|
|
199
|
+
```bash
|
|
200
|
+
# Status
|
|
201
|
+
systemctl is-active endlessh
|
|
202
|
+
|
|
203
|
+
# Logs
|
|
204
|
+
journalctl -u endlessh -f
|
|
205
|
+
cat /var/log/endlessh.log
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## What Was NOT Changed (By Design)
|
|
211
|
+
|
|
212
|
+
| Setting | Value | Why |
|
|
213
|
+
|---------|-------|-----|
|
|
214
|
+
| `PermitRootLogin` | `yes` | You need root access |
|
|
215
|
+
| `PasswordAuthentication` | `yes` | You use password auth |
|
|
216
|
+
| PostgreSQL `listen_addresses` | `*` | Your APIs need external access |
|
|
217
|
+
| Port 9999 | Open | glance API (legitimate PoolBot skill) |
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
## Security Score
|
|
222
|
+
|
|
223
|
+
| Measure | Status | Protection Level |
|
|
224
|
+
|---------|--------|-----------------|
|
|
225
|
+
| fail2ban | ✅ Active | High (blocks brute force) |
|
|
226
|
+
| UFW rate limit | ✅ Active | Medium (slows attacks) |
|
|
227
|
+
| SSH hardening | ✅ Active | Medium (reduces attack window) |
|
|
228
|
+
| Honeypot | ✅ Active | Low (detection only) |
|
|
229
|
+
| security-audit | ✅ Available | Medium (daily checks) |
|
|
230
|
+
|
|
231
|
+
**Overall: Good baseline security without breaking workflow.**
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Troubleshooting
|
|
236
|
+
|
|
237
|
+
### "I got locked out!"
|
|
238
|
+
**Unlikely, but if it happens:**
|
|
239
|
+
|
|
240
|
+
1. Wait 1 hour (fail2ban ban expires)
|
|
241
|
+
2. Or access via Tailscale (bypasses fail2ban)
|
|
242
|
+
3. Or console access (VPS provider)
|
|
243
|
+
|
|
244
|
+
**To prevent:**
|
|
245
|
+
- Use Tailscale for primary access
|
|
246
|
+
- Keep your IP whitelisted if needed
|
|
247
|
+
|
|
248
|
+
### "SSH is slow"
|
|
249
|
+
**Check if fail2ban is blocking you:**
|
|
250
|
+
```bash
|
|
251
|
+
fail2ban-client status sshd
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
**If your IP is listed:**
|
|
255
|
+
```bash
|
|
256
|
+
fail2ban-client set sshd unbanip <YOUR_IP>
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### "Honeypot not working"
|
|
260
|
+
```bash
|
|
261
|
+
# Check status
|
|
262
|
+
systemctl is-active endlessh
|
|
263
|
+
|
|
264
|
+
# Check logs
|
|
265
|
+
journalctl -u endlessh -n 50
|
|
266
|
+
|
|
267
|
+
# Restart
|
|
268
|
+
systemctl restart endlessh
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Next Steps (Optional)
|
|
274
|
+
|
|
275
|
+
1. **Enable unattended-upgrades** — Auto security patches
|
|
276
|
+
2. **Configure PostgreSQL backups** — Protect API data
|
|
277
|
+
3. **Add PoolBot security alerts** — Telegram notifications for suspicious activity
|
|
278
|
+
4. **Whitelist your IP** — Extra protection for SSH
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Summary
|
|
283
|
+
|
|
284
|
+
✅ **fail2ban** — Blocks brute force after 5 failures
|
|
285
|
+
✅ **UFW rate limit** — Slows down connection floods
|
|
286
|
+
✅ **SSH hardening** — Reduces attack window
|
|
287
|
+
✅ **Honeypot** — Detects and logs attackers
|
|
288
|
+
✅ **security-audit skill** — Daily automated audits
|
|
289
|
+
✅ **self-healing skill** — Auto-fix common issues
|
|
290
|
+
|
|
291
|
+
❌ **Nothing broken** — SSH password auth still works, PostgreSQL still accessible, root login still allowed
|
|
292
|
+
|
|
293
|
+
**Security improved without breaking your workflow.**
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Honeypot Note
|
|
298
|
+
|
|
299
|
+
**endlessh runs in manual mode** (systemd service has namespace issues).
|
|
300
|
+
|
|
301
|
+
**To restart after reboot:**
|
|
302
|
+
```bash
|
|
303
|
+
nohup endlessh -p 2222 > /var/log/endlessh.log 2>&1 &
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
**Or add to crontab @reboot:**
|
|
307
|
+
```bash
|
|
308
|
+
echo '@reboot nohup endlessh -p 2222 > /var/log/endlessh.log 2>&1 &' | crontab -
|
|
309
|
+
```
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# VPS Security Monitoring Skill
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Monitors and manages VPS security features including fail2ban, UFW firewall, SSH hardening, and honeypot.
|
|
6
|
+
|
|
7
|
+
## Capabilities
|
|
8
|
+
|
|
9
|
+
- **fail2ban monitoring** — Check banned IPs, failed attempts, unban IPs
|
|
10
|
+
- **UFW status** — Check firewall rules and rate limits
|
|
11
|
+
- **SSH hardening** — Verify SSH security configuration
|
|
12
|
+
- **Honeypot monitoring** — Check endlessh activity and attacker logs
|
|
13
|
+
- **Security reports** — Generate security status reports
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
### Check Security Status
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
Check VPS security status
|
|
21
|
+
Show fail2ban status
|
|
22
|
+
How many failed login attempts?
|
|
23
|
+
Show banned IPs
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Manage fail2ban
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
Unban IP 1.2.3.4
|
|
30
|
+
Restart fail2ban
|
|
31
|
+
Show fail2ban logs
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Check Firewall
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
Show UFW status
|
|
38
|
+
Check SSH rate limit
|
|
39
|
+
Show firewall rules
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Honeypot Monitoring
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
Show honeypot activity
|
|
46
|
+
How many bots tried to connect?
|
|
47
|
+
Show recent attacker IPs
|
|
48
|
+
Check endlessh status
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Security Reports
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
Generate security report
|
|
55
|
+
Daily security summary
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Commands
|
|
59
|
+
|
|
60
|
+
### `vps_security status`
|
|
61
|
+
|
|
62
|
+
Returns overall security status including:
|
|
63
|
+
- fail2ban status (active/inactive, banned count)
|
|
64
|
+
- UFW status (active/inactive, rate limits)
|
|
65
|
+
- SSH hardening (LoginGraceTime, MaxAuthTries)
|
|
66
|
+
- Honeypot status (active/inactive, port)
|
|
67
|
+
|
|
68
|
+
### `vps_security fail2ban`
|
|
69
|
+
|
|
70
|
+
Returns fail2ban details:
|
|
71
|
+
- Currently failed attempts
|
|
72
|
+
- Total failed attempts
|
|
73
|
+
- Currently banned IPs
|
|
74
|
+
- Total banned IPs
|
|
75
|
+
- Banned IP list
|
|
76
|
+
|
|
77
|
+
### `vps_security unban <ip>`
|
|
78
|
+
|
|
79
|
+
Unbans a specific IP address from fail2ban.
|
|
80
|
+
|
|
81
|
+
### `vps_security ufw`
|
|
82
|
+
|
|
83
|
+
Returns UFW firewall status:
|
|
84
|
+
- Active/inactive
|
|
85
|
+
- Rules list
|
|
86
|
+
- Rate limits
|
|
87
|
+
|
|
88
|
+
### `vps_security ssh`
|
|
89
|
+
|
|
90
|
+
Returns SSH hardening status:
|
|
91
|
+
- LoginGraceTime
|
|
92
|
+
- MaxAuthTries
|
|
93
|
+
- PermitRootLogin
|
|
94
|
+
- PasswordAuthentication
|
|
95
|
+
|
|
96
|
+
### `vps_security honeypot`
|
|
97
|
+
|
|
98
|
+
Returns honeypot (endlessh) status:
|
|
99
|
+
- Active/inactive
|
|
100
|
+
- Port (default: 2222)
|
|
101
|
+
- Recent activity count
|
|
102
|
+
|
|
103
|
+
### `vps_security report`
|
|
104
|
+
|
|
105
|
+
Generates comprehensive security report with:
|
|
106
|
+
- Overall security score (0-100)
|
|
107
|
+
- Active measures
|
|
108
|
+
- Recommendations
|
|
109
|
+
- Recent activity summary
|
|
110
|
+
|
|
111
|
+
## Implementation Notes
|
|
112
|
+
|
|
113
|
+
- All commands execute via SSH to the VPS
|
|
114
|
+
- Requires SSH access configured in PoolBot
|
|
115
|
+
- Output is formatted for Telegram/Discord/Slack delivery
|
|
116
|
+
- Security score calculation:
|
|
117
|
+
- fail2ban active: +25 points
|
|
118
|
+
- UFW active: +25 points
|
|
119
|
+
- SSH hardening: +25 points
|
|
120
|
+
- Honeypot active: +15 points
|
|
121
|
+
- No critical issues: +10 points
|
|
122
|
+
|
|
123
|
+
## Security Considerations
|
|
124
|
+
|
|
125
|
+
- Only authorized users should access security commands
|
|
126
|
+
- Unban commands should be logged
|
|
127
|
+
- Security reports should not expose sensitive data
|
|
128
|
+
- Consider adding authentication for security commands
|
|
129
|
+
|
|
130
|
+
## Related Skills
|
|
131
|
+
|
|
132
|
+
- `security-audit` — Automated daily security audits
|
|
133
|
+
- `self-healing` — Automatic issue recovery
|
|
134
|
+
- `vps-api` — VPS management API
|
|
135
|
+
|
|
136
|
+
## Files
|
|
137
|
+
|
|
138
|
+
- Skill: `/root/pool/skills/vps-security/SKILL.md`
|
|
139
|
+
- Scripts: `/root/pool/skills/vps-security/scripts/`
|
|
140
|
+
- Logs: `/var/log/fail2ban.log`, `/var/log/endlessh.log`
|