Compare commits

...

2 Commits

6 changed files with 39 additions and 26 deletions

View File

@@ -1,4 +1,5 @@
# Seekright Pulse RMM - Central System Production Deployment Manual # Seekright Pulse RMM - Central System Production Deployment Manual
## Fresh Linux Production VM Setup & Operations Guide (Transitional ngrok Testing Setup) ## Fresh Linux Production VM Setup & Operations Guide (Transitional ngrok Testing Setup)
This document serves as the master production setup and deployment manual for hosting the **Seekright Pulse RMM Central System** on a dedicated Virtual Machine (VM). This document serves as the master production setup and deployment manual for hosting the **Seekright Pulse RMM Central System** on a dedicated Virtual Machine (VM).
@@ -8,7 +9,9 @@ This guide focuses on a **Transitional ngrok Testing Setup** designed to get you
--- ---
## 1. Why Use ngrok for VM Testing? ## 1. Why Use ngrok for VM Testing?
Running **ngrok** as a service on the remote VM offers several major benefits for transitional testing: Running **ngrok** as a service on the remote VM offers several major benefits for transitional testing:
1. **Zero Open Ports:** You **do not** need to open port `8000` to the public internet on the VM firewall. ngrok creates a secure outbound TCP connection, protecting your VM backend from external scanners. 1. **Zero Open Ports:** You **do not** need to open port `8000` to the public internet on the VM firewall. ngrok creates a secure outbound TCP connection, protecting your VM backend from external scanners.
2. **URL Reusability:** Remote client agents can continue connecting to your established public ngrok HTTPS URL without requiring any code edits or DNS configurations. 2. **URL Reusability:** Remote client agents can continue connecting to your established public ngrok HTTPS URL without requiring any code edits or DNS configurations.
3. **No SSL Setup Required:** ngrok automatically provides secure, pre-configured HTTPS certificates out-of-the-box. 3. **No SSL Setup Required:** ngrok automatically provides secure, pre-configured HTTPS certificates out-of-the-box.
@@ -19,11 +22,11 @@ Running **ngrok** as a service on the remote VM offers several major benefits fo
When using ngrok, the internal ports are locked down strictly to the loopback interface (`127.0.0.1`), ensuring maximum security during testing. When using ngrok, the internal ports are locked down strictly to the loopback interface (`127.0.0.1`), ensuring maximum security during testing.
| Service | Local Port | Exposed Globally? | Access Method / Firewall | | Service | Local Port | Exposed Globally? | Access Method / Firewall |
|---|---|---|---| | --------------------- | ---------- | ----------------- | ---------------------------------------------------------------------------------- |
| **FastAPI Backend** | `8000` | **No** (Directly) | Bound strictly to `127.0.0.1`. Exposed externally ONLY via the secure ngrok tunnel | | **FastAPI Backend** | `8000` | **No** (Directly) | Bound strictly to `127.0.0.1`. Exposed externally ONLY via the secure ngrok tunnel |
| **MongoDB Community** | `27017` | **No** | Bound strictly to `127.0.0.1`. No external access permitted | | **MongoDB Community** | `27017` | **No** | Bound strictly to `127.0.0.1`. No external access permitted |
| **Prometheus Server** | `9090` | **No** | Bound strictly to `127.0.0.1`. Accessible locally on VM or via SSH port forwarding | | **Prometheus Server** | `9090` | **No** | Bound strictly to `127.0.0.1`. Accessible locally on VM or via SSH port forwarding |
--- ---
@@ -32,7 +35,9 @@ When using ngrok, the internal ports are locked down strictly to the loopback in
Execute these steps chronologically on your remote VM. Execute these steps chronologically on your remote VM.
### Step 1: OS Preparation ### Step 1: OS Preparation
Update system index dependencies, disable sleep loops, and install required tools: Update system index dependencies, disable sleep loops, and install required tools:
```bash ```bash
sudo apt-get update && sudo apt-get upgrade -y sudo apt-get update && sudo apt-get upgrade -y
sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target
@@ -42,6 +47,7 @@ sudo apt-get install -y git curl wget build-essential python3 python3-pip python
--- ---
### Step 2: Install and Configure MongoDB ### Step 2: Install and Configure MongoDB
Install MongoDB Community Edition 8.0 and lock it down to the loopback interface. Install MongoDB Community Edition 8.0 and lock it down to the loopback interface.
```bash ```bash
@@ -70,6 +76,7 @@ sudo systemctl status mongod
--- ---
### Step 3: Set Up the FastAPI Backend ### Step 3: Set Up the FastAPI Backend
Deploy the backend application code under `/opt/rmm-backend` and install dependencies. Deploy the backend application code under `/opt/rmm-backend` and install dependencies.
```bash ```bash
@@ -100,7 +107,9 @@ deactivate
``` ```
#### Run FastAPI as a systemd Background Service #### Run FastAPI as a systemd Background Service
Configure Uvicorn to run as a persistent background daemon: Configure Uvicorn to run as a persistent background daemon:
```bash ```bash
sudo tee /etc/systemd/system/rmm-backend.service << 'EOF' sudo tee /etc/systemd/system/rmm-backend.service << 'EOF'
[Unit] [Unit]
@@ -111,7 +120,7 @@ After=network.target mongod.service
Type=simple Type=simple
User=root User=root
WorkingDirectory=/opt/rmm-backend WorkingDirectory=/opt/rmm-backend
ExecStart=/opt/rmm-backend/venv/bin/uvicorn central_api_prototype:app --host 127.0.0.1 --port 8000 --workers 4 ExecStart=/opt/rmm-backend/venv/bin/uvicorn central_api_prototype:app --host 0.0.0.0 --port 8000 --workers 4
Restart=always Restart=always
RestartSec=5 RestartSec=5
EnvironmentFile=/opt/rmm-backend/.env EnvironmentFile=/opt/rmm-backend/.env
@@ -129,9 +138,11 @@ sudo systemctl start rmm-backend
--- ---
### Step 4: Install and Run ngrok as a Persistent VM Service ### Step 4: Install and Run ngrok as a Persistent VM Service
Since a remote VM is managed via SSH, launching `ngrok http 8000` directly in the shell will terminate as soon as the SSH connection closes. To keep ngrok running persistently in the background on the VM, install and run it as a **systemd service**. Since a remote VM is managed via SSH, launching `ngrok http 8000` directly in the shell will terminate as soon as the SSH connection closes. To keep ngrok running persistently in the background on the VM, install and run it as a **systemd service**.
#### A. Install ngrok on the VM #### A. Install ngrok on the VM
```bash ```bash
# 1. Clean any previous broken list files # 1. Clean any previous broken list files
sudo rm -f /etc/apt/sources.list.d/ngrok.list sudo rm -f /etc/apt/sources.list.d/ngrok.list
@@ -147,12 +158,15 @@ sudo apt-get update && sudo apt-get install -y ngrok
``` ```
#### B. Authenticate ngrok #### B. Authenticate ngrok
Run this command on the VM, substituting `<YOUR_AUTHTOKEN>` with your actual ngrok token: Run this command on the VM, substituting `<YOUR_AUTHTOKEN>` with your actual ngrok token:
```bash ```bash
sudo ngrok config add-authtoken <YOUR_AUTHTOKEN> sudo ngrok config add-authtoken <YOUR_AUTHTOKEN>
``` ```
#### C. Create the ngrok systemd Service File #### C. Create the ngrok systemd Service File
```bash ```bash
sudo tee /etc/systemd/system/ngrok.service << 'EOF' sudo tee /etc/systemd/system/ngrok.service << 'EOF'
[Unit] [Unit]
@@ -176,15 +190,19 @@ sudo systemctl start ngrok
``` ```
#### D. Retrieve Your Public ngrok URL from the VM #### D. Retrieve Your Public ngrok URL from the VM
Because the ngrok agent runs silently in the background, query the local ngrok client API to find the active HTTPS endpoint: Because the ngrok agent runs silently in the background, query the local ngrok client API to find the active HTTPS endpoint:
```bash ```bash
curl http://localhost:4040/api/tunnels curl http://localhost:4040/api/tunnels
``` ```
Look for the `"public_url"` value (e.g. `https://xxxx.ngrok-free.app`) in the JSON output. Look for the `"public_url"` value (e.g. `https://xxxx.ngrok-free.app`) in the JSON output.
--- ---
### Step 5: Configure Firewall Protection (UFW) ### Step 5: Configure Firewall Protection (UFW)
Since ngrok tunnels traffic privately, secure your server by locking down all ports except SSH (`22`). Since ngrok tunnels traffic privately, secure your server by locking down all ports except SSH (`22`).
```bash ```bash

