getWhmcsParamByKey('status') != 'Active') { return; } elseif(!ProxmoxAddonValidator::isInstalled()){ ProxmoxAddonValidator::isInstalledOrFail(); } else if (!$this->isVpsCreated()) { return $this->onVpsBuild(); } (new AppParams())->initFromWhmcsParams(); return Helper\view()->addElement(ServiceActions::class) ->addElement(ServiceManagement::class) ->addElement(ServiceInformation::class) ->addElement(IpAddressDataTable::class); } public function sshPublicKeyDownload() { $response = new StreamedResponse(); $response->setStatusCode(200); $response->headers->set('Content-Type', 'application/x-pem-file; charset=utf-8'); $response->headers->set('Content-Transfer-Encoding', 'Binary'); $response->setCallback(function () { /** * @var $keyPair KeyPair */ $keyPair = KeyPair::ofHostingId($this->getWhmcsParamByKey("serviceid"))->firstOrFail(); echo $keyPair->getPublic(); die(); }); $response->headers->set( 'Content-Disposition', 'attachment; filename="id_rsa.pub"' ); $response->send(); } public function sshPrivateKeyDownload() { $response = new StreamedResponse(); $response->setStatusCode(200); $response->headers->set('Content-Type', 'application/x-pem-file; charset=utf-8'); $response->headers->set('Content-Transfer-Encoding', 'Binary'); $response->setCallback(function () { /** * @var $keyPair KeyPair */ $keyPair = KeyPair::ofHostingId($this->getWhmcsParamByKey("serviceid"))->firstOrFail(); echo $keyPair->getPrivate(); //delete private key if ($this->configuration()->isSshDeletePrivateKey()) { $keyPair->setPrivate(null); $keyPair->save(); } die(); }); $response->headers->set( 'Content-Disposition', 'attachment; filename="id_rsa"' ); $response->send(); } }