Esempio n. 1
0
/**
 * --- Update bundles ---
 * Updates the hosters current amount of bundles the overriding the existing list with
 * the bundles returned by the nimbusec API
 */
function updateBundles()
{
    // -- Retrieves crednetials --
    $credentials = getCredentials();
    $packageExt = new PackageExtensions($credentials['key'], $credentials['secret']);
    $packageExt->updatePackageExtensions();
}
Esempio n. 2
0
 $whmApi->setNVData($serverAgentArr);
 $logger->info("Server agent token created");
 // Default param $server
 $serverAgent->createConfigFile($serverAgentKey, $serverAgentSecret);
 $logger->info("Server agent config file created");
 array_push($responseArray['content'], "Server agent installation finished");
 $logger->progress("Server agent installation finished");
 // ################################## 2.) Package extensions ##################################
 $packageExt = new PackageExtensions($apiKey, $apiSecret);
 $res1 = copy("/usr/local/nimbusec/nimbusec/package_extensions/nimbusec", PackageExtensions::$extensionSettingPath);
 $res2 = copy("/usr/local/nimbusec/nimbusec/package_extensions/nimbusec.tt2", PackageExtensions::$extensionTemplatePath);
 if (!$res1 || !$res2) {
     throw new Exception(__METHOD__ . " - Package extension: Couldn't copy extention files.\nStatus setting: " . json_encode($res1) . "\nStatus template: " . json_encode($res2) . "\n");
 }
 $logger->info("Pacakge extensions copied");
 $packageExt->updatePackageExtensions();
 $logger->progress("Package extentions installed and updated");
 array_push($responseArray['content'], "Package extentions installed and updated");
 // ################################## 3.) Cron job ##################################
 if (file_put_contents("/etc/cron.daily/nimbusec", "#!/bin/bash") === false) {
     throw new Exception(__METHOD__ . " - file_put_contents: creating cron job failed");
 }
 if (!chmod("/etc/cron.daily/nimbusec", 0755)) {
     throw new Exception(__METHOD__ . " - chmod: setting permissions failed");
 }
 $logger->progress("Cron job created");
 array_push($responseArray['content'], "Cron job created");
 // ################################## 4.) Hooks + cPanel ##################################
 // -- Installing hooks --
 $disabled = explode(',', ini_get('disable_functions'));
 $logger->debug(ini_get('disable_functions'));