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.
55 lines
1.3 KiB
Bash
55 lines
1.3 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)
|
|
|
|
# Load Config and Libraries
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
source "$SCRIPT_DIR/config.env"
|
|
source "$SCRIPT_DIR/lib/utils.sh"
|
|
source "$SCRIPT_DIR/lib/network.sh"
|
|
source "$SCRIPT_DIR/lib/wg_core.sh" # Needed for create_client_config
|
|
source "$SCRIPT_DIR/lib/client_mgmt.sh"
|
|
|
|
check_root
|
|
|
|
while true; do
|
|
clear
|
|
echo -e "${BLUE}"
|
|
echo "================================================="
|
|
echo " WireGuard Management Menu"
|
|
echo "================================================="
|
|
echo -e "${NC}"
|
|
echo "1. Add New Client"
|
|
echo "2. Remove Client"
|
|
echo "3. View Bandwidth Usage"
|
|
echo "4. Exit"
|
|
echo ""
|
|
echo -n "Select an option [1-4]: "
|
|
read -r OPTION
|
|
|
|
case $OPTION in
|
|
1)
|
|
new_client
|
|
;;
|
|
2)
|
|
remove_client
|
|
;;
|
|
3)
|
|
view_usage_logs
|
|
;;
|
|
4)
|
|
echo "Exiting..."
|
|
exit 0
|
|
;;
|
|
*)
|
|
echo "Invalid option."
|
|
sleep 1
|
|
;;
|
|
esac
|
|
|
|
echo ""
|
|
echo -n "Press Enter to return to menu..."
|
|
read -r
|
|
done
|