4.7 KiB
WGDashboard WHMCS Module
WHMCS module for integration with WGDashboard, enabling automated WireGuard peer management through WHMCS.
📋 Requirements
- WHMCS 7.0 or higher
- WGDashboard v4.0+ with API enabled
- PHP 7.4 or higher
- PHP cURL extension enabled
🚀 Installation
-
Upload the module files to the WHMCS directory:
/modules/servers/wgdashboard/ -
File structure:
modules/server/wgdashboard/ ├── wgdashboard.php └── clientarea.tpl -
In the WHMCS admin panel, navigate to: Setup → Products/Services → Servers → Add New Server
-
Configure the server:
- Hostname: IP or domain of WGDashboard (e.g.,
10.0.238.222orvpn.example.com) - Module: WGDashboard
- Port: API port (e.g.,
10086) - Password: WGDashboard API Key
- Hostname: IP or domain of WGDashboard (e.g.,
-
Click Test Connection to validate the configuration.
⚙️ Product Configuration
-
Create or edit a product in Setup → Products/Services
-
In the Module Settings tab:
- Module Name: WGDashboard
- Server Group: Select the configured server
-
Configuration Options:
- Allowed IPs: Allowed IPs for the peer (default:
0.0.0.0/0) - Config Name: WireGuard configuration name in the dashboard (default:
wg0) - Peer Template: (Optional) JSON template to customize peer creation
- Allowed IPs: Allowed IPs for the peer (default:
Peer Template Example
{
"DNS": "8.8.8.8,1.1.1.1",
"mtu": 1420,
"keepalive": 25
}
Available placeholders:
{{client_email}}- Client's email{{domain}}- Service domain{{serviceid}}- Service ID in WHMCS
🔧 Features
Peer Automation
Module options:
- ✅ Creation: Automatically generates keys and creates peer in WGDashboard
- ✅ Suspension: Restricts peer access when service is suspended
- ✅ Reactivation: Restores access when service is reactivated
- ✅ Termination: Completely removes peer when service is cancelled
Client Area
Client Area:
- 📱 QR Code: For quick configuration on mobile devices
- 📄 Formatted Configuration: Ready-to-use WireGuard configuration file
- 📋 Download: Button to download
.conffile
Admin Panel
In the client's service tab, the administrator views:
- Public Key: Peer's public key
- Peer Name: Peer identifier name
- Allowed IPs: Allowed IPs
- Status: Current peer state
- Latest Handshake: Last handshake with server
- Data Received: Volume of data received From peer to server
- Data Sent: Volume of data sent From server to peer
🌐 WGDashboard Configuration
To use this module, ensure the WGDashboard API is enabled:
- Access WGDashboard settings
- Navigate to Settings → API
- Enable the API and generate a key
- Use this key in the Password field of the server configuration in WHMCS
🐛 Troubleshooting
Connection Test Fails
Error 401/403: Verify API Key
Solution: Confirm that the API Key is correct in the server's Password field
Error 404: Endpoint not found
Solution: Check if your WGDashboard version supports the API
Error 500: WGDashboard internal error
Solution: Check WGDashboard logs on the server
Peer Not Created
- Enable Module Debug Log in WHMCS
- Navigate to Utilities → Logs → Module Log
- Look for "WGDashboard-WHMCS" entries
- Analyze request and response details
QR Code Doesn't Appear
Check:
- If JavaScript is enabled in the browser
- Browser console for errors (F12)
- If QRCode.js library is loading correctly
Port Not Recognized
The module uses WHMCS's Server Port field to define the API port. Do not include the port in the hostname, only in the dedicated field.
✅ Correct:
- Hostname:
10.0.0.55 - Port:
10086
❌ Incorrect:
- Hostname:
10.0.0.55:10086 - Port: (empty)
🔄 Compatibility
- WHMCS: 7.0+
- WGDashboard: v4.0+
- PHP: 7.4, 8.0, 8.1, 8.2
- WireGuard: All versions
📄 License
This module is provided "as is", without warranties of any kind.
🤝 Contributing
Contributions are welcome! To contribute:
- Fork the repository
- Create a branch for your feature
- Commit your changes
- Push to the branch
- Open a Pull Request
🔗 Useful Links
📋 Changelog
v1.0.0
- ✨ Initial release
- ✅ Peer creation, suspension, reactivation, and termination
- 📱 Client area with QR code and formatted configuration
- 🌐 Portuguese translation
- 🔐 Local WireGuard key generation
- 📊 Admin panel with peer statistics