diff --git a/README.md b/README.md index 3e8cd7bd..113fbd96 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ opkg → apt + repo apt.secubox.in --- -## Packages (30 modules) +## Packages (93 modules) ### Core & Dashboard | Package | Description | @@ -97,20 +97,49 @@ opkg → apt + repo apt.secubox.in ## Quick Start -### Live USB (Recommended) +### VirtualBox (Fastest) -The fastest way to try SecuBox - boot directly from USB with all packages pre-installed. +Test SecuBox in VirtualBox in 2 minutes: + +```bash +# One-liner: Download, convert, create VM, and start +curl -sLO https://github.com/CyberMind-FR/secubox-deb/releases/download/v1.5.0/secubox-live-amd64-bookworm.img.gz && \ +gunzip secubox-live-amd64-bookworm.img.gz && \ +VBoxManage convertfromraw secubox-live-amd64-bookworm.img secubox-live.vdi --format VDI && \ +curl -sL https://raw.githubusercontent.com/CyberMind-FR/secubox-deb/master/scripts/create-secubox-vm.sh | bash -s -- secubox-live.vdi +``` + +Or step by step: + +```bash +# 1. Download and extract +wget https://github.com/CyberMind-FR/secubox-deb/releases/download/v1.5.0/secubox-live-amd64-bookworm.img.gz +gunzip secubox-live-amd64-bookworm.img.gz + +# 2. Use the VM creation script +./scripts/create-secubox-vm.sh secubox-live-amd64-bookworm.img + +# 3. Access (wait 30-60s for boot) +ssh -p 2222 root@localhost # Password: secubox +firefox https://localhost:9443 # Web UI +``` + +See [wiki/Live-USB-VirtualBox.md](wiki/Live-USB-VirtualBox.md) for full documentation. + +### Live USB (Hardware) + +Boot directly from USB with all packages pre-installed: ```bash # Download latest release -wget https://github.com/CyberMind-FR/secubox-deb/releases/latest/download/secubox-live-amd64-bookworm.img.gz +wget https://github.com/CyberMind-FR/secubox-deb/releases/download/v1.5.0/secubox-live-amd64-bookworm.img.gz # Flash to USB (replace /dev/sdX with your device) zcat secubox-live-amd64-bookworm.img.gz | sudo dd of=/dev/sdX bs=4M status=progress sync # Boot from USB and access: -# Web UI: https://:8443 (admin / admin) +# Web UI: https://:443 # SSH: root / secubox ``` diff --git a/scripts/create-secubox-vm.sh b/scripts/create-secubox-vm.sh new file mode 100755 index 00000000..590836d0 --- /dev/null +++ b/scripts/create-secubox-vm.sh @@ -0,0 +1,199 @@ +#!/bin/bash +# SecuBox VirtualBox VM Creator +# CyberMind — https://cybermind.fr +# +# Usage: +# ./create-secubox-vm.sh +# ./create-secubox-vm.sh # Auto-converts to VDI +# ./create-secubox-vm.sh --download # Downloads latest and creates VM +# +# Examples: +# ./create-secubox-vm.sh secubox-live.vdi +# ./create-secubox-vm.sh --download +# ./create-secubox-vm.sh secubox-live.img --name "SecuBox-Test" + +set -euo pipefail + +# Colors +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +CYAN='\033[0;36m' +NC='\033[0m' + +# Defaults +VM_NAME="SecuBox-Live" +MEMORY=4096 +CPUS=2 +VRAM=128 +SSH_PORT=2222 +HTTPS_PORT=9443 +FIRMWARE="efi" +DOWNLOAD_URL="https://github.com/CyberMind-FR/secubox-deb/releases/latest/download/secubox-live-amd64-bookworm.img.gz" + +usage() { + cat << EOF +SecuBox VirtualBox VM Creator + +Usage: $0 [OPTIONS] + +Options: + --name NAME VM name (default: SecuBox-Live) + --memory MB RAM in MB (default: 4096) + --cpus N CPU count (default: 2) + --ssh-port PORT SSH forward port (default: 2222) + --https-port PORT HTTPS forward port (default: 9443) + --headless Start in headless mode + --no-start Create VM but don't start + --download Download latest image first + -h, --help Show this help + +Examples: + $0 secubox-live.vdi + $0 secubox-live.img --name "SecuBox-Dev" + $0 --download --headless + $0 --download --ssh-port 2223 --https-port 9444 + +EOF + exit 0 +} + +log() { echo -e "${GREEN}[+]${NC} $1"; } +warn() { echo -e "${YELLOW}[!]${NC} $1"; } +error() { echo -e "${RED}[!]${NC} $1"; exit 1; } +info() { echo -e "${CYAN}[i]${NC} $1"; } + +# Parse arguments +IMAGE="" +HEADLESS=false +NO_START=false +DOWNLOAD=false + +while [[ $# -gt 0 ]]; do + case $1 in + --name) VM_NAME="$2"; shift 2 ;; + --memory) MEMORY="$2"; shift 2 ;; + --cpus) CPUS="$2"; shift 2 ;; + --ssh-port) SSH_PORT="$2"; shift 2 ;; + --https-port) HTTPS_PORT="$2"; shift 2 ;; + --headless) HEADLESS=true; shift ;; + --no-start) NO_START=true; shift ;; + --download) DOWNLOAD=true; shift ;; + -h|--help) usage ;; + -*) error "Unknown option: $1" ;; + *) IMAGE="$1"; shift ;; + esac +done + +# Check VirtualBox +command -v VBoxManage &>/dev/null || error "VirtualBox not installed" + +# Download if requested +if $DOWNLOAD; then + log "Downloading SecuBox Live image..." + if command -v wget &>/dev/null; then + wget -q --show-progress -O secubox-live.img.gz "$DOWNLOAD_URL" + elif command -v curl &>/dev/null; then + curl -L -o secubox-live.img.gz "$DOWNLOAD_URL" + else + error "wget or curl required for download" + fi + log "Extracting..." + gunzip -f secubox-live.img.gz + IMAGE="secubox-live.img" +fi + +# Validate image +[[ -n "$IMAGE" ]] || error "No image specified. Use --download or provide image path." +[[ -f "$IMAGE" ]] || error "Image not found: $IMAGE" + +# Convert IMG to VDI if needed +if [[ "$IMAGE" == *.img ]]; then + VDI="${IMAGE%.img}.vdi" + if [[ ! -f "$VDI" ]]; then + log "Converting IMG to VDI..." + VBoxManage convertfromraw "$IMAGE" "$VDI" --format VDI + else + info "Using existing VDI: $VDI" + fi + IMAGE="$VDI" +fi + +# Get absolute path +IMAGE="$(realpath "$IMAGE")" + +# Check if VM exists +if VBoxManage showvminfo "$VM_NAME" &>/dev/null; then + warn "VM '$VM_NAME' already exists" + read -p "Delete and recreate? [y/N] " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + VBoxManage controlvm "$VM_NAME" poweroff 2>/dev/null || true + sleep 1 + VBoxManage unregistervm "$VM_NAME" --delete 2>/dev/null || true + else + error "Aborted" + fi +fi + +# Create VM +log "Creating VM: $VM_NAME" +VBoxManage createvm --name "$VM_NAME" --ostype "Debian_64" --register + +# Configure VM +log "Configuring VM (${MEMORY}MB RAM, ${CPUS} CPUs)..." +VBoxManage modifyvm "$VM_NAME" \ + --memory "$MEMORY" \ + --cpus "$CPUS" \ + --vram "$VRAM" \ + --graphicscontroller vboxsvga \ + --firmware "$FIRMWARE" \ + --boot1 disk \ + --boot2 none \ + --nic1 nat \ + --natpf1 "SSH,tcp,,$SSH_PORT,,22" \ + --natpf1 "HTTPS,tcp,,$HTTPS_PORT,,443" \ + --clipboard bidirectional \ + --draganddrop bidirectional \ + --usb on \ + --audio-enabled off + +# Add storage controller +log "Attaching disk..." +VBoxManage storagectl "$VM_NAME" --name "SATA" --add sata --controller IntelAhci +VBoxManage storageattach "$VM_NAME" --storagectl "SATA" --port 0 --device 0 \ + --type hdd --medium "$IMAGE" + +# Show summary +echo "" +echo -e "${GREEN}════════════════════════════════════════════════════════${NC}" +echo -e "${GREEN} SecuBox VM Created Successfully${NC}" +echo -e "${GREEN}════════════════════════════════════════════════════════${NC}" +echo "" +echo -e " VM Name: ${CYAN}$VM_NAME${NC}" +echo -e " Memory: ${MEMORY}MB" +echo -e " CPUs: $CPUS" +echo -e " Disk: $IMAGE" +echo "" +echo -e " ${YELLOW}Access (after boot):${NC}" +echo -e " SSH: ssh -p $SSH_PORT root@localhost" +echo -e " Web UI: https://localhost:$HTTPS_PORT" +echo -e " Password: ${CYAN}secubox${NC}" +echo "" + +# Start VM +if ! $NO_START; then + log "Starting VM..." + if $HEADLESS; then + VBoxManage startvm "$VM_NAME" --type headless + info "VM running in headless mode" + info "Use 'VBoxManage controlvm $VM_NAME poweroff' to stop" + else + VBoxManage startvm "$VM_NAME" --type gui + fi + echo "" + info "Wait 30-60 seconds for boot to complete" +else + info "VM created but not started (--no-start)" + info "Start with: VBoxManage startvm \"$VM_NAME\"" +fi diff --git a/templates/SecuBox-Live.vbox.template b/templates/SecuBox-Live.vbox.template new file mode 100644 index 00000000..476a3afa --- /dev/null +++ b/templates/SecuBox-Live.vbox.template @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wiki/Live-USB-VirtualBox.md b/wiki/Live-USB-VirtualBox.md new file mode 100644 index 00000000..2311dc78 --- /dev/null +++ b/wiki/Live-USB-VirtualBox.md @@ -0,0 +1,217 @@ +# Live USB to VirtualBox — Quick Start Guide + +Test SecuBox on VirtualBox in minutes using the pre-built live image. + +## Prerequisites + +- VirtualBox 7.0+ installed +- 8GB free disk space +- 4GB RAM available + +## Quick Start (One-Liner) + +```bash +# Download and create VM in one command +curl -sL https://github.com/CyberMind-FR/secubox-deb/releases/download/v1.5.0/secubox-live-amd64-bookworm.img.gz | \ + gunzip > secubox-live.img && \ + VBoxManage convertfromraw secubox-live.img secubox-live.vdi --format VDI && \ + bash <(curl -sL https://raw.githubusercontent.com/CyberMind-FR/secubox-deb/master/scripts/create-secubox-vm.sh) secubox-live.vdi +``` + +## Step-by-Step Guide + +### 1. Download the Live Image + +```bash +# From GitHub Releases +wget https://github.com/CyberMind-FR/secubox-deb/releases/download/v1.5.0/secubox-live-amd64-bookworm.img.gz + +# Extract +gunzip secubox-live-amd64-bookworm.img.gz +``` + +### 2. Convert IMG to VDI + +VirtualBox requires VDI format: + +```bash +VBoxManage convertfromraw secubox-live-amd64-bookworm.img secubox-live.vdi --format VDI +``` + +### 3. Create the VM + +#### Option A: Using the Script + +```bash +# Download and run the VM creation script +curl -sLO https://raw.githubusercontent.com/CyberMind-FR/secubox-deb/master/scripts/create-secubox-vm.sh +chmod +x create-secubox-vm.sh +./create-secubox-vm.sh secubox-live.vdi +``` + +#### Option B: Manual Commands + +```bash +VM_NAME="SecuBox-Live" +VDI_PATH="$(pwd)/secubox-live.vdi" + +# Create VM +VBoxManage createvm --name "$VM_NAME" --ostype "Debian_64" --register + +# Configure VM +VBoxManage modifyvm "$VM_NAME" \ + --memory 4096 \ + --cpus 2 \ + --vram 128 \ + --graphicscontroller vboxsvga \ + --firmware efi \ + --boot1 disk \ + --nic1 nat \ + --natpf1 "SSH,tcp,,2222,,22" \ + --natpf1 "HTTPS,tcp,,9443,,443" + +# Add storage +VBoxManage storagectl "$VM_NAME" --name "SATA" --add sata --controller IntelAhci +VBoxManage storageattach "$VM_NAME" --storagectl "SATA" --port 0 --device 0 --type hdd --medium "$VDI_PATH" +``` + +### 4. Start the VM + +```bash +# GUI mode +VBoxManage startvm "SecuBox-Live" --type gui + +# Headless mode (background) +VBoxManage startvm "SecuBox-Live" --type headless +``` + +### 5. Access SecuBox + +Wait 30-60 seconds for boot, then: + +| Access | Command/URL | +|--------|-------------| +| **SSH** | `ssh -p 2222 root@localhost` | +| **Web UI** | https://localhost:9443 | +| **Password** | `secubox` | + +## Complete Script + +Save as `secubox-vbox-quickstart.sh`: + +```bash +#!/bin/bash +# SecuBox VirtualBox Quick Start +# Usage: ./secubox-vbox-quickstart.sh [image.img] + +set -euo pipefail + +IMG="${1:-secubox-live-amd64-bookworm.img}" +VDI="${IMG%.img}.vdi" +VM_NAME="SecuBox-Live-$(date +%Y%m%d)" + +# Check if image exists +if [[ ! -f "$IMG" ]]; then + echo "Downloading SecuBox Live image..." + wget -q --show-progress \ + https://github.com/CyberMind-FR/secubox-deb/releases/download/v1.5.0/secubox-live-amd64-bookworm.img.gz + gunzip secubox-live-amd64-bookworm.img.gz + IMG="secubox-live-amd64-bookworm.img" + VDI="${IMG%.img}.vdi" +fi + +# Convert to VDI if needed +if [[ ! -f "$VDI" ]]; then + echo "Converting to VDI format..." + VBoxManage convertfromraw "$IMG" "$VDI" --format VDI +fi + +# Remove existing VM +VBoxManage unregistervm "$VM_NAME" --delete 2>/dev/null || true + +# Create VM +echo "Creating VM: $VM_NAME" +VBoxManage createvm --name "$VM_NAME" --ostype "Debian_64" --register + +# Configure +VBoxManage modifyvm "$VM_NAME" \ + --memory 4096 \ + --cpus 2 \ + --vram 128 \ + --graphicscontroller vboxsvga \ + --firmware efi \ + --boot1 disk \ + --nic1 nat \ + --natpf1 "SSH,tcp,,2222,,22" \ + --natpf1 "HTTPS,tcp,,9443,,443" \ + --clipboard bidirectional + +# Storage +VBoxManage storagectl "$VM_NAME" --name "SATA" --add sata --controller IntelAhci +VBoxManage storageattach "$VM_NAME" --storagectl "SATA" --port 0 --device 0 \ + --type hdd --medium "$(realpath "$VDI")" + +# Start +echo "Starting VM..." +VBoxManage startvm "$VM_NAME" --type gui + +echo "" +echo "=== SecuBox VM Ready ===" +echo "SSH: ssh -p 2222 root@localhost" +echo "Web: https://localhost:9443" +echo "Pass: secubox" +echo "" +echo "Wait 30-60 seconds for boot to complete." +``` + +## Troubleshooting + +### VM won't boot (black screen) + +```bash +# Try BIOS instead of EFI +VBoxManage modifyvm "SecuBox-Live" --firmware bios +``` + +### Port already in use + +```bash +# Use different ports +VBoxManage modifyvm "SecuBox-Live" --natpf1 delete "SSH" +VBoxManage modifyvm "SecuBox-Live" --natpf1 delete "HTTPS" +VBoxManage modifyvm "SecuBox-Live" --natpf1 "SSH,tcp,,2223,,22" +VBoxManage modifyvm "SecuBox-Live" --natpf1 "HTTPS,tcp,,9444,,443" +``` + +### Graphics issues + +```bash +# Disable 3D acceleration +VBoxManage modifyvm "SecuBox-Live" --accelerate3d off --graphicscontroller vmsvga +``` + +### Check VM status + +```bash +VBoxManage list runningvms +VBoxManage showvminfo "SecuBox-Live" | head -40 +``` + +## Cleanup + +```bash +# Stop VM +VBoxManage controlvm "SecuBox-Live" poweroff + +# Delete VM and files +VBoxManage unregistervm "SecuBox-Live" --delete + +# Remove VDI +rm -f secubox-live.vdi +``` + +## See Also + +- [Installation Guide](Installation.md) +- [Build from Source](Building.md) +- [Hardware Deployment](Hardware.md) diff --git a/wiki/_Sidebar.md b/wiki/_Sidebar.md index 228bfc43..f0b00f67 100644 --- a/wiki/_Sidebar.md +++ b/wiki/_Sidebar.md @@ -1,6 +1,7 @@ **[Home](Home)** | [FR](Home-FR) | [中文](Home-ZH) ### Getting Started +* [[Live-USB-VirtualBox|VirtualBox Quick Start]] ⭐ * [[Live-USB]] | [FR](Live-USB-FR) | [中文](Live-USB-ZH) * [[Installation]] | [FR](Installation-FR) | [中文](Installation-ZH)