diff --git a/README.md b/README.md index af51da2..6d9439d 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,14 @@ **Salvation, a free and open-source solution for beloved PVE!** If you love it, REVIEW & SHARE IT! ❤️ -Logo for the Proxmox VE for WHMCS module - - 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-ve/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 :) +Logo for the Proxmox VE for WHMCS module + > **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! @@ -48,8 +48,6 @@ Once you've done all of that, in order to get the module working properly, you n 5. WHMCS Admin > Config > Products/Services > New Service (create offering) 6. " " > Newly-added Service > Tab 3 > **SAVE** (links Module Plan to WHMCS Service type) -> Note: At the moment, the new Connection Test in WHMCS shows an empty red box. Try an action to test. - ## 🥽 noVNC: Console Tunnel (Client Area) 🥽 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. @@ -212,9 +210,7 @@ Please consult the [UPDATE-SQL.md](https://github.com/The-Network-Crew/Proxmox-V ## 📄 DIY: Documentation & Resources 📄 - Proxmox API: https://pve.proxmox.com/pve-docs/api-viewer/ -- SPICE: https://gitlab.freedesktop.org/spice/spice-html5 - TigerVNC: https://github.com/TigerVNC/tigervnc/wiki -- Xterm.js: https://github.com/xtermjs/xterm.js/ - 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) diff --git a/modules/addons/pvewhmcs/db.sql b/modules/addons/pvewhmcs/db.sql index 2ae1dce..ea330d9 100644 --- a/modules/addons/pvewhmcs/db.sql +++ b/modules/addons/pvewhmcs/db.sql @@ -22,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, diff --git a/modules/addons/pvewhmcs/pvewhmcs.php b/modules/addons/pvewhmcs/pvewhmcs.php index f543ad8..bb5cc7b 100644 --- a/modules/addons/pvewhmcs/pvewhmcs.php +++ b/modules/addons/pvewhmcs/pvewhmcs.php @@ -1,6 +1,15 @@ (Intel) Broadwell-noTSX-IBRS + + + + + @@ -451,6 +466,10 @@ function kvm_plan_add() { + + + + @@ -459,12 +478,16 @@ function kvm_plan_add() { + + + + @@ -478,13 +501,15 @@ function kvm_plan_add() { + + - CPU emulation type. Default is KVM64 + CPU emulation type. Default is x86-64 psABI v2-AES @@ -725,7 +750,12 @@ function kvm_plan_edit($id) { + + + + + @@ -734,6 +764,10 @@ function kvm_plan_edit($id) { + + + + @@ -742,12 +776,16 @@ function kvm_plan_edit($id) { + + + + @@ -761,13 +799,15 @@ function kvm_plan_edit($id) { + + - CPU emulation type. Default is KVM64 + CPU emulation type. Default is x86-64 psABI v2-AES diff --git a/modules/servers/pvewhmcs/pvewhmcs.php b/modules/servers/pvewhmcs/pvewhmcs.php index cd827c8..9cfb238 100644 --- a/modules/servers/pvewhmcs/pvewhmcs.php +++ b/modules/servers/pvewhmcs/pvewhmcs.php @@ -1,7 +1,7 @@ $vm_settings, 'v' => $v] ); } + // KVM TEMPLATE - Conduct the VM CLONE from Template to Machine $response = $proxmox->post('/nodes/' . $first_node . '/qemu/' . $params['customfields']['KVMTemplate'] . '/clone', $vm_settings); if ($response) { Capsule::table('mod_pvewhmcs_vms')->insert( @@ -125,6 +126,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'])) { @@ -139,7 +149,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') { @@ -195,6 +205,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); @@ -219,6 +230,7 @@ function pvewhmcs_CreateAccount($params) { ['vm_settings' => $vm_settings, 'v' => $v] ); } + // ACTION - Fire the attempt to create $response = $proxmox->post('/nodes/' . $first_node . '/' . $v, $vm_settings); if ($response) { unset($vm_settings);