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>
107 lines
3.0 KiB
Rust
107 lines
3.0 KiB
Rust
//! SAS Client - Named pipe client for communicating with GuruConnect SAS Service
|
|
//!
|
|
//! The SAS Service runs as SYSTEM and handles Ctrl+Alt+Del requests.
|
|
//! This client sends commands to the service via named pipe.
|
|
|
|
use std::fs::OpenOptions;
|
|
use std::io::{Read, Write};
|
|
use std::time::Duration;
|
|
|
|
use anyhow::{Context, Result};
|
|
use tracing::{debug, error, info, warn};
|
|
|
|
const PIPE_NAME: &str = r"\\.\pipe\guruconnect-sas";
|
|
const TIMEOUT_MS: u64 = 5000;
|
|
|
|
/// Request Ctrl+Alt+Del (Secure Attention Sequence) via the SAS service
|
|
pub fn request_sas() -> Result<()> {
|
|
info!("Requesting SAS via service pipe...");
|
|
|
|
// Try to connect to the pipe
|
|
let mut pipe = match OpenOptions::new()
|
|
.read(true)
|
|
.write(true)
|
|
.open(PIPE_NAME)
|
|
{
|
|
Ok(p) => p,
|
|
Err(e) => {
|
|
warn!("Failed to connect to SAS service pipe: {}", e);
|
|
return Err(anyhow::anyhow!(
|
|
"SAS service not available. Install with: guruconnect-sas-service install"
|
|
));
|
|
}
|
|
};
|
|
|
|
debug!("Connected to SAS service pipe");
|
|
|
|
// Send the command
|
|
pipe.write_all(b"sas\n")
|
|
.context("Failed to send command to SAS service")?;
|
|
|
|
// Read the response
|
|
let mut response = [0u8; 64];
|
|
let n = pipe.read(&mut response)
|
|
.context("Failed to read response from SAS service")?;
|
|
|
|
let response_str = String::from_utf8_lossy(&response[..n]);
|
|
let response_str = response_str.trim();
|
|
|
|
debug!("SAS service response: {}", response_str);
|
|
|
|
match response_str {
|
|
"ok" => {
|
|
info!("SAS request successful");
|
|
Ok(())
|
|
}
|
|
"error" => {
|
|
error!("SAS service reported an error");
|
|
Err(anyhow::anyhow!("SAS service failed to send Ctrl+Alt+Del"))
|
|
}
|
|
_ => {
|
|
error!("Unexpected response from SAS service: {}", response_str);
|
|
Err(anyhow::anyhow!("Unexpected SAS service response: {}", response_str))
|
|
}
|
|
}
|
|
}
|
|
|
|
/// Check if the SAS service is available
|
|
pub fn is_service_available() -> bool {
|
|
// Try to open the pipe
|
|
if let Ok(mut pipe) = OpenOptions::new()
|
|
.read(true)
|
|
.write(true)
|
|
.open(PIPE_NAME)
|
|
{
|
|
// Send a ping command
|
|
if pipe.write_all(b"ping\n").is_ok() {
|
|
let mut response = [0u8; 64];
|
|
if let Ok(n) = pipe.read(&mut response) {
|
|
let response_str = String::from_utf8_lossy(&response[..n]);
|
|
return response_str.trim() == "pong";
|
|
}
|
|
}
|
|
}
|
|
false
|
|
}
|
|
|
|
/// Get information about SAS service status
|
|
pub fn get_service_status() -> String {
|
|
if is_service_available() {
|
|
"SAS service is running and responding".to_string()
|
|
} else {
|
|
"SAS service is not available".to_string()
|
|
}
|
|
}
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn test_service_check() {
|
|
// This test just checks the function runs without panicking
|
|
let available = is_service_available();
|
|
println!("SAS service available: {}", available);
|
|
}
|
|
}
|