View File

@@ -7,12 +7,12 @@ import psutil
CLIENT_ID = "client_1" CLIENT_ID = "client_1"
import os import os
# Using the public ngrok URL so the agent can connect from anywhere in the world! # Using the central production backend URL
CENTRAL_API_URL = f"https://culprit-campfire-galore.ngrok-free.dev/api/get-command?client_id={CLIENT_ID}" CENTRAL_API_URL = f"http://rmm-backend.seekright.com/api/get-command?client_id={CLIENT_ID}"
CENTRAL_TELEMETRY_URL = f"https://culprit-campfire-galore.ngrok-free.dev/api/telemetry?client_id={CLIENT_ID}" CENTRAL_TELEMETRY_URL = f"http://rmm-backend.seekright.com/api/telemetry?client_id={CLIENT_ID}"
platform_name = "nt" if os.name == "nt" else "posix" platform_name = "nt" if os.name == "nt" else "posix"
CENTRAL_COMMANDS_URL = f"https://culprit-campfire-galore.ngrok-free.dev/api/get-commands?platform={platform_name}" CENTRAL_COMMANDS_URL = f"http://rmm-backend.seekright.com/api/get-commands?platform={platform_name}"
# SECURITY MECHANISM: The "Whitelist" # SECURITY MECHANISM: The "Whitelist"
# The agent NEVER executes arbitrary strings from the internet. # The agent NEVER executes arbitrary strings from the internet.

