This commit introduces a new WireGuard VPN installer with enterprise-grade security features. The installer includes: - Zero-touch installation with automatic configuration - Modular architecture for maintainability (separate lib files) - Client management interface with bandwidth monitoring - Support for multiple Linux distributions - Secure defaults and hardened configurations The implementation provides a complete solution for deploying WireGuard VPN servers with minimal user interaction while maintaining security best practices.
45 lines
1.0 KiB
Bash
45 lines
1.0 KiB
Bash
#!/bin/bash
|
|
# WireGuard Secure Installer
|
|
# Copyright (c) 2025 Muhammad Fadhila Abiyyu Faris
|
|
# GitHub: [github.com/fadhila36/wireguard-secure-installer](https://github.com/fadhila36/wireguard-secure-installer)
|
|
|
|
set -e
|
|
|
|
REPO_URL="https://github.com/fadhila36/wireguard-secure-installer.git"
|
|
INSTALL_DIR="/opt/wg-installer"
|
|
|
|
echo "Bootstrapping WireGuard Secure Installer..."
|
|
|
|
# Check Root
|
|
if [ "$EUID" -ne 0 ]; then
|
|
echo "Error: Must be run as root."
|
|
exit 1
|
|
fi
|
|
|
|
# Install Git if missing
|
|
if ! command -v git >/dev/null; then
|
|
echo "Installing Git..."
|
|
if [ -f /etc/debian_version ]; then
|
|
apt-get update && apt-get install -y git
|
|
elif [ -f /etc/redhat-release ]; then
|
|
dnf install -y git
|
|
fi
|
|
fi
|
|
|
|
# Clone or Update Repo
|
|
if [ -d "$INSTALL_DIR" ]; then
|
|
echo "Updating existing installation..."
|
|
cd "$INSTALL_DIR"
|
|
git pull
|
|
else
|
|
echo "Cloning repository..."
|
|
git clone "$REPO_URL" "$INSTALL_DIR"
|
|
cd "$INSTALL_DIR"
|
|
fi
|
|
|
|
# Make scripts executable
|
|
chmod +x install.sh manage.sh lib/*.sh
|
|
|
|
# Run Installer
|
|
./install.sh
|