mirror of
https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS.git
synced 2026-04-02 10:38:30 +00:00
Compare commits
83 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
22d19b4ad4 | ||
|
|
69e5a830ce | ||
|
|
a6ed7d001a | ||
|
|
66c1058970 | ||
|
|
8a21e011f9 | ||
|
|
57c39489f8 | ||
|
|
bc9e4554fa | ||
|
|
7d76126bdf | ||
|
|
b497a0e928 | ||
|
|
38463dd97d | ||
|
|
448aadfffd | ||
|
|
f822293c80 | ||
|
|
a01da7cbb4 | ||
|
|
b38079947e | ||
|
|
e8f659ad22 | ||
|
|
f50f52ae77 | ||
|
|
163b967301 | ||
|
|
fd345b674c | ||
|
|
ea458af9e5 | ||
|
|
d415eb0b8b | ||
|
|
be3e050ffa | ||
|
|
3ab4574789 | ||
|
|
9b1e53a05d | ||
|
|
4a455b6203 | ||
|
|
a3a8543b1c | ||
|
|
be0cc40386 | ||
|
|
d45d0bb80b | ||
|
|
416069e4f1 | ||
|
|
a0f5612994 | ||
|
|
e5a35c7492 | ||
|
|
e822540455 | ||
|
|
6fec30628b | ||
|
|
7d7b5be4bf | ||
|
|
dcea0c267c | ||
|
|
5c66ea3c94 | ||
|
|
529d065690 | ||
|
|
435ccf272a | ||
|
|
1772bf85d2 | ||
|
|
f7455f10a1 | ||
|
|
81483ee853 | ||
|
|
32f2d7a7b6 | ||
|
|
bb14aec611 | ||
|
|
730f9d1e85 | ||
|
|
db2cca1c94 | ||
|
|
bb2179ef2f | ||
|
|
4376798c0d | ||
|
|
ea5f67cfa9 | ||
|
|
a0decccb50 | ||
|
|
eb7c0914f8 | ||
|
|
2d2755bb81 | ||
|
|
201d7f6f29 | ||
|
|
1951b5dbb2 | ||
|
|
13fce0651b | ||
|
|
6e6f2a5e86 | ||
|
|
5fa8fbe00f | ||
|
|
0e040aff44 | ||
|
|
dd2ec07d6b | ||
|
|
98fa2c32d8 | ||
|
|
6a96263dee | ||
|
|
88720b5f56 | ||
|
|
aca15eb2d3 | ||
|
|
d5ab11b03e | ||
|
|
d9ef54e25a | ||
|
|
6f969a618e | ||
|
|
a016784d20 | ||
|
|
4e7cb78aad | ||
|
|
0b794ebd96 | ||
|
|
f017bcd1f0 | ||
|
|
a220eea9fa | ||
|
|
b8da683746 | ||
|
|
25ea01effb | ||
|
|
3ee12c4231 | ||
|
|
8ef4b8cb4f | ||
|
|
616ccda1f9 | ||
|
|
d8d8644775 | ||
|
|
0b39af76b8 | ||
|
|
7dc3ebce92 | ||
|
|
484bb1f79c | ||
|
|
3854fd86fe | ||
|
|
c9d14506c4 | ||
|
|
799500bbf0 | ||
|
|
b7ee090b4d | ||
|
|
7f6171efbf |
37
.github/ISSUE_TEMPLATE/🐛-bug-report.md
vendored
Normal file
37
.github/ISSUE_TEMPLATE/🐛-bug-report.md
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
name: "\U0001F41B Bug Report"
|
||||
about: Create a report to help us improve the module!
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behaviour:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behaviour**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem to us.
|
||||
|
||||
**Module > Support/Health tab (remove IP and paste here):**
|
||||
- Version of module
|
||||
- Web Server info
|
||||
- PHP version
|
||||
- etc.
|
||||
|
||||
**WHMCS Information (please complete the following):**
|
||||
- WHMCS Version (must be supported):
|
||||
- Using HTTPS: Yes or No
|
||||
|
||||
**Confirm that you have MORE THAN 100 services (all statuses) in WHMCS?**
|
||||
Otherwise you will receive a "value does not look like a valid VM ID" error. Check the error!
|
||||
20
.github/ISSUE_TEMPLATE/🚀-feature-request.md
vendored
Normal file
20
.github/ISSUE_TEMPLATE/🚀-feature-request.md
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
name: "\U0001F680 Feature Request"
|
||||
about: How can we improve Proxmox VE for WHMCS?
|
||||
title: ''
|
||||
labels: enhancement
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
78
CHANGELOG.md
78
CHANGELOG.md
@@ -1,29 +1,69 @@
|
||||
# Changelog
|
||||
All notable changes to Proxmox VE for WHMCS will be documented in this file.
|
||||
|
||||
## [1.2.1b] - 2023-06-19
|
||||
## [1.2.3] - 2023-12-31 - _"NY Tidy-up 123"_
|
||||
|
||||
### Added
|
||||
### 🚀 Feature
|
||||
- x86-64-ABI: Add options; Emulation default now `x86-64-v2-AES` (#58)
|
||||
- Intel/AMD: Add new CPU Emulation options (8~ Intel, 2x EPYC) (#58)
|
||||
|
||||
### 💅 Polish
|
||||
- Debug Logs: Improved quality & scope of logged info (#59)
|
||||
- SECURITY.md: Add file to repository, clarifying process (#61)
|
||||
- README.md: Add VM/CT creation explanations from old Manual (#57)
|
||||
- Logo: Per request from Proxmox Server Solutions, we got a logo (#56)
|
||||
- SPICE: Ground-work for future potential addition of 2nd HTML5/etc VNC
|
||||
|
||||
### 🐛 Bug Fix
|
||||
- PHP v8.1: Verified no problems operating on v8 old-stable ver.
|
||||
- Connection Test: Fixed, so it reports OK/Green or an error (#29)
|
||||
- Admin, Edit Service: Should now populate existing config OK (#36)
|
||||
|
||||
## [1.2.2] - 2023-09-15 - _"Nice refinements"_
|
||||
|
||||
### 🚀 Feature
|
||||
- Debugging Mode: Allow admin to turn on/off Module Log feed (#38)*
|
||||
- VLAN ID: Set the required Virtual LAN ID against VM/CT Plan (#35)*
|
||||
- Version: Report in-use & latest versions in Health; ver alert (#21)
|
||||
- Power Actions: Now available in Admin Area as well as Client Area
|
||||
- (Note: Suspend/Unsuspend/Terminate remain admin-only functions)
|
||||
|
||||
### 💅 Polish
|
||||
- Suspend/Unsuspend: Functions changed to Stop/Start (fixes #34)
|
||||
- Client Area: Power Action wording amended (Soft Stop, Hard Stop)
|
||||
- Admin, Module Config: Explain what the VNC Secret field is about
|
||||
- Admin, Module Config: House-keeping to design, Support/Health tab
|
||||
|
||||
### 🐛 Bug Fix
|
||||
- Admin, Create Service: Fails if Plan/Pool not assigned in WHMCS (#36)
|
||||
- Client, VNC: Fails early if VNC Secret is not set or adequate (#27)
|
||||
- On-boot Status: Enabled/Disabled now properly applied for CTs (#34)
|
||||
|
||||
(\*): SQL Note: There are new columns in 2 of the module tables, see [SQL.md](https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/blob/master/SQL.md)
|
||||
|
||||
## [1.2.1b] - 2023-06-19 - _"Working, including VNC!"_
|
||||
|
||||
### 🚀 Feature
|
||||
- Module Config tab, allowing for configuration of the VNC Secret
|
||||
- Reboot command/action added to Client Area (ie. on/off/hard-off)
|
||||
- Link from Health tab of Admin GUI to WHMCS Marketplace re: reviews
|
||||
- Images for all supported Operating Systems & Kernel types (some fixed)
|
||||
- Ground-work for noVNC overhaul, to support PVE Auth & VNC Tunnel tickets
|
||||
- noVNC overhauled, to send PVE Cookie (ticket) and VNC Access Ticket also
|
||||
|
||||
### Changed
|
||||
### 💅 Polish
|
||||
- Stop VM/CT (Client Area) renamed to Hard Stop, compared to Shut Down
|
||||
- Modify the PHP API2 class, adding getTicket() so we can dual-auth (VNC)
|
||||
- Move VNC Clients from root-level to vnc-only-level access to Proxmox VE
|
||||
|
||||
### Fixed
|
||||
### 🐛 Bug Fix
|
||||
- noVNC render method updated to stop out-of-order data flow problem
|
||||
- noVNC back-end vncproxy and vncwebsocket methods updated re: spec
|
||||
- Client Area actions (Power Off/On, etc) fixed for LXC (QEMU OK)
|
||||
- Error with both VNC methods. We are going to remove TigerVNC
|
||||
|
||||
## [1.2.0b] - 2023-06-18
|
||||
## [1.2.0b] - 2023-06-18 - _"Loads of key fixes"_
|
||||
|
||||
### Added
|
||||
### 🚀 Feature
|
||||
- Link off to GitHub Issues for Support from the Module page in WHMCS
|
||||
- CHANGELOG.md file added to repository to track in recommended format
|
||||
- Try-catch around the Creation API Call, routing OK/error into WHMCS
|
||||
@@ -34,7 +74,7 @@ All notable changes to Proxmox VE for WHMCS will be documented in this file.
|
||||
- Warning in README.md re: WHMCS Service ID being > 100
|
||||
- Zero Tolerance Abuse Policy added to README file
|
||||
|
||||
### Changed
|
||||
### 💅 Polish
|
||||
- Module versioning changed to semver (semantic versioning) 1.2.0
|
||||
- Change rel. path to ROOTDIR in IPv4 file, in case of other issues
|
||||
- Use /cluster/resources via API, not /node/, to get stats (ex. swap)
|
||||
@@ -43,7 +83,7 @@ All notable changes to Proxmox VE for WHMCS will be documented in this file.
|
||||
- Updated the PVE2 API Class and improved its logging (prefix/exception)
|
||||
- Method to fire API Calls updated due to reduction in WHMCS param scope
|
||||
|
||||
### Fixed
|
||||
### 🐛 Bug Fix
|
||||
- Regression in v1.1 with missing semicolon breaking activation (#14)
|
||||
- Edit Icon not rendering on IP/Pool edit page, missing asset (#13)
|
||||
- Relative link to PVE2 API Class file broken, use ROOTDIR (#13/15)
|
||||
@@ -54,33 +94,35 @@ All notable changes to Proxmox VE for WHMCS will be documented in this file.
|
||||
- Client Area pages/actions now fixed (fixes #19)
|
||||
- Font Awesome icons fixed in the Client Area
|
||||
|
||||
## [1.1b] - 2023-06-06
|
||||
## [1.1b] - 2023-06-06 - _"The overhaul begins!"_
|
||||
|
||||
### Added
|
||||
### 🚀 Feature
|
||||
- Swap space editing for plans; back-end existed but not GUI editing
|
||||
- Modern-day language to GUI according to changes in the 6 years
|
||||
- README now links out to all Dependencies and Documentation
|
||||
|
||||
### Changed
|
||||
### 💅 Polish
|
||||
- Module Name from "PRVE" to "pvewhmcs" (ie. Proxmox VE for WHMCS)
|
||||
- Default storage/disk type changed from IDE to Virtio (fastest)
|
||||
- Updated 3 dependencies to latest: PVE2-PHP, noVNC, TigerVNC
|
||||
- Removed all code segments relating to Software Licensing
|
||||
- DNS defaults changed from Google DNS to Cloudflare DNS
|
||||
|
||||
### Fixed
|
||||
### 🐛 Bug Fix
|
||||
- Module can now be installed onto WHMCS 8.x installations
|
||||
- OpenVZ changed to LXC, to support PVE 4.x installs & up
|
||||
- Removed I/O Priority setting, to re-do via Throttling
|
||||
- Catch exception in Client Area if can't reach Proxmox
|
||||
|
||||
## [1.0] - 2017-01-26
|
||||
## [1.0] - 2017-01-26 - _"FOSS Foundations"_
|
||||
|
||||
### Added
|
||||
**_Thank you @cybercoder for open-sourcing your code!_**
|
||||
|
||||
### 🚀 Feature
|
||||
- Open-sourced the previously commercial plugin
|
||||
|
||||
### Changed
|
||||
### 💅 Polish
|
||||
- Commented out the licensing code segments
|
||||
|
||||
### Fixed
|
||||
- Removed old database schema import file
|
||||
### 🐛 Bug Fix
|
||||
- Removed old database schema import file
|
||||
|
||||
238
README.md
238
README.md
@@ -1,94 +1,246 @@
|
||||
# Proxmox VE for WHMCS (Module) Provision & Manage
|
||||
|
||||
We're overhauling the Module to suit our internal needs at [LEOPARD.host](https://leopard.host).
|
||||
**Salvation, a free and open-source solution for beloved PVE!** If you love it, REVIEW & SHARE IT! ❤️
|
||||
|
||||
- Automatically Provision VMs & CTs in [Proxmox VE](https://proxmox.com/en/proxmox-ve/features) from [WHMCS](https://www.whmcs.com/tour/)
|
||||
- Allow clients to view/manage VMs using WHMCS Client Area
|
||||
<img alt="Logo for the Proxmox VE for WHMCS module" src="zLOGO.png">
|
||||
|
||||
The original module was written in 2 months by @cybercoder for sale online in 2016, though didn't sell any copies so they kindly open-sourced it and removed the licensing requirement. _The manual PDF files are due to be updated (these still mention licensing - ignore this)_
|
||||
- Configure VM/CT plans with custom CPU/RAM/VLAN/On-boot/Bandwidth/etc
|
||||
- Automatically Provision VMs & CTs in [Proxmox VE](https://proxmox.com/en/proxmox-virtual-environment/features) from [WHMCS](https://www.whmcs.com/tour/) easily
|
||||
- Allow clients to view/manage VMs using the WHMCS Client Area
|
||||
- Create/Suspend/Unsuspend/Terminate via WHMCS Admin Area
|
||||
- Statistics/Graphing is available in the Client Area for services :)
|
||||
|
||||
https://marketplace.whmcs.com/product/6935-proxmox-ve-for-whmcs
|
||||
## ❤️ RTFM: Read the Manual & Review the Module!
|
||||
|
||||
### 🛠️ SYSTEM REQUIREMENTS:
|
||||
**Please read the entire README.md file before getting started with Proxmox VE for WHMCS.** Thanks!
|
||||
|
||||
We're pretty much done overhauling the Module to suit our needs at [The Network Crew Pty Ltd (TNC)](https://thenetworkcrew.com.au).
|
||||
|
||||
> **Please review the module!** https://marketplace.whmcs.com/product/6935-proxmox-ve-for-whmcs
|
||||
>
|
||||
> If you want it to remain free and fabulous, it could use a moment of your time in reviewing it. Thanks!
|
||||
|
||||
## 🎯 MODULE: System Requirements (PVE/WHMCS)
|
||||
|
||||
New Biz: Fresh Installations/Businesses using WHMCS need to take note of the Service ID < 100 case.
|
||||
|
||||
**SID >100:** The WHMCS Service ID requirement is CRITICAL, as Proxmox reserves VMIDs <100 (system).
|
||||
|
||||
- (WHMCS) v8.x.x stable (HTTPS)
|
||||
- (WHMCS) Service ID >100
|
||||
- (PHP) v8.x.x stable
|
||||
- (Proxmox) VE v7/8
|
||||
- (Proxmox) 2 users
|
||||
- (WHMCS) **Service ID above 100**
|
||||
- (PHP) v8.x (stable version)
|
||||
- (Proxmox) VE v8.x (current)
|
||||
- (Proxmox) 2 users (API/VNC)
|
||||
|
||||
**SID >100:** The WHMCS Service ID requirement is critical, as Proxmox reserves VMIDs <100.
|
||||
_If you don't have enough services (of any status) in WHMCS (DB: tblhosting.id), create enough dummy/test entries to reach Service ID 101+._ **Else you're likely to see an error which explains this:** `HTTP/1.1 400 Parameter verification failed. (invalid format - value does not look like a valid VM ID)`
|
||||
|
||||
_If you don't have enough services (any status) in WHMCS, create services until you reach SID 101._
|
||||
## ✅ MODULE: Installation & Configuration
|
||||
|
||||
### 🥽 noVNC CONSOLE TUNNELING:
|
||||
**DON'T SKIP ANY PART OF THIS README.md - please don't raise pointless Issues - thank you!**
|
||||
|
||||
To access VNC via WHMCS Client Area, you need to:
|
||||
Firstly, you need to upload, activate and make the WHMCS Module available to Administrators.
|
||||
|
||||
1. Follow the PVE User Requirement below
|
||||
2. PVE and WHMCS on the same Domain Name*
|
||||
3. Have valid PTR/rDNS for the PVE Address
|
||||
Once you've done all of that, in order to get the module working properly, you need to:
|
||||
|
||||
**WIP NOTE:** noVNC has been overhauled. It is not guaranteed, nor the project at all. :-)
|
||||
0. Proxmox VE > Create an additional VNC-only user, per instructions below
|
||||
1. WHMCS Admin > Config > Servers > Add your PVE host/s (user: root; IP: PVE's)
|
||||
2. WHMCS Admin > Addons > Proxmox VE for WHMCS > Module Config > VNC Secret (see below)
|
||||
3. WHMCS Admin > Addons > Proxmox VE for WHMCS > Add KVM/LXC Plan/s
|
||||
4. WHMCS Admin > Addons > Proxmox VE for WHMCS > Add an IP Pool
|
||||
5. WHMCS Admin > Config > Products/Services > New Service (create offering)
|
||||
6. " " > Newly-added Service > Tab 3 > **SAVE** (links Module Plan to WHMCS Service type)
|
||||
|
||||
\* = You must use different Subdomains on the same Domain Name, for the cookie (anti-CSRF).
|
||||
## 🥽 noVNC: Console Tunnel (Client Area)
|
||||
|
||||
\* = If your Domain Name has a 2-part TLD (ie. co.uk) then you will need to amend the code.
|
||||
After forking the module, we considered how to improve security of Console Tunneling via WHMCS. We decided to implement a routing method which uses a secondary user in Proxmox VE with very restrictive permissions. This requires more work to make it function, however improves security.
|
||||
|
||||
### 👥 PROXMOX USER REQUIREMENT:
|
||||
### To offer VNC via WHMCS Client Area
|
||||
|
||||
You must have a root (etc) account to Create/Access services. Configured via WHMCS Config > Servers.
|
||||
1. Install & configure the module properly
|
||||
2. Follow the PVE User Requirement info below
|
||||
3. Public IPv4 for PVE (or proxy to private)
|
||||
4. PVE and WHMCS on the same Domain Name*
|
||||
5. Have valid PTR/rDNS for the PVE Address
|
||||
|
||||
Additionally, to improve security, for VNC you must have a Restricted User. "" via Module Config.
|
||||
noVNC has been overhauled. It isn't guaranteed, nor the project at all. :-)
|
||||
|
||||
- Note #1 = You must use different Subdomains on the same Domain Name, for the cookie (anti-CSRF).
|
||||
- Note #2 = If your Domain Name has a 2-part TLD (ie. co.uk) then you will need to fork & amend `novnc_router.php` - ideally we/someone will optimise this to better cater to all formats.
|
||||
|
||||
## 👥 PVE: User Requirements (API & VNC)
|
||||
|
||||
**You must have a root account to use the Module at all.** Configured via WHMCS > Servers.
|
||||
|
||||
Additionally, to improve security, for VNC you must also have a Restricted User. Configured in the _Module_.
|
||||
|
||||
### Creating the VNC user within PVE
|
||||
|
||||
For the VNC User in Proxmox you need to:
|
||||
1. Create User Group "VNC" via PVE > Datacenter / Permissions / Group
|
||||
2. Create new User "vnc" > Datacenter / Permissions / Users - select Group: "VNC", Realm: pve
|
||||
3. Create new Role -> Datacenter / Permissions / Roles - select Name: "VNC", Privileges: VM.Console (only)
|
||||
4. Add permission to access VNC -> Datacenter / Node / VM / Permissions / Add Group Permissions - select Group: "VNC", Role: "VNC"
|
||||
5. Configure the WHMCS > Modules > Proxmox VE for WHMCS > Module Config > VNC Secret with 'vnc' password.
|
||||
|
||||
### 🤬 ABUSE - ZERO TOLERANCE:
|
||||
> Do NOT set less restrictive permissions. The above is designed for hypervisor security.
|
||||
|
||||
**NOTE:** This module is being overhauled and is in beta. Your support is welcomed.
|
||||
## ⚙️ VM/CT PLANS: Setting everything up
|
||||
|
||||
If you cannot accept this, do not download nor use the code. Complaints, nasty reviews, and similar behaviour is against the spirit of FOSS and will not be tolerated. Be grateful & considerate - thank you!
|
||||
These steps explain the unique requirements per-option.
|
||||
|
||||
### 🆘 TECHNICAL SUPPORT:
|
||||
Custom Fields: Values need to go in Name & Select Options.
|
||||
|
||||
Including logs, details, steps to reproduce, etc, please raise an [Issue](https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/issues).
|
||||
> **Unsure?** Consult the zMANUAL-PVE4.pdf _legacy_ manual file.
|
||||
|
||||
Information we will need, at a minimum:
|
||||
### VM Option 1: KVM, using PVE Template VM
|
||||
|
||||
- (PHP) error_log contents
|
||||
- (WHMCS) Module Debug Log contents
|
||||
Firstly, create the Template in PVE. You need its unique PVE ID.
|
||||
|
||||
Use that ID in the Custom Field `KVMTemplate`, as in `ID|Name`.
|
||||
|
||||
> Note: `Name` is what's displayed in the WHMCS Client Area.
|
||||
|
||||
### VM Option 2: KVM, WHMCS Plan + PVE ISO
|
||||
|
||||
Firstly, create the Plan in WHMCS Module. Then, WHMCS Config > Services.
|
||||
|
||||
Under the Service, you need to add a Custom Field `ISO` with the full location.
|
||||
|
||||
### CT Option: LXC, using PVE Template File
|
||||
|
||||
Firstly, store the Template in PVE. You need its unique File Name.
|
||||
|
||||
Use that full file name in the Custom Field `Template`, as in:
|
||||
|
||||
`ubuntu-99.99-standard_amd64.tar.gz|Ubuntu 99`
|
||||
|
||||
Then make a 2nd Custom Field `Password` for the CT's root user.
|
||||
|
||||
## 🌐 IPv4/v6: Networking (IP Pools)
|
||||
|
||||
Please make sure you create an IP Pool with sufficient scope/size to be able to deploy addresses within it to your guest VMs and CTs. Else it won't be able to create a Service for you.
|
||||
|
||||
**Private IPs for PVE Hosts:** Note that VNC may be problematic without work due to the strict requirements introduced in Proxmox v8.0 (strict same-site attribute).
|
||||
|
||||
### IPv6: Not yet functional! 😐
|
||||
|
||||
Per The-Network-Crew/Proxmox-VE-for-WHMCS#33 there is not yet functional IPv6 in this module.
|
||||
|
||||
You can of course add this via PVE/`pvesh` manually, however it isn't module-supported as of late 2023.
|
||||
|
||||
## 💅 FEATURES: PVE v8.0/8.1 bling
|
||||
|
||||
There are new features deployed into Proxmox VE upstream in the v8 branch which are exciting and should be added to this module.
|
||||
|
||||
### Proxmox v8.0
|
||||
|
||||
1. Create, manage and assign resource mappings for PCI and USB devices for use in virtual machines (VMs) via API and web UI.
|
||||
2. (DONE) Add virtual machine CPU models based on the x86-64 psABI Micro-Architecture Levels and use the widely supported x86-64-v2-AES as default for new VMs created via the web UI.
|
||||
|
||||
### Proxmox v8.1
|
||||
|
||||
1. Secure Boot support.
|
||||
2. Software Defined Networking (SDN).
|
||||
3. New flexible notification system (SMTP & Gotify).
|
||||
4. MAC Organizationally Unique Identifier (OUI) BC:24:11: prefix!
|
||||
|
||||
Reference: https://pve.proxmox.com/wiki/Roadmap
|
||||
|
||||
## 🤬 ABUSE: Zero Tolerance (ZT)
|
||||
|
||||
This module has been overhauled and remains functionally-OK but not thoroughly tested nor reviewed.
|
||||
|
||||
Your support and assistance is always welcomed per the spirit of FOSS (Free Open-source Software)!
|
||||
|
||||
If you cannot accept this, do not download nor use the code. Complaints, nasty reviews, and similar behaviour is against the spirit of FOSS and will not be tolerated.
|
||||
|
||||
**Be grateful & considerate - thank you!**
|
||||
|
||||
## 🆘 HELP: Best-effort Support
|
||||
|
||||
**Before raising a [GitHub Issue](https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/issues), please check:**
|
||||
|
||||
1. The [Wiki](https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/wiki)
|
||||
2. The [README.md](https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/tree/master)
|
||||
3. Open [GitHub Issues](https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/issues)
|
||||
4. HTTP, PHP, WHMCS & debug logs (see below).
|
||||
5. PVE logs; best practices; network; etc.
|
||||
6. Read the errors. Do they explain it?
|
||||
|
||||
> Help: Including logs, details, steps to reproduce, etc, please raise a [GitHub Issue](https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/issues).
|
||||
>
|
||||
> Logs: We work to ensure that Proxmox VE for WHMCS passes through error details to you.
|
||||
|
||||
### Issues/etc raised must include:
|
||||
|
||||
#### Logging & Debug Logging
|
||||
|
||||
- (Logs: PHP) `error_log` contents
|
||||
- (Logs: WHMCS) Module Debug Logging*
|
||||
- (Logs: Config) WHMCS Display/Log Errors = ON
|
||||
- (Logs: PVE) Logs from Proxmox Host (`pveproxy` etc)
|
||||
|
||||
#### Other Support Requirements
|
||||
|
||||
- (Visibility) Screenshots of the issue
|
||||
- (Configs) WHMCS/PHP/Module/Proxmox/etc
|
||||
- (PVE) Logs from Proxmox Host (pveproxy etc)
|
||||
- (Reproduction) pvesh/etc variants of failing calls
|
||||
- (Reproduction) `pvesh` etc variants of failing calls
|
||||
- (Network) Proof WHMCS Server can talk to PVE OK
|
||||
- (PEBKAC) _PROOF THAT YOU'VE FOLLOWED THIS README!_
|
||||
|
||||
Please note that this is FOSS and Support is not guaranteed.
|
||||
The more info/context you provide up-front, the quicker & easier it will be!
|
||||
|
||||
This module is licensed via the GNU General Public License v3.0.
|
||||
\* Debug: Make sure you enable Debug Logging in the Module Settings, as needed.
|
||||
|
||||
### 🖥️ LIBRARIES & DEPENDENCIES:
|
||||
**Please note that this is FOSS and Support is not guaranteed at all.**
|
||||
|
||||
- [PHP Client for PVE2 API](https://github.com/CpuID/pve2-api-php-client) (Dec 5th, 2022)
|
||||
- [TigerVNC VncViewer.jar](https://sourceforge.net/projects/tigervnc/files/stable/) (v1.13.1 in repo)
|
||||
- [noVNC HTML5 Viewer](https://github.com/novnc/noVNC) (v1.4.0 in repo)
|
||||
**If you don't read, listen or actively try, no help given.**
|
||||
|
||||
### 📄 DOCUMENTATION & RESOURCES:
|
||||
## 🔄 UPDATING: Patching the Module
|
||||
|
||||
WHMCS Admin > Addon Modules > Proxmox VE for WHMCS > Support/Health shows updates.
|
||||
|
||||
You can download the new version and upload it over the top, then run any needed SQL ops.
|
||||
|
||||
Please consult the [UPDATE-SQL.md](https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/blob/master/UPDATE-SQL.md) file, open your WHMCS DB & run the statements. Then you're done.
|
||||
|
||||
## 🖥️ INC: Libraries & Dependencies
|
||||
|
||||
- (MIT) [PHP Client for PVE2 API](https://github.com/CpuID/pve2-api-php-client) (Dec 5th, 2022)
|
||||
- (GPLv2) [TigerVNC VncViewer.jar](https://sourceforge.net/projects/tigervnc/files/stable/) (v1.13.1 in repo)
|
||||
- (MPLv2) [noVNC HTML5 Viewer](https://github.com/novnc/noVNC) (v1.4.0 in repo)
|
||||
- (GPLv3) [SPICE HTML5 Viewer](https://gitlab.freedesktop.org/spice/spice-html5) (v0.3 in repo)
|
||||
- (MIT) [IPv4/SN Validation](https://github.com/tapmodo/php-ipv4/) (August 2012)
|
||||
|
||||
## 📄 DIY: Documentation & Resources
|
||||
|
||||
- Proxmox API: https://pve.proxmox.com/pve-docs/api-viewer/
|
||||
- TigerVNC: https://github.com/TigerVNC/tigervnc/wiki
|
||||
- noVNC: https://github.com/novnc/noVNC/wiki
|
||||
- WHMCS: https://developers.whmcs.com/
|
||||
- x86-64-ABI: [latest PDF download](https://gitlab.com/x86-psABIs/x86-64-ABI/-/jobs/artifacts/master/raw/x86-64-ABI/abi.pdf?job=build)
|
||||
|
||||
### 🙌 CONTRIBUTING TO THE MODULE:
|
||||
## 🎉 FOSS: Contributions & Open-source
|
||||
|
||||
If you'd like to contribute to the Module, please open a [PR](https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/pulls).
|
||||
|
||||
We would like to thank [@cybercoder](https://github.com/cybercoder/) and [@WaldperlachFabi](https://github.com/WaldperlachFabi) for their original contributions and troubleshooting assistance respectively. FOSS is only possible thanks to dedicated individuals!
|
||||
The original module was written in 2 months by @cybercoder for sale online in 2016, though didn't sell any copies so they kindly open-sourced it and removed the licensing requirement.
|
||||
|
||||
We would like to thank [@cybercoder](https://github.com/cybercoder/) and [@WaldperlachFabi](https://github.com/WaldperlachFabi) for their original contributions and troubleshooting assistance respectively.
|
||||
|
||||
Thank you to [psyborg®](https://www.psyborg.com.au/graphic-design-services-newcastle/logo-design/) for the module's logo design! We love it.
|
||||
|
||||
FOSS is only possible thanks to dedicated individuals!
|
||||
|
||||
## Usage License (GPLv3) & Links to TNC & Co.
|
||||
|
||||
_**This module is licensed under the GNU General Public License (GPL) v3.0.**_
|
||||
|
||||
GPLv3: https://www.gnu.org/licenses/gpl-3.0.txt (by the Free Software Foundation)
|
||||
|
||||
**[The Network Crew Pty Ltd](https://thenetworkcrew.com.au)**
|
||||
|
||||
**[LEOPARD.host](https://leopard.host)**
|
||||
|
||||
### Support: Best-effort via GitHub Issues
|
||||
|
||||
Browse issues, raise a new one: **[GitHub Issues](https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/issues)**
|
||||
|
||||
57
SECURITY.md
Normal file
57
SECURITY.md
Normal file
@@ -0,0 +1,57 @@
|
||||
# Security Policy
|
||||
|
||||
## 🏥 Supported Versions
|
||||
|
||||
The single latest available release is the only release supported by this Security Policy.
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 1.x.x latest | :white_check_mark: |
|
||||
| 1.2.x | :x: |
|
||||
| 1.1.x | :x: |
|
||||
| 1.0.x | :x: |
|
||||
|
||||
> \* Note: Latest version - if it is v1.2.3 then that is supported, if latest is v1.4.1 then that is supported, etc.
|
||||
|
||||
## 🔒 Secure Code Contributions
|
||||
|
||||
Please refrain from depending on any external source - for instance, noVNC-latest is bundled into the Module.
|
||||
|
||||
Best practices should be followed during Software Engineering which is especially hard when only patching.
|
||||
|
||||
### For instance, work to implement:
|
||||
|
||||
- Principle of Least Privilege
|
||||
- Input Validation & Sanitisation
|
||||
- Secure Communication (HTTPS etc)
|
||||
- Compatibility with core/updates
|
||||
- Thorough inline comments/specs
|
||||
- Robust error handling/logging
|
||||
- Secure configs by default
|
||||
|
||||
### References:
|
||||
|
||||
- https://owasp.org/
|
||||
- [CERT Secure Coding](https://wiki.sei.cmu.edu/confluence/display/seccode/SEI+CERT+Coding+Standards)
|
||||
- [NIST Secure SW Dev](https://csrc.nist.gov/Projects/ssdf)
|
||||
- [MIT Open Security](https://ocw.mit.edu/courses/6-858-computer-systems-security-fall-2014/)
|
||||
|
||||
## 🐛 Reporting a Vulnerability
|
||||
|
||||
GitHub "Private vulnerability reporting" is enabled for The-Network-Crew/Proxmox-VE-for-WHMCS repository.
|
||||
|
||||
Or, use a publicly-available email address for The Network Crew Pty Ltd to submit it via email instead.
|
||||
|
||||
DO NOT raise a public issue where there is threat to users of the module. Raise it properly.
|
||||
|
||||
### No bounties offered
|
||||
|
||||
As a company, we do not believe in paying security bounties, rather in writing good code.
|
||||
|
||||
We appreciate your input and work to address issues as quickly as possible, security first and foremost.
|
||||
|
||||
Updates can be provided as promptly as days apart, however this depends on severity/scope, and is always reasonable.
|
||||
|
||||
## ❤️ Thank you for responsibly disclosing
|
||||
|
||||
We & the entire FOSS community thank you for reviewing this file & being aware of how to improve the project.
|
||||
8
UPDATE-SQL.md
Normal file
8
UPDATE-SQL.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# SQL Statements for Updates (nav to DB first)
|
||||
|
||||
### v1.2.1 to v1.2.2
|
||||
|
||||
```
|
||||
ALTER TABLE mod_pvewhmcs ADD COLUMN `debug_mode` tinyint(1) unsigned DEFAULT '0';
|
||||
ALTER TABLE mod_pvewhmcs_plans ADD COLUMN `vlanid` varchar(10) DEFAULT NULL;
|
||||
```
|
||||
Binary file not shown.
@@ -2,9 +2,10 @@ CREATE TABLE IF NOT EXISTS `mod_pvewhmcs` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`config` varchar(255),
|
||||
`vnc_secret` varchar(255),
|
||||
`debug_mode` tinyint(1) unsigned DEFAULT '0',
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
INSERT INTO `mod_pvewhmcs` (`id`, `config`) VALUES (1, NULL);
|
||||
INSERT INTO `mod_pvewhmcs` (`id`, `config`, `vnc_secret`) VALUES (1, NULL, NULL);
|
||||
CREATE TABLE IF NOT EXISTS `mod_pvewhmcs_ip_addresses` (
|
||||
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`pool_id` int(11) NOT NULL DEFAULT '0',
|
||||
@@ -21,13 +22,13 @@ CREATE TABLE IF NOT EXISTS `mod_pvewhmcs_ip_pools` (
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS `mod_pvewhmcs_plans` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(255) CHARACTER SET utf8 NOT NULL COMMENT 'Plan - Name',
|
||||
`vmtype` varchar(8) NOT NULL COMMENT 'Guest Type - KVM or LXC',
|
||||
`ostype` varchar(8) DEFAULT NULL COMMENT 'OS - Type',
|
||||
`title` varchar(255) CHARACTER SET utf8 NOT NULL,
|
||||
`vmtype` varchar(8) NOT NULL,
|
||||
`ostype` varchar(8) DEFAULT NULL,
|
||||
`cpus` tinyint(2) unsigned DEFAULT NULL,
|
||||
`cpuemu` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT 'Emulated CPU Type eg. coreduo | core2duo | kvm32 | kvm64 | qemu32 | qemu64 | phenom | host',
|
||||
`cores` tinyint(2) unsigned DEFAULT NULL COMMENT 'Cores per Socket',
|
||||
`cpulimit` smallint(5) unsigned DEFAULT NULL COMMENT 'Limit vs Host CPU (max)',
|
||||
`cpuemu` varchar(30) CHARACTER SET utf8 DEFAULT NULL,
|
||||
`cores` tinyint(2) unsigned DEFAULT NULL,
|
||||
`cpulimit` smallint(5) unsigned DEFAULT NULL,
|
||||
`cpuunits` smallint(5) unsigned DEFAULT NULL,
|
||||
`memory` smallint(5) unsigned NOT NULL,
|
||||
`swap` smallint(5) unsigned DEFAULT NULL,
|
||||
@@ -46,6 +47,7 @@ CREATE TABLE IF NOT EXISTS `mod_pvewhmcs_plans` (
|
||||
`bw` int(6) unsigned DEFAULT '0',
|
||||
`kvm` tinyint(1) unsigned DEFAULT '0',
|
||||
`onboot` tinyint(1) unsigned DEFAULT '0',
|
||||
`vlanid` varchar(10) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
);
|
||||
CREATE TABLE IF NOT EXISTS `mod_pvewhmcs_vms` (
|
||||
|
||||
@@ -1,5 +1,26 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Proxmox VE for WHMCS - Addon/Server Modules for WHMCS (& PVE)
|
||||
https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/
|
||||
File: /modules/addons/pvewhmcs/hooks.php (WHMCS Hooks)
|
||||
|
||||
Copyright (C) The Network Crew Pty Ltd (TNC) & Co.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (!defined("WHMCS"))
|
||||
die("This file cannot be accessed directly");
|
||||
|
||||
|
||||
@@ -1,62 +1,117 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Proxmox VE for WHMCS - Addon/Server Modules for WHMCS (& PVE)
|
||||
https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/
|
||||
File: /modules/addons/pvewhmcs/pvewhmcs.php (GUI Work)
|
||||
|
||||
Copyright (C) The Network Crew Pty Ltd (TNC) & Co.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// Pull in the WHMCS database handler Capsule for SQL
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
|
||||
// Define where the module operates in the Admin GUI
|
||||
define( 'pvewhmcs_BASEURL', 'addonmodules.php?module=pvewhmcs' );
|
||||
|
||||
// DEP: Require the PHP API Class to interact with Proxmox VE
|
||||
require_once('proxmox.php');
|
||||
|
||||
// CONFIG: Declare key options to the WHMCS Addon Module framework.
|
||||
function pvewhmcs_config() {
|
||||
$configarray = array(
|
||||
"name" => "Proxmox VE for WHMCS",
|
||||
"description" => "Proxmox Virtual Environment + WHMCS",
|
||||
"version" => "1.2.1",
|
||||
"description" => "Proxmox VE (Virtual Environment) & WHMCS, integrated & open-source! Provisioning & Management of VMs/CTs.".is_pvewhmcs_outdated(),
|
||||
"version" => "1.2.3",
|
||||
"author" => "The Network Crew Pty Ltd",
|
||||
'language' => 'English'
|
||||
);
|
||||
return $configarray;
|
||||
}
|
||||
|
||||
// VERSION: also stored in repo/version (for update-available checker)
|
||||
function pvewhmcs_version(){
|
||||
return "1.2.1";
|
||||
return "1.2.3";
|
||||
}
|
||||
|
||||
// WHMCS MODULE: ACTIVATION of the ADDON MODULE
|
||||
// This consists of importing the SQL structure, and then crudely returning yay or nay (needs improving)
|
||||
function pvewhmcs_activate() {
|
||||
|
||||
// Pull in the SQL structure (includes VNC/etc tweaks)
|
||||
$sql = file_get_contents(ROOTDIR.'/modules/addons/pvewhmcs/db.sql');
|
||||
if (!$sql) {
|
||||
return array('status'=>'error','description'=>'The db.sql file not found.');
|
||||
}
|
||||
// SQL file is good, let's proceed with pulling it in
|
||||
$err=false;
|
||||
$i=0;
|
||||
$query_array=explode(';',$sql) ;
|
||||
$query_count=count($query_array) ;
|
||||
// Iterate through the SQL commands to finalise init.
|
||||
foreach ( $query_array as $query) {
|
||||
if ($i<$query_count-1)
|
||||
if (!Capsule::statement($query.';'))
|
||||
$err=true;
|
||||
$i++ ;
|
||||
}
|
||||
// Return success or error.
|
||||
if (!$err)
|
||||
return array('status'=>'success','description'=>'PVE for WHMCS installed successfuly.');
|
||||
return array('status'=>'success','description'=>'Proxmox VE for WHMCS was installed successfully.');
|
||||
|
||||
return array('status'=>'error','description'=>'PVE for WHMCS was not activated properly.');
|
||||
return array('status'=>'error','description'=>'Proxmox VE for WHMCS was not activated properly.');
|
||||
|
||||
}
|
||||
|
||||
// WHMCS MODULE: DEACTIVATION
|
||||
function pvewhmcs_deactivate() {
|
||||
// Drop all module-related tables
|
||||
Capsule::statement('drop table mod_pvewhmcs_ip_addresses,mod_pvewhmcs_ip_pools,mod_pvewhmcs_plans,mod_pvewhmcs_vms,mod_pvewhmcs');
|
||||
# Return Result
|
||||
return array('status'=>'success','description'=>'PVE for WHMCS successfuly deactivated and all related tables deleted.');
|
||||
return array('status'=>'error','description'=>'If an error occurs you can return an error
|
||||
message for display here');
|
||||
return array('status'=>'info','description'=>'If you want to give an info message to a user
|
||||
you can return it here');
|
||||
|
||||
// Return the assumed result (change?)
|
||||
return array('status'=>'success','description'=>'Proxmox VE for WHMCS successfully deactivated and all related tables deleted.');
|
||||
}
|
||||
|
||||
function pvewhmcs_output($vars) {
|
||||
// UPDATE CHECKER: live vs repo
|
||||
function is_pvewhmcs_outdated(){
|
||||
if(get_pvewhmcs_latest_version() > pvewhmcs_version()){
|
||||
return "<br><span style='float:right;'><b>Proxmox VE for WHMCS is outdated: <a style='color:red' href='https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/releases'>Download the new version!</a></span>";
|
||||
}
|
||||
}
|
||||
|
||||
// UPDATE CHECKER: return latest ver
|
||||
function get_pvewhmcs_latest_version(){
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "https://raw.githubusercontent.com/The-Network-Crew/Proxmox-VE-for-WHMCS/master/version");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$result = curl_exec($ch);
|
||||
curl_close ($ch);
|
||||
|
||||
return str_replace("\n", "", $result);
|
||||
}
|
||||
|
||||
// ADMIN MODULE GUI: output (HTML etc)
|
||||
function pvewhmcs_output($vars) {
|
||||
$modulelink = $vars['modulelink'];
|
||||
|
||||
// Messages
|
||||
// Check for update and report if available
|
||||
if (!empty(is_pvewhmcs_outdated())) {
|
||||
$_SESSION['pvewhmcs']['infomsg']['title']='Proxmox VE for WHMCS: New version available!' ;
|
||||
$_SESSION['pvewhmcs']['infomsg']['message']='Please visit the GitHub repository > Releases page. https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/releases' ;
|
||||
}
|
||||
|
||||
// Print Messages to GUI before anything else
|
||||
if (isset($_SESSION['pvewhmcs']['infomsg'])) {
|
||||
echo '
|
||||
<div class="infobox">
|
||||
@@ -74,8 +129,10 @@ function pvewhmcs_output($vars) {
|
||||
<ul class="nav nav-tabs admin-tabs">
|
||||
<li class="'.($_GET['tab']=="vmplans" ? "active" : "").'"><a id="tabLink1" data-toggle="tab" role="tab" href="#plans">VM Plans</a></li>
|
||||
<li class="'.($_GET['tab']=="ippools" ? "active" : "").'"><a id="tabLink2" data-toggle="tab" role="tab" href="#ippools">IP Pools</a></li>
|
||||
<li class="'.($_GET['tab']=="health" ? "active" : "").'"><a id="tabLink3" data-toggle="tab" role="tab" href="#health">Support / Health</a></li>
|
||||
<li class="'.($_GET['tab']=="config" ? "active" : "").'"><a id="tabLink4" data-toggle="tab" role="tab" href="#config">Module Config</a></li>
|
||||
<li class="'.($_GET['tab']=="nodes" ? "active" : "").'"><a id="tabLink3" data-toggle="tab" role="tab" href="#nodes">Nodes / Cluster</a></li>
|
||||
<li class="'.($_GET['tab']=="actions" ? "active" : "").'"><a id="tabLink4" data-toggle="tab" role="tab" href="#actions">Actions / Logs</a></li>
|
||||
<li class="'.($_GET['tab']=="health" ? "active" : "").'"><a id="tabLink5" data-toggle="tab" role="tab" href="#health">Support / Health</a></li>
|
||||
<li class="'.($_GET['tab']=="config" ? "active" : "").'"><a id="tabLink6" data-toggle="tab" role="tab" href="#config">Module Config</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="tab-content admin-tabs">
|
||||
@@ -103,15 +160,15 @@ function pvewhmcs_output($vars) {
|
||||
|
||||
echo '
|
||||
<div id="plans" class="tab-pane '.($_GET['tab']=="vmplans" ? "active" : "").'">
|
||||
<div class="btn-group btn-group-lg" role="group" aria-label="...">
|
||||
<div class="btn-group" role="group" aria-label="...">
|
||||
<a class="btn btn-default" href="'. pvewhmcs_BASEURL .'&tab=vmplans&action=planlist">
|
||||
<i class="fa fa-list"></i> Plans List
|
||||
<i class="fa fa-list"></i> List: VM Plans
|
||||
</a>
|
||||
<a class="btn btn-default" href="'. pvewhmcs_BASEURL .'&tab=vmplans&action=add_kvm_plan">
|
||||
<i class="fa fa-plus-square"></i> Add new KVM plan
|
||||
<i class="fa fa-plus-square"></i> Add: KVM Plan
|
||||
</a>
|
||||
<a class="btn btn-default" href="'. pvewhmcs_BASEURL .'&tab=vmplans&action=add_lxc_plan">
|
||||
<i class="fa fa-plus-square"></i> Add new LXC plan
|
||||
<i class="fa fa-plus-square"></i> Add: LXC Plan
|
||||
</a>
|
||||
</div>
|
||||
';
|
||||
@@ -187,6 +244,9 @@ function pvewhmcs_output($vars) {
|
||||
NIC Model
|
||||
</th>
|
||||
<th>
|
||||
VLAN ID
|
||||
</th>
|
||||
<th>
|
||||
Rate
|
||||
</th>
|
||||
<th>
|
||||
@@ -214,6 +274,7 @@ function pvewhmcs_output($vars) {
|
||||
echo '<td>'.$vm->netmode . PHP_EOL .'</td>';
|
||||
echo '<td>'.$vm->bridge.$vm->vmbr . PHP_EOL .'</td>';
|
||||
echo '<td>'.$vm->netmodel . PHP_EOL .'</td>';
|
||||
echo '<td>'.$vm->vlanid . PHP_EOL .'</td>';
|
||||
echo '<td>'.$vm->netrate . PHP_EOL .'</td>';
|
||||
echo '<td>'.$vm->bw . PHP_EOL .'</td>';
|
||||
echo '<td>
|
||||
@@ -237,10 +298,10 @@ function pvewhmcs_output($vars) {
|
||||
<div id="ippools" class="tab-pane '.($_GET['tab']=="ippools" ? "active" : "").'" >
|
||||
<div class="btn-group">
|
||||
<a class="btn btn-default" href="'. pvewhmcs_BASEURL .'&tab=ippools&action=list_ip_pools">
|
||||
<i class="fa fa-list"></i> List IP Pools
|
||||
<i class="fa fa-list"></i> List: IP Pools
|
||||
</a>
|
||||
<a class="btn btn-default" href="'. pvewhmcs_BASEURL .'&tab=ippools&action=newip">
|
||||
<i class="fa fa-plus"></i> Add IP to Pool
|
||||
<i class="fa fa-plus"></i> Add: IP to Pool
|
||||
</a>
|
||||
</div>
|
||||
';
|
||||
@@ -268,13 +329,33 @@ function pvewhmcs_output($vars) {
|
||||
echo'
|
||||
</div>
|
||||
';
|
||||
// Health Tab
|
||||
// NODES / CLUSTER tab in ADMIN GUI
|
||||
echo '<div id="nodes" class="tab-pane '.($_GET['tab']=="nodes" ? "active" : "").'" >' ;
|
||||
echo ('<strong><h2>PVE: /cluster/resources</h2></strong>');
|
||||
echo ('Coming in v1.3.x');
|
||||
echo ('<strong><h2>PVE: Cluster Action Viewer</h2></strong>');
|
||||
echo ('Coming in v1.3.x');
|
||||
echo ('<strong><h2>PVE: Failed Actions (emailed)</h2></strong>');
|
||||
echo ('Coming in v1.3.x<br><br>');
|
||||
echo ('<strong><a href=\'https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/milestones\' target=\'_blank\'>View the milestones/versions on GitHub</a></strong>');
|
||||
echo '</div>';
|
||||
// ACTIONS / LOGS tab in ADMIN GUI
|
||||
echo '<div id="actions" class="tab-pane '.($_GET['tab']=="actions" ? "active" : "").'" >' ;
|
||||
echo ('<strong><h2>Module: Action History</h2></strong>');
|
||||
echo ('Coming in v1.3.x');
|
||||
echo ('<strong><h2>Module: Failed Actions</h2></strong>');
|
||||
echo ('Coming in v1.3.x');
|
||||
echo ('<strong><h2>WHMCS: Module Logging</h2></strong>');
|
||||
echo ('<u><a href=\'/admin/index.php?rp=/admin/logs/module-log\'>Click here</a></u> (Module Config > Debug Mode = ON)<br><br>');
|
||||
echo ('<strong><a href=\'https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/milestones\' target=\'_blank\'>View the milestones/versions on GitHub</a></strong>');
|
||||
echo '</div>';
|
||||
// SUPPORT / HEALTH tab in ADMIN GUI
|
||||
echo '<div id="health" class="tab-pane '.($_GET['tab']=="health" ? "active" : "").'" >' ;
|
||||
echo ('<h2>System Environment:</h2>Proxmox VE for WHMCS v' . pvewhmcs_version() . ' on PHP v' . phpversion() . ' (' . $_SERVER['SERVER_SOFTWARE'] . ')<br><br>');
|
||||
echo ('<h2>Technical Support:</h2>Please raise an <a href="https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/issues/new" target="_blank"><u>Issue</u></a> on GitHub - include logs, steps to reproduce, etc.<br><br>');
|
||||
echo ('<h2>Updates & Codebase:</h2><b>Proxmox for WHMCS is open-source and free to use & improve on!</b><br><a href="https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/" target="_blank">https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/</a><br><br>');
|
||||
echo ('<h2>Product & Reviewing</h2><b>Your 5-star review on WHMCS Marketplace will help the module grow!</b><br><a href="https://marketplace.whmcs.com/product/6935-proxmox-ve-for-whmcs" target="_blank">https://marketplace.whmcs.com/product/6935-proxmox-ve-for-whmcs</a><br><br>');
|
||||
|
||||
echo ('<strong><h2>System Environment</h2></strong><b>Proxmox VE for WHMCS</b> v' . pvewhmcs_version() . ' (GitHub reports latest as <b>v' . get_pvewhmcs_latest_version() . '</b>)' . '<br><b>PHP</b> v' . phpversion() . ' running on <b>' . $_SERVER['SERVER_SOFTWARE'] . '</b> Web Server (' . $_SERVER['SERVER_NAME'] . ')<br><br>');
|
||||
echo ('<strong><h2>Updates & Codebase</h2></strong><b>Proxmox for WHMCS is open-source and free to use & improve on! ❤️</b><br>Repo: <a href="https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/" target="_blank">https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/</a><br><br>');
|
||||
echo ('<strong><h2>Product & Reviewing</h2></strong><b style="color:darkgreen;">Your 5-star review on WHMCS Marketplace will help the module grow!</b><br>*****: <a href="https://marketplace.whmcs.com/product/6935-proxmox-ve-for-whmcs" target="_blank">https://marketplace.whmcs.com/product/6935-proxmox-ve-for-whmcs</a><br><br>');
|
||||
echo ('<strong><h2>Issues: Common Causes</h2></strong>1. <b>WHMCS needs to have >100 Services, else it is an illegal Proxmox VMID.</b><br>2. Save your Package (Plan/Pool)! (configproducts.php?action=edit&id=...#tab=3)<br>3. Where possible, we pass-through the exact error to WHMCS Admin. Check it for info!<br><br>');
|
||||
echo ('<strong><h2>Module Technical Support</h2></strong>Please raise an <a href="https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/issues/new" target="_blank"><u>Issue</u></a> on GitHub - include logs, steps to reproduce, etc.<br>Help is not guaranteed (FOSS). We will need your assistance. <b>Thank you.</b><br><br>');
|
||||
echo '</div>';
|
||||
|
||||
// Config Tab
|
||||
@@ -286,7 +367,15 @@ function pvewhmcs_output($vars) {
|
||||
<tr>
|
||||
<td class="fieldlabel">VNC Secret</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="35" name="vnc_secret" id="vnc_secret" value="'.$config->vnc_secret.'">
|
||||
<input type="text" size="35" name="vnc_secret" id="vnc_secret" value="'.$config->vnc_secret.'"> Password of "vnc"@"pve" user. Mandatory for VNC proxying. See the <a href="https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/wiki" target="_blank">Wiki</a> for more info.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">Debug Mode</td>
|
||||
<td class="fieldarea">
|
||||
<label class="checkbox-inline">
|
||||
<input type="checkbox" name="debug_mode" value="1" '. ($config->debug_mode=="1" ? "checked" : "").'> Whether or not you want Debug Logging enabled (WHMCS Module Log for Debugging >> /admin/logs/module-log)
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -306,7 +395,7 @@ function pvewhmcs_output($vars) {
|
||||
}
|
||||
}
|
||||
|
||||
/* commit module config to DB */
|
||||
// MODULE CONFIG: Commit changes to the database
|
||||
function save_config() {
|
||||
try {
|
||||
Capsule::connection()->transaction(
|
||||
@@ -316,6 +405,7 @@ function save_config() {
|
||||
$connectionManager->table('mod_pvewhmcs')->update(
|
||||
[
|
||||
'vnc_secret' => $_POST['vnc_secret'],
|
||||
'debug_mode' => $_POST['debug_mode'],
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -328,7 +418,7 @@ function save_config() {
|
||||
}
|
||||
}
|
||||
|
||||
/* adding a KVM plan */
|
||||
// MODULE FORM: Add new KVM Plan
|
||||
function kvm_plan_add() {
|
||||
echo '
|
||||
<form method="post">
|
||||
@@ -364,10 +454,14 @@ function kvm_plan_add() {
|
||||
<select class="form-control select-inline" name="cpuemu">
|
||||
<option value="host">(Host) Host</option>
|
||||
<option value="kvm32">(QEMU) kvm32</option>
|
||||
<option value="kvm64" selected="">(QEMU) kvm64</option>
|
||||
<option value="kvm64">(QEMU) kvm64</option>
|
||||
<option value="max">(QEMU) Max</option>
|
||||
<option value="qemu32">(QEMU) qemu32</option>
|
||||
<option value="qemu64">(QEMU) qemu64</option>
|
||||
<option value="x86-64-v2">(x86-64 psABI) v2 (Nehalem/Opteron_G3 on)</option>
|
||||
<option value="x86-64-v2-AES" selected="">(x86-64 psABI) v2-AES (Westmere/Opteron_G4 on)</option>
|
||||
<option value="x86-64-v3">(x86-64 psABI) v3 (Broadwell/EPYC on)</option>
|
||||
<option value="x86-64-v4">(x86-64 psABI) v4 (Skylake/EPYCv4 on)</option>
|
||||
<option value="486">(Intel) 486</option>
|
||||
<option value="Broadwell">(Intel) Broadwell</option>
|
||||
<option value="Broadwell-IBRS">(Intel) Broadwell-IBRS</option>
|
||||
@@ -375,7 +469,12 @@ function kvm_plan_add() {
|
||||
<option value="Broadwell-noTSX-IBRS">(Intel) Broadwell-noTSX-IBRS</option>
|
||||
<option value="Cascadelake-Server">(Intel) Cascadelake-Server</option>
|
||||
<option value="Cascadelake-Server-noTSX">(Intel) Cascadelake-Server-noTSX</option>
|
||||
<option value="Cascadelake-Server-v2">(Intel) Cascadelake-Server-v2</option>
|
||||
<option value="Cascadelake-Server-v4">(Intel) Cascadelake-Server-v4</option>
|
||||
<option value="Cascadelake-Server-v5">(Intel) Cascadelake-Server-v5</option>
|
||||
<option value="Conroe">(Intel) Conroe</option>
|
||||
<option value="Cooperlake">(Intel) Cooperlake</option>
|
||||
<option value="Cooperlake-v2">(Intel) Cooperlake-v2</option>
|
||||
<option value="Haswell">(Intel) Haswell</option>
|
||||
<option value="Haswell-IBRS">(Intel) Haswell-IBRS</option>
|
||||
<option value="Haswell-noTSX">(Intel) Haswell-noTSX</option>
|
||||
@@ -384,6 +483,10 @@ function kvm_plan_add() {
|
||||
<option value="Icelake-Client-noTSX">(Intel) Icelake-Client-noTSX</option>
|
||||
<option value="Icelake-Server">(Intel) Icelake-Server</option>
|
||||
<option value="Icelake-Server-noTSX">(Intel) Icelake-Server-noTSX</option>
|
||||
<option value="Icelake-Server-v3">(Intel) Icelake-Server-v3</option>
|
||||
<option value="Icelake-Server-v4">(Intel) Icelake-Server-v4</option>
|
||||
<option value="Icelake-Server-v5">(Intel) Icelake-Server-v5</option>
|
||||
<option value="Icelake-Server-v6">(Intel) Icelake-Server-v6</option>
|
||||
<option value="IvyBridge">(Intel) IvyBridge</option>
|
||||
<option value="IvyBridge-IBRS">(Intel) IvyBridge-IBRS</option>
|
||||
<option value="KnightsMill">(Intel) KnightsMill</option>
|
||||
@@ -392,12 +495,16 @@ function kvm_plan_add() {
|
||||
<option value="Penryn">(Intel) Penryn</option>
|
||||
<option value="SandyBridge">(Intel) SandyBridge</option>
|
||||
<option value="SandyBridge-IBRS">(Intel) SandyBridge-IBRS</option>
|
||||
<option value="SapphireRapids">(Intel) SapphireRapids</option>
|
||||
<option value="Skylake-Client">(Intel) Skylake-Client</option>
|
||||
<option value="Skylake-Client-IBRS">(Intel) Skylake-Client-IBRS</option>
|
||||
<option value="Skylake-Client-noTSX-IBRS">(Intel) Skylake-Client-noTSX-IBRS</option>
|
||||
<option value="Skylake-Client-v4">(Intel) Skylake-Client-v4</option>
|
||||
<option value="Skylake-Server">(Intel) Skylake-Server</option>
|
||||
<option value="Skylake-Server-IBRS">(Intel) Skylake-Server-IBRS</option>
|
||||
<option value="Skylake-Server-noTSX-IBRS">(Intel) Skylake-Server-noTSX-IBRS</option>
|
||||
<option value="Skylake-Server-v4">(Intel) Skylake-Server-v4</option>
|
||||
<option value="Skylake-Server-v5">(Intel) Skylake-Server-v5</option>
|
||||
<option value="Westmere">(Intel) Westmere</option>
|
||||
<option value="Westmere-IBRS">(Intel) Westmere-IBRS</option>
|
||||
<option value="pentium">(Intel) Pentium I</option>
|
||||
@@ -411,13 +518,15 @@ function kvm_plan_add() {
|
||||
<option value="EPYC-IBPB">(AMD) EPYC-IBPB</option>
|
||||
<option value="EPYC-Milan">(AMD) EPYC-Milan</option>
|
||||
<option value="EPYC-Rome">(AMD) EPYC-Rome</option>
|
||||
<option value="EPYC-Rome-v2">(AMD) EPYC-Rome-v2</option>
|
||||
<option value="EPYC-v3">(AMD) EPYC-v3</option>
|
||||
<option value="Opteron_G1">(AMD) Opteron_G1</option>
|
||||
<option value="Opteron_G2">(AMD) Opteron_G2</option>
|
||||
<option value="Opteron_G3">(AMD) Opteron_G3</option>
|
||||
<option value="Opteron_G4">(AMD) Opteron_G4</option>
|
||||
<option value="Opteron_G5">(AMD) Opteron_G5</option>
|
||||
</select>
|
||||
CPU emulation type. Default is KVM64
|
||||
CPU emulation type. Default is x86-64 psABI v2-AES
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -500,7 +609,7 @@ function kvm_plan_add() {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">PVE Storage - Name</td>
|
||||
<td class="fieldlabel">PVE Store - Name</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="storage" id="storage" value="local" required>
|
||||
Name of VM/CT Storage on Proxmox VE hypervisor. local/local-lvm/etc.
|
||||
@@ -563,12 +672,19 @@ function kvm_plan_add() {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">Trunk - VLAN ID</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="vlanid" id="vlanid">
|
||||
VLAN ID for Plan Services. Default forgoes tagging (VLAN ID), leave blank for untagged.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">
|
||||
Hardware Virt?
|
||||
</td>
|
||||
<td class="fieldarea">
|
||||
<label class="checkbox-inline">
|
||||
<input type="checkbox" name="kvm" value="1" checked> Enable KVM hardware virtualisation. (Recommended)
|
||||
<input type="checkbox" name="kvm" value="1" checked> Enable KVM hardware virtualisation. Requires support/enablement in BIOS. (Recommended)
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -592,7 +708,7 @@ function kvm_plan_add() {
|
||||
';
|
||||
}
|
||||
|
||||
/* editing a KVM plan */
|
||||
// MODULE FORM: Edit a KVM Plan
|
||||
function kvm_plan_edit($id) {
|
||||
$plan= Capsule::table('mod_pvewhmcs_plans')->where('id', '=', $id)->get()[0];
|
||||
if (empty($plan)) {
|
||||
@@ -640,6 +756,10 @@ function kvm_plan_edit($id) {
|
||||
<option value="max" ' . ($plan->cpuemu == "max" ? "selected" : "") . '>(QEMU) Max</option>
|
||||
<option value="qemu32" ' . ($plan->cpuemu == "qemu32" ? "selected" : "") . '>(QEMU) qemu32</option>
|
||||
<option value="qemu64" ' . ($plan->cpuemu == "qemu64" ? "selected" : "") . '>(QEMU) qemu64</option>
|
||||
<option value="x86-64-v2" ' . ($plan->cpuemu == "x86-64-v2" ? "selected" : "") . '>(x86-64 psABI) v2 (Nehalem/Opteron_G3 on)</option>
|
||||
<option value="x86-64-v2-AES" ' . ($plan->cpuemu == "x86-64-v2-AES" ? "selected" : "") . '>(x86-64 psABI) v2-AES (Westmere/Opteron_G4 on)</option>
|
||||
<option value="x86-64-v3" ' . ($plan->cpuemu == "x86-64-v3" ? "selected" : "") . '>(x86-64 psABI) v3 (Broadwell/EPYC on)</option>
|
||||
<option value="x86-64-v4" ' . ($plan->cpuemu == "x86-64-v4" ? "selected" : "") . '>(x86-64 psABI) v4 (Skylake/EPYCv4 on)</option>
|
||||
<option value="486" ' . ($plan->cpuemu == "486" ? "selected" : "") . '>(Intel) 486</option>
|
||||
<option value="Broadwell" ' . ($plan->cpuemu == "Broadwell" ? "selected" : "") . '>(Intel) Broadwell</option>
|
||||
<option value="Broadwell-IBRS" ' . ($plan->cpuemu == "Broadwell-IBRS" ? "selected" : "") . '>(Intel) Broadwell-IBRS</option>
|
||||
@@ -647,7 +767,12 @@ function kvm_plan_edit($id) {
|
||||
<option value="Broadwell-noTSX-IBRS" ' . ($plan->cpuemu == "Broadwell-noTSX-IBRS" ? "selected" : "") . '>(Intel) Broadwell-noTSX-IBRS</option>
|
||||
<option value="Cascadelake-Server" ' . ($plan->cpuemu == "Cascadelake-Server" ? "selected" : "") . '>(Intel) Cascadelake-Server</option>
|
||||
<option value="Cascadelake-Server-noTSX" ' . ($plan->cpuemu == "Cascadelake-Server-noTSX" ? "selected" : "") . '>(Intel) Cascadelake-Server-noTSX</option>
|
||||
<option value="Cascadelake-Server-v2" ' . ($plan->cpuemu == "Cascadelake-Server-v2" ? "selected" : "") . '>(Intel) Cascadelake-Server V2</option>
|
||||
<option value="Cascadelake-Server-v4" ' . ($plan->cpuemu == "Cascadelake-Server-v4" ? "selected" : "") . '>(Intel) Cascadelake-Server V4</option>
|
||||
<option value="Cascadelake-Server-v5" ' . ($plan->cpuemu == "Cascadelake-Server-v5" ? "selected" : "") . '>(Intel) Cascadelake-Server V5</option>
|
||||
<option value="Conroe" ' . ($plan->cpuemu == "Conroe" ? "selected" : "") . '>(Intel) Conroe</option>
|
||||
<option value="Cooperlake" ' . ($plan->cpuemu == "Cooperlake" ? "selected" : "") . '>(Intel) Cooperlake</option>
|
||||
<option value="Cooperlake-v2" ' . ($plan->cpuemu == "Cooperlake-v2" ? "selected" : "") . '>(Intel) Cooperlake V2</option>
|
||||
<option value="Haswell" ' . ($plan->cpuemu == "Haswell" ? "selected" : "") . '>(Intel) Haswell</option>
|
||||
<option value="Haswell-IBRS" ' . ($plan->cpuemu == "Haswell-IBRS" ? "selected" : "") . '>(Intel) Haswell-IBRS</option>
|
||||
<option value="Haswell-noTSX" ' . ($plan->cpuemu == "Haswell-noTSX" ? "selected" : "") . '>(Intel) Haswell-noTSX</option>
|
||||
@@ -656,6 +781,10 @@ function kvm_plan_edit($id) {
|
||||
<option value="Icelake-Client-noTSX" ' . ($plan->cpuemu == "Icelake-Client-noTSX" ? "selected" : "") . '>(Intel) Icelake-Client-noTSX</option>
|
||||
<option value="Icelake-Server" ' . ($plan->cpuemu == "Icelake-Server" ? "selected" : "") . '>(Intel) Icelake-Server</option>
|
||||
<option value="Icelake-Server-noTSX" ' . ($plan->cpuemu == "Icelake-Server-noTSX" ? "selected" : "") . '>(Intel) Icelake-Server-noTSX</option>
|
||||
<option value="Icelake-Server-v3" ' . ($plan->cpuemu == "Icelake-Server-v3" ? "selected" : "") . '>(Intel) Icelake-Server V3</option>
|
||||
<option value="Icelake-Server-v4" ' . ($plan->cpuemu == "Icelake-Server-v4" ? "selected" : "") . '>(Intel) Icelake-Server V4</option>
|
||||
<option value="Icelake-Server-v5" ' . ($plan->cpuemu == "Icelake-Server-v5" ? "selected" : "") . '>(Intel) Icelake-Server V5</option>
|
||||
<option value="Icelake-Server-v6" ' . ($plan->cpuemu == "Icelake-Server-v6" ? "selected" : "") . '>(Intel) Icelake-Server V6</option>
|
||||
<option value="IvyBridge" ' . ($plan->cpuemu == "IvyBridge" ? "selected" : "") . '>(Intel) IvyBridge</option>
|
||||
<option value="IvyBridge-IBRS" ' . ($plan->cpuemu == "IvyBridge-IBRS" ? "selected" : "") . '>(Intel) IvyBridge-IBRS</option>
|
||||
<option value="KnightsMill" ' . ($plan->cpuemu == "KnightsMill" ? "selected" : "") . '>(Intel) KnightsMill</option>
|
||||
@@ -664,12 +793,16 @@ function kvm_plan_edit($id) {
|
||||
<option value="Penryn" ' . ($plan->cpuemu == "Penryn" ? "selected" : "") . '>(Intel) Penryn</option>
|
||||
<option value="SandyBridge" ' . ($plan->cpuemu == "SandyBridge" ? "selected" : "") . '>(Intel) SandyBridge</option>
|
||||
<option value="SandyBridge-IBRS" ' . ($plan->cpuemu == "SandyBridge-IBRS" ? "selected" : "") . '>(Intel) SandyBridge-IBRS</option>
|
||||
<option value="SapphireRapids" ' . ($plan->cpuemu == "SapphireRapids" ? "selected" : "") . '>(Intel) Sapphire Rapids</option>
|
||||
<option value="Skylake-Client" ' . ($plan->cpuemu == "Skylake-Client" ? "selected" : "") . '>(Intel) Skylake-Client</option>
|
||||
<option value="Skylake-Client-IBRS" ' . ($plan->cpuemu == "Skylake-Client-IBRS" ? "selected" : "") . '>(Intel) Skylake-Client-IBRS</option>
|
||||
<option value="Skylake-Client-noTSX-IBRS" ' . ($plan->cpuemu == "Skylake-Client-noTSX-IBRS" ? "selected" : "") . '>(Intel) Skylake-Client-noTSX-IBRS</option>
|
||||
<option value="Skylake-Client-v4" ' . ($plan->cpuemu == "Skylake-Client-v4" ? "selected" : "") . '>(Intel) Skylake-Client V4</option>
|
||||
<option value="Skylake-Server" ' . ($plan->cpuemu == "Skylake-Server" ? "selected" : "") . '>(Intel) Skylake-Server</option>
|
||||
<option value="Skylake-Server-IBRS" ' . ($plan->cpuemu == "Skylake-Server-IBRS" ? "selected" : "") . '>(Intel) Skylake-Server-IBRS</option>
|
||||
<option value="Skylake-Server-noTSX-IBRS" ' . ($plan->cpuemu == "Skylake-Server-noTSX-IBRS" ? "selected" : "") . '>(Intel) Skylake-Server-noTSX-IBRS</option>
|
||||
<option value="Skylake-Server-v4" ' . ($plan->cpuemu == "Skylake-Server-v4" ? "selected" : "") . '>(Intel) Skylake-Server V4</option>
|
||||
<option value="Skylake-Server-v5" ' . ($plan->cpuemu == "Skylake-Server-v5" ? "selected" : "") . '>(Intel) Skylake-Server V5</option>
|
||||
<option value="Westmere" ' . ($plan->cpuemu == "Westmere" ? "selected" : "") . '>(Intel) Westmere</option>
|
||||
<option value="Westmere-IBRS" ' . ($plan->cpuemu == "Westmere-IBRS" ? "selected" : "") . '>(Intel) Westmere-IBRS</option>
|
||||
<option value="pentium" ' . ($plan->cpuemu == "pentium" ? "selected" : "") . '>(Intel) Pentium I</option>
|
||||
@@ -683,13 +816,15 @@ function kvm_plan_edit($id) {
|
||||
<option value="EPYC-IBPB" ' . ($plan->cpuemu == "EPYC-IBPB" ? "selected" : "") . '>(AMD) EPYC-IBPB</option>
|
||||
<option value="EPYC-Milan" ' . ($plan->cpuemu == "EPYC-Milan" ? "selected" : "") . '>(AMD) EPYC-Milan</option>
|
||||
<option value="EPYC-Rome" ' . ($plan->cpuemu == "EPYC-Rome" ? "selected" : "") . '>(AMD) EPYC-Rome</option>
|
||||
<option value="EPYC-Rome-v2" ' . ($plan->cpuemu == "EPYC-Rome-v2" ? "selected" : "") . '>(AMD) EPYC-Rome-v2</option>
|
||||
<option value="EPYC-v3" ' . ($plan->cpuemu == "EPYC-v3" ? "selected" : "") . '>(AMD) EPYC-v3</option>
|
||||
<option value="Opteron_G1" ' . ($plan->cpuemu == "Opteron_G1" ? "selected" : "") . '>(AMD) Opteron_G1</option>
|
||||
<option value="Opteron_G2" ' . ($plan->cpuemu == "Opteron_G2" ? "selected" : "") . '>(AMD) Opteron_G2</option>
|
||||
<option value="Opteron_G3" ' . ($plan->cpuemu == "Opteron_G3" ? "selected" : "") . '>(AMD) Opteron_G3</option>
|
||||
<option value="Opteron_G4" ' . ($plan->cpuemu == "Opteron_G4" ? "selected" : "") . '>(AMD) Opteron_G4</option>
|
||||
<option value="Opteron_G5" ' . ($plan->cpuemu == "Opteron_G5" ? "selected" : "") . '>(AMD) Opteron_G5</option>
|
||||
</select>
|
||||
CPU emulation type. Default is KVM64
|
||||
CPU emulation type. Default is x86-64 psABI v2-AES
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -718,7 +853,7 @@ function kvm_plan_edit($id) {
|
||||
<td class="fieldlabel">CPU - Weighting</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="cpuunits" id="cpuunits" value="'.$plan->cpuunits.'" required>
|
||||
Number is relative to weights of all the other running VMs. 8 - 500000 recommended 1024. NOTE: You can disable fair-scheduler configuration by setting this to 0.
|
||||
Number is relative to weights of all the other running VMs. 8 - 500000 recommended 1024. NOTE: You can disable fair-scheduler by setting this to 0.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -772,7 +907,7 @@ function kvm_plan_edit($id) {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">PVE Storage - Name</td>
|
||||
<td class="fieldlabel">PVE Store - Name</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="storage" id="storage" required value="'.$plan->storage.'">
|
||||
Name of VM/CT Storage on Proxmox VE hypervisor. local/local-lvm/etc.
|
||||
@@ -800,14 +935,14 @@ function kvm_plan_edit($id) {
|
||||
<td class="fieldlabel">Network - Rate</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="netrate" id="netrate" value="'.$plan->netrate.'">
|
||||
Network Rate Limit in Megabit, Blank means unlimit.
|
||||
Network Rate Limit in Megabit, Blank means unlimited.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">Network - BW Limit</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="bw" id="bw" value="'.$plan->bw.'">
|
||||
Monthly Bandwidth Limit in GigaByte, Blank means unlimit.
|
||||
Monthly Bandwidth Limit in Gigabyte, Blank means unlimited.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -835,12 +970,19 @@ function kvm_plan_edit($id) {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">Trunk - VLAN ID</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="vlanid" id="vlanid">
|
||||
VLAN ID for Plan Services. Default forgoes tagging (VLAN ID), leave blank for untagged.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">
|
||||
Hardware Virt?
|
||||
</td>
|
||||
<td class="fieldarea">
|
||||
<label class="checkbox-inline">
|
||||
<input type="checkbox" name="kvm" value="1" '. ($plan->kvm=="1" ? "checked" : "").'> Enable KVM hardware virtualisation. (Recommended)
|
||||
<input type="checkbox" name="kvm" value="1" '. ($plan->kvm=="1" ? "checked" : "").'> Enable KVM hardware virtualisation. Requires support/enablement in BIOS. (Recommended)
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -864,8 +1006,7 @@ function kvm_plan_edit($id) {
|
||||
';
|
||||
}
|
||||
|
||||
|
||||
/* adding an LXC plan */
|
||||
// MODULE FORM: Add an LXC Plan
|
||||
function lxc_plan_add() {
|
||||
echo '
|
||||
<form method="post">
|
||||
@@ -908,11 +1049,11 @@ function lxc_plan_add() {
|
||||
<td class="fieldlabel">SSD/HDD - Disk</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="disk" id="disk" required>
|
||||
Disk space in Gigabayte e.g 1024 = 1TB
|
||||
Disk space in Gigabytes e.g 1024 = 1TB
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">PVE Storage - Name</td>
|
||||
<td class="fieldlabel">PVE Store - Name</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="storage" id="storage" value="local" required>
|
||||
Name of VM/CT Storage on Proxmox VE hypervisor. local/local-lvm/etc.
|
||||
@@ -940,6 +1081,13 @@ function lxc_plan_add() {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">Trunk - VLAN ID</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="vlanid" id="vlanid">
|
||||
VLAN ID for Plan Services. Default forgoes tagging (VLAN ID), leave blank for untagged.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">Network - Rate</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="netrate" id="netrate">
|
||||
@@ -973,7 +1121,7 @@ function lxc_plan_add() {
|
||||
';
|
||||
}
|
||||
|
||||
/* editing an LXC plan */
|
||||
// MODULE FORM: Edit an LXC Plan
|
||||
function lxc_plan_edit($id) {
|
||||
$plan= Capsule::table('mod_pvewhmcs_plans')->where('id', '=', $id)->get()[0];
|
||||
if (empty($plan)) {
|
||||
@@ -1029,7 +1177,7 @@ function lxc_plan_edit($id) {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">PVE Storage - Name</td>
|
||||
<td class="fieldlabel">PVE Store - Name</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="storage" id="storage" value="'.$plan->storage.'" required>
|
||||
Name of VM/CT Storage on Proxmox VE hypervisor. local/local-lvm/etc.
|
||||
@@ -1057,6 +1205,13 @@ function lxc_plan_edit($id) {
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">Trunk - VLAN ID</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="vlanid" id="vlanid">
|
||||
VLAN ID for Plan Services. Default forgoes tagging (VLAN ID), leave blank for untagged.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="fieldlabel">Network - Rate</td>
|
||||
<td class="fieldarea">
|
||||
<input type="text" size="8" name="netrate" id="netrate" value="'.$plan->netrate.'">
|
||||
@@ -1090,6 +1245,7 @@ function lxc_plan_edit($id) {
|
||||
';
|
||||
}
|
||||
|
||||
// MODULE FORM ACTION: Save KVM Plan
|
||||
function save_kvm_plan() {
|
||||
try {
|
||||
Capsule::connection()->transaction(
|
||||
@@ -1117,6 +1273,7 @@ function save_kvm_plan() {
|
||||
'bridge' => $_POST['bridge'],
|
||||
'vmbr' => $_POST['vmbr'],
|
||||
'netmodel' => $_POST['netmodel'],
|
||||
'vlanid' => $_POST['vlanid'],
|
||||
'netrate' => $_POST['netrate'],
|
||||
'bw' => $_POST['bw'],
|
||||
'kvm' => $_POST['kvm'],
|
||||
@@ -1133,6 +1290,7 @@ function save_kvm_plan() {
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE FORM ACTION: Update KVM Plan
|
||||
function update_kvm_plan() {
|
||||
Capsule::table('mod_pvewhmcs_plans')
|
||||
->where('id', $_GET['id'])
|
||||
@@ -1157,6 +1315,7 @@ function update_kvm_plan() {
|
||||
'bridge' => $_POST['bridge'],
|
||||
'vmbr' => $_POST['vmbr'],
|
||||
'netmodel' => $_POST['netmodel'],
|
||||
'vlanid' => $_POST['vlanid'],
|
||||
'netrate' => $_POST['netrate'],
|
||||
'bw' => $_POST['bw'],
|
||||
'kvm' => $_POST['kvm'],
|
||||
@@ -1168,13 +1327,15 @@ function update_kvm_plan() {
|
||||
header("Location: ".pvewhmcs_BASEURL."&tab=vmplans&action=planlist");
|
||||
}
|
||||
|
||||
|
||||
// MODULE FORM ACTION: Remove Plan
|
||||
function remove_plan($id) {
|
||||
Capsule::table('mod_pvewhmcs_plans')->where('id', '=', $id)->delete();
|
||||
header("Location: ".pvewhmcs_BASEURL."&tab=vmplans&action=planlist");
|
||||
$_SESSION['pvewhmcs']['infomsg']['title']='Plan Deleted.' ;
|
||||
$_SESSION['pvewhmcs']['infomsg']['message']='Selected Item deleted successfuly.' ;
|
||||
}
|
||||
|
||||
// MODULE FORM ACTION: Save LXC Plan
|
||||
function save_lxc_plan() {
|
||||
try {
|
||||
Capsule::connection()->transaction(
|
||||
@@ -1196,6 +1357,7 @@ function save_lxc_plan() {
|
||||
'bridge' => $_POST['bridge'],
|
||||
'vmbr' => $_POST['vmbr'],
|
||||
'netmodel' => $_POST['netmodel'],
|
||||
'vlanid' => $_POST['vlanid'],
|
||||
'netrate' => $_POST['netrate'],
|
||||
'bw' => $_POST['bw'],
|
||||
'onboot' => $_POST['onboot'],
|
||||
@@ -1211,6 +1373,7 @@ function save_lxc_plan() {
|
||||
}
|
||||
}
|
||||
|
||||
// MODULE FORM ACTION: Update LXC Plan
|
||||
function update_lxc_plan() {
|
||||
Capsule::table('mod_pvewhmcs_plans')
|
||||
->where('id', $_GET['id'])
|
||||
@@ -1229,6 +1392,7 @@ function update_lxc_plan() {
|
||||
'bridge' => $_POST['bridge'],
|
||||
'vmbr' => $_POST['vmbr'],
|
||||
'netmodel' => $_POST['netmodel'],
|
||||
'vlanid' => $_POST['vlanid'],
|
||||
'netrate' => $_POST['netrate'],
|
||||
'bw' => $_POST['bw'],
|
||||
'onboot' => $_POST['onboot'],
|
||||
@@ -1239,7 +1403,7 @@ function update_lxc_plan() {
|
||||
header("Location: ".pvewhmcs_BASEURL."&tab=vmplans&action=planlist");
|
||||
}
|
||||
|
||||
// List IP pools in table
|
||||
// IP POOLS: List all Pools
|
||||
function list_ip_pools() {
|
||||
echo '<a class="btn btn-default" href="'. pvewhmcs_BASEURL .'&tab=ippools&action=new_ip_pool"><i class="fa fa-plus-square"></i> New IP Pool</a>';
|
||||
echo '<table class="datatable"><tr><th>ID</th><th>Pool</th><th>Gateway</th><th>Action</th></tr>';
|
||||
@@ -1257,7 +1421,7 @@ function list_ip_pools() {
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
//create new IP pool
|
||||
// IP POOL FORM: Add IP Pool
|
||||
function add_ip_pool() {
|
||||
echo '
|
||||
<form method="post">
|
||||
@@ -1279,6 +1443,7 @@ function add_ip_pool() {
|
||||
';
|
||||
}
|
||||
|
||||
// IP POOL FORM ACTION: Save Pool
|
||||
function save_ip_pool() {
|
||||
try {
|
||||
Capsule::connection()->transaction(
|
||||
@@ -1301,6 +1466,7 @@ function save_ip_pool() {
|
||||
}
|
||||
}
|
||||
|
||||
// IP POOL FORM ACTION: Remove Pool
|
||||
function removeIpPool($id) {
|
||||
Capsule::table('mod_pvewhmcs_ip_addresses')->where('pool_id', '=', $id)->delete();
|
||||
Capsule::table('mod_pvewhmcs_ip_pools')->where('id', '=', $id)->delete();
|
||||
@@ -1310,7 +1476,7 @@ function removeIpPool($id) {
|
||||
$_SESSION['pvewhmcs']['infomsg']['message']='Deleted the IP Pool successfully.' ;
|
||||
}
|
||||
|
||||
// add IP address/subnet to Pool
|
||||
// IP POOL FORM ACTION: Add IP to Pool
|
||||
function add_ip_2_pool() {
|
||||
require_once(ROOTDIR.'/modules/addons/pvewhmcs/Ipv4/Subnet.php');
|
||||
echo '<form method="post">
|
||||
@@ -1370,7 +1536,7 @@ function add_ip_2_pool() {
|
||||
}
|
||||
}
|
||||
|
||||
// List IP addresses in pool
|
||||
// IP POOL FORM: List IPs in Pool
|
||||
function list_ips() {
|
||||
//echo '<script>$(function() {$( "#dialog" ).dialog();});</script>' ;
|
||||
//echo '<div id="dialog">' ;
|
||||
@@ -1387,7 +1553,7 @@ function list_ips() {
|
||||
|
||||
}
|
||||
|
||||
// Remove IP Address
|
||||
// IP POOL FORM ACTION: Remove IP from Pool
|
||||
function removeip($id,$pool_id) {
|
||||
Capsule::table('mod_pvewhmcs_ip_addresses')->where('id', '=', $id)->delete();
|
||||
header("Location: ".pvewhmcs_BASEURL."&tab=ippools&action=list_ips&id=".$pool_id);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</div>
|
||||
<div class="col col-md-2">
|
||||
<img src="/modules/servers/pvewhmcs/img/{$vm_status['status']}.png"/><br/>
|
||||
<span style="text-transform: uppercase"><strong>{$vm_status['status']}</strong></span><br/>
|
||||
<span style="text-transform: uppercase"><strong><i>{$vm_status['status']}</i></strong></span><br/>
|
||||
Up: {$vm_status['uptime']}
|
||||
|
||||
</div>
|
||||
@@ -25,16 +25,16 @@
|
||||
<div class="row">
|
||||
<script src="/modules/servers/pvewhmcs/js/CircularLoader.js"></script>
|
||||
<div class="col col-md-3" style="height:106px;">
|
||||
<div id="c1" class="circle" data-percent="{$vm_status['cpu']}">CPU</div>
|
||||
<div id="c1" class="circle" data-percent="{$vm_status['cpu']}"><strong>CPU</strong></div>
|
||||
</div>
|
||||
<div class="col col-md-3">
|
||||
<div id="c2" class="circle" data-percent="{$vm_status['memusepercent']}">RAM</div>
|
||||
<div id="c2" class="circle" data-percent="{$vm_status['memusepercent']}"><strong>RAM</strong></div>
|
||||
</div>
|
||||
<div class="col col-md-3">
|
||||
<div id="c3" class="circle" data-percent="{$vm_status['diskusepercent']}">Disk</div>
|
||||
<div id="c3" class="circle" data-percent="{$vm_status['diskusepercent']}"><strong>Disk</strong></div>
|
||||
</div>
|
||||
<div class="col col-md-3">
|
||||
<div id="c4" class="circle" data-percent="{$vm_status['swapusepercent']}">Swap</div>
|
||||
<div id="c4" class="circle" data-percent="{$vm_status['swapusepercent']}"><strong>Swap</strong></div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
@@ -57,30 +57,31 @@
|
||||
|
||||
<table class="table table-bordered table-striped">
|
||||
<tr>
|
||||
<td>Network Addressing</td><td><strong>{$vm_config['ipv4']}</strong><br/>Subnet Mask: {$vm_config['netmask4']}<br/>Gateway: {$vm_config['gateway4']}</td>
|
||||
<td><strong>IP</strong> (Addressing)</td><td><strong>{$vm_config['ipv4']}</strong><br/>Subnet Mask: {$vm_config['netmask4']}<br/>Gateway: {$vm_config['gateway4']}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OS (Type)</td>
|
||||
<td>Kernel/System: {$vm_config['ostype']}</td>
|
||||
<td><strong>OS/etc</strong> (System)</td>
|
||||
<td>Kernel: {$vm_config['ostype']}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CPU (Spec)</td>
|
||||
<td>{$vm_config['sockets']} socket/s, {$vm_config['cores']} core/s ({$vm_config['cpu']})</td>
|
||||
<td><strong>Compute</strong> (CPU)</td>
|
||||
<td>{$vm_config['sockets']} socket/s, {$vm_config['cores']} core/s<br />
|
||||
Emulation: {$vm_config['cpu']}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Memory (RAM)</td>
|
||||
<td><strong>Memory</strong> (RAM)</td>
|
||||
<td>{$vm_config['memory']}MB</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Network Interface #1</td>
|
||||
<td><strong>NIC</strong> (Interface #1)</td>
|
||||
<td>{($vm_config['net0']|replace:',':'<br/>')}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Network Interface #2</td>
|
||||
<td><strong>NIC</strong> (Interface #2)</td>
|
||||
<td>{$vm_config['net1']}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Storage (SSD/HDD)</td>
|
||||
<td><strong>Storage</strong> (SSD/HDD)</td>
|
||||
<td>
|
||||
{$rootfs=(","|explode:$vm_config['rootfs'])}
|
||||
{$disk=(","|explode:$vm_config['ide0'])}
|
||||
|
||||
BIN
modules/servers/pvewhmcs/img/spice.png
Normal file
BIN
modules/servers/pvewhmcs/img/spice.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
@@ -1,24 +1,50 @@
|
||||
<?php
|
||||
// FILE: novnc_router.php
|
||||
// TASK: Take WHMCS request, add browser cookie, then redirect to noVNC
|
||||
|
||||
/*
|
||||
Proxmox VE for WHMCS - Addon/Server Modules for WHMCS (& PVE)
|
||||
https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/
|
||||
File: /modules/servers/pvewhmcs/novnc_router.php (VNC)
|
||||
|
||||
Copyright (C) The Network Crew Pty Ltd (TNC) & Co.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
if (isset($_GET['pveticket']) && isset($_GET['host']) && isset($_GET['path']) && isset($_GET['vncticket'])) {
|
||||
// Take passed-in variables and re-assign for usage
|
||||
$pveticket = $_GET['pveticket'];
|
||||
$vncticket = $_GET['vncticket'];
|
||||
$host = $_GET['host'];
|
||||
$path = $_GET['path'];
|
||||
|
||||
// Get the requesting hostname/domain from request
|
||||
$whmcsdomain = parse_url($_SERVER['HTTP_HOST']);
|
||||
$domainonly = preg_replace("/^(.*?)\.(.*)$/","$2",$whmcsdomain['path']);
|
||||
// Get the requesting hostname/domain from the WHMCS-originated request
|
||||
$whmcsdomain = parse_url($_SERVER['HTTP_HOST']);
|
||||
// Now extract just the domain parts we need (FUTURE: capacity/option for multi-part TLDs)
|
||||
$domainonly = preg_replace("/^(.*?)\.(.*)$/","$2",$whmcsdomain['path']);
|
||||
// Set the cookie as Proxmox will be expecting it, so it is WHMCS to VNC without further login
|
||||
setrawcookie('PVEAuthCookie', $pveticket, 0, '/', $domainonly);
|
||||
|
||||
// Create the final noVNC URL with the re-encoded vncticket
|
||||
$hostname = gethostbyaddr($host);
|
||||
$redirect_url = '/modules/servers/pvewhmcs/novnc/vnc.html?autoconnect=true&encrypt=true&host=' . $hostname . '&port=8006&password=' . urlencode($vncticket) . '&path=' . urlencode($path);
|
||||
|
||||
// Redirect the visitor to noVNC & we're done
|
||||
header('Location: ' . $redirect_url);
|
||||
exit;
|
||||
} else {
|
||||
// Passed in values not present, exit
|
||||
echo 'Error: Missing required info to route your request. Please try again.';
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,4 +1,27 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Proxmox VE for WHMCS - Addon/Server Modules for WHMCS (& PVE)
|
||||
https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/
|
||||
File: /modules/servers/pvewhmcs/pvewhmcs.php (PVE Work)
|
||||
|
||||
Copyright (C) The Network Crew Pty Ltd (TNC) & Co.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// DEP: Proxmox API Class - make sure we can access via PVE via API
|
||||
if (file_exists('../modules/addons/pvewhmcs/proxmox.php'))
|
||||
require_once('../modules/addons/pvewhmcs/proxmox.php');
|
||||
else
|
||||
@@ -8,17 +31,17 @@ use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
|
||||
global $guest ;
|
||||
|
||||
// WHMCS CONFIG > SERVICES/PRODUCTS > Their Service > Tab #3 (Plan/Pool)
|
||||
function pvewhmcs_ConfigOptions() {
|
||||
// Reterive PVE for WHMCS Cluster
|
||||
$server=Capsule::table('tblservers')->where('type', '=', 'pve-whmcs')->get()[0] ;
|
||||
// Retrieve PVE for WHMCS Cluster
|
||||
$server=Capsule::table('tblservers')->where('type', '=', 'pvewhmcs')->get()[0] ;
|
||||
|
||||
|
||||
// Reterive Plans
|
||||
// Retrieve Plans
|
||||
foreach (Capsule::table('mod_pvewhmcs_plans')->get() as $plan) {
|
||||
$plans[$plan->id]=$plan->vmtype.' : '.$plan->title ;
|
||||
}
|
||||
|
||||
// Reterive IP Pools
|
||||
// Retrieve IP Pools
|
||||
foreach (Capsule::table('mod_pvewhmcs_ip_pools')->get() as $ippool) {
|
||||
$ippools[$ippool->id]=$ippool->title ;
|
||||
}
|
||||
@@ -39,7 +62,8 @@ function pvewhmcs_ConfigOptions() {
|
||||
}
|
||||
}
|
||||
*/
|
||||
// Options for the Service
|
||||
// OPTIONS FOR THE QEMU/LXC PACKAGE; ties WHMCS PRODUCT to MODULE PLAN/POOL
|
||||
// Ref: https://developers.whmcs.com/provisioning-modules/config-options/
|
||||
// SQL/Param: configoption1 configoption2
|
||||
$configarray = array(
|
||||
"Plan" => array(
|
||||
@@ -59,7 +83,19 @@ function pvewhmcs_ConfigOptions() {
|
||||
return $configarray;
|
||||
}
|
||||
|
||||
// PVE API FUNCTION: Create the Service on the Hypervisor
|
||||
function pvewhmcs_CreateAccount($params) {
|
||||
// Make sure "WHMCS Admin > Products/Services > Proxmox-based Service -> Plan + Pool" are set. Else, fail early. (Issue #36)
|
||||
if (!isset($params['configoption1'], $params['configoption2'])) {
|
||||
throw new Exception("PVEWHMCS Error: Missing Config. Service/Product WHMCS Config not saved (Plan/Pool not assigned to WHMCS Service type). Check Support/Health tab in Module Config for info. Quick and easy fix.");
|
||||
}
|
||||
if (empty($params['configoption1'])) {
|
||||
throw new Exception("PVEWHMCS Error: Missing Config. Service/Product WHMCS Config not saved (Plan/Pool not assigned to WHMCS Service type). Check Support/Health tab in Module Config for info. Quick and easy fix.");
|
||||
}
|
||||
if (empty($params['configoption2'])) {
|
||||
throw new Exception("PVEWHMCS Error: Missing Config. Service/Product WHMCS Config not saved (Plan/Pool not assigned to WHMCS Service type). Check Support/Health tab in Module Config for info. Quick and easy fix.");
|
||||
}
|
||||
|
||||
// Retrieve Plan from table
|
||||
$plan = Capsule::table('mod_pvewhmcs_plans')->where('id', '=', $params['configoption1'])->get()[0];
|
||||
|
||||
@@ -74,7 +110,7 @@ function pvewhmcs_CreateAccount($params) {
|
||||
|
||||
// CREATE IF QEMU/KVM
|
||||
if (!empty($params['customfields']['KVMTemplate'])) {
|
||||
file_put_contents('d:\log.txt', $params['customfields']['KVMTemplate']);
|
||||
// file_put_contents('d:\log.txt', $params['customfields']['KVMTemplate']);
|
||||
|
||||
$proxmox = new PVE2_API($serverip, $serverusername, "pam", $serverpassword);
|
||||
if ($proxmox->login()) {
|
||||
@@ -85,14 +121,18 @@ function pvewhmcs_CreateAccount($params) {
|
||||
$vm_settings['newid'] = $params["serviceid"];
|
||||
$vm_settings['name'] = "vps" . $params["serviceid"] . "-cus" . $params['clientsdetails']['userid'];
|
||||
$vm_settings['full'] = true;
|
||||
// DEBUG - Log the request parameters before it's fired
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
'vm_settings_and_v_1',
|
||||
['vm_settings' => $vm_settings, 'v' => $v]
|
||||
);
|
||||
// KVM TEMPLATE - Conduct the VM CLONE from Template to Machine
|
||||
$logrequest = '/nodes/' . $first_node . '/qemu/' . $params['customfields']['KVMTemplate'] . '/clone' . $vm_settings;
|
||||
$response = $proxmox->post('/nodes/' . $first_node . '/qemu/' . $params['customfields']['KVMTemplate'] . '/clone', $vm_settings);
|
||||
// DEBUG - Log the request parameters before it's fired
|
||||
if (Capsule::table('mod_pvewhmcs')->where('id', '1')->value('debug_mode') == 1) {
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
$logrequest,
|
||||
json_decode($response)
|
||||
);
|
||||
}
|
||||
if ($response) {
|
||||
Capsule::table('mod_pvewhmcs_vms')->insert(
|
||||
[
|
||||
@@ -105,6 +145,15 @@ function pvewhmcs_CreateAccount($params) {
|
||||
'created' => date("Y-m-d H:i:s"),
|
||||
]
|
||||
);
|
||||
// ISSUE #32 relates - amend post-clone to ensure excludes-disk amendments are all done, too.
|
||||
$cloned_tweaks['memory'] = $plan->memory;
|
||||
$cloned_tweaks['ostype'] = $plan->ostype;
|
||||
$cloned_tweaks['sockets'] = $plan->cpus;
|
||||
$cloned_tweaks['cores'] = $plan->cores;
|
||||
$cloned_tweaks['cpu'] = $plan->cpuemu;
|
||||
$cloned_tweaks['kvm'] = $plan->kvm;
|
||||
$cloned_tweaks['onboot'] = $plan->onboot;
|
||||
$amendment = $proxmox->post('/nodes/' . $first_node . '/qemu/' . $vm_settings['newid'] . '/config'. $cloned_tweaks);
|
||||
return true;
|
||||
} else {
|
||||
if (is_array($response) && isset($response['data']['errors'])) {
|
||||
@@ -119,7 +168,7 @@ function pvewhmcs_CreateAccount($params) {
|
||||
} else {
|
||||
throw new Exception("Proxmox Error: PVE API login failed. Please check your credentials.");
|
||||
}
|
||||
// CREATE IF LXC/CONTAINER
|
||||
// PREPARE SETTINGS FOR QEMU/LXC EVENTUALITIES
|
||||
} else {
|
||||
$vm_settings['vmid'] = $params["serviceid"];
|
||||
if ($plan->vmtype == 'lxc') {
|
||||
@@ -128,7 +177,11 @@ function pvewhmcs_CreateAccount($params) {
|
||||
$vm_settings['rootfs'] = $plan->storage . ':' . $plan->disk;
|
||||
$vm_settings['bwlimit'] = $plan->diskio;
|
||||
$vm_settings['net0'] = 'name=eth0,bridge=' . $plan->bridge . $plan->vmbr . ',ip=' . $ip->ipaddress . '/' . mask2cidr($ip->mask) . ',gw=' . $ip->gateway;
|
||||
if(!empty($plan->vlanid)){
|
||||
$vm_settings['net0'] .= ',trunk=' . $plan->vlanid;
|
||||
}
|
||||
$vm_settings['nameserver'] = '1.1.1.1';
|
||||
$vm_settings['onboot'] = $plan->onboot;
|
||||
$vm_settings['password'] = $params['customfields']['Password'];
|
||||
} else {
|
||||
$vm_settings['ostype'] = $plan->ostype;
|
||||
@@ -160,6 +213,9 @@ function pvewhmcs_CreateAccount($params) {
|
||||
if (!empty($plan->netrate)) {
|
||||
$vm_settings['net0'] .= ',rate=' . $plan->netrate;
|
||||
}
|
||||
if (!empty($plan->vlanid)) {
|
||||
$vm_settings['net0'] .= ',trunk=' . $plan->vlanid;
|
||||
}
|
||||
}
|
||||
/* end of network settings */
|
||||
}
|
||||
@@ -168,6 +224,7 @@ function pvewhmcs_CreateAccount($params) {
|
||||
$vm_settings['cpulimit'] = $plan->cpulimit;
|
||||
$vm_settings['memory'] = $plan->memory;
|
||||
|
||||
// CREATION: Attempt to create the QEMU/LXC instance on Proxmox VE via API
|
||||
try {
|
||||
$proxmox = new PVE2_API($serverip, $serverusername, "pam", $serverpassword);
|
||||
|
||||
@@ -183,14 +240,18 @@ function pvewhmcs_CreateAccount($params) {
|
||||
$v = 'lxc';
|
||||
}
|
||||
|
||||
// DEBUG - Log the request parameters before it's fired
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
'vm_settings_and_v_2',
|
||||
['vm_settings' => $vm_settings, 'v' => $v]
|
||||
);
|
||||
// ACTION - Fire the attempt to create
|
||||
$logrequest = '/nodes/' . $first_node . '/' . $v . $vm_settings;
|
||||
$response = $proxmox->post('/nodes/' . $first_node . '/' . $v, $vm_settings);
|
||||
// DEBUG - Log the request parameters after it's fired
|
||||
if (Capsule::table('mod_pvewhmcs')->where('id', '1')->value('debug_mode') == 1) {
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
$logrequest,
|
||||
json_decode($response)
|
||||
);
|
||||
}
|
||||
if ($response) {
|
||||
unset($vm_settings);
|
||||
Capsule::table('mod_pvewhmcs_vms')->insert(
|
||||
@@ -220,85 +281,128 @@ function pvewhmcs_CreateAccount($params) {
|
||||
}
|
||||
} catch (PVE2_Exception $e) {
|
||||
// Record the error in WHMCS's module log.
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
$params,
|
||||
$e->getMessage(),
|
||||
$e->getTraceAsString()
|
||||
);
|
||||
|
||||
if (Capsule::table('mod_pvewhmcs')->where('id', '1')->value('debug_mode') == 1) {
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
$params,
|
||||
$e->getMessage() . $e->getTraceAsString()
|
||||
);
|
||||
}
|
||||
return $e->getMessage();
|
||||
}
|
||||
unset($vm_settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// PVE API FUNCTION, ADMIN: Test Connection with Proxmox node
|
||||
function pvewhmcs_TestConnection(array $params) {
|
||||
try {
|
||||
$success = true; // Assume success by default
|
||||
|
||||
try {
|
||||
// Call the service's connection test function.
|
||||
$serverip = $params["serverip"];
|
||||
$serverusername = $params["serverusername"];
|
||||
$serverpassword = $params["serverpassword"];
|
||||
$proxmox=new PVE2_API($serverip, $serverusername, "pam", $serverpassword);
|
||||
if ($proxmox->login())
|
||||
$success = true;
|
||||
$errorMsg = '';
|
||||
} catch (Exception $e) {
|
||||
// Record the error in WHMCS's module log.
|
||||
logModuleCall(
|
||||
'provisioningmodule',
|
||||
__FUNCTION__,
|
||||
$params,
|
||||
$e->getMessage(),
|
||||
$e->getTraceAsString()
|
||||
);
|
||||
$success = false;
|
||||
$errorMsg = $e->getMessage();
|
||||
}
|
||||
return array(
|
||||
'success' => $success,
|
||||
'error' => $errorMsg,
|
||||
);
|
||||
$serverip = $params["serverip"];
|
||||
$serverusername = $params["serverusername"];
|
||||
$serverpassword = $params["serverpassword"];
|
||||
$proxmox = new PVE2_API($serverip, $serverusername, "pam", $serverpassword);
|
||||
|
||||
if (!$proxmox->login()) {
|
||||
$success = false; // Set success to false if login fails
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// Record the error in WHMCS's module log, if debug mode is enabled.
|
||||
if (Capsule::table('mod_pvewhmcs')->where('id', '1')->value('debug_mode') == 1) {
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
$params,
|
||||
$e->getMessage() . $e->getTraceAsString()
|
||||
);
|
||||
}
|
||||
$success = $e->getMessage(); // Set the error message as the success value
|
||||
}
|
||||
|
||||
return array('success' => $success); // Return either true or the error
|
||||
}
|
||||
|
||||
// PVE API FUNCTION, ADMIN: Suspend a Service on the hypervisor
|
||||
function pvewhmcs_SuspendAccount(array $params) {
|
||||
$serverip = $params["serverip"]; $serverusername = $params["serverusername"]; $serverpassword = $params["serverpassword"];
|
||||
$serverip = $params["serverip"];
|
||||
$serverusername = $params["serverusername"];
|
||||
$serverpassword = $params["serverpassword"];
|
||||
|
||||
$proxmox=new PVE2_API($serverip, $serverusername, "pam", $serverpassword);
|
||||
if ($proxmox->login()){
|
||||
if ($proxmox->login()) {
|
||||
# Get first node name.
|
||||
$nodes = $proxmox->get_node_list();
|
||||
$first_node = $nodes[0];
|
||||
unset($nodes);
|
||||
// find virtual machine type
|
||||
$vm=Capsule::table('mod_pvewhmcs_vms')->where('id', '=', $params['serviceid'])->get()[0];
|
||||
if ($proxmox->post('/nodes/'.$first_node.'/'.$vm->vtype.'/'.$params['serviceid'].'/status/suspend')) {
|
||||
return true ;
|
||||
}
|
||||
$guest=Capsule::table('mod_pvewhmcs_vms')->where('id','=',$params['serviceid'])->get()[0] ;
|
||||
$pve_cmdparam = array();
|
||||
$logrequest = '/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/stop';
|
||||
$response = $proxmox->post('/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/stop' , $pve_cmdparam);
|
||||
}
|
||||
// DEBUG - Log the request parameters before it's fired
|
||||
if (Capsule::table('mod_pvewhmcs')->where('id', '1')->value('debug_mode') == 1) {
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
$logrequest,
|
||||
json_encode($response)
|
||||
);
|
||||
}
|
||||
// Return success only if no errors returned by PVE
|
||||
if (isset($response) && !isset($response['errors'])) {
|
||||
return "success";
|
||||
} else {
|
||||
// Handle the case where there are errors
|
||||
$response_message = isset($response['errors']) ? json_encode($response['errors']) : "Unknown Error, consider using Debug Mode.";
|
||||
return "Error performing action. " . $response_message;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// PVE API FUNCTION, ADMIN: Unsuspend a Service on the hypervisor
|
||||
function pvewhmcs_UnsuspendAccount(array $params) {
|
||||
$serverip = $params["serverip"]; $serverusername = $params["serverusername"]; $serverpassword = $params["serverpassword"];
|
||||
$serverip = $params["serverip"];
|
||||
$serverusername = $params["serverusername"];
|
||||
$serverpassword = $params["serverpassword"];
|
||||
|
||||
$proxmox=new PVE2_API($serverip, $serverusername, "pam", $serverpassword);
|
||||
if ($proxmox->login()){
|
||||
if ($proxmox->login()) {
|
||||
# Get first node name.
|
||||
$nodes = $proxmox->get_node_list();
|
||||
$first_node = $nodes[0];
|
||||
unset($nodes);
|
||||
// find virtual machine type
|
||||
$vm=Capsule::table('mod_pvewhmcs_vms')->where('id', '=', $params['serviceid'])->get()[0];
|
||||
if ($proxmox->post('/nodes/'.$first_node.'/'.$vm->vtype.'/'.$params['serviceid'].'/status/resume')) {
|
||||
return true ;
|
||||
}
|
||||
$guest=Capsule::table('mod_pvewhmcs_vms')->where('id','=',$params['serviceid'])->get()[0] ;
|
||||
$pve_cmdparam = array();
|
||||
$logrequest = '/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/start';
|
||||
$response = $proxmox->post('/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/start');
|
||||
}
|
||||
// DEBUG - Log the request parameters before it's fired
|
||||
if (Capsule::table('mod_pvewhmcs')->where('id', '1')->value('debug_mode') == 1) {
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
$logrequest,
|
||||
json_encode($response)
|
||||
);
|
||||
}
|
||||
// Return success only if no errors returned by PVE
|
||||
if (isset($response) && !isset($response['errors'])) {
|
||||
return "success";
|
||||
} else {
|
||||
// Handle the case where there are errors
|
||||
$response_message = isset($response['errors']) ? json_encode($response['errors']) : "Unknown Error, consider using Debug Mode.";
|
||||
return "Error performing action. " . $response_message;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// PVE API FUNCTION, ADMIN: Terminate a Service on the hypervisor
|
||||
function pvewhmcs_TerminateAccount(array $params) {
|
||||
$serverip = $params["serverip"]; $serverusername = $params["serverusername"]; $serverpassword = $params["serverpassword"];
|
||||
$serverip = $params["serverip"];
|
||||
$serverusername = $params["serverusername"];
|
||||
$serverpassword = $params["serverpassword"];
|
||||
|
||||
$proxmox=new PVE2_API($serverip, $serverusername, "pam", $serverpassword);
|
||||
if ($proxmox->login()){
|
||||
# Get first node name.
|
||||
@@ -306,19 +410,21 @@ function pvewhmcs_TerminateAccount(array $params) {
|
||||
$first_node = $nodes[0];
|
||||
unset($nodes);
|
||||
// find virtual machine type
|
||||
$vm=Capsule::table('mod_pvewhmcs_vms')->where('id', '=', $params['serviceid'])->get()[0];
|
||||
$proxmox->post('/nodes/'.$first_node.'/'.$vm->vtype.'/'.$params['serviceid'].'/status/stop') ;
|
||||
sleep(10) ;
|
||||
if ($proxmox->delete('/nodes/'.$first_node.'/'.$vm->vtype.'/'.$params['serviceid'],array('skiplock'=>1))) {
|
||||
$guest=Capsule::table('mod_pvewhmcs_vms')->where('id', '=', $params['serviceid'])->get()[0];
|
||||
// stop the service before terminating
|
||||
$proxmox->post('/nodes/'.$first_node.'/'.$guest->vtype.'/'.$params['serviceid'].'/status/stop') ;
|
||||
sleep(30) ;
|
||||
if ($proxmox->delete('/nodes/'.$first_node.'/'.$guest->vtype.'/'.$params['serviceid'],array('skiplock'=>1))) {
|
||||
// delete entry from module table once service terminated in PVE
|
||||
Capsule::table('mod_pvewhmcs_vms')->where('id', '=', $params['serviceid'])->delete();
|
||||
return true ;
|
||||
return "success";
|
||||
}
|
||||
}
|
||||
return false ;
|
||||
|
||||
$response_message = json_encode($proxmox['data']['errors']);
|
||||
return "Error performing action. " . $response_message;
|
||||
}
|
||||
|
||||
// WHMCS Decrypter
|
||||
// GENERAL CLASS: WHMCS Decrypter
|
||||
class hash_encryption {
|
||||
/**
|
||||
* Hashed value of the user provided encryption key
|
||||
@@ -508,6 +614,7 @@ class hash_encryption {
|
||||
}
|
||||
}
|
||||
|
||||
// GENERAL FUNCTION: Server PW from WHMCS DB
|
||||
function get_server_pass_from_whmcs($enc_pass){
|
||||
global $cc_encryption_hash;
|
||||
// Include WHMCS database configuration file
|
||||
@@ -519,19 +626,32 @@ function get_server_pass_from_whmcs($enc_pass){
|
||||
return $hasher->decrypt($enc_pass);
|
||||
}
|
||||
|
||||
// MODULE BUTTONS: Admin Interface button regos
|
||||
function pvewhmcs_AdminCustomButtonArray() {
|
||||
$buttonarray = array(
|
||||
"Start" => "vmStart",
|
||||
"Reboot" => "vmReboot",
|
||||
"Soft Stop" => "vmShutdown",
|
||||
"Hard Stop" => "vmStop",
|
||||
);
|
||||
return $buttonarray;
|
||||
}
|
||||
|
||||
// MODULE BUTTONS: Client Interface button regos
|
||||
function pvewhmcs_ClientAreaCustomButtonArray() {
|
||||
$buttonarray = array(
|
||||
"<img src='./modules/servers/pvewhmcs/img/novnc.png'/> noVNC (HTML5)" => "noVNC",
|
||||
"<img src='./modules/servers/pvewhmcs/img/tigervnc.png'/> TigerVNC (Java)" => "javaVNC",
|
||||
"<i class='fa fa-2x fa-flag-checkered'></i> Start Machine" => "vmStart",
|
||||
"<i class='fa fa-2x fa-sync'></i> Reboot Now" => "vmReboot",
|
||||
"<i class='fa fa-2x fa-power-off'></i> Shut Down" => "vmShutdown",
|
||||
"<i class='fa fa-2x fa-power-off'></i> Power Off" => "vmShutdown",
|
||||
"<i class='fa fa-2x fa-stop'></i> Hard Stop" => "vmStop",
|
||||
"<i class='fa fa-2x fa-chart-bar'></i> Statistics" => "vmStat",
|
||||
);
|
||||
return $buttonarray;
|
||||
}
|
||||
|
||||
// OUTPUT: Module output to the Client Area
|
||||
function pvewhmcs_ClientArea($params) {
|
||||
// Retrieve virtual machine info from table mod_pvewhmcs_vms
|
||||
$guest=Capsule::table('mod_pvewhmcs_vms')->where('id','=',$params['serviceid'])->get()[0] ;
|
||||
@@ -561,6 +681,18 @@ function pvewhmcs_ClientArea($params) {
|
||||
$cluster_resources = $proxmox->get('/cluster/resources');
|
||||
$vm_status = null;
|
||||
|
||||
// DEBUG - Log the /cluster/resources and /config for the VM/CT, if enabled
|
||||
$cluster_encoded = json_encode($cluster_resources);
|
||||
$vmspecs_encoded = json_encode($vm_config);
|
||||
if (Capsule::table('mod_pvewhmcs')->where('id', '1')->value('debug_mode') == 1) {
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
'CLUSTER INFO: ' . $cluster_encoded,
|
||||
'GUEST CONFIG (Service #' . $params['serviceid'] . ' / Client #' . $params['clientsdetails']['userid'] . '): ' . $vmspecs_encoded
|
||||
);
|
||||
}
|
||||
|
||||
# Loop through data, find ID
|
||||
foreach ($cluster_resources as $vm) {
|
||||
if ($vm['vmid'] == $params['serviceid'] && $vm['type'] == $guest->vtype) {
|
||||
@@ -707,11 +839,18 @@ function pvewhmcs_ClientArea($params) {
|
||||
);
|
||||
}
|
||||
|
||||
// OUTPUT: VM Statistics/Graphs render to Client Area
|
||||
function pvewhmcs_vmStat($params) {
|
||||
return true ;
|
||||
return true;
|
||||
}
|
||||
|
||||
// VNC: Console access to VM/CT via noVNC
|
||||
function pvewhmcs_noVNC($params) {
|
||||
// Check if VNC Secret is configured in Module Config, fail early if not. (#27)
|
||||
if (strlen(Capsule::table('mod_pvewhmcs')->where('id', '1')->value('vnc_secret'))<15) {
|
||||
throw new Exception("PVEWHMCS Error: VNC Secret in Module Config either not set or not long enough. Recommend 20+ characters for security.");
|
||||
}
|
||||
// Get login credentials then make the Proxmox connection attempt.
|
||||
$serverip = $params["serverip"];
|
||||
$serverusername = 'vnc';
|
||||
$serverpassword = Capsule::table('mod_pvewhmcs')->where('id', '1')->value('vnc_secret');
|
||||
@@ -729,19 +868,59 @@ function pvewhmcs_noVNC($params) {
|
||||
$vncticket = $vm_vncproxy['ticket'];
|
||||
// $path should only contain the actual path without any query parameters
|
||||
$path = 'api2/json/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/vncwebsocket?port=' . $vm_vncproxy['port'] . '&vncticket=' . urlencode($vncticket);
|
||||
|
||||
// Construct the noVNC Router URL with the path already prepared now
|
||||
$url = '/modules/servers/pvewhmcs/novnc_router.php?host=' . $serverip . '&pveticket=' . urlencode($pveticket) . '&path=' . urlencode($path) . '&vncticket=' . urlencode($vncticket);
|
||||
// Build and deliver the noVNC Router hyperlink for access
|
||||
$vncreply='<center><strong>Console (noVNC) prepared for usage. <a href="'.$url.'" target="_blanK">Click here</a> to open the noVNC window.</strong></center>' ;
|
||||
|
||||
return $vncreply;
|
||||
|
||||
} else {
|
||||
$vncreply='Failed to prepare noVNC. Please contact Technical Support.';
|
||||
return $vncreply;
|
||||
}
|
||||
}
|
||||
|
||||
// VNC: Console access to VM/CT via SPICE
|
||||
function pvewhmcs_SPICE($params) {
|
||||
// Check if VNC Secret is configured in Module Config, fail early if not. (#27)
|
||||
if (strlen(Capsule::table('mod_pvewhmcs')->where('id', '1')->value('vnc_secret'))<15) {
|
||||
throw new Exception("PVEWHMCS Error: VNC Secret in Module Config either not set or not long enough. Recommend 20+ characters for security.");
|
||||
}
|
||||
// Get login credentials then make the Proxmox connection attempt.
|
||||
$serverip = $params["serverip"];
|
||||
$serverusername = 'vnc';
|
||||
$serverpassword = Capsule::table('mod_pvewhmcs')->where('id', '1')->value('vnc_secret');
|
||||
$proxmox=new PVE2_API($serverip, $serverusername, "pve", $serverpassword);
|
||||
if ($proxmox->login()) {
|
||||
# Get first node name.
|
||||
$nodes = $proxmox->get_node_list();
|
||||
$first_node = $nodes[0];
|
||||
unset($nodes);
|
||||
$guest=Capsule::table('mod_pvewhmcs_vms')->where('id','=',$params['serviceid'])->get()[0] ;
|
||||
$vm_vncproxy=$proxmox->post('/nodes/'.$first_node.'/'.$guest->vtype.'/'.$params['serviceid'] .'/vncproxy', array( 'websocket' => '1' )) ;
|
||||
|
||||
// Get both tickets prepared
|
||||
$pveticket = $proxmox->getTicket();
|
||||
$vncticket = $vm_vncproxy['ticket'];
|
||||
// $path should only contain the actual path without any query parameters
|
||||
$path = 'api2/json/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/vncwebsocket?port=' . $vm_vncproxy['port'] . '&vncticket=' . urlencode($vncticket);
|
||||
// Construct the SPICE Router URL with the path already prepared now
|
||||
$url = '/modules/servers/pvewhmcs/spice_router.php?host=' . $serverip . '&pveticket=' . urlencode($pveticket) . '&path=' . urlencode($path) . '&vncticket=' . urlencode($vncticket);
|
||||
// Build and deliver the SPICE Router hyperlink for access
|
||||
$vncreply='<center><strong>Console (SPICE) prepared for usage. <a href="'.$url.'" target="_blanK">Click here</a> to open the noVNC window.</strong></center>' ;
|
||||
return $vncreply;
|
||||
} else {
|
||||
$vncreply='Failed to prepare SPICE. Please contact Technical Support.';
|
||||
return $vncreply;
|
||||
}
|
||||
}
|
||||
|
||||
// VNC: Console access to VM/CT via TigerVNC
|
||||
function pvewhmcs_javaVNC($params){
|
||||
// Check if VNC Secret is configured in Module Config, fail early if not. (#27)
|
||||
if (strlen(Capsule::table('mod_pvewhmcs')->where('id', '1')->value('vnc_secret'))<15) {
|
||||
throw new Exception("PVEWHMCS Error: VNC Secret in Module Config either not set or not long enough. Recommend 20+ characters for security.");
|
||||
}
|
||||
// Get login credentials then make the Proxmox connection attempt.
|
||||
$serverip = $params["serverip"];
|
||||
$serverusername = 'vnc';
|
||||
$serverpassword = Capsule::table('mod_pvewhmcs')->where('id', '1')->value('vnc_secret');
|
||||
@@ -774,6 +953,7 @@ function pvewhmcs_javaVNC($params){
|
||||
}
|
||||
}
|
||||
|
||||
// PVE API FUNCTION, CLIENT/ADMIN: Start the VM/CT
|
||||
function pvewhmcs_vmStart($params) {
|
||||
// Gather access credentials for PVE, as these are no longer passed for Client Area
|
||||
$pveservice=Capsule::table('tblhosting')->find($params['serviceid']) ;
|
||||
@@ -794,14 +974,29 @@ function pvewhmcs_vmStart($params) {
|
||||
unset($nodes);
|
||||
$guest=Capsule::table('mod_pvewhmcs_vms')->where('id','=',$params['serviceid'])->get()[0] ;
|
||||
$pve_cmdparam = array();
|
||||
// $pve_cmdparam['timeout'] = '60';
|
||||
|
||||
if ($proxmox->post('/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/start' , $pve_cmdparam))
|
||||
return true ;
|
||||
$logrequest = '/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/start';
|
||||
$response = $proxmox->post('/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/start' , $pve_cmdparam);
|
||||
}
|
||||
// DEBUG - Log the request parameters before it's fired
|
||||
if (Capsule::table('mod_pvewhmcs')->where('id', '1')->value('debug_mode') == 1) {
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
$logrequest,
|
||||
json_encode($response)
|
||||
);
|
||||
}
|
||||
// Return success only if no errors returned by PVE
|
||||
if (isset($response) && !isset($response['errors'])) {
|
||||
return "success";
|
||||
} else {
|
||||
// Handle the case where there are errors
|
||||
$response_message = isset($response['errors']) ? json_encode($response['errors']) : "Unknown Error, consider using Debug Mode.";
|
||||
return "Error performing action. " . $response_message;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// PVE API FUNCTION, CLIENT/ADMIN: Reboot the VM/CT
|
||||
function pvewhmcs_vmReboot($params) {
|
||||
// Gather access credentials for PVE, as these are no longer passed for Client Area
|
||||
$pveservice=Capsule::table('tblhosting')->find($params['serviceid']) ;
|
||||
@@ -823,13 +1018,29 @@ function pvewhmcs_vmReboot($params) {
|
||||
$guest=Capsule::table('mod_pvewhmcs_vms')->where('id','=',$params['serviceid'])->get()[0] ;
|
||||
$pve_cmdparam = array();
|
||||
// $pve_cmdparam['timeout'] = '60';
|
||||
|
||||
if ($proxmox->post('/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/reboot' , $pve_cmdparam))
|
||||
return true ;
|
||||
$logrequest = '/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/reboot';
|
||||
$response = $proxmox->post('/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/reboot' , $pve_cmdparam);
|
||||
}
|
||||
// DEBUG - Log the request parameters before it's fired
|
||||
if (Capsule::table('mod_pvewhmcs')->where('id', '1')->value('debug_mode') == 1) {
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
$logrequest,
|
||||
json_encode($response)
|
||||
);
|
||||
}
|
||||
// Return success only if no errors returned by PVE
|
||||
if (isset($response) && !isset($response['errors'])) {
|
||||
return "success";
|
||||
} else {
|
||||
// Handle the case where there are errors
|
||||
$response_message = isset($response['errors']) ? json_encode($response['errors']) : "Unknown Error, consider using Debug Mode.";
|
||||
return "Error performing action. " . $response_message;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// PVE API FUNCTION, CLIENT/ADMIN: Shutdown the VM/CT
|
||||
function pvewhmcs_vmShutdown($params) {
|
||||
// Gather access credentials for PVE, as these are no longer passed for Client Area
|
||||
$pveservice=Capsule::table('tblhosting')->find($params['serviceid']) ;
|
||||
@@ -851,13 +1062,29 @@ function pvewhmcs_vmShutdown($params) {
|
||||
$guest=Capsule::table('mod_pvewhmcs_vms')->where('id','=',$params['serviceid'])->get()[0] ;
|
||||
$pve_cmdparam = array();
|
||||
// $pve_cmdparam['timeout'] = '60';
|
||||
|
||||
if ($proxmox->post('/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/shutdown' , $pve_cmdparam))
|
||||
return true ;
|
||||
$logrequest = '/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/shutdown';
|
||||
$response = $proxmox->post('/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/shutdown' , $pve_cmdparam);
|
||||
}
|
||||
// DEBUG - Log the request parameters before it's fired
|
||||
if (Capsule::table('mod_pvewhmcs')->where('id', '1')->value('debug_mode') == 1) {
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
$logrequest,
|
||||
json_encode($response)
|
||||
);
|
||||
}
|
||||
// Return success only if no errors returned by PVE
|
||||
if (isset($response) && !isset($response['errors'])) {
|
||||
return "success";
|
||||
} else {
|
||||
// Handle the case where there are errors
|
||||
$response_message = isset($response['errors']) ? json_encode($response['errors']) : "Unknown Error, consider using Debug Mode.";
|
||||
return "Error performing action. " . $response_message;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// PVE API FUNCTION, CLIENT/ADMIN: Stop the VM/CT
|
||||
function pvewhmcs_vmStop($params) {
|
||||
// Gather access credentials for PVE, as these are no longer passed for Client Area
|
||||
$pveservice=Capsule::table('tblhosting')->find($params['serviceid']) ;
|
||||
@@ -879,14 +1106,29 @@ function pvewhmcs_vmStop($params) {
|
||||
$guest=Capsule::table('mod_pvewhmcs_vms')->where('id','=',$params['serviceid'])->get()[0] ;
|
||||
$pve_cmdparam = array();
|
||||
// $pve_cmdparam['timeout'] = '60';
|
||||
|
||||
if ($proxmox->post('/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/stop' , $pve_cmdparam))
|
||||
return true ;
|
||||
$logrequest = '/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/stop';
|
||||
$response = $proxmox->post('/nodes/' . $first_node . '/' . $guest->vtype . '/' . $params['serviceid'] . '/status/stop' , $pve_cmdparam);
|
||||
}
|
||||
// DEBUG - Log the request parameters before it's fired
|
||||
if (Capsule::table('mod_pvewhmcs')->where('id', '1')->value('debug_mode') == 1) {
|
||||
logModuleCall(
|
||||
'pvewhmcs',
|
||||
__FUNCTION__,
|
||||
$logrequest,
|
||||
json_encode($response)
|
||||
);
|
||||
}
|
||||
// Return success only if no errors returned by PVE
|
||||
if (isset($response) && !isset($response['errors'])) {
|
||||
return "success";
|
||||
} else {
|
||||
// Handle the case where there are errors
|
||||
$response_message = isset($response['errors']) ? json_encode($response['errors']) : "Unknown Error, consider using Debug Mode.";
|
||||
return "Error performing action. " . $response_message;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// convert subnet mask to CIDR
|
||||
// NETWORKING FUNCTION: Convert subnet mask to CIDR
|
||||
function mask2cidr($mask){
|
||||
$long = ip2long($mask);
|
||||
$base = ip2long('255.255.255.255');
|
||||
@@ -935,4 +1177,4 @@ function time2format($s) {
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -1,3 +1,25 @@
|
||||
|
||||
/*
|
||||
Proxmox VE for WHMCS - Addon/Server Modules for WHMCS (& PVE)
|
||||
https://github.com/The-Network-Crew/Proxmox-VE-for-WHMCS/
|
||||
File: /modules/servers/pvewhmcs/tigervnc.php (VNC)
|
||||
|
||||
Copyright (C) The Network Crew Pty Ltd (TNC) & Co.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see https://www.gnu.org/licenses
|
||||
*/
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<title>Serial Console</title>
|
||||
|
||||
Reference in New Issue
Block a user