Files
claudetools/projects/msp-tools/guru-rmm/agent/scripts/install.sh
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

234 lines
4.8 KiB
Bash

#!/bin/bash
#
# GuruRMM Agent Installer
#
# Usage:
# curl -fsSL https://rmm.azcomputerguru.com/install.sh | sudo bash -s -- --api-key YOUR_KEY
#
# Or download and run locally:
# ./install.sh --server-url wss://rmm-api.example.com/ws --api-key YOUR_KEY
#
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Default values
DOWNLOAD_URL="${GURURMM_DOWNLOAD_URL:-https://rmm.azcomputerguru.com/downloads/gururmm-agent-linux-amd64}"
SERVER_URL=""
API_KEY=""
SKIP_LEGACY_CHECK=""
TMP_DIR=""
# Cleanup function
cleanup() {
if [ -n "$TMP_DIR" ] && [ -d "$TMP_DIR" ]; then
rm -rf "$TMP_DIR"
fi
}
trap cleanup EXIT
# Print colored message
info() {
echo -e "${GREEN}[INFO]${NC} $1"
}
warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
error() {
echo -e "${RED}[ERROR]${NC} $1"
exit 1
}
# Show usage
usage() {
cat <<EOF
GuruRMM Agent Installer
Usage: $0 [OPTIONS]
Options:
--server-url URL Server WebSocket URL (e.g., wss://rmm-api.example.com/ws)
--api-key KEY API key for authentication (required)
--download-url URL Override the default binary download URL
--skip-legacy-check Skip legacy service detection and cleanup
-h, --help Show this help message
Examples:
# Install with API key (uses default server URL)
sudo $0 --api-key grmm_abc123...
# Install with custom server URL
sudo $0 --server-url wss://my-server.com/ws --api-key grmm_abc123...
# Install from custom download URL
sudo $0 --download-url https://myserver.com/agent --api-key grmm_abc123...
EOF
exit 0
}
# Parse arguments
while [[ $# -gt 0 ]]; do
case $1 in
--server-url)
SERVER_URL="$2"
shift 2
;;
--api-key)
API_KEY="$2"
shift 2
;;
--download-url)
DOWNLOAD_URL="$2"
shift 2
;;
--skip-legacy-check)
SKIP_LEGACY_CHECK="--skip-legacy-check"
shift
;;
-h|--help)
usage
;;
*)
error "Unknown option: $1"
;;
esac
done
# Check if running as root
if [ "$EUID" -ne 0 ]; then
error "This script must be run as root. Use: sudo $0 $*"
fi
# Validate required arguments
if [ -z "$API_KEY" ]; then
error "API key is required. Use --api-key YOUR_KEY"
fi
# Detect OS and architecture
detect_platform() {
local os=""
local arch=""
case "$(uname -s)" in
Linux)
os="linux"
;;
Darwin)
os="darwin"
;;
*)
error "Unsupported operating system: $(uname -s)"
;;
esac
case "$(uname -m)" in
x86_64|amd64)
arch="amd64"
;;
aarch64|arm64)
arch="arm64"
;;
armv7l)
arch="armv7"
;;
*)
error "Unsupported architecture: $(uname -m)"
;;
esac
echo "${os}-${arch}"
}
# Check for required commands
check_dependencies() {
local missing=""
for cmd in curl chmod; do
if ! command -v "$cmd" &> /dev/null; then
missing="$missing $cmd"
fi
done
if [ -n "$missing" ]; then
error "Missing required commands:$missing"
fi
}
# Download the agent binary
download_agent() {
local platform="$1"
local dest="$2"
# Adjust download URL for platform if not overridden
local url="$DOWNLOAD_URL"
if [[ "$DOWNLOAD_URL" == *"linux-amd64"* ]]; then
url="${DOWNLOAD_URL/linux-amd64/$platform}"
fi
info "Downloading agent from: $url"
if ! curl -fsSL -o "$dest" "$url"; then
error "Failed to download agent binary"
fi
chmod +x "$dest"
info "Downloaded to: $dest"
}
# Main installation
main() {
info "GuruRMM Agent Installer"
info "======================"
check_dependencies
local platform
platform=$(detect_platform)
info "Detected platform: $platform"
# Create temp directory
TMP_DIR=$(mktemp -d)
local agent_binary="$TMP_DIR/gururmm-agent"
# Download the agent
download_agent "$platform" "$agent_binary"
# Build install command
local install_cmd="$agent_binary install"
if [ -n "$SERVER_URL" ]; then
install_cmd="$install_cmd --server-url \"$SERVER_URL\""
fi
install_cmd="$install_cmd --api-key \"$API_KEY\""
if [ -n "$SKIP_LEGACY_CHECK" ]; then
install_cmd="$install_cmd $SKIP_LEGACY_CHECK"
fi
info "Running installation..."
# Execute install command
eval "$install_cmd"
info ""
info "Installation complete!"
info ""
info "Check agent status with:"
info " sudo systemctl status gururmm-agent"
info ""
info "View logs with:"
info " sudo journalctl -u gururmm-agent -f"
}
main "$@"