From db2e4f8959b568400995f024833c978e984ff29e Mon Sep 17 00:00:00 2001 From: NixReaper Date: Sat, 11 Apr 2026 15:48:55 -0500 Subject: [PATCH] =?UTF-8?q?chore:=20initial=20public=20repo=20=E2=80=94=20?= =?UTF-8?q?README,=20install=20script,=20changelog,=20license?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 + CHANGELOG.md | 97 +++++++++++++++ LICENSE | 22 ++++ README.md | 89 ++++++++++++++ install.sh | 327 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 538 insertions(+) create mode 100644 .gitignore create mode 100644 CHANGELOG.md create mode 100644 LICENSE create mode 100644 README.md create mode 100644 install.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..71c5423 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.DS_Store +Thumbs.db +*.log diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ac0671d --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,97 @@ +# NixPanel Changelog + +All notable changes to NixPanel are documented here. +Versioning follows [Semantic Versioning](https://semver.org/). + +--- + +## [0.5.0] — 2026-04-11 + +### Bug Fixes +- Clean install on every update — `node_modules` and lock file are always regenerated fresh on the server platform, eliminating rollup native binary mismatches between Windows dev machines and Linux servers. +- `update.sh` no longer blocked by local `package-lock.json` changes. +- `.gitignore` corrected for `nixserver/` and `nixclient/` dist paths. + +--- + +## [0.4.8] — 2026-04-11 + +### Bug Fixes +- Login page now fetches version from `/api/health` dynamically instead of showing a hardcoded stale version number. +- Login page subtitle changed from "Web Host Manager" to "Admin Panel". + +--- + +## [0.4.6] — 2026-04-11 + +### Changes +- Removed all WHM® trademark references throughout the panel. All instances replaced with "NixServer". + +--- + +## [0.4.5] — 2026-04-11 + +### New Features +- **Day/Night mode toggle** — sun/moon flip switch in the dashboard info bar. Preference persisted across sessions. + +### Bug Fixes +- Sidebar version refresh now clears stale value immediately and cache-busts the API response. +- `uptime` added to exec allowlist — fixes Hostname/OS showing `…` on the dashboard. +- Version fetch auto-retries every 5 s after failure (handles post-upgrade service restart window). + +--- + +## [0.4.4] — 2026-04-11 + +### New Features +- **Server info bar** — cPanel-style strip at the top of the dashboard showing Username, Hostname, OS, NixPanel Version, live Load Averages, and Server Monitoring alert count. + +--- + +## [0.4.3] — 2026-04-11 + +### New Features +- **Version display in sidebar** — shows installed version with up-to-date / update-available indicator. +- **One-click panel upgrade** — upgrade button in the sidebar footer runs `update.sh` in the background. Panel restarts automatically. +- **Check for updates** — refresh icon re-fetches version on demand. + +--- + +## [0.4.2] — 2026-04-11 + +### New Features +- **NixServer sidebar redesigned** — full collapsible category sidebar with 29 categories and ~210 menu items. Live search, auto-expand active category, sidebar toggle. + +--- + +## [0.4.1] — 2026-04-11 + +### Bug Fixes (Installer) +- SpamAssassin: Ubuntu 24.04 service name is `spamd`, not `spamassassin`. +- PowerDNS: `systemd-resolved` stub listener disabled before package install to free port 53. +- Git clone into pre-existing directory handled correctly. +- Apache 403 fixed — post-build `chmod 755/644` on all dist assets. +- Apache 500 fixed — `mod_proxy_http` and `mod_proxy_wstunnel` now enabled. + +--- + +## [0.4.0] — 2026-04-11 + +### New Features +- Shell Access Manager — enable/disable SSH shell access per hosting account. +- Apache Log Viewer — view access/error logs per account. +- WebServer page rewritten to Apache-only stack. + +--- + +## [0.3.x] — 2026-04-10 + +### Architecture +- Full service stack: Apache2 + PHP-FPM, PowerDNS, Exim4, Dovecot, MariaDB, SQLite (panel DB). +- Complete MariaDB management, email routing, certbot SSL, Fail2ban. + +--- + +## [0.2.0] + +- Initial development release. Renamed to NixServer / NixClient. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c93b09f --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +NixPanel Source Available License v1.0 + +Copyright (c) 2026 NixReaper + +Permission is hereby granted to use, copy, and run this software for personal +or internal business use, subject to the following conditions: + +1. REDISTRIBUTION PROHIBITED — You may not redistribute, resell, sublicense, + or offer this software (or any derivative) as a service without explicit + written permission from the copyright holder. + +2. MODIFICATION — You may modify the software for your own use. Modified + versions may not be distributed publicly or commercially. + +3. ATTRIBUTION — Any permitted use must retain this copyright notice and + license in all copies or substantial portions of the software. + +4. NO WARRANTY — The software is provided "as is", without warranty of any + kind. The copyright holder is not liable for any damages arising from use. + +For commercial licensing, white-labelling, or reseller arrangements contact: + https://nixpanel.io diff --git a/README.md b/README.md new file mode 100644 index 0000000..08117af --- /dev/null +++ b/README.md @@ -0,0 +1,89 @@ +# NixPanel + +A modern, open-source web hosting control panel for Linux servers — a free alternative to cPanel/WHM. + +**NixServer** (port 2087) — Server admin panel for managing accounts, DNS, email, databases, SSL, and services. +**NixClient** (port 2083) — End-user panel for hosting account holders. + +--- + +## Requirements + +| Component | Version | +|-----------|---------| +| OS | Ubuntu 24.04 LTS | +| Architecture | x86_64 | +| RAM | 2 GB minimum, 4 GB recommended | +| Disk | 20 GB minimum | +| Root access | Required | + +--- + +## Quick Install + +```bash +bash <(curl -fsSL https://raw.githubusercontent.com/NixReaper/nixpanel/main/install.sh) +``` + +Or download and inspect first: + +```bash +curl -fsSL https://raw.githubusercontent.com/NixReaper/nixpanel/main/install.sh -o install.sh +less install.sh +bash install.sh +``` + +--- + +## What Gets Installed + +| Component | Role | +|-----------|------| +| Apache 2 + PHP-FPM 8.2/8.3 | Web server | +| PowerDNS | DNS server | +| Exim4 | Mail transfer agent | +| Dovecot | IMAP / POP3 server | +| MariaDB | Database server | +| SpamAssassin | Spam filtering | +| Fail2ban | Brute force protection | +| Let's Encrypt (certbot) | Free SSL certificates | +| NixPanel | Control panel (ports 2083, 2087) | + +--- + +## After Installation + +| Panel | URL | Default credentials | +|-------|-----|---------------------| +| NixServer (admin) | `https://your-ip:2087` | Set during install | +| NixClient (user) | `https://your-ip:2083` | Per-account | + +--- + +## Updating + +```bash +bash /opt/nixpanel/scripts/update.sh +``` + +Or click **Upgrade Panel** in the NixServer sidebar. + +--- + +## Stack + +- **Backend** — Node.js (Fastify), SQLite (panel DB), Prisma ORM +- **Frontend** — React 18, Tailwind CSS, Vite +- **Auth** — JWT (access + refresh tokens), bcrypt + +--- + +## Changelog + +See [CHANGELOG.md](CHANGELOG.md) for full version history. + +--- + +## License + +NixPanel is source-available software. See [LICENSE](LICENSE) for details. diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..d2250a8 --- /dev/null +++ b/install.sh @@ -0,0 +1,327 @@ +#!/usr/bin/env bash +# NixPanel Installer +# https://github.com/NixReaper/nixpanel +set -euo pipefail + +RED='\033[0;31m'; GREEN='\033[0;32m'; CYAN='\033[0;36m'; YELLOW='\033[1;33m' +BOLD='\033[1m'; RESET='\033[0m' + +info() { echo -e "${CYAN}[INFO]${RESET} $*"; } +success() { echo -e "${GREEN}[OK]${RESET} $*"; } +warn() { echo -e "${YELLOW}[WARN]${RESET} $*"; } +error() { echo -e "${RED}[ERROR]${RESET} $*" >&2; exit 1; } +step() { echo -e "\n${BOLD}${CYAN}━━━ $* ━━━${RESET}"; } + +# ── Preflight ────────────────────────────────────────────────────────────────── + +[[ $EUID -ne 0 ]] && error "Must be run as root (sudo bash install.sh)" + +OS_ID=$(. /etc/os-release && echo "$ID") +OS_VERSION=$(. /etc/os-release && echo "$VERSION_ID") +ARCH=$(uname -m) + +[[ "$OS_ID" != "ubuntu" ]] && error "NixPanel requires Ubuntu 24.04 LTS (detected: $OS_ID)" +[[ "$OS_VERSION" != "24.04" ]] && error "NixPanel requires Ubuntu 24.04 LTS (detected: Ubuntu $OS_VERSION)" +[[ "$ARCH" != "x86_64" ]] && error "NixPanel requires x86_64 architecture (detected: $ARCH)" + +INSTALL_DIR="/opt/nixpanel" +DATA_DIR="/opt/nixpanel/data" +LOG_DIR="/opt/nixpanel/logs" +STEP_DIR="/var/lib/nixpanel/install" +GITHUB_REPO="NixReaper/nixpanel" + +mkdir -p "$STEP_DIR" "$DATA_DIR" "$LOG_DIR" + +mark_done() { touch "$STEP_DIR/$1.done"; } +step_done() { [[ -f "$STEP_DIR/$1.done" ]]; } + +echo "" +echo -e "${BOLD}${CYAN}" +echo " ███╗ ██╗██╗██╗ ██╗██████╗ █████╗ ███╗ ██╗███████╗██╗ " +echo " ████╗ ██║██║╚██╗██╔╝██╔══██╗██╔══██╗████╗ ██║██╔════╝██║ " +echo " ██╔██╗ ██║██║ ╚███╔╝ ██████╔╝███████║██╔██╗ ██║█████╗ ██║ " +echo " ██║╚██╗██║██║ ██╔██╗ ██╔═══╝ ██╔══██║██║╚██╗██║██╔══╝ ██║ " +echo " ██║ ╚████║██║██╔╝ ██╗██║ ██║ ██║██║ ╚████║███████╗███████╗" +echo " ╚═╝ ╚═══╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚══════╝╚══════╝" +echo -e "${RESET}" +echo -e " Web Hosting Control Panel · Ubuntu 24.04 · x86_64" +echo "" + +# ── Helper: latest release version ──────────────────────────────────────────── + +get_latest_version() { + curl -fsSL "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" \ + | grep '"tag_name"' | cut -d'"' -f4 +} + +# ── System packages ──────────────────────────────────────────────────────────── + +step "Updating system packages" +if ! step_done "apt_update"; then + export DEBIAN_FRONTEND=noninteractive + apt-get update -qq + apt-get upgrade -y -qq + mark_done "apt_update" +fi +success "System packages up to date" + +step "Freeing port 53 for PowerDNS" +if ! step_done "resolved_stub"; then + sed -i 's/#DNSStubListener=yes/DNSStubListener=no/' /etc/systemd/resolved.conf 2>/dev/null || true + sed -i 's/^DNSStubListener=yes/DNSStubListener=no/' /etc/systemd/resolved.conf 2>/dev/null || true + echo "DNSStubListener=no" >> /etc/systemd/resolved.conf + systemctl restart systemd-resolved 2>/dev/null || true + mark_done "resolved_stub" +fi +success "Port 53 free" + +step "Installing service stack" +if ! step_done "packages"; then + export DEBIAN_FRONTEND=noninteractive + apt-get install -y -qq \ + apache2 \ + php8.3 php8.3-fpm php8.3-cli php8.3-mysql php8.3-curl php8.3-mbstring \ + php8.3-xml php8.3-zip php8.3-gd php8.3-intl php8.3-bcmath \ + php8.2 php8.2-fpm php8.2-cli php8.2-mysql php8.2-curl php8.2-mbstring \ + php8.2-xml php8.2-zip php8.2-gd php8.2-intl php8.2-bcmath \ + mariadb-server mariadb-client \ + pdns-server pdns-backend-bind \ + exim4 exim4-daemon-light \ + dovecot-imapd dovecot-pop3d dovecot-lmtpd \ + spamassassin spamc \ + certbot python3-certbot-apache \ + fail2ban \ + curl wget git unzip software-properties-common \ + openssl ca-certificates \ + nodejs npm 2>/dev/null || true + mark_done "packages" +fi +success "Service stack installed" + +# ── Apache ───────────────────────────────────────────────────────────────────── + +step "Configuring Apache" +if ! step_done "apache"; then + a2enmod rewrite ssl proxy proxy_http proxy_wstunnel proxy_fcgi headers expires deflate 2>/dev/null || true + systemctl enable apache2 + systemctl start apache2 + mark_done "apache" +fi +success "Apache configured" + +# ── MariaDB ──────────────────────────────────────────────────────────────────── + +step "Configuring MariaDB" +if ! step_done "mariadb"; then + systemctl enable mariadb + systemctl start mariadb + mark_done "mariadb" +fi +success "MariaDB ready" + +# ── PowerDNS ─────────────────────────────────────────────────────────────────── + +step "Configuring PowerDNS" +if ! step_done "pdns"; then + systemctl enable pdns + systemctl start pdns 2>/dev/null || true + mark_done "pdns" +fi +success "PowerDNS ready" + +# ── SpamAssassin ─────────────────────────────────────────────────────────────── + +step "Configuring SpamAssassin" +if ! step_done "spamd"; then + systemctl enable spamd + systemctl start spamd 2>/dev/null || true + mark_done "spamd" +fi +success "SpamAssassin ready" + +# ── Download NixPanel release ────────────────────────────────────────────────── + +step "Downloading NixPanel" +if ! step_done "download"; then + VERSION=$(get_latest_version) + [[ -z "$VERSION" ]] && error "Could not determine latest NixPanel version" + info "Latest version: $VERSION" + + mkdir -p "$INSTALL_DIR" + TMP_DIR=$(mktemp -d) + TARBALL_URL="https://github.com/${GITHUB_REPO}/releases/download/${VERSION}/nixpanel-${VERSION}-linux-x64.tar.gz" + + info "Downloading release tarball..." + curl -fsSL "$TARBALL_URL" -o "$TMP_DIR/nixpanel.tar.gz" \ + || error "Failed to download NixPanel $VERSION from GitHub Releases" + + tar -xzf "$TMP_DIR/nixpanel.tar.gz" -C "$TMP_DIR" + cp -a "$TMP_DIR/nixpanel-${VERSION}"/. "$INSTALL_DIR/" + rm -rf "$TMP_DIR" + mark_done "download" +fi +success "NixPanel downloaded" + +# ── Environment ──────────────────────────────────────────────────────────────── + +step "Configuring environment" +if ! step_done "env"; then + if [[ ! -f "$INSTALL_DIR/.env" ]]; then + JWT_SECRET=$(openssl rand -hex 32) + REFRESH_SECRET=$(openssl rand -hex 32) + DB_PASS=$(openssl rand -hex 16) + cat > "$INSTALL_DIR/.env" </dev/null || true + mark_done "db_init" +fi +success "Database ready" + +# ── Admin account ────────────────────────────────────────────────────────────── + +step "Creating admin account" +if ! step_done "admin_account"; then + echo "" + echo -e " ${BOLD}Create your NixServer admin account${RESET}" + read -rp " Admin username [admin]: " ADMIN_USER + ADMIN_USER="${ADMIN_USER:-admin}" + read -rsp " Admin password: " ADMIN_PASS + echo "" + read -rsp " Confirm password: " ADMIN_PASS2 + echo "" + [[ "$ADMIN_PASS" != "$ADMIN_PASS2" ]] && error "Passwords do not match" + read -rp " Admin email: " ADMIN_EMAIL + + node "$INSTALL_DIR/scripts/create-admin.js" \ + --username "$ADMIN_USER" \ + --password "$ADMIN_PASS" \ + --email "$ADMIN_EMAIL" \ + || error "Failed to create admin account" + mark_done "admin_account" +fi +success "Admin account ready" + +# ── Permissions ──────────────────────────────────────────────────────────────── + +step "Setting permissions" +chmod 755 "$INSTALL_DIR" +[[ -d "$INSTALL_DIR/nixserver/dist" ]] && { + chmod 755 "$INSTALL_DIR/nixserver" + find "$INSTALL_DIR/nixserver/dist" -type d -exec chmod 755 {} \; + find "$INSTALL_DIR/nixserver/dist" -type f -exec chmod 644 {} \; +} +[[ -d "$INSTALL_DIR/nixclient/dist" ]] && { + chmod 755 "$INSTALL_DIR/nixclient" + find "$INSTALL_DIR/nixclient/dist" -type d -exec chmod 755 {} \; + find "$INSTALL_DIR/nixclient/dist" -type f -exec chmod 644 {} \; +} +chmod 755 "$INSTALL_DIR/bin/nixpanel" 2>/dev/null || true +success "Permissions set" + +# ── Systemd service ──────────────────────────────────────────────────────────── + +step "Installing systemd service" +if ! step_done "systemd"; then + cat > /etc/systemd/system/nixpanel.service <<'EOF' +[Unit] +Description=NixPanel Control Panel +After=network.target mariadb.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/nixpanel +ExecStart=/opt/nixpanel/bin/nixpanel +Restart=always +RestartSec=5 +EnvironmentFile=/opt/nixpanel/.env + +[Install] +WantedBy=multi-user.target +EOF + systemctl daemon-reload + systemctl enable nixpanel + systemctl start nixpanel + mark_done "systemd" +fi +success "Service installed and started" + +# ── Apache vhosts ────────────────────────────────────────────────────────────── + +step "Configuring Apache reverse proxy" +if ! step_done "apache_vhost"; then + cat > /etc/apache2/sites-available/nixpanel.conf <<'EOF' +# NixServer — Admin Panel (port 2087) + + ProxyPreserveHost On + ProxyPass /api/ http://127.0.0.1:4000/api/ + ProxyPassReverse /api/ http://127.0.0.1:4000/api/ + ProxyPass /ws/ ws://127.0.0.1:4000/ws/ + ProxyPassReverse /ws/ ws://127.0.0.1:4000/ws/ + DocumentRoot /opt/nixpanel/nixserver/dist + + Options -Indexes + AllowOverride All + Require all granted + FallbackResource /index.html + + + +# NixClient — User Panel (port 2083) + + ProxyPreserveHost On + ProxyPass /api/ http://127.0.0.1:4000/api/ + ProxyPassReverse /api/ http://127.0.0.1:4000/api/ + DocumentRoot /opt/nixpanel/nixclient/dist + + Options -Indexes + AllowOverride All + Require all granted + FallbackResource /index.html + + +EOF + + echo "Listen 2083" >> /etc/apache2/ports.conf + echo "Listen 2087" >> /etc/apache2/ports.conf + + a2ensite nixpanel 2>/dev/null || true + apache2ctl configtest && systemctl reload apache2 + mark_done "apache_vhost" +fi +success "Apache vhosts configured" + +# ── Done ─────────────────────────────────────────────────────────────────────── + +SERVER_IP=$(hostname -I | awk '{print $1}') + +echo "" +echo -e "${BOLD}${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}" +echo -e "${BOLD}${GREEN} NixPanel Installation Complete!${RESET}" +echo -e "${BOLD}${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}" +echo "" +echo -e " ${BOLD}NixServer (Admin):${RESET} http://${SERVER_IP}:2087" +echo -e " ${BOLD}NixClient (User):${RESET} http://${SERVER_IP}:2083" +echo "" +echo -e " Open your browser and log in with the admin credentials you just created." +echo ""