Files
Mike Swanson 6c316aa701 Add VPN configuration tools and agent documentation
Created comprehensive VPN setup tooling for Peaceful Spirit L2TP/IPsec connection
and enhanced agent documentation framework.

VPN Configuration (PST-NW-VPN):
- Setup-PST-L2TP-VPN.ps1: Automated L2TP/IPsec setup with split-tunnel and DNS
- Connect-PST-VPN.ps1: Connection helper with PPP adapter detection, DNS (192.168.0.2), and route config (192.168.0.0/24)
- Connect-PST-VPN-Standalone.ps1: Self-contained connection script for remote deployment
- Fix-PST-VPN-Auth.ps1: Authentication troubleshooting for CHAP/MSChapv2
- Diagnose-VPN-Interface.ps1: Comprehensive VPN interface and routing diagnostic
- Quick-Test-VPN.ps1: Fast connectivity verification (DNS/router/routes)
- Add-PST-VPN-Route-Manual.ps1: Manual route configuration helper
- vpn-connect.bat, vpn-disconnect.bat: Simple batch file shortcuts
- OpenVPN config files (Windows-compatible, abandoned for L2TP)

Key VPN Implementation Details:
- L2TP creates PPP adapter with connection name as interface description
- UniFi auto-configures DNS (192.168.0.2) but requires manual route to 192.168.0.0/24
- Split-tunnel enabled (only remote traffic through VPN)
- All-user connection for pre-login auto-connect via scheduled task
- Authentication: CHAP + MSChapv2 for UniFi compatibility

Agent Documentation:
- AGENT_QUICK_REFERENCE.md: Quick reference for all specialized agents
- documentation-squire.md: Documentation and task management specialist agent
- Updated all agent markdown files with standardized formatting

Project Organization:
- Moved conversation logs to dedicated directories (guru-connect-conversation-logs, guru-rmm-conversation-logs)
- Cleaned up old session JSONL files from projects/msp-tools/
- Added guru-connect infrastructure (agent, dashboard, proto, scripts, .gitea workflows)
- Added guru-rmm server components and deployment configs

Technical Notes:
- VPN IP pool: 192.168.4.x (client gets 192.168.4.6)
- Remote network: 192.168.0.0/24 (router at 192.168.0.10)
- PSK: rrClvnmUeXEFo90Ol+z7tfsAZHeSK6w7
- Credentials: pst-admin / 24Hearts$

Files: 15 VPN scripts, 2 agent docs, conversation log reorganization,
guru-connect/guru-rmm infrastructure additions

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-18 11:51:47 -07:00

135 lines
4.7 KiB
Markdown