View File

@@ -46,11 +46,11 @@ import os
CLIENT_ID = "TEMPLATE_CLIENT_ID" CLIENT_ID = "TEMPLATE_CLIENT_ID"
CENTRAL_API_URL = f"https://culprit-campfire-galore.ngrok-free.dev/api/get-command?client_id={CLIENT_ID}" CENTRAL_API_URL = f"http://rmm-backend.seekright.com/api/get-command?client_id={CLIENT_ID}"
CENTRAL_TELEMETRY_URL = f"https://culprit-campfire-galore.ngrok-free.dev/api/telemetry?client_id={CLIENT_ID}" CENTRAL_TELEMETRY_URL = f"http://rmm-backend.seekright.com/api/telemetry?client_id={CLIENT_ID}"
platform_name = "nt" if os.name == "nt" else "posix" platform_name = "nt" if os.name == "nt" else "posix"
CENTRAL_COMMANDS_URL = f"https://culprit-campfire-galore.ngrok-free.dev/api/get-commands?platform={platform_name}" CENTRAL_COMMANDS_URL = f"http://rmm-backend.seekright.com/api/get-commands?platform={platform_name}"
CACHED_COMMANDS = {} CACHED_COMMANDS = {}

View File

@@ -26,7 +26,7 @@ scrape_configs:
# - job_name: "desktop_ngrok_test" # - job_name: "desktop_ngrok_test"
# scheme: https # scheme: https
# static_configs: # static_configs:
# - targets: ["culprit-campfire-galore.ngrok-free.dev"] # - targets: ["rmm-backend.seekright.com"]
# #
# - job_name: "sasi_gpu" # - job_name: "sasi_gpu"
# scheme: https # scheme: https

View File

@@ -15,17 +15,11 @@ import {
Play Play
} from 'lucide-react'; } from 'lucide-react';
const API_BASE = 'https://culprit-campfire-galore.ngrok-free.dev'; // Target FastAPI central server in production VM const API_BASE = 'http://rmm-backend.seekright.com'; // Target FastAPI central server in production VM
// Secure API fetch wrapper to automatically bypass ngrok's transitional browser warning page // Secure API fetch wrapper
const apiFetch = (url, options = {}) => { const apiFetch = (url, options = {}) => {
return fetch(url, { return fetch(url, options);
...options,
headers: {
...options.headers,
'ngrok-skip-browser-warning': 'true'
}
});
}; };
function App() { function App() {

View File

@@ -5,7 +5,8 @@ import react from '@vitejs/plugin-react'
export default defineConfig({ export default defineConfig({
plugins: [react()], plugins: [react()],
server: { server: {
host: 'localhost', host: '0.0.0.0',
port: 8080, port: 4173,
allowedHosts: ["rmm.seekright.com"]
}, },
}) })