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>
100 lines
4.0 KiB
PowerShell
100 lines
4.0 KiB
PowerShell
# Connect to PST VPN and configure DNS
|
|
# Can be run manually or by Task Scheduler
|
|
|
|
$vpnName = "PST-NW-VPN"
|
|
$username = "pst-admin"
|
|
$password = "24Hearts$"
|
|
$dnsServer = "192.168.0.2"
|
|
$remoteNetwork = "192.168.0.0"
|
|
$subnetMask = "255.255.255.0"
|
|
|
|
# Connect to VPN
|
|
Write-Host "Connecting to $vpnName..." -ForegroundColor Cyan
|
|
$result = cmd /c "rasdial `"$vpnName`" $username $password" 2>&1
|
|
|
|
if ($LASTEXITCODE -eq 0 -or $result -like "*Already connected*") {
|
|
Write-Host "[OK] Connected to VPN" -ForegroundColor Green
|
|
|
|
# Wait for interface to be ready
|
|
Start-Sleep -Seconds 5
|
|
|
|
# Configure DNS
|
|
Write-Host "Setting DNS to $dnsServer..." -ForegroundColor Cyan
|
|
|
|
try {
|
|
# Find the VPN interface - L2TP creates a PPP adapter with the connection name
|
|
$vpnInterface = Get-NetAdapter | Where-Object {
|
|
($_.InterfaceAlias -eq $vpnName -or
|
|
$_.InterfaceDescription -eq $vpnName -or
|
|
$_.Name -eq $vpnName) -and
|
|
$_.Status -eq "Up"
|
|
} | Select-Object -First 1
|
|
|
|
# If not found, try PPP adapter pattern
|
|
if (-not $vpnInterface) {
|
|
Write-Host "Trying PPP adapter search..." -ForegroundColor Gray
|
|
$vpnInterface = Get-NetAdapter | Where-Object {
|
|
$_.InterfaceDescription -like "*PPP*" -and $_.Status -eq "Up"
|
|
} | Select-Object -First 1
|
|
}
|
|
|
|
# Last resort: WAN Miniport
|
|
if (-not $vpnInterface) {
|
|
Write-Host "Trying WAN Miniport search..." -ForegroundColor Gray
|
|
$vpnInterface = Get-NetAdapter | Where-Object {
|
|
$_.InterfaceDescription -like "*WAN*" -and $_.Status -eq "Up"
|
|
} | Select-Object -First 1
|
|
}
|
|
|
|
if ($vpnInterface) {
|
|
Write-Host "Found VPN interface: $($vpnInterface.Name) ($($vpnInterface.InterfaceDescription))" -ForegroundColor Gray
|
|
|
|
Set-DnsClientServerAddress -InterfaceIndex $vpnInterface.InterfaceIndex -ServerAddresses $dnsServer
|
|
Write-Host "[OK] DNS configured: $dnsServer" -ForegroundColor Green
|
|
|
|
# Verify DNS
|
|
$dns = Get-DnsClientServerAddress -InterfaceIndex $vpnInterface.InterfaceIndex -AddressFamily IPv4
|
|
Write-Host "Current DNS: $($dns.ServerAddresses -join ', ')" -ForegroundColor Gray
|
|
|
|
# Add route for remote network (UniFi L2TP requirement)
|
|
Write-Host "Adding route for remote network $remoteNetwork..." -ForegroundColor Cyan
|
|
|
|
try {
|
|
# Remove existing route if present (avoid duplicates)
|
|
route delete $remoteNetwork 2>$null | Out-Null
|
|
|
|
# Add persistent route through VPN interface
|
|
$routeCmd = "route add $remoteNetwork mask $subnetMask 0.0.0.0 if $($vpnInterface.InterfaceIndex) metric 1"
|
|
cmd /c $routeCmd 2>&1 | Out-Null
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host "[OK] Route added: $remoteNetwork/$subnetMask via VPN" -ForegroundColor Green
|
|
}
|
|
else {
|
|
Write-Host "[WARNING] Route command returned code $LASTEXITCODE" -ForegroundColor Yellow
|
|
}
|
|
|
|
# Verify route
|
|
$routes = route print | Select-String $remoteNetwork
|
|
if ($routes) {
|
|
Write-Host "Route verified in routing table" -ForegroundColor Gray
|
|
}
|
|
}
|
|
catch {
|
|
Write-Host "[WARNING] Failed to add route: $_" -ForegroundColor Yellow
|
|
Write-Host "You may need to manually add route: route add $remoteNetwork mask $subnetMask 0.0.0.0 if $($vpnInterface.InterfaceIndex)" -ForegroundColor Yellow
|
|
}
|
|
}
|
|
else {
|
|
Write-Host "[WARNING] VPN interface not found or not active" -ForegroundColor Yellow
|
|
}
|
|
}
|
|
catch {
|
|
Write-Host "[ERROR] Failed to configure VPN: $_" -ForegroundColor Red
|
|
}
|
|
}
|
|
else {
|
|
Write-Host "[ERROR] Connection failed: $result" -ForegroundColor Red
|
|
exit 1
|
|
}
|