# GuruConnect Session Log - 2025-12-29
## Session Summary
### What Was Accomplished
1. **Cleaned up stale persistent sessions** - Deleted 12 offline machines from PostgreSQL database
2. **Added machine deletion API with uninstall support** - Implemented full machine management endpoints
3. **Added AdminCommand protobuf message** - For server-to-agent commands (uninstall, restart, update)
4. **Implemented machine history export** - Sessions and events can be exported before deletion
### Key Decisions
- Machine deletion has two modes:
- **Delete Only** (`DELETE /api/machines/:agent_id`) - Removes from DB, allows re-registration
- **Delete with Uninstall** (`DELETE /api/machines/:agent_id?uninstall=true`) - Sends uninstall command to agent if online
- History export available via `?export=true` query param or separate endpoint
- AdminCommand message types: ADMIN_UNINSTALL, ADMIN_RESTART, ADMIN_UPDATE
### Problems Encountered
- Server endpoint returning 404 - new binary may not have been properly deployed
- Cross-compilation issues with ring crate for Windows MSVC on Linux
---
## Credentials
### GuruConnect Database (PostgreSQL)
- **Host:** 172.16.3.30 (localhost from server)
- **Database:** guruconnect
- **User:** guruconnect
- **Password:** gc_a7f82d1e4b9c3f60
- **DATABASE_URL:** `postgres://guruconnect:gc_a7f82d1e4b9c3f60@localhost:5432/guruconnect`
### Build Server SSH
- **Host:** 172.16.3.30
- **User:** guru
- **Password:** Gptf*77ttb123!@#-rmm
- **Sudo Password:** Gptf*77ttb123!@#-rmm
---
## Infrastructure
### GuruConnect Server
- **Host:** 172.16.3.30
- **Port:** 3002
- **Binary:** `/home/guru/guru-connect/target/release/guruconnect-server`
- **Service:** guruconnect.service (systemd)
- **Log:** ~/gc-server.log
### API Endpoints (NEW)
```
GET /api/machines - List all persistent machines
GET /api/machines/:agent_id - Get machine info
GET /api/machines/:agent_id/history - Get full session/event history
DELETE /api/machines/:agent_id - Delete machine
Query params:
?uninstall=true - Send uninstall command to agent
?export=true - Include history in response
```
---
## Files Modified
### Protobuf Schema
- `proto/guruconnect.proto` - Added AdminCommand message and AdminCommandType enum
### Server Changes
- `server/src/main.rs` - Added machine API routes and handlers
- `server/src/api/mod.rs` - Added MachineInfo, MachineHistory, DeleteMachineParams types
- `server/src/db/machines.rs` - Existing delete_machine function used
- `server/src/db/sessions.rs` - Added get_sessions_for_machine()
- `server/src/db/events.rs` - Added get_events_for_machine()
- `server/src/session/mod.rs` - Added send_admin_command() and remove_agent() methods
### Agent Changes
- `agent/src/session/mod.rs` - Added AdminCommand message handler
- `agent/src/main.rs` - Added ADMIN_UNINSTALL and ADMIN_RESTART error handlers
---
## Important Commands
### Query/Delete Machines from PostgreSQL
```bash
# Query all machines
ssh guru@172.16.3.30 'PGPASSWORD=gc_a7f82d1e4b9c3f60 psql -h localhost -U guruconnect -d guruconnect -c "SELECT agent_id, hostname, status FROM connect_machines;"'
# Delete all offline machines
ssh guru@172.16.3.30 'PGPASSWORD=gc_a7f82d1e4b9c3f60 psql -h localhost -U guruconnect -d guruconnect -c "DELETE FROM connect_machines WHERE status = '\''offline'\'';"'
```
### Build Server
```bash
# Build for Linux
ssh guru@172.16.3.30 'cd ~/guru-connect && source ~/.cargo/env && cargo build -p guruconnect-server --release --target x86_64-unknown-linux-gnu'
# Restart server
ssh guru@172.16.3.30 'pkill -f guruconnect-server; cd ~/guru-connect/server && DATABASE_URL="postgres://guruconnect:gc_a7f82d1e4b9c3f60@localhost:5432/guruconnect" nohup ~/guru-connect/target/release/guruconnect-server > ~/gc-server.log 2>&1 &'
```
---
## Pending Tasks
1. **Debug 404 on /api/machines endpoint** - The new routes aren't being recognized
- May need to verify the correct binary is being executed
- Check if old process is still running on port 3002
2. **Test machine deletion flow end-to-end**
- Connect an agent
- Delete with uninstall flag
- Verify agent receives command and uninstalls
3. **Build Windows agent binary** - Cross-compilation needs MSVC tools or use Windows build
---
## Git Status
Committed and pushed:
```
commit dc7b742: Add machine deletion API with uninstall command support
- 8 files changed, 380 insertions(+), 6 deletions(-)
```
---
## Next Steps for Future Sessions
1. Investigate why `/api/machines` returns 404 - likely old binary running
2. Use systemd properly for server management (need root access)
3. Build and test Windows agent with uninstall command handling
4. Add dashboard UI for machine management (list, delete with options)