mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-05-06 19:35:31 +02:00
push changes
This commit is contained in:
127
serverStatus/litespeed/FileManager/php/caller.php
Normal file
127
serverStatus/litespeed/FileManager/php/caller.php
Normal file
@@ -0,0 +1,127 @@
|
||||
<?php
|
||||
|
||||
class Caller{
|
||||
|
||||
private $basePath = null;
|
||||
|
||||
public function __construct($basePath = null)
|
||||
{
|
||||
$this->basePath = $basePath ?: dirname(__DIR__);
|
||||
}
|
||||
|
||||
public function requestHandler()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST' and isset($_POST['method'])) {
|
||||
|
||||
$pathToSeed = '/home/' . $_POST['domainName'] . '/..filemanagerkey';
|
||||
$receivedSeed = $_POST['domainRandomSeed'];
|
||||
|
||||
$myfile = fopen($pathToSeed, "r") or die("Unable to open file!");
|
||||
$seed = fread($myfile,filesize($pathToSeed));
|
||||
fclose($myfile);
|
||||
|
||||
if ($seed != $receivedSeed){
|
||||
$answer = array(
|
||||
'uploadStatus' => 0,
|
||||
'answer' => 'Not allowed to upload in this path.',
|
||||
'error_message' => "None",
|
||||
'fileName' => $_FILES['file']['name']
|
||||
);
|
||||
$json = json_encode($answer);
|
||||
echo $json;
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($_POST['method']) {
|
||||
case 'upload':
|
||||
$this->uploadFile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function uploadFile(){
|
||||
try {
|
||||
if (!empty($_FILES)) {
|
||||
|
||||
if($this->return_bytes(ini_get('upload_max_filesize')) < $_SERVER['CONTENT_LENGTH']){
|
||||
throw new Exception("Size of uploaded file is greater than upload limit!");
|
||||
}
|
||||
|
||||
$completePath = $this->cleanInput($_POST['completePath']);
|
||||
$fileName = $this->cleanInput($_FILES['file']['name']);
|
||||
$homePath = $this->cleanInput($_POST['home']);
|
||||
|
||||
$tempPath = $_FILES['file']['tmp_name'];
|
||||
$uploadPath = $completePath . DIRECTORY_SEPARATOR . $fileName;
|
||||
|
||||
$pos = strpos($uploadPath, $homePath);
|
||||
|
||||
if ($pos === false) {
|
||||
throw new Exception("Not allowed to upload in this path!");
|
||||
}
|
||||
|
||||
|
||||
if(move_uploaded_file($tempPath, $uploadPath)==true){
|
||||
$answer = array(
|
||||
'uploadStatus' => 1,
|
||||
'answer' => 'File transfer completed',
|
||||
'error_message' => "None",
|
||||
'fileName' => $_FILES['file']['name']
|
||||
);
|
||||
$json = json_encode($answer);
|
||||
echo $json;
|
||||
}
|
||||
else{
|
||||
throw new Exception("Can not move uploaded file to destination location!");
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
throw new Exception("No Files to upload!");
|
||||
}
|
||||
}
|
||||
catch(Exception $e) {
|
||||
$answer = array(
|
||||
'uploadStatus' => 0,
|
||||
'answer' => 'No files',
|
||||
'error_message' => $e->getMessage(),
|
||||
'fileName' => $_FILES['file']['name'],
|
||||
);
|
||||
$json = json_encode($answer);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function return_bytes($val) {
|
||||
$val = trim($val);
|
||||
$last = strtolower($val[strlen($val)-1]);
|
||||
switch($last) {
|
||||
// The 'G' modifier is available since PHP 5.1.0
|
||||
case 'g':
|
||||
$val *= 1024;
|
||||
case 'm':
|
||||
$val *= 1024;
|
||||
case 'k':
|
||||
$val *= 1024;
|
||||
}
|
||||
|
||||
return $val;
|
||||
}
|
||||
|
||||
private function cleanInput($input) {
|
||||
$search = array(
|
||||
'@<script[^>]*?>.*?</script>@si',
|
||||
'@<[\/\!]*?[^<>]*?>@si',
|
||||
'@<style[^>]*?>.*?</style>@siU',
|
||||
'@<![\s\S]*?--[ \t\n\r]*>@'
|
||||
);
|
||||
$output = preg_replace($search, '', $input);
|
||||
return $output;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$caller = new Caller("/");
|
||||
$caller->requestHandler();
|
||||
748
serverStatus/litespeed/FileManager/php/fileManager.php
Normal file
748
serverStatus/litespeed/FileManager/php/fileManager.php
Normal file
@@ -0,0 +1,748 @@
|
||||
<?php
|
||||
|
||||
|
||||
class fileManager
|
||||
{
|
||||
|
||||
private $basePath = null;
|
||||
|
||||
public function requestHandler()
|
||||
{
|
||||
$postdata = file_get_contents("php://input");
|
||||
$request = json_decode($postdata);
|
||||
|
||||
$pathToSeed = '/home/' . $request->domainName . '/..filemanagerkey';
|
||||
$receivedSeed = $request->domainRandomSeed;
|
||||
|
||||
$myfile = fopen($pathToSeed, "r") or die("Unable to open file!");
|
||||
$seed = fread($myfile,filesize($pathToSeed));
|
||||
fclose($myfile);
|
||||
|
||||
if ($seed != $receivedSeed){
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "You can not open filemanager for this domain.",
|
||||
"copied" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (isset($request->method)) {
|
||||
|
||||
switch ($request->method) {
|
||||
case 'list':
|
||||
$this->listDir($request->completeStartingPath);
|
||||
break;
|
||||
case 'listForTable':
|
||||
$home = $this->cleanInput($request->home);
|
||||
$completeStartingPath = $this->cleanInput($request->completeStartingPath);
|
||||
$this->listForTable($home,$completeStartingPath);
|
||||
break;
|
||||
case 'readFileContents':
|
||||
$this->readFileContents($request->fileName);
|
||||
break;
|
||||
case 'writeFileContents':
|
||||
$this->writeFileContents($request->fileName, $request->fileContent);
|
||||
break;
|
||||
case 'createNewFolder':
|
||||
$folderName = $this->cleanInput($request->folderName);
|
||||
$this->createNewFolder($folderName);
|
||||
break;
|
||||
case 'createNewFile':
|
||||
$fileName = $this->cleanInput($request->fileName);
|
||||
$this->createNewFile($fileName);
|
||||
break;
|
||||
case 'deleteFolderOrFile':
|
||||
$this->deleteFolderOrFile($request->path, $request->fileAndFolders);
|
||||
break;
|
||||
case 'compress':
|
||||
$compressedFileName = $this->cleanInput($request->compressedFileName);
|
||||
$this->compress($request->basePath, $request->listOfFiles, $compressedFileName, $request->compressionType);
|
||||
break;
|
||||
case 'extract':
|
||||
$extractionLocation = $this->cleanInput($request->extractionLocation);
|
||||
$this->extract($request->home,$request->basePath,$request->fileToExtract,$request->extractionType,$extractionLocation);
|
||||
break;
|
||||
case 'move':
|
||||
$this->moveFileAndFolders($request->home,$request->basePath,$request->newPath,$request->fileAndFolders);
|
||||
break;
|
||||
case 'copy':
|
||||
$this->copyFileAndFolders($request->home,$request->basePath,$request->newPath,$request->fileAndFolders);
|
||||
break;
|
||||
case 'rename':
|
||||
$newFileName = $this->cleanInput($request->newFileName);
|
||||
$this->renameFileOrFolder($request->basePath,$request->existingName,$newFileName);
|
||||
break;
|
||||
case 'changePermissions':
|
||||
$this->changePermissions($request->basePath, $request->permissionsPath, $request->newPermissions, $request->recursive);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function changePermissions($basePath, $permissionsPath, $newPermissions, $recursive)
|
||||
{
|
||||
try {
|
||||
|
||||
$completePath = $basePath . DIRECTORY_SEPARATOR . $permissionsPath;
|
||||
|
||||
if($recursive == 1){
|
||||
|
||||
$commandToExecute = 'chmod -R ' . $newPermissions . " '". $completePath . "'";
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
|
||||
}else{
|
||||
$commandToExecute = 'chmod ' . $newPermissions . " '". $completePath . "'";
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
}
|
||||
|
||||
|
||||
exec($commandToExecute, $programOutput);
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"permissionsChanged" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"permissionsChanged" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function listDir($basePath)
|
||||
{
|
||||
try {
|
||||
$path = "";
|
||||
$listPath = $basePath . $path;
|
||||
$files = scandir($listPath);
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"fetchStatus" => 1
|
||||
);
|
||||
$counter = 0;
|
||||
|
||||
$tempDir = array();
|
||||
$tempFiles = array();
|
||||
|
||||
// sorting files at end
|
||||
|
||||
foreach ($files as $dirFile) {
|
||||
|
||||
$completePath = $basePath . $path . DIRECTORY_SEPARATOR . $dirFile;
|
||||
if (is_dir($completePath) == true) {
|
||||
array_push($tempDir, $dirFile);
|
||||
} else {
|
||||
array_push($tempFiles, $dirFile);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$result = array_merge($tempDir, $tempFiles);
|
||||
|
||||
foreach ($result as $dirFile) {
|
||||
if ($dirFile == "." or $dirFile == "..") {
|
||||
continue;
|
||||
}
|
||||
$arrayCounter = 0;
|
||||
$tempArray = array($dirFile);
|
||||
$arrayCounter += 1;
|
||||
$completePath = $basePath . $path . DIRECTORY_SEPARATOR . $dirFile;
|
||||
$tempArray[$arrayCounter] = $completePath;
|
||||
$arrayCounter += 1;
|
||||
|
||||
if (is_dir($completePath) == true) {
|
||||
$list = true;
|
||||
$tempArray[$arrayCounter] = $list;
|
||||
} else {
|
||||
$list = false;
|
||||
$tempArray[$arrayCounter] = $list;
|
||||
}
|
||||
|
||||
$json_data[(string)$counter] = $tempArray;
|
||||
$counter += 1;
|
||||
|
||||
}
|
||||
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} catch (Exception $e) {
|
||||
$answer = array(
|
||||
'uploadStatus' => 0,
|
||||
'answer' => [1, 2, 3],
|
||||
'error_message' => $e->getMessage(),
|
||||
);
|
||||
$json = json_encode($answer);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function getPermissions($fileName){
|
||||
|
||||
$perms = fileperms($fileName);
|
||||
|
||||
switch ($perms & 0xF000) {
|
||||
case 0xC000: // socket
|
||||
$info = 's';
|
||||
break;
|
||||
case 0xA000: // symbolic link
|
||||
$info = 'l';
|
||||
break;
|
||||
case 0x8000: // regular
|
||||
$info = 'r';
|
||||
break;
|
||||
case 0x6000: // block special
|
||||
$info = 'b';
|
||||
break;
|
||||
case 0x4000: // directory
|
||||
$info = 'd';
|
||||
break;
|
||||
case 0x2000: // character special
|
||||
$info = 'c';
|
||||
break;
|
||||
case 0x1000: // FIFO pipe
|
||||
$info = 'p';
|
||||
break;
|
||||
default: // unknown
|
||||
$info = 'u';
|
||||
}
|
||||
|
||||
// Owner
|
||||
$info .= (($perms & 0x0100) ? 'r' : '-');
|
||||
$info .= (($perms & 0x0080) ? 'w' : '-');
|
||||
$info .= (($perms & 0x0040) ?
|
||||
(($perms & 0x0800) ? 's' : 'x' ) :
|
||||
(($perms & 0x0800) ? 'S' : '-'));
|
||||
|
||||
// Group
|
||||
$info .= (($perms & 0x0020) ? 'r' : '-');
|
||||
$info .= (($perms & 0x0010) ? 'w' : '-');
|
||||
$info .= (($perms & 0x0008) ?
|
||||
(($perms & 0x0400) ? 's' : 'x' ) :
|
||||
(($perms & 0x0400) ? 'S' : '-'));
|
||||
|
||||
// World
|
||||
$info .= (($perms & 0x0004) ? 'r' : '-');
|
||||
$info .= (($perms & 0x0002) ? 'w' : '-');
|
||||
$info .= (($perms & 0x0001) ?
|
||||
(($perms & 0x0200) ? 't' : 'x' ) :
|
||||
(($perms & 0x0200) ? 'T' : '-'));
|
||||
|
||||
return $info;
|
||||
|
||||
}
|
||||
|
||||
private function listForTable($home,$basePath)
|
||||
{
|
||||
try {
|
||||
|
||||
$pos = strpos($basePath, $home);
|
||||
|
||||
if ($pos === false) {
|
||||
throw new Exception("Not allowed to browse this path, going back home!");
|
||||
}
|
||||
|
||||
$path = "";
|
||||
$listPath = $basePath . $path;
|
||||
$files = scandir($listPath);
|
||||
$json_data = array("error_message" => "None",
|
||||
"fetchStatus" => 1
|
||||
);
|
||||
$counter = 0;
|
||||
|
||||
$tempDir = array();
|
||||
$tempFiles = array();
|
||||
|
||||
// sorting files at end
|
||||
|
||||
foreach ($files as $dirFile) {
|
||||
|
||||
$completePath = $basePath . $path . DIRECTORY_SEPARATOR . $dirFile;
|
||||
if (is_dir($completePath) == true) {
|
||||
array_push($tempDir, $dirFile);
|
||||
} else {
|
||||
array_push($tempFiles, $dirFile);
|
||||
}
|
||||
}
|
||||
|
||||
$result = array_merge($tempDir, $tempFiles);
|
||||
|
||||
foreach ($result as $dirFile) {
|
||||
if ($dirFile == "." or $dirFile == "..") {
|
||||
continue;
|
||||
}
|
||||
$arrayCounter = 0;
|
||||
$tempArray = array($dirFile);
|
||||
$arrayCounter += 1;
|
||||
$completePath = $basePath . $path . DIRECTORY_SEPARATOR . $dirFile;
|
||||
$tempArray[$arrayCounter] = $completePath;
|
||||
$arrayCounter += 1;
|
||||
|
||||
// find last modified
|
||||
|
||||
$lastModified = date("F d Y H:i:s.", filemtime($completePath));
|
||||
$tempArray[$arrayCounter] = $lastModified;
|
||||
$arrayCounter += 1;
|
||||
|
||||
// find size of file
|
||||
|
||||
$fileSize = (int)(filesize($completePath) / 1024);
|
||||
$tempArray[$arrayCounter] = $fileSize;
|
||||
$arrayCounter += 1;
|
||||
|
||||
// find permissions of file
|
||||
|
||||
|
||||
$tempArray[$arrayCounter] = substr(sprintf('%o', fileperms($completePath)), -4);;
|
||||
$arrayCounter += 1;
|
||||
|
||||
|
||||
// Deciding if the current path is file or dir.
|
||||
|
||||
if (is_dir($completePath) == true) {
|
||||
$list = true;
|
||||
$tempArray[$arrayCounter] = $list;
|
||||
} else {
|
||||
$list = false;
|
||||
$tempArray[$arrayCounter] = $list;
|
||||
}
|
||||
|
||||
$json_data[(string)$counter] = $tempArray;
|
||||
$counter += 1;
|
||||
|
||||
}
|
||||
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} catch (Exception $e) {
|
||||
$answer = array(
|
||||
'fetchStatus' => 0,
|
||||
'error_message' => $e->getMessage(),
|
||||
);
|
||||
$json = json_encode($answer);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function readFileContents($pathToFile)
|
||||
{
|
||||
|
||||
try {
|
||||
$listPath = $pathToFile;
|
||||
$contentsofFile = file_get_contents($pathToFile);
|
||||
|
||||
if ($contentsofFile !== false) {
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"fetchStatus" => 1,
|
||||
"fileContents" => $contentsofFile
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} else {
|
||||
throw new Exception("Can not read the file Contents");
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"fetchStatus" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function writeFileContents($pathToFile, $fileContent)
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
|
||||
$contentsofFile = file_put_contents($pathToFile, $fileContent);
|
||||
|
||||
if ($contentsofFile !== false) {
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"saveStatus" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} else {
|
||||
throw new Exception("Can not write the file Contents.");
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"saveStatus" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function createNewFolder($folderName)
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
|
||||
$returnVal = mkdir($folderName);
|
||||
|
||||
if ($returnVal !== false) {
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"createStatus" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} else {
|
||||
throw new Exception("Can not create Folder");
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"createStatus" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function createNewFile($fileName)
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
|
||||
if (touch($fileName)) {
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"createStatus" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} else {
|
||||
throw new Exception("Can not create file!");
|
||||
}
|
||||
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"createStatus" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function deleteFolderOrFile($basePath, $fileAndFolders)
|
||||
{
|
||||
try {
|
||||
|
||||
foreach ($fileAndFolders as $path) {
|
||||
|
||||
$path = $basePath . DIRECTORY_SEPARATOR . $path;
|
||||
|
||||
if (is_dir($path) == true) {
|
||||
$commandToExecute = 'rm -rf ' . "'".$path ."'";
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
exec($commandToExecute, $programOutput);
|
||||
} else {
|
||||
if (unlink($path)) {
|
||||
continue;
|
||||
} else {
|
||||
throw new Exception("Can not delete!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"deleteStatus" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"deleteStatus" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function compress($basePath, $listOfFiles, $compressedFileName, $compressionType)
|
||||
{
|
||||
try {
|
||||
|
||||
chdir($basePath);
|
||||
|
||||
if ($compressionType == "zip") {
|
||||
|
||||
$compressedFileName = $basePath . DIRECTORY_SEPARATOR . $compressedFileName . ".zip";
|
||||
|
||||
$commandToExecute = 'zip -r ' . $compressedFileName . ' ';
|
||||
|
||||
foreach ($listOfFiles as $file) {
|
||||
$completePathToFile = $file;
|
||||
$commandToExecute = $commandToExecute ."'". $completePathToFile ."'". ' ';
|
||||
}
|
||||
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
|
||||
exec($commandToExecute, $programOutput);
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => $commandToExecute,
|
||||
"compressed" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
else {
|
||||
|
||||
$compressedFileName = $basePath . DIRECTORY_SEPARATOR . $compressedFileName . ".tar.gz";
|
||||
|
||||
$commandToExecute = 'tar -czvf ' . $compressedFileName . ' ';
|
||||
|
||||
foreach ($listOfFiles as $file) {
|
||||
$completePathToFile = $file;
|
||||
$commandToExecute = $commandToExecute ."'". $completePathToFile ."'". ' ';
|
||||
}
|
||||
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
|
||||
exec($commandToExecute, $programOutput);
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"compressed" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"compressed" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
}
|
||||
|
||||
private function extract($home,$basePath,$completeFileToExtract, $extractionType, $extractionLocation)
|
||||
{
|
||||
try {
|
||||
|
||||
$pos = strpos($extractionLocation, $home);
|
||||
|
||||
if ($pos === false) {
|
||||
throw new Exception("Not allowed to extact in this path, please choose location inside home!");
|
||||
}
|
||||
|
||||
if ($extractionType == "zip") {
|
||||
|
||||
$commandToExecute = "unzip -o '" . $completeFileToExtract . "' -d '" . $extractionLocation . "'";
|
||||
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
|
||||
exec($commandToExecute, $programOutput);
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => $commandToExecute,
|
||||
"extracted" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
} else {
|
||||
|
||||
$commandToExecute = "tar xf '" . $completeFileToExtract . "' -C '" . $extractionLocation . "'";
|
||||
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
|
||||
exec($commandToExecute, $programOutput);
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"extracted" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
|
||||
|
||||
}
|
||||
}catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"extracted" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
}
|
||||
|
||||
private function moveFileAndFolders($home,$basePath, $newPath, $fileAndFolders)
|
||||
{
|
||||
try {
|
||||
|
||||
$pos = strpos($newPath, $home);
|
||||
|
||||
if ($pos === false) {
|
||||
throw new Exception("Not allowed to move in this path, please choose location inside home!");
|
||||
}
|
||||
|
||||
if(!file_exists($newPath)){
|
||||
if(!mkdir($newPath, 0777, true)){
|
||||
$json_data = array(
|
||||
"error_message" => "Can not create the new folder, it already exists!",
|
||||
"moved" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($fileAndFolders as $path) {
|
||||
|
||||
$completePathToFile = $basePath . DIRECTORY_SEPARATOR . $path;
|
||||
$completeNewPath = $newPath . DIRECTORY_SEPARATOR . $path;
|
||||
|
||||
$commandToExecute = 'mv ' ."'". $completePathToFile . "'" . ' ' . "'" . $completeNewPath . "'";
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
exec($commandToExecute, $programOutput);
|
||||
}
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"moved" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"moved" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function copyFileAndFolders($home,$basePath, $newPath, $fileAndFolders)
|
||||
{
|
||||
try {
|
||||
|
||||
$pos = strpos($newPath, $home);
|
||||
|
||||
if ($pos === false) {
|
||||
throw new Exception("Not allowed to move in this path, please choose location inside home!");
|
||||
}
|
||||
|
||||
if(!file_exists($newPath)){
|
||||
if(!mkdir($newPath, 0777, true)){
|
||||
throw new Exception("Can not create the new folder, it already exists!");
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($fileAndFolders as $path) {
|
||||
|
||||
$completePathToFile = $basePath . DIRECTORY_SEPARATOR . $path;
|
||||
$completeNewPath = $newPath . DIRECTORY_SEPARATOR . $path;
|
||||
|
||||
$commandToExecute = 'cp ' ."'". $completePathToFile . "'" . ' ' . "'" . $completeNewPath . "'";
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
exec($commandToExecute, $programOutput);
|
||||
}
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"copied" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"copied" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function renameFileOrFolder($basePath, $currentName, $newName)
|
||||
{
|
||||
try {
|
||||
|
||||
$completeOldPath = $basePath . DIRECTORY_SEPARATOR . $currentName;
|
||||
$completeNewPath = $basePath . DIRECTORY_SEPARATOR . $newName;
|
||||
|
||||
$commandToExecute = 'mv ' ."'". $completeOldPath . "'" . ' ' . "'" . $completeNewPath . "'";
|
||||
$programOutput = fopen('temp.txt', 'a');
|
||||
exec($commandToExecute, $programOutput);
|
||||
|
||||
$json_data = array(
|
||||
"error_message" => "None",
|
||||
"renamed" => 1,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
|
||||
} catch (Exception $e) {
|
||||
$json_data = array(
|
||||
"error_message" => $e->getMessage(),
|
||||
"renamed" => 0,
|
||||
);
|
||||
$json = json_encode($json_data);
|
||||
echo $json;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private function cleanInput($input) {
|
||||
$search = array(
|
||||
'@<script[^>]*?>.*?</script>@si', // Strip out javascript
|
||||
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags
|
||||
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly
|
||||
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments
|
||||
);
|
||||
$output = preg_replace($search, '', $input);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
$caller = new fileManager();
|
||||
$caller->requestHandler();
|
||||
0
serverStatus/litespeed/FileManager/php/temp.txt
Normal file
0
serverStatus/litespeed/FileManager/php/temp.txt
Normal file
0
serverStatus/litespeed/FileManager/php/tests.php
Normal file
0
serverStatus/litespeed/FileManager/php/tests.php
Normal file
202
serverStatus/litespeed/conf/httpd_config.conf
Normal file
202
serverStatus/litespeed/conf/httpd_config.conf
Normal file
@@ -0,0 +1,202 @@
|
||||
#
|
||||
# PLAIN TEXT CONFIGURATION FILE
|
||||
#
|
||||
serverName lscp
|
||||
user nobody
|
||||
group nobody
|
||||
priority 0
|
||||
inMemBufSize 60M
|
||||
swappingDir /tmp/lshttpd/swap
|
||||
autoFix503 1
|
||||
gracefulRestartTimeout 300
|
||||
mime $SERVER_ROOT/conf/mime.properties
|
||||
showVersionNumber 0
|
||||
adminEmails root@localhost
|
||||
adminRoot $SERVER_ROOT/admin/
|
||||
|
||||
errorlog $SERVER_ROOT/logs/error.log {
|
||||
logLevel DEBUG
|
||||
debugLevel 0
|
||||
rollingSize 10M
|
||||
enableStderrLog 1
|
||||
}
|
||||
|
||||
accesslog $SERVER_ROOT/logs/access.log {
|
||||
rollingSize 10M
|
||||
keepDays 30
|
||||
compressArchive 0
|
||||
}
|
||||
indexFiles index.html, index.php
|
||||
|
||||
expires {
|
||||
enableExpires 1
|
||||
expiresByType image/*=A604800, text/css=A604800, application/x-javascript=A604800
|
||||
}
|
||||
|
||||
tuning {
|
||||
eventDispatcher best
|
||||
maxConnections 2000
|
||||
maxSSLConnections 1000
|
||||
connTimeout 300
|
||||
maxKeepAliveReq 1000
|
||||
smartKeepAlive 0
|
||||
keepAliveTimeout 5
|
||||
sndBufSize 0
|
||||
rcvBufSize 0
|
||||
maxReqURLLen 8192
|
||||
maxReqHeaderSize 16380
|
||||
maxReqBodySize 2047M
|
||||
maxDynRespHeaderSize 8192
|
||||
maxDynRespSize 2047M
|
||||
maxCachedFileSize 4096
|
||||
totalInMemCacheSize 20M
|
||||
maxMMapFileSize 256K
|
||||
totalMMapCacheSize 40M
|
||||
useSendfile 1
|
||||
fileETag 28
|
||||
enableGzipCompress 1
|
||||
enableDynGzipCompress 1
|
||||
gzipCompressLevel 6
|
||||
compressibleTypes text/*,application/x-javascript,application/javascript,application/xml, image/svg+xml
|
||||
gzipAutoUpdateStatic 1
|
||||
gzipStaticCompressLevel 6
|
||||
gzipMaxFileSize 1M
|
||||
gzipMinFileSize 300
|
||||
SSLCryptoDevice null
|
||||
}
|
||||
|
||||
fileAccessControl {
|
||||
followSymbolLink 1
|
||||
checkSymbolLink 0
|
||||
requiredPermissionMask 000
|
||||
restrictedPermissionMask 000
|
||||
}
|
||||
|
||||
perClientConnLimit {
|
||||
staticReqPerSec 0
|
||||
dynReqPerSec 0
|
||||
outBandwidth 0
|
||||
inBandwidth 0
|
||||
softLimit 10000
|
||||
hardLimit 10000
|
||||
gracePeriod 15
|
||||
banPeriod 300
|
||||
}
|
||||
|
||||
CGIRLimit {
|
||||
maxCGIInstances 20
|
||||
minUID 11
|
||||
minGID 10
|
||||
priority 0
|
||||
CPUSoftLimit 10
|
||||
CPUHardLimit 50
|
||||
memSoftLimit 460M
|
||||
memHardLimit 470M
|
||||
procSoftLimit 400
|
||||
procHardLimit 450
|
||||
}
|
||||
|
||||
accessDenyDir {
|
||||
dir /
|
||||
dir /etc/*
|
||||
dir /dev/*
|
||||
dir $SERVER_ROOT/conf/*
|
||||
dir $SERVER_ROOT/admin/conf/*
|
||||
}
|
||||
|
||||
accessControl {
|
||||
allow ALL
|
||||
}
|
||||
|
||||
scripthandler {
|
||||
add lsapi:php70 php
|
||||
}
|
||||
|
||||
railsDefaults {
|
||||
maxConns 5
|
||||
env LSAPI_MAX_REQS=1000
|
||||
env LSAPI_MAX_IDLE=60
|
||||
initTimeout 60
|
||||
retryTimeout 0
|
||||
pcKeepAliveTimeout 60
|
||||
respBuffer 0
|
||||
backlog 50
|
||||
runOnStartUp 1
|
||||
extMaxIdleTime 300
|
||||
priority 3
|
||||
memSoftLimit 2047M
|
||||
memHardLimit 2047M
|
||||
procSoftLimit 500
|
||||
procHardLimit 600
|
||||
}
|
||||
|
||||
|
||||
module cache {
|
||||
param <<<END_param
|
||||
enableCache 0
|
||||
enablePrivateCache 0
|
||||
checkPublicCache 1
|
||||
checkPrivateCache 1
|
||||
qsCache 1
|
||||
reqCookieCache 1
|
||||
ignoreReqCacheCtrl 1
|
||||
ignoreRespCacheCtrl 0
|
||||
respCookieCache 1
|
||||
expireInSeconds 3600
|
||||
privateExpireInSeconds 3600
|
||||
maxStaleAge 200
|
||||
maxCacheObjSize 10000000
|
||||
storagepath cachedata
|
||||
noCacheDomain
|
||||
noCacheUrl
|
||||
no-vary 0
|
||||
addEtag 0
|
||||
END_param
|
||||
|
||||
}
|
||||
|
||||
|
||||
listener Default{
|
||||
address *:80
|
||||
secure 0
|
||||
map Example *
|
||||
}
|
||||
|
||||
|
||||
|
||||
vhTemplate centralConfigLog {
|
||||
templateFile $SERVER_ROOT/conf/templates/ccl.conf
|
||||
listeners Default
|
||||
}
|
||||
|
||||
vhTemplate PHP_SuEXEC {
|
||||
templateFile $SERVER_ROOT/conf/templates/phpsuexec.conf
|
||||
listeners Default
|
||||
}
|
||||
|
||||
vhTemplate EasyRailsWithSuEXEC {
|
||||
templateFile $SERVER_ROOT/conf/templates/rails.conf
|
||||
listeners Default
|
||||
}
|
||||
|
||||
virtualHost Example{
|
||||
vhRoot $SERVER_ROOT/Example/
|
||||
allowSymbolLink 1
|
||||
enableScript 1
|
||||
restrained 1
|
||||
maxKeepAliveReq
|
||||
smartKeepAlive
|
||||
setUIDMode 0
|
||||
chrootMode 0
|
||||
configFile $SERVER_ROOT/conf/vhosts/Example/vhconf.conf
|
||||
}
|
||||
|
||||
|
||||
|
||||
include phpconfigs/php53.conf
|
||||
include phpconfigs/php54.conf
|
||||
include phpconfigs/php55.conf
|
||||
include phpconfigs/php56.conf
|
||||
include phpconfigs/php70.conf
|
||||
include phpconfigs/php71.conf
|
||||
|
||||
158
serverStatus/litespeed/conf/mime.properties
Normal file
158
serverStatus/litespeed/conf/mime.properties
Normal file
@@ -0,0 +1,158 @@
|
||||
default = application/octet-stream
|
||||
3gp = video/3gpp
|
||||
3g2 = video/3gpp2
|
||||
ai, eps = application/postscript
|
||||
aif, aifc, aiff = audio/x-aiff
|
||||
asc = text/plain
|
||||
asf = video/asf
|
||||
asx = video/x-ms-asf
|
||||
au = audio/basic
|
||||
avi = video/x-msvideo
|
||||
bcpio = application/x-bcpio
|
||||
bmp = image/bmp
|
||||
bin = application/octet-stream
|
||||
bz, bz2 = application/x-bzip
|
||||
cdf = application/x-netcdf
|
||||
class = application/java-vm
|
||||
cpio = application/x-cpio
|
||||
cpt = application/mac-compactpro
|
||||
crt = application/x-x509-ca-cert
|
||||
csh = application/x-csh
|
||||
css = text/css
|
||||
dcr,dir, dxr = application/x-director
|
||||
dms = application/octet-stream
|
||||
doc = application/msword
|
||||
dtd = application/xml-dtd
|
||||
dvi = application/x-dvi
|
||||
eot = application/vnd.ms-fontobject
|
||||
etx = text/x-setext
|
||||
exe = application/x-executable
|
||||
ez = application/andrew-inset
|
||||
flv = video/x-flv
|
||||
gif = image/gif
|
||||
gtar = application/x-gtar
|
||||
gz, gzip = application/gzip
|
||||
hdf = application/x-hdf
|
||||
hqx = application/mac-binhex40
|
||||
htc = text/x-component
|
||||
html, htm = text/html
|
||||
ice = x-conference/x-cooltalk
|
||||
ico = image/x-icon
|
||||
ief = image/ief
|
||||
iges, igs = model/iges
|
||||
iso = application/x-cd-image
|
||||
java = text/plain
|
||||
jar = application/java-archive
|
||||
jnlp = application/x-java-jnlp-file
|
||||
jpeg, jpe, jpg = image/jpeg
|
||||
js = application/x-javascript
|
||||
js2 = application/javascript
|
||||
js3 = text/javascript
|
||||
json = application/json
|
||||
jsp = text/plain
|
||||
kar = audio/midi
|
||||
latex = application/x-latex
|
||||
lha, lzh = application/octet-stream
|
||||
man = application/x-troff-man
|
||||
mdb = application/vnd.ms-access
|
||||
me = application/x-troff-me
|
||||
mesh = model/mesh
|
||||
mid, midi = audio/midi
|
||||
mif = application/vnd.mif
|
||||
movie = video/x-sgi-movie
|
||||
mov = video/quicktime
|
||||
mp2, mp3, mpga = audio/mpeg
|
||||
mpeg, mpe, mpg = video/mpeg
|
||||
mp4 = video/mp4
|
||||
mpp = application/vnd.ms-project
|
||||
ms = application/x-troff-ms
|
||||
msh = model/mesh
|
||||
nc = application/x-netcdf
|
||||
oda = application/oda
|
||||
odb = application/vnd.oasis.opendocument.database
|
||||
odc = application/vnd.oasis.opendocument.chart
|
||||
odf = application/vnd.oasis.opendocument.formula
|
||||
odg = application/vnd.oasis.opendocument.graphics
|
||||
odi = application/vnd.oasis.opendocument.image
|
||||
odp = application/vnd.oasis.opendocument.presentation
|
||||
ods = application/vnd.oasis.opendocument.spreadsheet
|
||||
odt = application/vnd.oasis.opendocument.text
|
||||
ogg = audio/ogg
|
||||
otf = application/x-font-woff
|
||||
pbm = image/x-portable-bitmap
|
||||
pdb = chemical/x-pdb
|
||||
pdf = application/pdf
|
||||
pgm = image/x-portable-graymap
|
||||
pgn = application/x-chess-pgn
|
||||
pls = audio/x-scpls
|
||||
png = image/png
|
||||
pnm = image/x-portable-anymap
|
||||
ppm = image/x-portable-pixmap
|
||||
ppt = application/vnd.ms-powerpoint
|
||||
ps = application/postscript
|
||||
qt,qtvr = video/quicktime
|
||||
ra = audio/x-realaudio
|
||||
ram, rm = audio/x-pn-realaudio
|
||||
rar = application/x-rar-compressed
|
||||
ras = image/x-cmu-raster
|
||||
rgb = image/x-rgb
|
||||
roff, t, tr = application/x-troff
|
||||
rss = application/rss+xml
|
||||
rsd = application/rsd+xml
|
||||
rtf = application/rtf
|
||||
rtx = text/richtext
|
||||
ser = application/java-serialized-object
|
||||
sgml, sgm = text/sgml
|
||||
sh = application/x-sh
|
||||
shar = application/x-shar
|
||||
shtml = application/x-httpd-shtml
|
||||
silo = model/mesh
|
||||
sit = application/x-stuffit
|
||||
skd, skm, skp, skt = application/x-koan
|
||||
smi,smil = application/smil
|
||||
snd = audio/basic
|
||||
spl = application/x-futuresplash
|
||||
sql = text/x-sql
|
||||
src = application/x-wais-source
|
||||
sv4cpio = application/x-sv4cpio
|
||||
sv4crc = application/x-sv4crc
|
||||
svg, svgz = image/svg+xml
|
||||
swf = application/x-shockwave-flash
|
||||
tar = application/x-tar
|
||||
tcl = application/x-tcl
|
||||
tex = application/x-tex
|
||||
texi, texinfo = application/x-texinfo
|
||||
tgz = application/x-gtar
|
||||
tiff, tif = image/tiff
|
||||
tsv = text/tab-separated-values
|
||||
ttf, ttc = application/x-font-ttf
|
||||
txt = text/plain
|
||||
ustar = application/x-ustar
|
||||
vcd = application/x-cdlink
|
||||
vrml = model/vrml
|
||||
vxml = application/voicexml+xml
|
||||
wav = audio/vnd.wave
|
||||
wax = audio/x-ms-wax
|
||||
wbmp = image/vnd.wap.wbmp
|
||||
wma = audio/x-ms-wma
|
||||
wml = text/vnd.wap.wml
|
||||
wmlc = application/vnd.wap.wmlc
|
||||
wmls = text/vnd.wap.wmlscript
|
||||
wmlsc = application/vnd.wap.wmlscriptc
|
||||
woff = application/font-woff
|
||||
woff2 = font/woff2
|
||||
woff_o1 = application/x-font-woff
|
||||
wtls-ca-certificate = application/vnd.wap.wtls-ca-certificate
|
||||
wri = application/vnd.ms-write
|
||||
wrl = model/vrml
|
||||
xbm = image/x-xbitmap
|
||||
xhtml, xht = application/xhtml+xml
|
||||
xls = application/vnd.ms-excel
|
||||
xml, xsd, xsl = application/xml
|
||||
xslt = application/xslt+xml
|
||||
xpm = image/x-xpixmap
|
||||
xwd = image/x-xwindowdump
|
||||
xyz = chemical/x-pdb
|
||||
zip = application/zip
|
||||
z = application/compress
|
||||
|
||||
86
serverStatus/litespeed/conf/templates/ccl.conf
Normal file
86
serverStatus/litespeed/conf/templates/ccl.conf
Normal file
@@ -0,0 +1,86 @@
|
||||
allowSymbolLink 1
|
||||
chrootMode 0
|
||||
enableScript 1
|
||||
restrained 1
|
||||
setUIDMode 0
|
||||
vhRoot $SERVER_ROOT/$VH_NAME/
|
||||
configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
|
||||
|
||||
virtualHostConfig {
|
||||
enableGzip 1
|
||||
docRoot $VH_ROOT/html/
|
||||
|
||||
hotlinkCtrl {
|
||||
allowedHosts
|
||||
enableHotlinkCtrl 0
|
||||
suffixes gif, jpeg, jpg
|
||||
allowDirectAccess 1
|
||||
redirectUri
|
||||
onlySelf 1
|
||||
}
|
||||
|
||||
general {
|
||||
enableContextAC 0
|
||||
}
|
||||
|
||||
expires {
|
||||
expiresDefault
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
|
||||
rules <<<MY_END
|
||||
RewriteCond %{HTTP_USER_AGENT} ^NameOfBadRobot
|
||||
RewriteRule ^/nospider/ - [F]
|
||||
MY_END
|
||||
}
|
||||
|
||||
index {
|
||||
useServer 0
|
||||
autoIndex 0
|
||||
indexFiles index.html
|
||||
autoIndexURI /_autoindex/default.php
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/logs/$VH_NAME.access.log{
|
||||
useServer 0
|
||||
keepDays 30
|
||||
rollingSize 100M
|
||||
compressArchive 1
|
||||
logUserAgent 1
|
||||
logReferer 1
|
||||
}
|
||||
|
||||
errorlog {
|
||||
useServer 1
|
||||
}
|
||||
|
||||
htAccess {
|
||||
allowOverride 0
|
||||
accessFileName .htaccess
|
||||
}
|
||||
|
||||
context /cgi-bin/{
|
||||
type cgi
|
||||
location $VH_ROOT/cgi-bin/
|
||||
allowBrowse 1
|
||||
}
|
||||
|
||||
awstats {
|
||||
updateMode 0
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateInterval 86400
|
||||
updateOffset 0
|
||||
siteDomain localhost
|
||||
workingDir $VH_ROOT/awstats
|
||||
awstatsURI /awstats/
|
||||
}
|
||||
|
||||
accessControl {
|
||||
deny
|
||||
allow *
|
||||
}
|
||||
}
|
||||
111
serverStatus/litespeed/conf/templates/ccl.conf0,v
Normal file
111
serverStatus/litespeed/conf/templates/ccl.conf0,v
Normal file
@@ -0,0 +1,111 @@
|
||||
head 1.1;
|
||||
access;
|
||||
symbols;
|
||||
locks
|
||||
root:1.1; strict;
|
||||
comment @# @;
|
||||
|
||||
|
||||
1.1
|
||||
date 2017.08.17.05.47.23; author root; state Exp;
|
||||
branches;
|
||||
next ;
|
||||
|
||||
|
||||
desc
|
||||
@/usr/local/CyberCP/conf/templates/ccl.conf0
|
||||
@
|
||||
|
||||
|
||||
1.1
|
||||
log
|
||||
@Update
|
||||
@
|
||||
text
|
||||
@allowSymbolLink 1
|
||||
chrootMode 0
|
||||
enableScript 1
|
||||
restrained 1
|
||||
setUIDMode 0
|
||||
vhRoot $SERVER_ROOT/$VH_NAME/
|
||||
configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
|
||||
|
||||
virtualHostConfig {
|
||||
enableGzip 1
|
||||
docRoot $VH_ROOT/html/
|
||||
|
||||
hotlinkCtrl {
|
||||
allowedHosts
|
||||
enableHotlinkCtrl 0
|
||||
suffixes gif, jpeg, jpg
|
||||
allowDirectAccess 1
|
||||
redirectUri
|
||||
onlySelf 1
|
||||
}
|
||||
|
||||
general {
|
||||
enableContextAC 0
|
||||
}
|
||||
|
||||
expires {
|
||||
expiresDefault
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
|
||||
rules <<<MY_END
|
||||
RewriteCond %{HTTP_USER_AGENT} ^NameOfBadRobot
|
||||
RewriteRule ^/nospider/ - [F]
|
||||
MY_END
|
||||
}
|
||||
|
||||
index {
|
||||
useServer 0
|
||||
autoIndex 0
|
||||
indexFiles index.html
|
||||
autoIndexURI /_autoindex/default.php
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/logs/$VH_NAME.access.log{
|
||||
useServer 0
|
||||
keepDays 30
|
||||
rollingSize 100M
|
||||
compressArchive 1
|
||||
logUserAgent 1
|
||||
logReferer 1
|
||||
}
|
||||
|
||||
errorlog {
|
||||
useServer 1
|
||||
}
|
||||
|
||||
htAccess {
|
||||
allowOverride 0
|
||||
accessFileName .htaccess
|
||||
}
|
||||
|
||||
context /cgi-bin/{
|
||||
type cgi
|
||||
location $VH_ROOT/cgi-bin/
|
||||
allowBrowse 1
|
||||
}
|
||||
|
||||
awstats {
|
||||
updateMode 0
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateInterval 86400
|
||||
updateOffset 0
|
||||
siteDomain localhost
|
||||
workingDir $VH_ROOT/awstats
|
||||
awstatsURI /awstats/
|
||||
}
|
||||
|
||||
accessControl {
|
||||
deny
|
||||
allow *
|
||||
}
|
||||
}
|
||||
@
|
||||
100
serverStatus/litespeed/conf/templates/phpsuexec.conf
Normal file
100
serverStatus/litespeed/conf/templates/phpsuexec.conf
Normal file
@@ -0,0 +1,100 @@
|
||||
allowSymbolLink 1
|
||||
chrootMode 0
|
||||
enableScript 1
|
||||
restrained 1
|
||||
setUIDMode 2
|
||||
vhRoot $SERVER_ROOT/$VH_NAME/
|
||||
configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
|
||||
|
||||
virtualHostConfig {
|
||||
enableGzip 1
|
||||
docRoot $VH_ROOT/public_html/
|
||||
|
||||
htAccess {
|
||||
accessFileName .htaccess
|
||||
allowOverride 31
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
}
|
||||
|
||||
awstats {
|
||||
updateMode 0
|
||||
workingDir $VH_ROOT/awstats
|
||||
awstatsURI /awstats/
|
||||
siteDomain localhost
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateInterval 86400
|
||||
updateOffset 0
|
||||
securedConn 0
|
||||
}
|
||||
|
||||
extProcessor $VH_NAME_lsphp{
|
||||
path $SERVER_ROOT/fcgi-bin/lsphp
|
||||
backlog 10
|
||||
instances 5
|
||||
runOnStartUp 0
|
||||
respBuffer 0
|
||||
autoStart 1
|
||||
extMaxIdleTime 60
|
||||
priority 0
|
||||
memSoftLimit 100M
|
||||
memHardLimit 150M
|
||||
procSoftLimit 100
|
||||
procHardLimit 200
|
||||
type lsapi
|
||||
address uds://tmp/lshttpd/$VH_NAME_lsphp.sock
|
||||
maxConns 5
|
||||
initTimeout 60
|
||||
retryTimeout 0
|
||||
persistConn 1
|
||||
pcKeepAliveTimeout 30
|
||||
}
|
||||
|
||||
index {
|
||||
useServer 0
|
||||
autoIndex 0
|
||||
autoIndexURI /_autoindex/default.php
|
||||
indexFiles index.html
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/logs/$VH_NAME.access.log{
|
||||
keepDays 30
|
||||
rollingSize 100M
|
||||
compressArchive 1
|
||||
useServer 0
|
||||
logHeaders 3
|
||||
}
|
||||
|
||||
errorlog {
|
||||
useServer 1
|
||||
}
|
||||
|
||||
hotlinkCtrl {
|
||||
enableHotlinkCtrl 0
|
||||
suffixes gif, jpeg, jpg
|
||||
allowDirectAccess 1
|
||||
onlySelf 1
|
||||
}
|
||||
|
||||
accessControl {
|
||||
allow *
|
||||
}
|
||||
|
||||
scriptHandler {
|
||||
add lsapi:$VH_NAME_lsphp php
|
||||
}
|
||||
|
||||
expires {
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
context /cgi-bin/{
|
||||
type cgi
|
||||
location $VH_ROOT/cgi-bin/
|
||||
accessControl
|
||||
rewrite
|
||||
}
|
||||
}
|
||||
125
serverStatus/litespeed/conf/templates/phpsuexec.conf0,v
Normal file
125
serverStatus/litespeed/conf/templates/phpsuexec.conf0,v
Normal file
@@ -0,0 +1,125 @@
|
||||
head 1.1;
|
||||
access;
|
||||
symbols;
|
||||
locks
|
||||
root:1.1; strict;
|
||||
comment @# @;
|
||||
|
||||
|
||||
1.1
|
||||
date 2017.08.17.05.47.23; author root; state Exp;
|
||||
branches;
|
||||
next ;
|
||||
|
||||
|
||||
desc
|
||||
@/usr/local/CyberCP/conf/templates/phpsuexec.conf0
|
||||
@
|
||||
|
||||
|
||||
1.1
|
||||
log
|
||||
@Update
|
||||
@
|
||||
text
|
||||
@allowSymbolLink 1
|
||||
chrootMode 0
|
||||
enableScript 1
|
||||
restrained 1
|
||||
setUIDMode 2
|
||||
vhRoot $SERVER_ROOT/$VH_NAME/
|
||||
configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
|
||||
|
||||
virtualHostConfig {
|
||||
enableGzip 1
|
||||
docRoot $VH_ROOT/public_html/
|
||||
|
||||
htAccess {
|
||||
accessFileName .htaccess
|
||||
allowOverride 31
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
}
|
||||
|
||||
awstats {
|
||||
updateMode 0
|
||||
workingDir $VH_ROOT/awstats
|
||||
awstatsURI /awstats/
|
||||
siteDomain localhost
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateInterval 86400
|
||||
updateOffset 0
|
||||
securedConn 0
|
||||
}
|
||||
|
||||
extProcessor $VH_NAME_lsphp{
|
||||
path $SERVER_ROOT/fcgi-bin/lsphp
|
||||
backlog 10
|
||||
instances 5
|
||||
runOnStartUp 0
|
||||
respBuffer 0
|
||||
autoStart 1
|
||||
extMaxIdleTime 60
|
||||
priority 0
|
||||
memSoftLimit 100M
|
||||
memHardLimit 150M
|
||||
procSoftLimit 100
|
||||
procHardLimit 200
|
||||
type lsapi
|
||||
address uds://tmp/lshttpd/$VH_NAME_lsphp.sock
|
||||
maxConns 5
|
||||
initTimeout 60
|
||||
retryTimeout 0
|
||||
persistConn 1
|
||||
pcKeepAliveTimeout 30
|
||||
}
|
||||
|
||||
index {
|
||||
useServer 0
|
||||
autoIndex 0
|
||||
autoIndexURI /_autoindex/default.php
|
||||
indexFiles index.html
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/logs/$VH_NAME.access.log{
|
||||
keepDays 30
|
||||
rollingSize 100M
|
||||
compressArchive 1
|
||||
useServer 0
|
||||
logHeaders 3
|
||||
}
|
||||
|
||||
errorlog {
|
||||
useServer 1
|
||||
}
|
||||
|
||||
hotlinkCtrl {
|
||||
enableHotlinkCtrl 0
|
||||
suffixes gif, jpeg, jpg
|
||||
allowDirectAccess 1
|
||||
onlySelf 1
|
||||
}
|
||||
|
||||
accessControl {
|
||||
allow *
|
||||
}
|
||||
|
||||
scriptHandler {
|
||||
add lsapi:$VH_NAME_lsphp php
|
||||
}
|
||||
|
||||
expires {
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
context /cgi-bin/{
|
||||
type cgi
|
||||
location $VH_ROOT/cgi-bin/
|
||||
accessControl
|
||||
rewrite
|
||||
}
|
||||
}
|
||||
@
|
||||
76
serverStatus/litespeed/conf/templates/rails.conf
Normal file
76
serverStatus/litespeed/conf/templates/rails.conf
Normal file
@@ -0,0 +1,76 @@
|
||||
allowSymbolLink 1
|
||||
chrootMode 0
|
||||
enableScript 1
|
||||
restrained 1
|
||||
setUIDMode 2
|
||||
vhRoot $SERVER_ROOT/$VH_NAME/
|
||||
configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
|
||||
|
||||
virtualHostConfig {
|
||||
enableGzip 1
|
||||
docRoot $VH_ROOT/public/
|
||||
|
||||
accessControl {
|
||||
allow *
|
||||
}
|
||||
|
||||
hotlinkCtrl {
|
||||
suffixes gif, jpeg, jpg
|
||||
allowDirectAccess 1
|
||||
onlySelf 1
|
||||
enableHotlinkCtrl 0
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
}
|
||||
|
||||
index {
|
||||
useServer 0
|
||||
autoIndex 0
|
||||
indexFiles index.html
|
||||
autoIndexURI /_autoindex/default.php
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/logs/$VH_NAME.access.log{
|
||||
logHeaders 3
|
||||
compressArchive 0
|
||||
useServer 0
|
||||
keepDays 30
|
||||
rollingSize 500M
|
||||
}
|
||||
|
||||
errorlog {
|
||||
useServer 1
|
||||
}
|
||||
|
||||
context /{
|
||||
railsEnv 1
|
||||
maxConns 5
|
||||
location $VH_ROOT/
|
||||
type rails
|
||||
accessControl
|
||||
addDefaultCharset off
|
||||
}
|
||||
|
||||
htAccess {
|
||||
allowOverride 0
|
||||
accessFileName .htaccess
|
||||
}
|
||||
|
||||
expires {
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
awstats {
|
||||
workingDir $VH_ROOT/awstats
|
||||
awstatsURI /awstats/
|
||||
siteDomain localhost
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateMode 0
|
||||
updateInterval 86400
|
||||
updateOffset 0
|
||||
securedConn 0
|
||||
}
|
||||
}
|
||||
101
serverStatus/litespeed/conf/templates/rails.conf0,v
Normal file
101
serverStatus/litespeed/conf/templates/rails.conf0,v
Normal file
@@ -0,0 +1,101 @@
|
||||
head 1.1;
|
||||
access;
|
||||
symbols;
|
||||
locks
|
||||
root:1.1; strict;
|
||||
comment @# @;
|
||||
|
||||
|
||||
1.1
|
||||
date 2017.08.17.05.47.23; author root; state Exp;
|
||||
branches;
|
||||
next ;
|
||||
|
||||
|
||||
desc
|
||||
@/usr/local/CyberCP/conf/templates/rails.conf0
|
||||
@
|
||||
|
||||
|
||||
1.1
|
||||
log
|
||||
@Update
|
||||
@
|
||||
text
|
||||
@allowSymbolLink 1
|
||||
chrootMode 0
|
||||
enableScript 1
|
||||
restrained 1
|
||||
setUIDMode 2
|
||||
vhRoot $SERVER_ROOT/$VH_NAME/
|
||||
configFile $SERVER_ROOT/conf/vhosts/$VH_NAME/vhconf.conf
|
||||
|
||||
virtualHostConfig {
|
||||
enableGzip 1
|
||||
docRoot $VH_ROOT/public/
|
||||
|
||||
accessControl {
|
||||
allow *
|
||||
}
|
||||
|
||||
hotlinkCtrl {
|
||||
suffixes gif, jpeg, jpg
|
||||
allowDirectAccess 1
|
||||
onlySelf 1
|
||||
enableHotlinkCtrl 0
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
}
|
||||
|
||||
index {
|
||||
useServer 0
|
||||
autoIndex 0
|
||||
indexFiles index.html
|
||||
autoIndexURI /_autoindex/default.php
|
||||
}
|
||||
|
||||
accessLog $SERVER_ROOT/logs/$VH_NAME.access.log{
|
||||
logHeaders 3
|
||||
compressArchive 0
|
||||
useServer 0
|
||||
keepDays 30
|
||||
rollingSize 500M
|
||||
}
|
||||
|
||||
errorlog {
|
||||
useServer 1
|
||||
}
|
||||
|
||||
context /{
|
||||
railsEnv 1
|
||||
maxConns 5
|
||||
location $VH_ROOT/
|
||||
type rails
|
||||
accessControl
|
||||
addDefaultCharset off
|
||||
}
|
||||
|
||||
htAccess {
|
||||
allowOverride 0
|
||||
accessFileName .htaccess
|
||||
}
|
||||
|
||||
expires {
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
awstats {
|
||||
workingDir $VH_ROOT/awstats
|
||||
awstatsURI /awstats/
|
||||
siteDomain localhost
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateMode 0
|
||||
updateInterval 86400
|
||||
updateOffset 0
|
||||
securedConn 0
|
||||
}
|
||||
}
|
||||
@
|
||||
4
serverStatus/litespeed/conf/vhosts/Example/htgroup
Normal file
4
serverStatus/litespeed/conf/vhosts/Example/htgroup
Normal file
@@ -0,0 +1,4 @@
|
||||
group1: user1,user2, user3
|
||||
group2:
|
||||
user: user8, test
|
||||
group3:
|
||||
2
serverStatus/litespeed/conf/vhosts/Example/htpasswd
Normal file
2
serverStatus/litespeed/conf/vhosts/Example/htpasswd
Normal file
@@ -0,0 +1,2 @@
|
||||
test:kF2EDBE2Ux8sQ
|
||||
user1:SQtevcsBBnBPY
|
||||
119
serverStatus/litespeed/conf/vhosts/Example/vhconf.conf
Normal file
119
serverStatus/litespeed/conf/vhosts/Example/vhconf.conf
Normal file
@@ -0,0 +1,119 @@
|
||||
docRoot $VH_ROOT/html/
|
||||
enableGzip 1
|
||||
|
||||
context /docs/{
|
||||
allowBrowse 1
|
||||
location $SERVER_ROOT/docs/
|
||||
type NULL
|
||||
}
|
||||
|
||||
context /protected/{
|
||||
required user test
|
||||
authName Protected
|
||||
type NULL
|
||||
allowBrowse 1
|
||||
location protected/
|
||||
realm SampleProtectedArea
|
||||
|
||||
accessControl {
|
||||
deny
|
||||
allow *
|
||||
}
|
||||
}
|
||||
|
||||
context /blocked/{
|
||||
allowBrowse 0
|
||||
type NULL
|
||||
}
|
||||
|
||||
context /cgi-bin/{
|
||||
allowBrowse 1
|
||||
location $VH_ROOT/cgi-bin/
|
||||
type cgi
|
||||
}
|
||||
|
||||
expires {
|
||||
enableExpires 1
|
||||
}
|
||||
|
||||
index {
|
||||
autoIndexURI /_autoindex/default.php
|
||||
indexFiles index.html
|
||||
autoIndex 0
|
||||
useServer 0
|
||||
}
|
||||
|
||||
errorPage 404{
|
||||
url /error404.html
|
||||
}
|
||||
|
||||
errorlog $VH_ROOT/logs/error.log{
|
||||
logLevel DEBUG
|
||||
rollingSize 10M
|
||||
useServer 1
|
||||
}
|
||||
|
||||
accessLog $VH_ROOT/logs/access.log{
|
||||
compressArchive 0
|
||||
logReferer 1
|
||||
keepDays 30
|
||||
rollingSize 10M
|
||||
logUserAgent 1
|
||||
useServer 0
|
||||
}
|
||||
|
||||
htAccess {
|
||||
accessFileName .htaccess
|
||||
allowOverride 0
|
||||
}
|
||||
|
||||
awstats {
|
||||
updateInterval 86400
|
||||
workingDir $VH_ROOT/awstats
|
||||
updateOffset 0
|
||||
siteDomain localhost
|
||||
siteAliases 127.0.0.1 localhost
|
||||
updateMode 0
|
||||
awstatsURI /awstats/
|
||||
}
|
||||
|
||||
rewrite {
|
||||
enable 0
|
||||
logLevel 0
|
||||
|
||||
rules <<<END_rules
|
||||
RewriteCond %{HTTP_USER_AGENT} ^NameOfBadRobot
|
||||
RewriteRule ^/nospider/ - [F]
|
||||
END_rules
|
||||
}
|
||||
|
||||
hotlinkCtrl {
|
||||
suffixes gif, jpeg, jpg
|
||||
allowedHosts
|
||||
allowDirectAccess 1
|
||||
enableHotlinkCtrl 0
|
||||
onlySelf 1
|
||||
}
|
||||
|
||||
accessControl {
|
||||
deny
|
||||
allow *
|
||||
}
|
||||
|
||||
realm SampleProtectedArea {
|
||||
userDB {
|
||||
cacheTimeout 60
|
||||
maxCacheSize 200
|
||||
location $SERVER_ROOT/conf/vhosts/Example/htpasswd
|
||||
}
|
||||
|
||||
groupDB {
|
||||
cacheTimeout 60
|
||||
maxCacheSize 200
|
||||
location $SERVER_ROOT/conf/vhosts/Example/htgroup
|
||||
}
|
||||
}
|
||||
|
||||
general {
|
||||
enableContextAC 0
|
||||
}
|
||||
1363
serverStatus/litespeed/functions.sh
Normal file
1363
serverStatus/litespeed/functions.sh
Normal file
File diff suppressed because it is too large
Load Diff
67
serverStatus/litespeed/httpd.conf
Normal file
67
serverStatus/litespeed/httpd.conf
Normal file
@@ -0,0 +1,67 @@
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
#
|
||||
#
|
||||
# Warning: Do not edit this file directly, this file is autogenerated.
|
||||
#
|
||||
#
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
|
||||
ServerRoot "/usr/local/lsws"
|
||||
|
||||
Listen 0.0.0.0:80
|
||||
Listen [::]:80
|
||||
Listen 0.0.0.0:443
|
||||
Listen [::]:443
|
||||
|
||||
User nobody
|
||||
Group nobody
|
||||
ServerAdmin root@localhost
|
||||
|
||||
<Directory />
|
||||
AllowOverride none
|
||||
</Directory>
|
||||
|
||||
<Directory /home>
|
||||
AllowOverride All
|
||||
Options +Includes -Indexes +ExecCGI
|
||||
</Directory>
|
||||
|
||||
DirectoryIndex index.php index.html
|
||||
|
||||
<Files ".ht*">
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
ErrorLog "/usr/local/lsws/logs/error.log"
|
||||
LogLevel warn
|
||||
|
||||
LogFormat '"%v %h %l %u %t \"%r\" %>s %b"' combined
|
||||
CustomLog "/usr/local/lsws/logs/access.log" combined
|
||||
|
||||
|
||||
AddType application/x-compress .Z
|
||||
AddType application/x-gzip .gz .tgz
|
||||
AddType text/html .shtml
|
||||
AddOutputFilter INCLUDES .shtml
|
||||
#AddHandler cgi-script .cgi
|
||||
|
||||
AddDefaultCharset UTF-8
|
||||
|
||||
<IfModule mime_magic_module>
|
||||
MIMEMagicFile conf/magic
|
||||
</IfModule>
|
||||
|
||||
EnableSendfile on
|
||||
|
||||
SSLProtocol all -SSLv3 -TLSv1
|
||||
SSLHonorCipherOrder on
|
||||
|
||||
SSLCipherSuite ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:HIGH:!EDH-RSA-DES-CBC3-SHA:!DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4
|
||||
|
||||
<IfModule Litespeed>
|
||||
CacheRoot /home/lscache/
|
||||
</IfModule>
|
||||
|
||||
|
||||
Include /usr/local/lsws/conf/modsec.conf
|
||||
413
serverStatus/litespeed/httpd_config.xml
Normal file
413
serverStatus/litespeed/httpd_config.xml
Normal file
@@ -0,0 +1,413 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<httpServerConfig>
|
||||
<serverName>$HOSTNAME</serverName>
|
||||
<user>nobody</user>
|
||||
<group>nobody</group>
|
||||
<priority>0</priority>
|
||||
<chrootPath>/</chrootPath>
|
||||
<enableChroot>0</enableChroot>
|
||||
<inMemBufSize>120M</inMemBufSize>
|
||||
<swappingDir>/tmp/lshttpd/swap</swappingDir>
|
||||
<autoFix503>1</autoFix503>
|
||||
<loadApacheConf>1</loadApacheConf>
|
||||
<autoReloadApacheConf>0</autoReloadApacheConf>
|
||||
<apacheConfFile>/usr/local/lsws/conf/httpd.conf</apacheConfFile>
|
||||
<apachePortOffset>0</apachePortOffset>
|
||||
<apacheIpOffset>0</apacheIpOffset>
|
||||
<phpSuExec>1</phpSuExec>
|
||||
<phpSuExecMaxConn>5</phpSuExecMaxConn>
|
||||
<mime>$SERVER_ROOT/conf/mime.properties</mime>
|
||||
<showVersionNumber>0</showVersionNumber>
|
||||
<autoUpdateInterval>86400</autoUpdateInterval>
|
||||
<autoUpdateDownloadPkg>1</autoUpdateDownloadPkg>
|
||||
<adminEmails>usman@cyberpersons.com</adminEmails>
|
||||
<adminRoot>$SERVER_ROOT/admin/</adminRoot>
|
||||
<logging>
|
||||
<log>
|
||||
<fileName>$SERVER_ROOT/logs/error.log</fileName>
|
||||
<logLevel>DEBUG</logLevel>
|
||||
<debugLevel>0</debugLevel>
|
||||
<rollingSize>10M</rollingSize>
|
||||
<enableStderrLog>1</enableStderrLog>
|
||||
<enableAioLog>1</enableAioLog>
|
||||
</log>
|
||||
<accessLog>
|
||||
<fileName>$SERVER_ROOT/logs/access.log</fileName>
|
||||
<rollingSize>10M</rollingSize>
|
||||
<keepDays>30</keepDays>
|
||||
<compressArchive>0</compressArchive>
|
||||
</accessLog>
|
||||
</logging>
|
||||
<indexFiles>index.html, index.php</indexFiles>
|
||||
<htAccess>
|
||||
<allowOverride>0</allowOverride>
|
||||
<accessFileName>.htaccess</accessFileName>
|
||||
</htAccess>
|
||||
<expires>
|
||||
<enableExpires>1</enableExpires>
|
||||
<expiresByType>image/*=A604800, text/css=A604800, application/x-javascript=A604800, application/javascript=A604800</expiresByType>
|
||||
</expires>
|
||||
<tuning>
|
||||
<eventDispatcher>best</eventDispatcher>
|
||||
<maxConnections>2000</maxConnections>
|
||||
<maxSSLConnections>200</maxSSLConnections>
|
||||
<connTimeout>300</connTimeout>
|
||||
<maxKeepAliveReq>1000</maxKeepAliveReq>
|
||||
<smartKeepAlive>0</smartKeepAlive>
|
||||
<keepAliveTimeout>5</keepAliveTimeout>
|
||||
<sndBufSize>0</sndBufSize>
|
||||
<rcvBufSize>0</rcvBufSize>
|
||||
<maxReqURLLen>8192</maxReqURLLen>
|
||||
<maxReqHeaderSize>16380</maxReqHeaderSize>
|
||||
<maxReqBodySize>500M</maxReqBodySize>
|
||||
<maxDynRespHeaderSize>8K</maxDynRespHeaderSize>
|
||||
<maxDynRespSize>500M</maxDynRespSize>
|
||||
<maxCachedFileSize>4096</maxCachedFileSize>
|
||||
<totalInMemCacheSize>20M</totalInMemCacheSize>
|
||||
<maxMMapFileSize>256K</maxMMapFileSize>
|
||||
<totalMMapCacheSize>40M</totalMMapCacheSize>
|
||||
<useSendfile>1</useSendfile>
|
||||
<useAIO>1</useAIO>
|
||||
<AIOBlockSize>4</AIOBlockSize>
|
||||
<enableGzipCompress>1</enableGzipCompress>
|
||||
<enableDynGzipCompress>1</enableDynGzipCompress>
|
||||
<gzipCompressLevel>1</gzipCompressLevel>
|
||||
<compressibleTypes>text/*,application/x-javascript,application/javascript,application/xml, image/svg+xml</compressibleTypes>
|
||||
<gzipAutoUpdateStatic>1</gzipAutoUpdateStatic>
|
||||
<gzipStaticCompressLevel>6</gzipStaticCompressLevel>
|
||||
<gzipMaxFileSize>1M</gzipMaxFileSize>
|
||||
<gzipMinFileSize>300</gzipMinFileSize>
|
||||
<SSLCryptoDevice>null</SSLCryptoDevice>
|
||||
</tuning>
|
||||
<quic>
|
||||
<quicEnable>1</quicEnable>
|
||||
</quic>
|
||||
<security>
|
||||
<fileAccessControl>
|
||||
<followSymbolLink>1</followSymbolLink>
|
||||
<checkSymbolLink>0</checkSymbolLink>
|
||||
<requiredPermissionMask>000</requiredPermissionMask>
|
||||
<restrictedPermissionMask>000</restrictedPermissionMask>
|
||||
</fileAccessControl>
|
||||
<perClientConnLimit>
|
||||
<staticReqPerSec>0</staticReqPerSec>
|
||||
<dynReqPerSec>0</dynReqPerSec>
|
||||
<outBandwidth>0</outBandwidth>
|
||||
<inBandwidth>0</inBandwidth>
|
||||
<softLimit>10000</softLimit>
|
||||
<hardLimit>10000</hardLimit>
|
||||
<gracePeriod>15</gracePeriod>
|
||||
<banPeriod>300</banPeriod>
|
||||
</perClientConnLimit>
|
||||
<CGIRLimit>
|
||||
<maxCGIInstances>200</maxCGIInstances>
|
||||
<minUID>11</minUID>
|
||||
<minGID>10</minGID>
|
||||
<priority>0</priority>
|
||||
<CPUSoftLimit>300</CPUSoftLimit>
|
||||
<CPUHardLimit>600</CPUHardLimit>
|
||||
<memSoftLimit>1450M</memSoftLimit>
|
||||
<memHardLimit>1500M</memHardLimit>
|
||||
<procSoftLimit>1400</procSoftLimit>
|
||||
<procHardLimit>1450</procHardLimit>
|
||||
</CGIRLimit>
|
||||
<censorshipControl>
|
||||
<enableCensorship>0</enableCensorship>
|
||||
<logLevel>0</logLevel>
|
||||
<defaultAction>deny,log,status:403</defaultAction>
|
||||
<scanPOST>1</scanPOST>
|
||||
<uploadTmpDir>/tmp</uploadTmpDir>
|
||||
<secAuditLog>$SERVER_ROOT/logs/security_audit.log</secAuditLog>
|
||||
</censorshipControl>
|
||||
<censorshipRuleSet>
|
||||
<name>XSS attack</name>
|
||||
<ruleSetAction>log,deny,status:403,msg:'XSS attack'</ruleSetAction>
|
||||
<enabled>1</enabled>
|
||||
<ruleSet>SecFilterSelective ARGS "(alert|expression|eval|url)[[:space:]]*\("
|
||||
SecFilterSelective ARGS "(&\{.+\}|(&#[[0-9a-fA-F]]|\x5cx[0-9a-fA-F]){2})"
|
||||
|
||||
SecFilterSelective ARGS "((javascript|vbscript):|style[[:space:]]*=)"
|
||||
SecFilterSelective ARGS "(fromCharCode|http-equiv|<.+>|innerHTML|dynsrc|-->)"
|
||||
SecFilterSelective ARGS "document\.(body|cookie|location|write)"
|
||||
|
||||
SecFilterSelective ARGS_VALUES "jsessionid|phpsessid|onReadyStateChange|xmlHttp"
|
||||
|
||||
SecFilterSelective ARGS "<(applet|div|embed|iframe|img|meta|object|script|textarea)"
|
||||
|
||||
# JavaScript event handlers
|
||||
SecFilterSelective ARGS "on(Abort|Blur|Click|DblClick|DragDrop|Error|Focus|KeyUp|KeyDown|KeyPrerss|Load|Mouse(Down|Out|Over|Up)|Move|Reset|Resize|Select|Submit|Unload)"</ruleSet>
|
||||
</censorshipRuleSet>
|
||||
<censorshipRuleSet>
|
||||
<name>SQL injection</name>
|
||||
<ruleSetAction>log,pass,msg:'SQL Injection attack'</ruleSetAction>
|
||||
<enabled>1</enabled>
|
||||
<ruleSet>#SQL generic
|
||||
SecFilterSelective ARGS "drop[[:space:]]+(database|table|column|procedure)"
|
||||
SecFilterSelective ARGS "delete[[:space:]]+from|create[[:space:]]+table|update.+set.+=|insert[[:space:]]+into.+values"
|
||||
SecFilterSelective ARGS "select.+from|bulk[[:space:]]+insert|union.+select|alter[[:space:]]+table"
|
||||
SecFilterSelective ARGS "or.+1[[:space:]]*=[[:space:]]1|or 1=1--'|'.+--"
|
||||
|
||||
SecFilterSelective ARGS "into[[:space:]]+outfile|load[[:space:]]+data|/\*.+\*/"</ruleSet>
|
||||
</censorshipRuleSet>
|
||||
<accessDenyDir>
|
||||
<dir>/</dir>
|
||||
<dir>/etc/*</dir>
|
||||
<dir>/dev/*</dir>
|
||||
<dir>$SERVER_ROOT/conf/*</dir>
|
||||
<dir>$SERVER_ROOT/admin/conf/*</dir>
|
||||
</accessDenyDir>
|
||||
<accessControl>
|
||||
<allow>ALL</allow>
|
||||
</accessControl>
|
||||
</security>
|
||||
<extProcessorList>
|
||||
<extProcessor>
|
||||
<type>lsapi</type>
|
||||
<name>lsphp5</name>
|
||||
<address>uds://tmp/lshttpd/lsphp5.sock</address>
|
||||
<maxConns>35</maxConns>
|
||||
<env>PHP_LSAPI_CHILDREN=35</env>
|
||||
<initTimeout>60</initTimeout>
|
||||
<retryTimeout>0</retryTimeout>
|
||||
<persistConn>1</persistConn>
|
||||
<respBuffer>0</respBuffer>
|
||||
<autoStart>3</autoStart>
|
||||
<path>$SERVER_ROOT/fcgi-bin/lsphp5</path>
|
||||
<backlog>100</backlog>
|
||||
<instances>1</instances>
|
||||
<priority>0</priority>
|
||||
<memSoftLimit>2047M</memSoftLimit>
|
||||
<memHardLimit>2047M</memHardLimit>
|
||||
<procSoftLimit>400</procSoftLimit>
|
||||
<procHardLimit>500</procHardLimit>
|
||||
</extProcessor>
|
||||
<extProcessor>
|
||||
<type>lsapi</type>
|
||||
<name>lsphp53</name>
|
||||
<address>uds://tmp/lshttpd/lsphp53.sock</address>
|
||||
<maxConns>35</maxConns>
|
||||
<env>PHP_LSAPI_CHILDREN=35</env>
|
||||
<initTimeout>60</initTimeout>
|
||||
<retryTimeout>0</retryTimeout>
|
||||
<persistConn>1</persistConn>
|
||||
<respBuffer>0</respBuffer>
|
||||
<autoStart>3</autoStart>
|
||||
<path>$SERVER_ROOT/lsphp53/bin/lsphp</path>
|
||||
<backlog>100</backlog>
|
||||
<instances>1</instances>
|
||||
<priority>0</priority>
|
||||
<memSoftLimit>2047M</memSoftLimit>
|
||||
<memHardLimit>2047M</memHardLimit>
|
||||
<procSoftLimit>400</procSoftLimit>
|
||||
<procHardLimit>500</procHardLimit>
|
||||
</extProcessor>
|
||||
<extProcessor>
|
||||
<type>lsapi</type>
|
||||
<name>lsphp54</name>
|
||||
<address>uds://tmp/lshttpd/lsphp54.sock</address>
|
||||
<maxConns>35</maxConns>
|
||||
<env>PHP_LSAPI_CHILDREN=35</env>
|
||||
<initTimeout>60</initTimeout>
|
||||
<retryTimeout>0</retryTimeout>
|
||||
<persistConn>1</persistConn>
|
||||
<respBuffer>0</respBuffer>
|
||||
<autoStart>3</autoStart>
|
||||
<path>$SERVER_ROOT/lsphp54/bin/lsphp</path>
|
||||
<backlog>100</backlog>
|
||||
<instances>1</instances>
|
||||
<priority>0</priority>
|
||||
<memSoftLimit>2047M</memSoftLimit>
|
||||
<memHardLimit>2047M</memHardLimit>
|
||||
<procSoftLimit>400</procSoftLimit>
|
||||
<procHardLimit>500</procHardLimit>
|
||||
</extProcessor>
|
||||
<extProcessor>
|
||||
<type>lsapi</type>
|
||||
<name>lsphp55</name>
|
||||
<address>uds://tmp/lshttpd/lsphp55.sock</address>
|
||||
<maxConns>35</maxConns>
|
||||
<env>PHP_LSAPI_CHILDREN=35</env>
|
||||
<initTimeout>60</initTimeout>
|
||||
<retryTimeout>0</retryTimeout>
|
||||
<persistConn>1</persistConn>
|
||||
<respBuffer>0</respBuffer>
|
||||
<autoStart>3</autoStart>
|
||||
<path>$SERVER_ROOT/lsphp55/bin/lsphp</path>
|
||||
<backlog>100</backlog>
|
||||
<instances>1</instances>
|
||||
<priority>0</priority>
|
||||
<memSoftLimit>2047M</memSoftLimit>
|
||||
<memHardLimit>2047M</memHardLimit>
|
||||
<procSoftLimit>400</procSoftLimit>
|
||||
<procHardLimit>500</procHardLimit>
|
||||
</extProcessor>
|
||||
<extProcessor>
|
||||
<type>lsapi</type>
|
||||
<name>lsphp56</name>
|
||||
<address>uds://tmp/lshttpd/lsphp56.sock</address>
|
||||
<maxConns>35</maxConns>
|
||||
<env>PHP_LSAPI_CHILDREN=35</env>
|
||||
<initTimeout>60</initTimeout>
|
||||
<retryTimeout>0</retryTimeout>
|
||||
<persistConn>1</persistConn>
|
||||
<respBuffer>0</respBuffer>
|
||||
<autoStart>3</autoStart>
|
||||
<path>$SERVER_ROOT/lsphp56/bin/lsphp</path>
|
||||
<backlog>100</backlog>
|
||||
<instances>1</instances>
|
||||
<priority>0</priority>
|
||||
<memSoftLimit>2047M</memSoftLimit>
|
||||
<memHardLimit>2047M</memHardLimit>
|
||||
<procSoftLimit>400</procSoftLimit>
|
||||
<procHardLimit>500</procHardLimit>
|
||||
</extProcessor>
|
||||
<extProcessor>
|
||||
<type>lsapi</type>
|
||||
<name>lsphp70</name>
|
||||
<address>uds://tmp/lshttpd/lsphp70.sock</address>
|
||||
<maxConns>35</maxConns>
|
||||
<env>PHP_LSAPI_CHILDREN=35</env>
|
||||
<initTimeout>60</initTimeout>
|
||||
<retryTimeout>0</retryTimeout>
|
||||
<persistConn>1</persistConn>
|
||||
<respBuffer>0</respBuffer>
|
||||
<autoStart>3</autoStart>
|
||||
<path>$SERVER_ROOT/lsphp70/bin/lsphp</path>
|
||||
<backlog>100</backlog>
|
||||
<instances>1</instances>
|
||||
<priority>0</priority>
|
||||
<memSoftLimit>2047M</memSoftLimit>
|
||||
<memHardLimit>2047M</memHardLimit>
|
||||
<procSoftLimit>400</procSoftLimit>
|
||||
<procHardLimit>500</procHardLimit>
|
||||
</extProcessor>
|
||||
<extProcessor>
|
||||
<type>lsapi</type>
|
||||
<name>lsphp71</name>
|
||||
<address>uds://tmp/lshttpd/lsphp71.sock</address>
|
||||
<maxConns>35</maxConns>
|
||||
<env>PHP_LSAPI_CHILDREN=35</env>
|
||||
<initTimeout>60</initTimeout>
|
||||
<retryTimeout>0</retryTimeout>
|
||||
<persistConn>1</persistConn>
|
||||
<respBuffer>0</respBuffer>
|
||||
<autoStart>3</autoStart>
|
||||
<path>$SERVER_ROOT/lsphp71/bin/lsphp</path>
|
||||
<backlog>100</backlog>
|
||||
<instances>1</instances>
|
||||
<priority>0</priority>
|
||||
<memSoftLimit>2047M</memSoftLimit>
|
||||
<memHardLimit>2047M</memHardLimit>
|
||||
<procSoftLimit>400</procSoftLimit>
|
||||
<procHardLimit>500</procHardLimit>
|
||||
</extProcessor>
|
||||
<extProcessor>
|
||||
<type>lsapi</type>
|
||||
<name>lsphp72</name>
|
||||
<address>uds://tmp/lshttpd/lsphp72.sock</address>
|
||||
<maxConns>35</maxConns>
|
||||
<env>PHP_LSAPI_CHILDREN=35</env>
|
||||
<initTimeout>60</initTimeout>
|
||||
<retryTimeout>0</retryTimeout>
|
||||
<persistConn>1</persistConn>
|
||||
<respBuffer>0</respBuffer>
|
||||
<autoStart>3</autoStart>
|
||||
<path>$SERVER_ROOT/lsphp72/bin/lsphp</path>
|
||||
<backlog>100</backlog>
|
||||
<instances>1</instances>
|
||||
<priority>0</priority>
|
||||
<memSoftLimit>2047M</memSoftLimit>
|
||||
<memHardLimit>2047M</memHardLimit>
|
||||
<procSoftLimit>400</procSoftLimit>
|
||||
<procHardLimit>500</procHardLimit>
|
||||
</extProcessor>
|
||||
<extProcessor>
|
||||
<type>lsapi</type>
|
||||
<name>lsphp73</name>
|
||||
<address>uds://tmp/lshttpd/lsphp73.sock</address>
|
||||
<maxConns>35</maxConns>
|
||||
<env>PHP_LSAPI_CHILDREN=35</env>
|
||||
<initTimeout>60</initTimeout>
|
||||
<retryTimeout>0</retryTimeout>
|
||||
<persistConn>1</persistConn>
|
||||
<respBuffer>0</respBuffer>
|
||||
<autoStart>3</autoStart>
|
||||
<path>$SERVER_ROOT/lsphp73/bin/lsphp</path>
|
||||
<backlog>100</backlog>
|
||||
<instances>1</instances>
|
||||
<priority>0</priority>
|
||||
<memSoftLimit>2047M</memSoftLimit>
|
||||
<memHardLimit>2047M</memHardLimit>
|
||||
<procSoftLimit>400</procSoftLimit>
|
||||
<procHardLimit>500</procHardLimit>
|
||||
</extProcessor>
|
||||
</extProcessorList>
|
||||
<scriptHandlerList>
|
||||
<scriptHandler>
|
||||
<suffix>php</suffix>
|
||||
<type>lsapi</type>
|
||||
<handler>lsphp5</handler>
|
||||
</scriptHandler>
|
||||
<scriptHandler>
|
||||
<suffix>php5</suffix>
|
||||
<type>lsapi</type>
|
||||
<handler>lsphp5</handler>
|
||||
</scriptHandler>
|
||||
<scriptHandler>
|
||||
<suffix>php53</suffix>
|
||||
<type>lsapi</type>
|
||||
<handler>lsphp53</handler>
|
||||
</scriptHandler>
|
||||
<scriptHandler>
|
||||
<suffix>php54</suffix>
|
||||
<type>lsapi</type>
|
||||
<handler>lsphp54</handler>
|
||||
</scriptHandler>
|
||||
<scriptHandler>
|
||||
<suffix>php55</suffix>
|
||||
<type>lsapi</type>
|
||||
<handler>lsphp55</handler>
|
||||
</scriptHandler>
|
||||
<scriptHandler>
|
||||
<suffix>php56</suffix>
|
||||
<type>lsapi</type>
|
||||
<handler>lsphp56</handler>
|
||||
</scriptHandler>
|
||||
<scriptHandler>
|
||||
<suffix>php70</suffix>
|
||||
<type>lsapi</type>
|
||||
<handler>lsphp70</handler>
|
||||
</scriptHandler>
|
||||
<scriptHandler>
|
||||
<suffix>php71</suffix>
|
||||
<type>lsapi</type>
|
||||
<handler>lsphp71</handler>
|
||||
</scriptHandler>
|
||||
<scriptHandler>
|
||||
<suffix>php72</suffix>
|
||||
<type>lsapi</type>
|
||||
<handler>lsphp72</handler>
|
||||
</scriptHandler>
|
||||
<scriptHandler>
|
||||
<suffix>php73</suffix>
|
||||
<type>lsapi</type>
|
||||
<handler>lsphp73</handler>
|
||||
</scriptHandler>
|
||||
</scriptHandlerList>
|
||||
<railsDefaults>
|
||||
<railsEnv>1</railsEnv>
|
||||
<maxConns>5</maxConns>
|
||||
<env>LSAPI_MAX_IDLE=60</env>
|
||||
<initTimeout>180</initTimeout>
|
||||
<retryTimeout>0</retryTimeout>
|
||||
<pcKeepAliveTimeout>60</pcKeepAliveTimeout>
|
||||
<respBuffer>0</respBuffer>
|
||||
<backlog>50</backlog>
|
||||
<runOnStartUp>1</runOnStartUp>
|
||||
<priority>3</priority>
|
||||
<memSoftLimit>2047M</memSoftLimit>
|
||||
<memHardLimit>2047M</memHardLimit>
|
||||
<procSoftLimit>400</procSoftLimit>
|
||||
<procHardLimit>500</procHardLimit>
|
||||
</railsDefaults>
|
||||
</httpServerConfig>
|
||||
505
serverStatus/litespeed/install.sh
Normal file
505
serverStatus/litespeed/install.sh
Normal file
@@ -0,0 +1,505 @@
|
||||
#!/bin/sh
|
||||
|
||||
cd `dirname "$0"`
|
||||
source ./functions.sh 2>/dev/null
|
||||
if [ $? != 0 ]; then
|
||||
. ./functions.sh
|
||||
if [ $? != 0 ]; then
|
||||
echo [ERROR] Can not include 'functions.sh'.
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
test_license()
|
||||
{
|
||||
COPY_LICENSE_KEY=1
|
||||
if [ -f "$LSWS_HOME/conf/serial.no" ]; then
|
||||
if [ ! -f "$LSINSTALL_DIR/serial.no" ]; then
|
||||
cp "$LSWS_HOME/conf/serial.no" "$LSINSTALL_DIR/serial.no"
|
||||
else
|
||||
diff "$LSWS_HOME/conf/serial.no" "$LSINSTALL_DIR/serial.no" 1>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
COPY_LICENSE_KEY=0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# if [ $COPY_LICENSE_KEY -eq 1 ]; then
|
||||
# if [ -f "$LSWS_HOME/conf/license.key" ] && [ ! -f "$LSINSTALL_DIR/license.key" ]; then
|
||||
# cp "$LSWS_HOME/conf/license.key" "$LSINSTALL_DIR/license.key"
|
||||
# fi
|
||||
# if [ -f "$LSWS_HOME/conf/license.key" ] && [ -f "$LSINSTALL_DIR/license.key" ]; then
|
||||
# diff "$LSWS_HOME/conf/license.key" "$LSINSTALL_DIR/license.key"
|
||||
# if [ $? -ne 0 ]; then
|
||||
# cp "$LSWS_HOME/conf/license.key" "$LSINSTALL_DIR/license.key"
|
||||
# fi
|
||||
# fi
|
||||
# fi
|
||||
if [ -f "$LSINSTALL_DIR/license.key" ] && [ -f "$LSINSTALL_DIR/serial.no" ]; then
|
||||
echo "License key and serial number are available, testing..."
|
||||
echo
|
||||
bin/lshttpd -V
|
||||
if [ $? -eq 0 ]; then
|
||||
LICENSE_OK=1
|
||||
if [ -f "$LSINSTALL_DIR/conf/license.key" ]; then
|
||||
mv "$LSINSTALL_DIR/conf/license.key" "$LSINSTALL_DIR/license.key"
|
||||
bin/lshttpd -t
|
||||
fi
|
||||
fi
|
||||
echo
|
||||
fi
|
||||
|
||||
if [ "x$LICENSE_OK" = "x" ]; then
|
||||
if [ -f "$LSINSTALL_DIR/serial.no" ]; then
|
||||
# echo "Serial number is available."
|
||||
# printf "Would you like to register a license key for this server? [Y/n]"
|
||||
# read TMP_YN
|
||||
# echo ""
|
||||
# if [ "x$TMP_YN" = "x" ] || [ `expr "$TMP_YN" : '[Yy]'` -gt 0 ]; then
|
||||
echo "Contacting licensing server ..."
|
||||
|
||||
echo ""
|
||||
$LSINSTALL_DIR/bin/lshttpd -r
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "[OK] License key received."
|
||||
$LSINSTALL_DIR/bin/lshttpd -t
|
||||
if [ $? -eq 0 ]; then
|
||||
LICENSE_OK=1
|
||||
else
|
||||
echo "The license key received does not work."
|
||||
fi
|
||||
fi
|
||||
# fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$LICENSE_OK" = "x" ]; then
|
||||
|
||||
if [ -f "$LSINSTALL_DIR/trial.key" ]; then
|
||||
$LSINSTALL_DIR/bin/lshttpd -t
|
||||
if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
cat <<EOF
|
||||
[ERROR] Sorry, installation will abort without a valid license key.
|
||||
|
||||
For evaluation purpose, please obtain a trial license key from our web
|
||||
site http://www.litespeedtech.com, copy it to this directory
|
||||
and run Installer again.
|
||||
|
||||
If a production license has been purchased, please copy the serial number
|
||||
from your confirmation email to this directory and run Installer again.
|
||||
|
||||
NOTE:
|
||||
Please remember to set ftp to BINARY mode when you ftp trial.key from
|
||||
another machine.
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
configChroot()
|
||||
{
|
||||
ENABLE_CHROOT=0
|
||||
CHROOT_PATH="/"
|
||||
if [ -f "$LSWS_HOME/conf/httpd_config.xml" ]; then
|
||||
OLD_ENABLE_CHROOT_CONF=`grep "<enableChroot>" "$LSWS_HOME/conf/httpd_config.xml"`
|
||||
OLD_CHROOT_PATH_CONF=`grep "<chrootPath>" "$LSWS_HOME/conf/httpd_config.xml"`
|
||||
OLD_ENABLE_CHROOT=`expr "$OLD_ENABLE_CHROOT_CONF" : '.*<enableChroot>\(.*\)</enableChroot>.*'`
|
||||
OLD_CHROOT_PATH=`expr "$OLD_CHROOT_PATH_CONF" : '[^<]*<chrootPath>\([^<]*\)</chrootPath>.*'`
|
||||
if [ "x$OLD_ENABLE_CHROOT" != "x" ]; then
|
||||
ENABLE_CHROOT=$OLD_ENABLE_CHROOT
|
||||
fi
|
||||
if [ "x$OLD_CHROOT_PATH" != "x" ]; then
|
||||
CHROOT_PATH=$OLD_CHROOT_PATH
|
||||
fi
|
||||
fi
|
||||
CHANGE_CHROOT=0
|
||||
if [ $INST_USER = "root" ]; then
|
||||
CHANGE_CHROOT=1
|
||||
|
||||
if [ $INSTALL_TYPE = "upgrade" ]; then
|
||||
CHANGE_CHROOT=0
|
||||
if [ $ENABLE_CHROOT -eq 1 ]; then
|
||||
cat <<EOF
|
||||
Chroot is enabled with your current setup and root directory is set to
|
||||
$CHROOT_PATH
|
||||
|
||||
EOF
|
||||
else
|
||||
echo "Chroot is disabled with your current setup."
|
||||
echo
|
||||
fi
|
||||
printf "%s" "Would you like to change chroot settings [y/N]? "
|
||||
TMP_URC='n'
|
||||
echo ""
|
||||
if [ "x$TMP_URC" != "x" ]; then
|
||||
if [ `expr "$TMP_URC" : '[Yy]'` -gt 0 ]; then
|
||||
CHANGE_CHROOT=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $CHANGE_CHROOT -eq 1 ]; then
|
||||
|
||||
cat<<EOF
|
||||
|
||||
LiteSpeed Web Server Enterprise Edition can run in chroot environment.
|
||||
It is impossible for the chrooted process and its children processes to
|
||||
access files outside the new root directory.
|
||||
|
||||
With chroot configured properly, there is no need to worry about sensitive
|
||||
data being accidentally exposed by insecure CGI programs or web server itself.
|
||||
Even when a hacker some how gain a shell access, all files he can access is
|
||||
under the chrooted directory.
|
||||
|
||||
This installation script will try to setup the initial chroot environment
|
||||
automatically.
|
||||
|
||||
However, it is not easy to setup a chroot environment and you CGI program may
|
||||
break. So we do not recommend enabling it for the first time user.
|
||||
It can be enabled later by running this installation script again.
|
||||
|
||||
EOF
|
||||
|
||||
SUCC=0
|
||||
printf "%s" "Enable chroot [y/N]: "
|
||||
TMP_YN='n'
|
||||
if [ `expr "x$TMP_YN" : 'x[Yy]'` -gt 1 ]; then
|
||||
ENABLE_CHROOT=1
|
||||
fi
|
||||
|
||||
LSWS_HOME_LEN=`expr "$LSWS_HOME" : '.*'`
|
||||
if [ $ENABLE_CHROOT -eq 1 ]; then
|
||||
while [ $SUCC -eq 0 ]; do
|
||||
cat <<EOF
|
||||
|
||||
Chroot path must be absolute path and the server root
|
||||
$LSWS_HOME
|
||||
must be included in the chroot directory tree.
|
||||
|
||||
EOF
|
||||
printf "%s" "Chroot directory without trailing '/': "
|
||||
TMP_CHROOT='n'
|
||||
if [ "x$TMP_CHROOT" != "x" ]; then
|
||||
if [ $TMP_CHROOT = '/' ]; then
|
||||
echo "Set chroot directory to '/' will disable chroot."
|
||||
printf "%s" "Are you sure? [y/N]"
|
||||
read TMP_YN
|
||||
if [ `expr "x$TMP_YN" : 'x[Yy]'` -gt 1 ]; then
|
||||
ENABLE_CHROOT=0
|
||||
SUCC=1
|
||||
fi
|
||||
else
|
||||
CHROOT_LEN=`expr "$TMP_CHROOT" : '.*'`
|
||||
MATCH_LEN=`expr "$LSWS_HOME" : "$TMP_CHROOT"`
|
||||
if [ $CHROOT_LEN -ne $MATCH_LEN ]; then
|
||||
echo "Server root is not included in the chroot directory tree"
|
||||
else
|
||||
TMP_CHROOT2="$TMP_CHROOT/"
|
||||
TMP_HOME="$LSWS_HOME/"
|
||||
MATCH_LEN=`expr "$TMP_HOME" : "$TMP_CHROOT2"`
|
||||
if [ $MATCH_LEN -le $CHROOT_LEN ]; then
|
||||
echo "Server root is not included in the chroot diretory tree"
|
||||
else
|
||||
SUCC=1
|
||||
CHROOT_PATH=$TMP_CHROOT
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
changeChroot()
|
||||
{
|
||||
util_cpfile "$SDIR_OWN" $EXEC_MOD admin/misc/chroot.sh
|
||||
|
||||
if [ $CHANGE_CHROOT -eq 1 ]; then
|
||||
|
||||
if [ $ENABLE_CHROOT -eq 1 ]; then
|
||||
$LSWS_HOME/admin/misc/chroot.sh $CHROOT_PATH
|
||||
$LSWS_HOME/admin/misc/chroot.sh $CHROOT_PATH $LSWS_HOME/bin/lshttpd
|
||||
$LSWS_HOME/admin/misc/chroot.sh $CHROOT_PATH $LSWS_HOME/admin/fcgi-bin/admin_php5
|
||||
$LSWS_HOME/admin/misc/chroot.sh $CHROOT_PATH $LSWS_HOME/bin/lscgid
|
||||
if [ -f $LSWS_HOME/fcgi-bin/php ]; then
|
||||
$LSWS_HOME/admin/misc/chroot.sh $CHROOT_PATH $LSWS_HOME/fcgi-bin/php
|
||||
fi
|
||||
$LSWS_HOME/admin/misc/chroot.sh $CHROOT_PATH $LSWS_HOME/fcgi-bin/lsphp
|
||||
if [ `expr "x$CHROOT_PATH" : '^x/[^/]'` -gt 1 ]; then
|
||||
cp $CHROOT_PATH/etc/passwd $CHROOT_PATH/etc/passwd.ls_bak
|
||||
cp $CHROOT_PATH/etc/group $CHROOT_PATH/etc/group.ls_bak
|
||||
egrep "$WS_USER|lsadm" /etc/passwd > $CHROOT_PATH/etc/passwd
|
||||
grep "$WS_GROUP" /etc/group > $CHROOT_PATH/etc/group
|
||||
fi
|
||||
fi
|
||||
cp $LSWS_HOME/conf/httpd_config.xml $LSWS_HOME/conf/httpd_config.xml.bak
|
||||
chown "$DIR_OWN" $LSWS_HOME/conf/httpd_config.xml.bak
|
||||
RES=`grep '</chrootPath>' $LSWS_HOME/conf/httpd_config.xml.bak`
|
||||
if [ $? -eq 1 ]; then
|
||||
sed -e "s#</group>#</group><chrootPath>$CHROOT_PATH</chrootPath><enableChroot>$ENABLE_CHROOT</enableChroot>#" "$LSWS_HOME/conf/httpd_config.xml.bak" > "$LSWS_HOME/conf/httpd_config.xml"
|
||||
else
|
||||
sed -e "s#<chrootPath>.*<\/chrootPath>#<chrootPath>$CHROOT_PATH<\/chrootPath>#" -e "s/<enableChroot>.*<\/enableChroot>/<enableChroot>$ENABLE_CHROOT<\/enableChroot>/" "$LSWS_HOME/conf/httpd_config.xml.bak" > "$LSWS_HOME/conf/httpd_config.xml"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
installLicense()
|
||||
{
|
||||
if [ -f ./serial.no ]; then
|
||||
cp -f ./serial.no $LSWS_HOME/conf
|
||||
chown "$SDIR_OWN" $LSWS_HOME/conf/serial.no
|
||||
chmod "$DOC_MOD" $LSWS_HOME/conf/serial.no
|
||||
fi
|
||||
|
||||
if [ -f ./license.key ]; then
|
||||
cp -f ./license.key $LSWS_HOME/conf
|
||||
chown "$SDIR_OWN" $LSWS_HOME/conf/license.key
|
||||
chmod "$CONF_MOD" $LSWS_HOME/conf/license.key
|
||||
fi
|
||||
|
||||
if [ -f ./trial.key ]; then
|
||||
cp -f ./trial.key $LSWS_HOME/conf
|
||||
chown "$SDIR_OWN" $LSWS_HOME/conf/trial.key
|
||||
chmod "$DOC_MOD" $LSWS_HOME/conf/trial.key
|
||||
fi
|
||||
}
|
||||
|
||||
portOffset()
|
||||
{
|
||||
SUCC=0
|
||||
SEL=0
|
||||
while [ $SUCC -eq "0" ]; do
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Would you like to run LiteSpeed along side with Apache on another port
|
||||
to make sure everything work properly? If yes, please set "Port Offset"
|
||||
to a non-zero value, LiteSpeed will run on Port 80 + "Port Offset",
|
||||
otherwise, set to "0" to replace Apache.
|
||||
|
||||
EOF
|
||||
printf "%s" "Port Offset [2000]? "
|
||||
TMPS=0
|
||||
echo ""
|
||||
if [ "x$TMPS" != "x" ]; then
|
||||
if [ `expr "$TMP_PORT" : '.*[^0-9]'` -gt 0 ]; then
|
||||
echo "[ERROR] Only digits is allowed, try again!"
|
||||
else
|
||||
AP_PORT_OFFSET=$TMPS
|
||||
SUCC=1
|
||||
fi
|
||||
else
|
||||
SUCC=1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
enablePHPsuExec()
|
||||
{
|
||||
SUCC=0
|
||||
SEL=0
|
||||
while [ $SUCC -eq "0" ]; do
|
||||
|
||||
cat <<EOF
|
||||
|
||||
PHP suEXEC will run php scripts of each web site as the user who own the
|
||||
document root directory,
|
||||
LiteSpeed PHP suEXEC does not have any performance penalty like other PHP
|
||||
suEXEC implementation, and .htaccess configuration overriden has been fully
|
||||
supported.
|
||||
|
||||
Note: You may need to fix some file/directory permissions if phpSuexec or
|
||||
suphp was not used with Apache.
|
||||
|
||||
Would you like to enable PHP suEXEC?
|
||||
0. No
|
||||
1. Yes
|
||||
2. Only in user's home directory (DirectAdmin should use this)
|
||||
|
||||
|
||||
EOF
|
||||
printf "%s" "Please select (0-2)? [2]"
|
||||
TMPS=1
|
||||
echo ""
|
||||
if [ "x$TMPS" != "x" ]; then
|
||||
if [ `expr "$TMPS" : '[012]'` -gt 0 ]; then
|
||||
PHP_SUEXEC=$TMPS
|
||||
SUCC=1
|
||||
else
|
||||
echo "[ERROR] Wrong selection, try again!"
|
||||
fi
|
||||
else
|
||||
SUCC=1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
hostPanelConfig()
|
||||
{
|
||||
SETUP_PHP=1
|
||||
portOffset
|
||||
enablePHPsuExec
|
||||
}
|
||||
|
||||
hostPanels()
|
||||
{
|
||||
|
||||
SUCC=0
|
||||
SEL=0
|
||||
while [ $SUCC -eq "0" ]; do
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Will you use LiteSpeed Web Server with a hosting control panel?
|
||||
|
||||
0. NONE
|
||||
1. cPanel
|
||||
2. DirectAdmin
|
||||
3. Plesk
|
||||
4. Hsphere
|
||||
5. Interworx
|
||||
6. Lxadmin
|
||||
7. ISPManager
|
||||
EOF
|
||||
|
||||
printf "%s" "Please select (0-7) [0]? "
|
||||
TMPS=0
|
||||
echo ""
|
||||
if [ "x$TMPS" != "x" ]; then
|
||||
if [ `expr "$TMPS" : '[01234567]'` -gt 0 ]; then
|
||||
SEL=$TMPS
|
||||
SUCC=1
|
||||
PANEL_VARY=""
|
||||
if [ $SEL -eq "1" ]; then
|
||||
HOST_PANEL="cpanel"
|
||||
WS_USER=nobody
|
||||
WS_GROUP=nobody
|
||||
if [ -e "/etc/cpanel/ea4/is_ea4" ] ; then
|
||||
PANEL_VARY=".ea4"
|
||||
fi
|
||||
elif [ $SEL -eq "2" ]; then
|
||||
HOST_PANEL="directadmin"
|
||||
WS_USER=apache
|
||||
WS_GROUP=apache
|
||||
elif [ $SEL -eq "3" ]; then
|
||||
HOST_PANEL="plesk"
|
||||
USER_INFO=`id apache 2>/dev/null`
|
||||
TST_USER=`expr "$USER_INFO" : 'uid=.*(\(.*\)) gid=.*'`
|
||||
if [ "x$TST_USER" = "xapache" ]; then
|
||||
WS_USER=apache
|
||||
WS_GROUP=apache
|
||||
else
|
||||
WS_USER=www-data
|
||||
WS_GROUP=www-data
|
||||
# default PID FILE, source the real one, debian and ubuntu different
|
||||
APACHE_PID_FILE=/var/run/apache2/apache2.pid
|
||||
source /etc/apache2/envvars 2>/dev/null
|
||||
if [ $? != 0 ]; then
|
||||
. /etc/apache2/envvars
|
||||
fi
|
||||
PANEL_VARY=".debian"
|
||||
fi
|
||||
ADMIN_PORT=7088
|
||||
elif [ $SEL -eq "4" ]; then
|
||||
HOST_PANEL="hsphere"
|
||||
WS_USER=httpd
|
||||
WS_GROUP=httpd
|
||||
elif [ $SEL -eq "5" ]; then
|
||||
HOST_PANEL="interworx"
|
||||
WS_USER=apache
|
||||
WS_GROUP=apache
|
||||
elif [ $SEL -eq "6" ]; then
|
||||
HOST_PANEL="lxadminh"
|
||||
WS_USER=apache
|
||||
WS_GROUP=apache
|
||||
elif [ $SEL -eq "7" ]; then
|
||||
HOST_PANEL="ispmanager"
|
||||
WS_USER=apache
|
||||
WS_GROUP=apache
|
||||
fi
|
||||
fi
|
||||
DIR_OWN=$WS_USER:$WS_GROUP
|
||||
CONF_OWN=$WS_USER:$WS_GROUP
|
||||
else
|
||||
SUCC=1
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
|
||||
LSINSTALL_DIR=`dirname "$0"`
|
||||
cd $LSINSTALL_DIR
|
||||
|
||||
init
|
||||
license
|
||||
install_dir
|
||||
test_license
|
||||
admin_login
|
||||
|
||||
|
||||
if [ $INSTALL_TYPE = "reinstall" ]; then
|
||||
|
||||
configAdminEmail
|
||||
if [ $INST_USER = "root" ]; then
|
||||
hostPanels
|
||||
fi
|
||||
if [ "x$HOST_PANEL" = "x" ]; then
|
||||
getUserGroup
|
||||
stopLshttpd
|
||||
getServerPort
|
||||
getAdminPort
|
||||
configRuby
|
||||
enablePHPHandler
|
||||
else
|
||||
hostPanelConfig
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "x$HOST_PANEL" = "x" ]; then
|
||||
configChroot
|
||||
fi
|
||||
|
||||
cat <<EOF
|
||||
|
||||
Installing, please wait...
|
||||
|
||||
EOF
|
||||
|
||||
if [ "x$HOST_PANEL" = "xdirectadmin" ]; then
|
||||
chmod g+x /var/log/httpd/
|
||||
chgrp apache /var/log/httpd/
|
||||
chown apache:apache /var/log/httpd/domains
|
||||
fi
|
||||
|
||||
if [ "x$HOST_PANEL" = "x" ]; then
|
||||
buildConfigFiles
|
||||
else
|
||||
buildApConfigFiles
|
||||
fi
|
||||
|
||||
installation
|
||||
|
||||
installLicense
|
||||
|
||||
|
||||
if [ "x$HOST_PANEL" = "x" ]; then
|
||||
changeChroot
|
||||
# setupPHPAccelerator
|
||||
installAWStats
|
||||
fi
|
||||
|
||||
|
||||
finish
|
||||
|
||||
21
serverStatus/litespeed/modsec.conf
Normal file
21
serverStatus/litespeed/modsec.conf
Normal file
@@ -0,0 +1,21 @@
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
#
|
||||
#
|
||||
# Warning: Do not edit this file directly, this file is autogenerated.
|
||||
#
|
||||
#
|
||||
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
|
||||
|
||||
<IfModule security2_module>
|
||||
SecRuleEngine off
|
||||
SecAuditEngine on
|
||||
SecDebugLogLevel 0
|
||||
SecAuditLogRelevantStatus ^(?:5|4(?!04))
|
||||
SecAuditLogParts ABIJDEFHZ
|
||||
SecAuditLogType Serial
|
||||
SecAuditLog /usr/local/lsws/logs/auditmodsec.log
|
||||
SecDataDir /usr/local/lsws/modsec
|
||||
Include /usr/local/lsws/conf/comodo_litespeed/*.conf
|
||||
Include /usr/local/lsws/conf/rules.conf
|
||||
</IfModule>
|
||||
|
||||
369
serverStatus/serverStatusUtil.py
Normal file
369
serverStatus/serverStatusUtil.py
Normal file
@@ -0,0 +1,369 @@
|
||||
#!/usr/local/CyberCP/bin/python2
|
||||
import os,sys
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
import django
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
django.setup()
|
||||
import subprocess
|
||||
import shlex
|
||||
import argparse
|
||||
import shutil
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from websiteFunctions.models import Websites
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
from plogical.sslUtilities import sslUtilities
|
||||
from plogical.vhost import vhost
|
||||
from shutil import copytree, ignore_patterns
|
||||
|
||||
|
||||
class ServerStatusUtil:
|
||||
lswsInstallStatusPath = '/home/cyberpanel/switchLSWSStatus'
|
||||
serverRootPath = '/usr/local/lsws/'
|
||||
|
||||
@staticmethod
|
||||
def executioner(command, statusFile):
|
||||
try:
|
||||
res = subprocess.call(shlex.split(command), stdout=statusFile, stderr=statusFile)
|
||||
if res == 1:
|
||||
return 0
|
||||
else:
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def installLiteSpeed(licenseKey, statusFile):
|
||||
try:
|
||||
|
||||
cwd = os.getcwd()
|
||||
try:
|
||||
|
||||
command = 'groupadd nobody'
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
command = 'usermod -a -G nobody nobody'
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
except:
|
||||
pass
|
||||
try:
|
||||
command = 'systemctl stop lsws'
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
except:
|
||||
pass
|
||||
|
||||
command = 'wget https://www.litespeedtech.com/packages/5.0/lsws-5.3.8-ent-x86_64-linux.tar.gz'
|
||||
if ServerStatusUtil.executioner(command, statusFile) == 0:
|
||||
return 0
|
||||
|
||||
if os.path.exists('/usr/local/CyberCP/lsws-5.3.8/'):
|
||||
shutil.rmtree('/usr/local/CyberCP/lsws-5.3.8')
|
||||
|
||||
|
||||
command = 'tar zxf lsws-5.3.8-ent-x86_64-linux.tar.gz -C /usr/local/CyberCP'
|
||||
if ServerStatusUtil.executioner(command, statusFile) == 0:
|
||||
return 0
|
||||
|
||||
if licenseKey == 'trial':
|
||||
command = 'wget -q --output-document=/usr/local/CyberCP/lsws-5.3.8/trial.key http://license.litespeedtech.com/reseller/trial.key'
|
||||
if ServerStatusUtil.executioner(command, statusFile) == 0:
|
||||
return 0
|
||||
else:
|
||||
writeSerial = open('/usr/local/CyberCP/lsws-5.3.8/serial.no', 'w')
|
||||
writeSerial.writelines(licenseKey)
|
||||
writeSerial.close()
|
||||
|
||||
shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/install.sh', '/usr/local/CyberCP/lsws-5.3.8/')
|
||||
shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/functions.sh', '/usr/local/CyberCP/lsws-5.3.8/')
|
||||
|
||||
os.chdir('/usr/local/CyberCP/lsws-5.3.8/')
|
||||
|
||||
command = 'chmod +x install.sh'
|
||||
if ServerStatusUtil.executioner(command, statusFile) == 0:
|
||||
return 0
|
||||
|
||||
command = 'chmod +x functions.sh'
|
||||
if ServerStatusUtil.executioner(command, statusFile) == 0:
|
||||
return 0
|
||||
|
||||
command = './install.sh'
|
||||
if ServerStatusUtil.executioner(command, statusFile) == 0:
|
||||
return 0
|
||||
|
||||
os.chdir(cwd)
|
||||
confPath = '/usr/local/lsws/conf/'
|
||||
shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/httpd_config.xml', confPath)
|
||||
shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/modsec.conf', confPath)
|
||||
shutil.copy('/usr/local/CyberCP/serverStatus/litespeed/httpd.conf', confPath)
|
||||
|
||||
try:
|
||||
command = 'chown -R lsadm:lsadm ' + confPath
|
||||
subprocess.call(shlex.split(command))
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
os.rmdir("/usr/local/CyberCP/lsws-5.3.8")
|
||||
except:
|
||||
pass
|
||||
|
||||
|
||||
files = ['/usr/local/lsws/conf/httpd_config.xml', '/usr/local/lsws/conf/modsec.conf', '/usr/local/lsws/conf/httpd.conf']
|
||||
for items in files:
|
||||
command = 'chmod 644 %s' % (items)
|
||||
ServerStatusUtil.executioner(command, statusFile)
|
||||
|
||||
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def setupFileManager(statusFile):
|
||||
try:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, "Setting up Filemanager files..\n")
|
||||
|
||||
fileManagerPath = ServerStatusUtil.serverRootPath+"FileManager"
|
||||
if os.path.exists(fileManagerPath):
|
||||
shutil.rmtree(fileManagerPath)
|
||||
shutil.copytree("/usr/local/CyberCP/serverStatus/litespeed/FileManager",fileManagerPath)
|
||||
|
||||
## remove unnecessary files
|
||||
|
||||
command = 'chmod -R 777 ' + fileManagerPath
|
||||
if ServerStatusUtil.executioner(command, statusFile) == 0:
|
||||
return 0
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,"Filemanager files are set!\n")
|
||||
|
||||
return 1
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def recover():
|
||||
FNULL = open(os.devnull, 'w')
|
||||
|
||||
if os.path.exists('/usr/local/lsws'):
|
||||
shutil.rmtree('/usr/local/lsws')
|
||||
|
||||
command = 'mv /usr/local/lswsbak /usr/local/lsws'
|
||||
ServerStatusUtil.executioner(command, FNULL)
|
||||
|
||||
command = '/usr/local/lsws/bin/openlitespeed'
|
||||
ServerStatusUtil.executioner(command, FNULL)
|
||||
|
||||
@staticmethod
|
||||
def createWebsite(website):
|
||||
try:
|
||||
virtualHostName = website.domain
|
||||
|
||||
confPath = vhost.Server_root + "/conf/vhosts/" + virtualHostName
|
||||
FNULL = open(os.devnull, 'w')
|
||||
if not os.path.exists(confPath):
|
||||
command = 'mkdir -p ' + confPath
|
||||
ServerStatusUtil.executioner(command, FNULL)
|
||||
|
||||
completePathToConfigFile = confPath + "/vhost.conf"
|
||||
|
||||
if vhost.perHostVirtualConf(completePathToConfigFile, website.adminEmail , website.externalApp, website.phpSelection,
|
||||
virtualHostName, 1) == 1:
|
||||
pass
|
||||
else:
|
||||
return 0
|
||||
|
||||
retValues = vhost.createConfigInMainVirtualHostFile(virtualHostName)
|
||||
if retValues[0] == 0:
|
||||
return 0
|
||||
|
||||
if os.path.exists('/etc/letsencrypt/live/' + virtualHostName):
|
||||
sslUtilities.installSSLForDomain(virtualHostName, website.adminEmail)
|
||||
|
||||
vhostPath = vhost.Server_root + "/conf/vhosts"
|
||||
FNULL = open(os.devnull, 'w')
|
||||
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + vhostPath
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def createDomain(website):
|
||||
try:
|
||||
virtualHostName = website.domain
|
||||
|
||||
confPath = vhost.Server_root + "/conf/vhosts/" + virtualHostName
|
||||
completePathToConfigFile = confPath + "/vhost.conf"
|
||||
|
||||
confPath = vhost.Server_root + "/conf/vhosts/" + virtualHostName
|
||||
FNULL = open(os.devnull, 'w')
|
||||
if not os.path.exists(confPath):
|
||||
command = 'mkdir -p ' + confPath
|
||||
ServerStatusUtil.executioner(command, FNULL)
|
||||
|
||||
if vhost.perHostDomainConf(website.path, website.master.domain, virtualHostName, completePathToConfigFile, website.master.adminEmail, website.phpSelection, website.master.externalApp, 1) == 1:
|
||||
pass
|
||||
else:
|
||||
return 0
|
||||
|
||||
retValues = vhost.createConfigInMainDomainHostFile(virtualHostName, website.master.domain)
|
||||
|
||||
if retValues[0] == 0:
|
||||
return 0
|
||||
|
||||
if os.path.exists('/etc/letsencrypt/live/' + virtualHostName):
|
||||
sslUtilities.installSSLForDomain(virtualHostName, website.master.adminEmail)
|
||||
|
||||
vhostPath = vhost.Server_root + "/conf/vhosts"
|
||||
FNULL = open(os.devnull, 'w')
|
||||
command = "chown -R " + "lsadm" + ":" + "lsadm" + " " + vhostPath
|
||||
cmd = shlex.split(command)
|
||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def rebuildvConf():
|
||||
try:
|
||||
allWebsites = Websites.objects.all()
|
||||
for website in allWebsites:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"Building vhost conf for: " + website.domain + ".\n", 1)
|
||||
if ServerStatusUtil.createWebsite(website) == 0:
|
||||
return 0
|
||||
|
||||
childs = website.childdomains_set.all()
|
||||
|
||||
for child in childs:
|
||||
try:
|
||||
if ServerStatusUtil.createDomain(child) == 0:
|
||||
logging.CyberCPLogFileWriter.writeToFile(
|
||||
'Error while creating child domain: ' + child.domain)
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(
|
||||
'Error while creating child domain: ' + child.domain + ' . Exact message: ' + str(
|
||||
msg))
|
||||
|
||||
aliases = website.aliasdomains_set.all()
|
||||
|
||||
for alias in aliases:
|
||||
try:
|
||||
aliasDomain = alias.aliasDomain
|
||||
alias.delete()
|
||||
virtualHostUtilities.createAlias(website.domain, aliasDomain, 0, '/home', website.adminEmail, website.admin)
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(
|
||||
'Error while creating alais domain: ' + aliasDomain + ' . Exact message: ' + str(
|
||||
msg))
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"vhost conf successfully built for: " + website.domain + ".\n", 1)
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
return 0
|
||||
|
||||
@staticmethod
|
||||
def switchTOLSWS(licenseKey):
|
||||
try:
|
||||
|
||||
os.environ['TERM'] = "xterm-256color"
|
||||
|
||||
statusFile = open(ServerStatusUtil.lswsInstallStatusPath, 'w')
|
||||
FNULL = open(os.devnull, 'w')
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,"Starting conversion process..\n")
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"Removing OpenLiteSpeed..\n", 1)
|
||||
|
||||
## Try to stop current LiteSpeed Process
|
||||
|
||||
ProcessUtilities.killLiteSpeed()
|
||||
|
||||
if os.path.exists('/usr/local/lsws'):
|
||||
|
||||
if not os.path.exists('/usr/local/lswsbak'):
|
||||
shutil.copytree('/usr/local/lsws', '/usr/local/lswsbak', symlinks=True, ignore=ignore_patterns('*.sock*'))
|
||||
|
||||
dirs = os.listdir('/usr/local/lsws')
|
||||
for dir in dirs:
|
||||
if dir.find('lsphp') > -1:
|
||||
continue
|
||||
finalDir = '/usr/local/lsws/' + dir
|
||||
try:
|
||||
shutil.rmtree(finalDir)
|
||||
except:
|
||||
pass
|
||||
|
||||
if os.path.exists('/etc/redhat-release'):
|
||||
command = 'yum remove -y openlitespeed'
|
||||
else:
|
||||
command = "apt-get -y remove openlitespeed"
|
||||
|
||||
ServerStatusUtil.executioner(command, FNULL)
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"OpenLiteSpeed removed.\n", 1)
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"Installing LiteSpeed Enterprise Web Server ..\n", 1)
|
||||
|
||||
|
||||
if ServerStatusUtil.installLiteSpeed(licenseKey, statusFile) == 0:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, "Failed to install LiteSpeed. [404]", 1)
|
||||
ServerStatusUtil.recover()
|
||||
return 0
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"LiteSpeed Enterprise Web Server installed.\n", 1)
|
||||
|
||||
|
||||
# if ServerStatusUtil.setupFileManager(statusFile) == 0:
|
||||
# logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath, "Failed to set up File Manager. [404]", 1)
|
||||
# ServerStatusUtil.recover()
|
||||
# return 0
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"Rebuilding vhost conf..\n", 1)
|
||||
|
||||
ServerStatusUtil.rebuildvConf()
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"vhost conf successfully built.\n", 1)
|
||||
|
||||
ProcessUtilities.stopLitespeed()
|
||||
ProcessUtilities.restartLitespeed()
|
||||
|
||||
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,"Successfully switched to LITESPEED ENTERPRISE WEB SERVER. [200]\n", 1)
|
||||
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.statusWriter(ServerStatusUtil.lswsInstallStatusPath,
|
||||
"%s. [404]" % (str(msg)), 1)
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg))
|
||||
ServerStatusUtil.recover()
|
||||
|
||||
def main():
|
||||
|
||||
parser = argparse.ArgumentParser(description='Server Status Util.')
|
||||
parser.add_argument('function', help='Specific a function to call!')
|
||||
parser.add_argument('--licenseKey', help='LITESPEED ENTERPRISE WEB SERVER License Key')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.function == "switchTOLSWS":
|
||||
ServerStatusUtil.switchTOLSWS(args.licenseKey)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
BIN
serverStatus/static/images/agreement.png
Normal file
BIN
serverStatus/static/images/agreement.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.1 KiB |
BIN
serverStatus/static/images/change-license.png
Normal file
BIN
serverStatus/static/images/change-license.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
serverStatus/static/images/change.png
Normal file
BIN
serverStatus/static/images/change.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
serverStatus/static/images/docker.png
Normal file
BIN
serverStatus/static/images/docker.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
BIN
serverStatus/static/images/license-status.png
Normal file
BIN
serverStatus/static/images/license-status.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
serverStatus/static/images/litespeed-logo.png
Normal file
BIN
serverStatus/static/images/litespeed-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
File diff suppressed because it is too large
Load Diff
@@ -9,18 +9,15 @@
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<div class="container">
|
||||
|
||||
|
||||
<div id="page-title">
|
||||
<h2>{% trans "CyberPanel Main Log File" %}</h2>
|
||||
<p>{% trans "This log file corresponds to errors generated by CyberPanel for your domain errors log you can look into /home/domain/logs." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-controller="readCyberCPLogFile" class="row">
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="title-hero">
|
||||
<h3 class="content-box-header">
|
||||
{% trans "Last 50 Lines" %} <img ng-hide="logFileLoading" src="{% static 'images/loading.gif' %}">
|
||||
</h3>
|
||||
<div class="col-md-12">
|
||||
@@ -28,7 +25,7 @@
|
||||
<form class="form-horizontal bordered-row">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12">
|
||||
<textarea ng-model="logsData" rows="30" class="form-control">{{ logs }}</textarea>
|
||||
<textarea ng-model="logsData" class="form-control" rows="30">{{ logs }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -37,7 +34,7 @@
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="fetchLogs()" class="btn btn-primary btn-lg btn-block">{% trans "Refresh" %}</button>
|
||||
<button type="button" ng-click="fetchLogs()" class="btn btn-primary btn-lg">{% trans "Refresh" %}</button>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
@@ -69,4 +66,4 @@
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -4,54 +4,56 @@
|
||||
{% block content %}
|
||||
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Server Status" %}</h2>
|
||||
<p>{% trans "View LiteSpeed status and log files." %}</p>
|
||||
</div>
|
||||
<div class="panel col-md-12">
|
||||
<div class="panel-body">
|
||||
<h3 class="content-box-header">
|
||||
{% trans "Available Functions" %}
|
||||
</h3>
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-md-3 btn-min-width">
|
||||
<a href="{% url 'litespeedStatus' %}" title="{% trans 'LiteSpeed Status' %}"
|
||||
class="tile-box tile-box-shortcut btn-primary">
|
||||
<div class="tile-header">
|
||||
{% trans "LiteSpeed Status" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="fa fa-heartbeat"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-3 btn-min-width">
|
||||
<a href="{% url 'cyberCPMainLogFile' %}" title="{% trans 'CyberPanel Main Log File' %}"
|
||||
class="tile-box tile-box-shortcut btn-primary">
|
||||
<div class="tile-header">
|
||||
{% trans "CyberPanel Main Log" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="fa fa-file"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Server Status" %}</h2>
|
||||
<p>{% trans "View LiteSpeed status and log files." %}</p>
|
||||
</div>
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
<h3 class="title-hero">
|
||||
{% trans "Available Functions" %}
|
||||
</h3>
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'litespeedStatus' %}" title="{% trans 'LiteSpeed Status' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<div class="tile-header">
|
||||
{% trans "LiteSpeed Status" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-md-4">
|
||||
<a href="{% url 'cyberCPMainLogFile' %}" title="{% trans 'CyberPanel Main Log File' %}" class="tile-box tile-box-shortcut btn-primary">
|
||||
<div class="tile-header">
|
||||
{% trans "CyberPanel Main Log File" %}
|
||||
</div>
|
||||
<div class="tile-content-wrapper">
|
||||
<i class="glyph-icon icon-dashboard"></i>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -3,36 +3,34 @@
|
||||
{% block title %}{% trans "LiteSpeed Status - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
|
||||
|
||||
|
||||
<div class="container">
|
||||
|
||||
{% if OLS %}
|
||||
<div class="container">
|
||||
<div id="page-title">
|
||||
<h2>{% trans "LiteSpeed Status:" %} <img src="{% static 'images/lsON.png' %}"></h2>
|
||||
<h2>{% trans "LiteSpeed Status:" %} <img src="{% static 'images/lsON.png' %}"
|
||||
style="margin-bottom: 5px;"></h2>
|
||||
<p>{% trans "On this page you can get information regarding your LiteSpeed processes." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="example-box-wrapper">
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
<div ng-controller="litespeedStatus" class="col-md-6">
|
||||
<div class="panel-body">
|
||||
{% if processList %}
|
||||
<div ng-controller="litespeedStatus" class="col-md-6" style="min-width: 350px;">
|
||||
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<div class="example-box-wrapper mr-10">
|
||||
|
||||
{% if processList %}
|
||||
|
||||
<h3 class="content-box-header bg-black">
|
||||
{% trans "LiteSpeed Processes" %}
|
||||
</h3>
|
||||
<h3 class="content-box-header">
|
||||
{% trans "LiteSpeed Processes" %}
|
||||
</h3>
|
||||
|
||||
<table class="table">
|
||||
<table class="table mb-5">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
@@ -42,7 +40,7 @@
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for items in processList %}
|
||||
<tr>
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
|
||||
<td> {{ items }}</td>
|
||||
@@ -58,83 +56,333 @@
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<div class="alert alert-danger">
|
||||
<p>{% trans "Could not fetch details, either LiteSpeed is not running or some error occurred, please see CyberPanel Main log file." %}</p>
|
||||
|
||||
<div class="mx-10">
|
||||
<button ng-click="restartLitespeed()" ng-disabled="disableReboot"
|
||||
class="btn btn-alt btn-hover btn-blue-alt mx-5 my-10">
|
||||
<span>{% trans "Reboot Litespeed" %}</span>
|
||||
<i class="glyph-icon icon-arrow-right"></i>
|
||||
</button>
|
||||
|
||||
<button ng-click="stopLitespeed()" ng-disable="disableStop"
|
||||
class="btn btn-alt btn-hover btn-danger mx-5 my-10">
|
||||
<span>{% trans "Stop LiteSpeed" %}</span>
|
||||
<i class="glyph-icon icon-arrow-right"></i>
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<button ng-click="restartLitespeed()" ng-disabled="disableReboot" class="btn btn-alt btn-hover btn-blue-alt">
|
||||
<span>{% trans "Reboot Litespeed" %}</span>
|
||||
<i class="glyph-icon icon-arrow-right"></i>
|
||||
</button>
|
||||
|
||||
<button ng-click="stopLitespeed()" ng-disable="disableStop" class="btn btn-alt btn-hover btn-danger">
|
||||
<span>{% trans "Stop LiteSpeed" %}</span>
|
||||
<i class="glyph-icon icon-arrow-right"></i>
|
||||
</button>
|
||||
|
||||
<img ng-hide="restartorStopLoading" src="{% static 'images/loading.gif' %}">
|
||||
<img ng-hide="restartorStopLoading" src="{% static 'images/loading.gif' %}">
|
||||
|
||||
|
||||
<div ng-hide="actionResult" class="alert alert-success">
|
||||
<p>{% trans "Action successful." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="actionResultBad" class="alert alert-danger">
|
||||
<p>{% trans "Error Occurred. See CyberPanel main log file." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="serverStatusCouldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<h3 class="content-box-header bg-black">
|
||||
Version: {{ lsversion }}
|
||||
</h3>
|
||||
<div class="content-box-wrapper">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ modules }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for items in loadedModules %}
|
||||
<tr>
|
||||
<td>{{ items }}</td>
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<div ng-hide="actionResult" class="alert alert-success">
|
||||
<p>{% trans "Action successful." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="actionResultBad" class="alert alert-danger">
|
||||
<p>{% trans "Error Occurred. See CyberPanel main log file." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="serverStatusCouldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="col-md-6">
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<h3 class="content-box-header">
|
||||
Version: {{ lsversion }}
|
||||
</h3>
|
||||
<div class="content-box-wrapper">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ modules }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for items in loadedModules %}
|
||||
<tr>
|
||||
<td>{{ items }}</td>
|
||||
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="panel panel-body">
|
||||
<div ng-controller="lswsSwitch" class="example-box-wrapper">
|
||||
<div class="panel-body">
|
||||
<h3 class="content-box-header">
|
||||
{% trans "Switch to LiteSpeed Enterprise Web Server" %} <img ng-hide="cyberPanelLoading"
|
||||
src="/static/images/loading.gif">
|
||||
</h3>
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<form action="/" class="form-horizontal bordered-row">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "LiteSpeed Serial No. (License Key)" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" ng-model="licenseKey"
|
||||
required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="switchTOLSWS()"
|
||||
class="btn btn-primary btn-lg">{% trans "Switch" %}</button>
|
||||
<button type="button" ng-click="switchTOLSWS()"
|
||||
class="btn btn-primary btn-lg">{% trans "Get 15 Days Trial" %}</button>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-6">
|
||||
<div class="alert alert-info">
|
||||
<p>{% trans "Note: If you select 15 days trial there is no need to enter the serial key, CyberPanel will auto fetch 15 days trial key for you. Make sure this server have not used trial already." %}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!------ LSWS Switch box ----------------->
|
||||
|
||||
<div style="margin-top: 2%" ng-hide="installBoxGen" class="col-md-12">
|
||||
|
||||
<form action="/" id="" class="form-horizontal bordered-row">
|
||||
<div class="form-group">
|
||||
<div class="col-sm-12 text-center">
|
||||
<h3><img style="width:70px"
|
||||
src="{% static 'images/litespeed-logo.png' %}"> {% trans "With great wisdom comes great responsibility." %}
|
||||
<img ng-hide="cyberPanelLoading" src="/static/images/loading.gif">
|
||||
</h3>
|
||||
</div>
|
||||
<div style="margin-top: 2%;" class="col-sm-12">
|
||||
<textarea ng-model="requestData" rows="15"
|
||||
class="form-control">{{ requestData }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<!----- LSWS Switch box ----------------->
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
|
||||
|
||||
<div ng-controller="litespeedStatus" class="container">
|
||||
|
||||
<div id="page-title">
|
||||
<h2>{% trans "LiteSpeed Status:" %} <img src="{% static 'images/lsON.png' %}"></h2>
|
||||
<p>{% trans "On this page you can get information regarding your LiteSpeed processes." %}</p>
|
||||
</div>
|
||||
{% if processList %}
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
<div class="col-md-12">
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
|
||||
<h3 class="content-box-header bg-black">
|
||||
{% trans "LiteSpeed Processes" %}
|
||||
</h3>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>{% trans "Process ID" %}</th>
|
||||
<th>{% trans "Name" %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for items in processList %}
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
|
||||
<td> {{ items }}</td>
|
||||
|
||||
{% if forloop.counter == 1 %}
|
||||
<td>{% trans "Main Process" %}</td>
|
||||
|
||||
{% elif forloop.counter == 2 %}
|
||||
<td>{% trans "lscgid Process" %}</td>
|
||||
|
||||
{% else %}
|
||||
<td>{% trans "Worker Process" %}</td>
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
<button ng-click="restartLitespeed()" ng-disabled="disableReboot"
|
||||
class="btn btn-alt btn-hover btn-blue-alt mx-5 my-10">
|
||||
<span>{% trans "Reboot Litespeed" %}</span>
|
||||
<i class="glyph-icon icon-arrow-right"></i>
|
||||
</button>
|
||||
|
||||
<button ng-click="stopLitespeed()" ng-disable="disableStop"
|
||||
class="btn btn-alt btn-hover btn-danger mx-5 my-10">
|
||||
<span>{% trans "Stop LiteSpeed" %}</span>
|
||||
<i class="glyph-icon icon-arrow-right"></i>
|
||||
</button>
|
||||
|
||||
<img ng-hide="restartorStopLoading" src="{% static 'images/loading.gif' %}">
|
||||
|
||||
|
||||
<div ng-hide="actionResult" class="alert alert-success">
|
||||
<p>{% trans "Action successful." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="actionResultBad" class="alert alert-danger">
|
||||
<p>{% trans "Error Occurred. See CyberPanel main log file." %}</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div ng-hide="serverStatusCouldNotConnect" class="alert alert-danger">
|
||||
<p>{% trans "Could not connect to server." %}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
|
||||
<div class="example-box-wrapper">
|
||||
<div class="panel panel-body">
|
||||
<h3 class="content-box-header">
|
||||
{% trans "License Manager" %} <img ng-hide="cpLoading" src="/static/images/loading.gif">
|
||||
</h3>
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<div class="row mt-5 mx-10">
|
||||
|
||||
<div class="col-md-6 panel-body">
|
||||
<a ng-click="licenseStatus(1)" href="" title="{% trans 'License Status' %}">
|
||||
<img src="{% static 'images/license-status.png' %}" width="65" class="mr-10 ">
|
||||
</a>
|
||||
|
||||
<a ng-click="licenseStatus(1)" href="" title="{% trans 'License Status' %}">
|
||||
<span class="h4">{% trans 'License Status' %}</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 panel-body">
|
||||
<a ng-click="showSerialBox()" href="" title="{% trans 'Change License' %}">
|
||||
<img src="{% static 'images/change-license.png' %}" width="65" class="mr-10">
|
||||
</a>
|
||||
|
||||
<a ng-click="showSerialBox()" href="" title="{% trans 'Change License' %}">
|
||||
<span class="h4">{% trans 'Change License' %}</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-md-12">
|
||||
|
||||
<div ng-hide="fetchedData">
|
||||
<div class="alert alert-success">
|
||||
<div class="bg-green alert-icon">
|
||||
<i class="glyph-icon icon-check"></i>
|
||||
</div>
|
||||
<div class="alert-content">
|
||||
<h4 class="alert-title">{$ lsSerial $}</h4>
|
||||
<p>{$ lsexpiration $}</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<!---------- HTML For Changing Serial No --------------->
|
||||
|
||||
<div ng-hide="changeSerialBox" class="col-md-12">
|
||||
<form action="/" class="form-horizontal bordered-row">
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">{% trans "New key" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" ng-model="newKey" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
<button type="button" ng-click="changeLicense()"
|
||||
class="btn btn-primary btn-lg">{% trans "Change Key" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!---------- HTML For Changing Serial No --------------->
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -22,20 +22,19 @@
|
||||
<div id="page-title">
|
||||
<h2>Services <img ng-show="actionLoader" src="/static/images/loading.gif"></h2>
|
||||
|
||||
<p>Show stats for services and actions (Start, Stop, Restart)</p>
|
||||
<p>{% trans 'Show stats for services and actions (Start, Stop, Restart)' %}</p>
|
||||
</div>
|
||||
|
||||
<div >
|
||||
<div class="row">
|
||||
<div class="col-sm-6 col-md-6">
|
||||
<div class="col-sm-6 col-md-3">
|
||||
<div class="panel panel-default service-panel">
|
||||
<div class="panel-body">
|
||||
<div class="serviceImg">
|
||||
<img src="{% static 'images/litespeed.png' %}" alt="OpenLitespeed" class="img-circle">
|
||||
<img src="{% static 'images/litespeed.png' %}" alt="Litespeed Webserver" class="img-circle">
|
||||
</div>
|
||||
<div class="serviceDetails">
|
||||
<div class="serviceHeading">
|
||||
<h5><b>OpenLitespeed</b></h5>
|
||||
<h5><b>{{ serverName }}</b></h5>
|
||||
<span class="help-block" ng-bind="olsStatus">Stopped</span>
|
||||
</div>
|
||||
<div class="serviceActionBtn">
|
||||
@@ -50,7 +49,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 col-md-6">
|
||||
<div class="col-sm-6 col-md-3">
|
||||
<div class="panel panel-default service-panel">
|
||||
<div class="panel-body">
|
||||
<div class="serviceImg">
|
||||
@@ -74,10 +73,8 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm-6 col-md-6">
|
||||
<div class="col-sm-6 col-md-3">
|
||||
<div class="panel panel-default service-panel">
|
||||
<div class="panel-body">
|
||||
<div class="serviceImg">
|
||||
@@ -100,7 +97,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 col-md-6">
|
||||
<div class="col-sm-6 col-md-3">
|
||||
<div class="panel panel-default service-panel">
|
||||
<div class="panel-body">
|
||||
<div class="serviceImg">
|
||||
@@ -123,7 +120,29 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% if isDocker %}
|
||||
<div class="col-sm-6 col-md-3">
|
||||
<div class="panel panel-default service-panel">
|
||||
<div class="panel-body">
|
||||
<div class="serviceImg">
|
||||
<img src="{% static 'images/docker.png' %}" alt="Docker" class="img-circle">
|
||||
</div>
|
||||
<div class="serviceDetails">
|
||||
<div class="serviceHeading">
|
||||
<h5><b>Docker</b></h5>
|
||||
<span class="help-block" ng-bind="dockerStatus">Stopped</span>
|
||||
</div>
|
||||
<div class="serviceActionBtn">
|
||||
<button type="button" class="btn btn-success" ng-disabled="btnDisable" ng-show="dockerStart" ng-click="serviceAction('docker','start')" data-toggle="tooltip" title="Start!"><i class="glyph-icon icon-play" aria-hidden="true"></i></button>
|
||||
<button type="button" class="btn btn-warning" ng-disabled="btnDisable" ng-show="dockerStop" ng-click="serviceAction('docker','stop')" data-toggle="tooltip" title="Stop!"><i class="glyph-icon icon-pause" aria-hidden="true"></i></button>
|
||||
<button type="button" class="btn btn-default" ng-disabled="btnDisable" ng-click="serviceAction('docker','restart')" data-toggle="tooltip" title="Restart!"><i class="glyph-icon icon-refresh" aria-hidden="true"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label"></label>
|
||||
<div class="col-sm-4">
|
||||
|
||||
227
serverStatus/templates/serverStatus/topProcesses.html
Normal file
227
serverStatus/templates/serverStatus/topProcesses.html
Normal file
@@ -0,0 +1,227 @@
|
||||
{% extends "baseTemplate/index.html" %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Top Processes - CyberPanel" %}{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
{% load static %}
|
||||
{% get_current_language as LANGUAGE_CODE %}
|
||||
<!-- Current language: {{ LANGUAGE_CODE }} -->
|
||||
|
||||
|
||||
<div ng-controller="topProcesses" class="container">
|
||||
|
||||
<div id="page-title">
|
||||
<h2>{% trans "Top Processes" %} <img height="20px" ng-hide="cyberPanelLoading"
|
||||
src="/static/images/loading.gif"></h2>
|
||||
<p>{% trans "List of top processes on your server. (Refresh every 3 seconds)" %}</p>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="example-box-wrapper">
|
||||
|
||||
<div class="content-box-wrapper">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr >
|
||||
<th>{% trans 'Cores' %}</th>
|
||||
<th>{% trans 'Model Name' %}</th>
|
||||
<th>{% trans 'CPU Mhz' %}</th>
|
||||
<th>{% trans 'Cache Size' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{$ cores $}</td>
|
||||
<td>{$ modelName $}</td>
|
||||
<td>{$ cpuMHZ $}</td>
|
||||
<td>{$ cacheSize $}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="example-box-wrapper">
|
||||
<div class="content-box-wrapper">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th >{% trans 'Processes' %}</th>
|
||||
<th >{% trans 'Running' %}</th>
|
||||
<th >{% trans 'Sleeping' %}</th>
|
||||
<th >{% trans 'Stopped' %}</th>
|
||||
<th >{% trans 'Zombie' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{$ totalProcesses $}</td>
|
||||
<td>{$ runningProcesses $}</td>
|
||||
<td>{$ sleepingProcesses $}</td>
|
||||
<td>{$ stoppedProcesses $}</td>
|
||||
<td>{$ zombieProcesses $}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="example-box-wrapper">
|
||||
<div class="content-box-wrapper">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans 'CPU Load' %}</th>
|
||||
<th>{% trans '1 Min' %}</th>
|
||||
<th>{% trans '5 Min' %}</th>
|
||||
<th>{% trans '15 Min' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{$ cpuNow $}</td>
|
||||
<td>{$ cpuOne $}</td>
|
||||
<td>{$ cpuFive $}</td>
|
||||
<td>{$ cpuFifteen $}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="example-box-wrapper">
|
||||
<div class="content-box-wrapper">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans 'I/O Wait' %}</th>
|
||||
<th>{% trans 'Idle Time' %}</th>
|
||||
<th>{% trans 'HW Interrupts' %}</th>
|
||||
<th>{% trans 'Softirqs' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{$ ioWait $}</td>
|
||||
<td>{$ idleTime $}</td>
|
||||
<td>{$ hwInterrupts $}</td>
|
||||
<td>{$ Softirqs $}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="example-box-wrapper">
|
||||
<div class="content-box-wrapper">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans 'Memory' %}</th>
|
||||
<th>{% trans 'Free' %}</th>
|
||||
<th>{% trans 'Used' %}</th>
|
||||
<th>{% trans 'buff/cache' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{$ totalMemory $}</td>
|
||||
<td>{$ freeMemory $}</td>
|
||||
<td>{$ usedMemory $}</td>
|
||||
<td>{$ buffCache $}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="example-box-wrapper">
|
||||
<div class="content-box-wrapper">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans 'SWAP' %}</th>
|
||||
<th>{% trans 'Free' %}</th>
|
||||
<th>{% trans 'Used' %}</th>
|
||||
<th>{% trans 'buff/cache' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{$ swapTotalMemory $}</td>
|
||||
<td>{$ swapFreeMemory $}</td>
|
||||
<td>{$ swapUsedMemory $}</td>
|
||||
<td>{$ swapBuffCache $}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12 mt-30">
|
||||
<div class="example-box-wrapper">
|
||||
<h3 style="" class="content-box-header bg-blue mx-10">
|
||||
{% trans 'Top Processes' %}
|
||||
</h3>
|
||||
<div class="content-box-wrapper content">
|
||||
<div style="margin-top: 2%; margin-bottom: 2%" class="row">
|
||||
<div class="col-sm-8">
|
||||
<input placeholder="Search..." ng-model="search" name="dom" type="text"
|
||||
class="form-control mx-10" ng-model="domainNameCreate" required>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans 'PID' %}</th>
|
||||
<th>{% trans 'User' %}</th>
|
||||
<th>{% trans 'VIRT' %}</th>
|
||||
<th>{% trans 'RES' %}</th>
|
||||
<th>{% trans 'State' %}</th>
|
||||
<th>{% trans '%CPU' %}</th>
|
||||
<th>{% trans '%MEM' %}</th>
|
||||
<th>{% trans 'Time' %}</th>
|
||||
<th>{% trans 'Command' %}</th>
|
||||
<th>{% trans 'Actions' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="process in processes | filter:search">
|
||||
<td ng-bind="process.PID"></td>
|
||||
<td ng-bind="process.User"></td>
|
||||
<td ng-bind="process.VIRT"></td>
|
||||
<td ng-bind="process.RES"></td>
|
||||
<td ng-bind="process.S"></td>
|
||||
<td ng-bind="process.CPU"></td>
|
||||
<td ng-bind="process.MEM"></td>
|
||||
<td ng-bind="process.Time"></td>
|
||||
<td ng-bind="process.Command"></td>
|
||||
<td>
|
||||
<button ng-click="killProcess(process.PID)" class="btn btn-sm btn-danger">KILL</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
@@ -3,13 +3,20 @@ import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.serverStatusHome, name='serverStatusHome'),
|
||||
url(r'^litespeedStatus', views.litespeedStatus, name='litespeedStatus'),
|
||||
url(r'^startorstopLitespeed', views.stopOrRestartLitespeed, name='startorstopLitespeed'),
|
||||
url(r'^cyberCPMainLogFile', views.cyberCPMainLogFile, name='cyberCPMainLogFile'),
|
||||
url(r'^getFurtherDataFromLogFile',views.getFurtherDataFromLogFile,name='getFurtherDataFromLogFile'),
|
||||
url(r'^litespeedStatus$', views.litespeedStatus, name='litespeedStatus'),
|
||||
url(r'^startorstopLitespeed$', views.stopOrRestartLitespeed, name='startorstopLitespeed'),
|
||||
url(r'^cyberCPMainLogFile$', views.cyberCPMainLogFile, name='cyberCPMainLogFile'),
|
||||
url(r'^getFurtherDataFromLogFile$',views.getFurtherDataFromLogFile,name='getFurtherDataFromLogFile'),
|
||||
|
||||
url(r'^servicesStatus', views.servicesStatus, name='servicesStatus'),
|
||||
url(r'^servicesAction', views.servicesAction, name='servicesAction'),
|
||||
url(r'^services', views.services, name='services'),
|
||||
url(r'^servicesStatus$', views.servicesStatus, name='servicesStatus'),
|
||||
url(r'^servicesAction$', views.servicesAction, name='servicesAction'),
|
||||
url(r'^services$', views.services, name='services'),
|
||||
url(r'^switchTOLSWS$', views.switchTOLSWS, name='switchTOLSWS'),
|
||||
url(r'^switchTOLSWSStatus$', views.switchTOLSWSStatus, name='switchTOLSWSStatus'),
|
||||
url(r'^licenseStatus$', views.licenseStatus, name='licenseStatus'),
|
||||
url(r'^changeLicense$', views.changeLicense, name='changeLicense'),
|
||||
url(r'^topProcesses$', views.topProcesses, name='topProcesses'),
|
||||
url(r'^topProcessesStatus$', views.topProcessesStatus, name='topProcessesStatus'),
|
||||
url(r'^killProcess$', views.killProcess, name='killProcess'),
|
||||
|
||||
]
|
||||
@@ -1,49 +1,52 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.shortcuts import render,redirect
|
||||
from django.shortcuts import render, redirect
|
||||
from django.http import HttpResponse
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
import plogical.CyberCPLogFileWriter as logging
|
||||
from loginSystem.views import loadLoginPage
|
||||
import json
|
||||
import subprocess
|
||||
from loginSystem.models import Administrator
|
||||
import psutil
|
||||
import shlex
|
||||
import socket
|
||||
# Create your views here.
|
||||
from plogical.acl import ACLManager
|
||||
import os
|
||||
from plogical.virtualHostUtilities import virtualHostUtilities
|
||||
import time
|
||||
import serverStatusUtil
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from plogical.httpProc import httpProc
|
||||
from plogical.installUtilities import installUtilities
|
||||
|
||||
|
||||
# Create your views here.
|
||||
|
||||
def serverStatusHome(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
|
||||
|
||||
return render(request,'serverStatus/index.html')
|
||||
return render(request, 'serverStatus/index.html')
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
def litespeedStatus(request):
|
||||
|
||||
def litespeedStatus(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
processList = ProcessUtilities.getLitespeedProcessNumber()
|
||||
|
||||
OLS = 0
|
||||
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
||||
OLS = 1
|
||||
try:
|
||||
|
||||
versionInformation = subprocess.check_output(["/usr/local/lsws/bin/lshttpd", "-v"]).split("\n")
|
||||
versionInformation = ProcessUtilities.outputExecutioner(["/usr/local/lsws/bin/lshttpd", "-v"]).split("\n")
|
||||
lsversion = versionInformation[0]
|
||||
modules = versionInformation[1]
|
||||
|
||||
@@ -57,49 +60,50 @@ def litespeedStatus(request):
|
||||
else:
|
||||
loadedModules.append(items)
|
||||
|
||||
except subprocess.CalledProcessError,msg:
|
||||
except BaseException, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
|
||||
return render(request,"serverStatus/litespeedStatus.html",{"processList":processList,"liteSpeedVersionStatus":"For some reaons not able to load version details, see CyberCP main log file."})
|
||||
|
||||
|
||||
if(processList!=0):
|
||||
return render(request, "serverStatus/litespeedStatus.html", {"processList": processList,
|
||||
"liteSpeedVersionStatus": "For some reaons not able to load version details, see CyberCP main log file.",
|
||||
'OLS': OLS})
|
||||
if (processList != 0):
|
||||
dataForHtml = {"processList": processList, "lsversion": lsversion, "modules": modules,
|
||||
"loadedModules": loadedModules}
|
||||
return render(request,"serverStatus/litespeedStatus.html",dataForHtml)
|
||||
"loadedModules": loadedModules, 'OLS': OLS}
|
||||
return render(request, "serverStatus/litespeedStatus.html", dataForHtml)
|
||||
else:
|
||||
dataForHtml = {"lsversion": lsversion, "modules": modules,
|
||||
"loadedModules": loadedModules}
|
||||
return render(request, "serverStatus/litespeedStatus.html",dataForHtml)
|
||||
"loadedModules": loadedModules, 'OLS': OLS}
|
||||
return render(request, "serverStatus/litespeedStatus.html", dataForHtml)
|
||||
|
||||
except KeyError,msg:
|
||||
except KeyError, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
|
||||
def stopOrRestartLitespeed(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('reboot', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
reboot = data['reboot']
|
||||
|
||||
if reboot==1:
|
||||
if ProcessUtilities.restartLitespeed() == 1:
|
||||
status = {"reboot":1,"shutdown":0}
|
||||
if reboot == 1:
|
||||
if installUtilities.reStartLiteSpeedSocket() == 1:
|
||||
status = {"reboot": 1, "shutdown": 0}
|
||||
else:
|
||||
status = {"reboot": 0, "shutdown": 0, "error_message":"Please see CyberCP main log file."}
|
||||
status = {"reboot": 0, "shutdown": 0, "error_message": "Please see CyberCP main log file."}
|
||||
else:
|
||||
if ProcessUtilities.stopLitespeed() == 1:
|
||||
status = {"reboot":0,"shutdown":1}
|
||||
if installUtilities.stopLiteSpeedSocket() == 1:
|
||||
status = {"reboot": 0, "shutdown": 1}
|
||||
else:
|
||||
status = {"reboot": 0, "shutdown": 0, "error_message":"Please see CyberCP main log file."}
|
||||
status = {"reboot": 0, "shutdown": 0, "error_message": "Please see CyberCP main log file."}
|
||||
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
@@ -109,45 +113,44 @@ def stopOrRestartLitespeed(request):
|
||||
return HttpResponse("Not Logged in as admin")
|
||||
|
||||
|
||||
|
||||
def cyberCPMainLogFile(request):
|
||||
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough privileges to access this page.")
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
return render(request, 'serverStatus/cybercpmainlogfile.html')
|
||||
|
||||
return render(request,'serverStatus/cybercpmainlogfile.html')
|
||||
|
||||
except KeyError,msg:
|
||||
except KeyError, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[cyberCPMainLogFile]")
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def getFurtherDataFromLogFile(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 1:
|
||||
|
||||
fewLinesOfLogFile = logging.CyberCPLogFileWriter.readLastNFiles(50,logging.CyberCPLogFileWriter.fileName)
|
||||
fewLinesOfLogFile = str(fewLinesOfLogFile)
|
||||
status = {"logstatus": 1, "logsdata": fewLinesOfLogFile}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
status = {"logstatus": 0,'error':"You don't have enough privilege to view logs."}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
return ACLManager.loadErrorJson('logstatus', 0)
|
||||
|
||||
fewLinesOfLogFile = logging.CyberCPLogFileWriter.readLastNFiles(50, logging.CyberCPLogFileWriter.fileName)
|
||||
|
||||
fewLinesOfLogFile = str(fewLinesOfLogFile)
|
||||
status = {"logstatus": 1, "logsdata": fewLinesOfLogFile}
|
||||
final_json = json.dumps(status)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except KeyError, msg:
|
||||
status = {"logstatus":0,"error":"Could not fetch data from log file, please see CyberCP main log file through command line."}
|
||||
status = {"logstatus": 0,
|
||||
"error": "Could not fetch data from log file, please see CyberCP main log file through command line."}
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[getFurtherDataFromLogFile]")
|
||||
return HttpResponse("Not Logged in as admin")
|
||||
|
||||
@@ -155,13 +158,26 @@ def getFurtherDataFromLogFile(request):
|
||||
def services(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
data = {}
|
||||
|
||||
if admin.type == 3:
|
||||
return HttpResponse("You don't have enough priviliges to access this page.")
|
||||
if ProcessUtilities.decideServer() == ProcessUtilities.OLS:
|
||||
data['serverName'] = 'OpenLiteSpeed'
|
||||
else:
|
||||
data['serverName'] = 'LiteSpeed Ent'
|
||||
|
||||
return render(request, 'serverStatus/services.html')
|
||||
dockerInstallPath = '/usr/bin/docker'
|
||||
if not os.path.exists(dockerInstallPath):
|
||||
data['isDocker'] = False
|
||||
else:
|
||||
data['isDocker'] = True
|
||||
|
||||
return render(request, 'serverStatus/services.html', data)
|
||||
except KeyError:
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
@@ -169,19 +185,19 @@ def services(request):
|
||||
def servicesStatus(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=userID)
|
||||
|
||||
if admin.type == 3:
|
||||
final = {'error': 1, "error_message": "Not enough privilege"}
|
||||
final_json = json.dumps(final)
|
||||
return HttpResponse(final_json)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('serviceAction', 0)
|
||||
|
||||
lsStatus = []
|
||||
sqlStatus = []
|
||||
dnsStatus = []
|
||||
ftpStatus = []
|
||||
mailStatus = []
|
||||
dockerStatus = []
|
||||
|
||||
processlist = subprocess.check_output(['ps', '-A'])
|
||||
|
||||
@@ -206,8 +222,10 @@ def servicesStatus(request):
|
||||
else:
|
||||
lsStatus.append(0)
|
||||
|
||||
# mysql status
|
||||
# Docker status
|
||||
dockerStatus.append(getServiceStats('docker'))
|
||||
|
||||
# mysql status
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
result = s.connect_ex(('127.0.0.1', 3306))
|
||||
|
||||
@@ -245,7 +263,8 @@ def servicesStatus(request):
|
||||
'mysql': sqlStatus[0],
|
||||
'powerdns': dnsStatus[0],
|
||||
'pureftp': ftpStatus[0],
|
||||
'postfix': mailStatus[0]},
|
||||
'postfix': mailStatus[0],
|
||||
'docker': dockerStatus[0]},
|
||||
'memUsage':
|
||||
{'litespeed': lsStatus[1],
|
||||
'mysql': sqlStatus[1],
|
||||
@@ -260,14 +279,13 @@ def servicesStatus(request):
|
||||
|
||||
def servicesAction(request):
|
||||
try:
|
||||
val = request.session['userID']
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
admin = Administrator.objects.get(pk=val)
|
||||
|
||||
if admin.type == 3:
|
||||
final = {'serviceAction': 0, "error_message": "Not enough privileges."}
|
||||
final_json = json.dumps(final)
|
||||
return HttpResponse(final_json)
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('serviceAction', 0)
|
||||
|
||||
try:
|
||||
if request.method == 'POST':
|
||||
@@ -283,29 +301,24 @@ def servicesAction(request):
|
||||
else:
|
||||
pass
|
||||
|
||||
if service not in ["lsws", "mysql", "pdns", "pure-ftpd"]:
|
||||
|
||||
if service not in ["lsws", "mysql", "pdns", "pure-ftpd", "docker"]:
|
||||
final_dic = {'serviceAction': 0, "error_message": "Invalid Service"}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
else:
|
||||
if service == 'pure-ftpd':
|
||||
if os.path.exists("/etc/lsb-release"):
|
||||
service = 'pure-ftpd-mysql'
|
||||
else:
|
||||
service = 'pure-ftpd'
|
||||
|
||||
command = 'sudo systemctl %s %s' % (action, service)
|
||||
cmd = shlex.split(command)
|
||||
res = subprocess.call(cmd)
|
||||
ProcessUtilities.executioner(command)
|
||||
final_dic = {'serviceAction': 1, "error_message": 0}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
||||
result = p.communicate()[0]
|
||||
|
||||
if res != 0:
|
||||
final_dic = {'serviceAction': 0, "error_message": "Error while performing action"}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
else:
|
||||
final_dic = {'serviceAction': 1, "error_message": 0}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
final_dic = {'serviceAction': 0, 'error_message': str(msg)}
|
||||
@@ -315,3 +328,317 @@ def servicesAction(request):
|
||||
final_dic = {'serviceAction': 0, 'error_message': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def switchTOLSWS(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('status', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
|
||||
try:
|
||||
licenseKey = data['licenseKey']
|
||||
except:
|
||||
licenseKey = 'trial'
|
||||
|
||||
execPath = "sudo /usr/local/CyberCP/bin/python " + virtualHostUtilities.cyberPanel + "/serverStatus/serverStatusUtil.py"
|
||||
execPath = execPath + " switchTOLSWS --licenseKey " + licenseKey
|
||||
|
||||
ProcessUtilities.popenExecutioner(execPath)
|
||||
time.sleep(2)
|
||||
|
||||
data_ret = {'status': 1, 'error_message': "None", }
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def switchTOLSWSStatus(request):
|
||||
try:
|
||||
|
||||
command = 'sudo cat ' + serverStatusUtil.ServerStatusUtil.lswsInstallStatusPath
|
||||
output = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
if output.find('[404]') > -1:
|
||||
command = "sudo rm -f " + serverStatusUtil.ServerStatusUtil.lswsInstallStatusPath
|
||||
ProcessUtilities.popenExecutioner(command)
|
||||
data_ret = {'status': 1, 'abort': 1, 'requestStatus': output, 'installed': 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
elif output.find('[200]') > -1:
|
||||
command = "sudo rm -f " + serverStatusUtil.ServerStatusUtil.lswsInstallStatusPath
|
||||
ProcessUtilities.popenExecutioner(command)
|
||||
data_ret = {'status': 1, 'abort': 1, 'requestStatus': output, 'installed': 1}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
else:
|
||||
data_ret = {'status': 1, 'abort': 0, 'requestStatus': output, 'installed': 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
except BaseException, msg:
|
||||
command = "sudo rm -f " + serverStatusUtil.ServerStatusUtil.lswsInstallStatusPath
|
||||
ProcessUtilities.popenExecutioner(command)
|
||||
data_ret = {'status': 0,'abort': 1, 'requestStatus': str(msg), 'installed': 0}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
def licenseStatus(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('status', 0)
|
||||
|
||||
command = 'sudo cat /usr/local/lsws/conf/serial.no'
|
||||
serial = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
command = 'sudo /usr/local/lsws/bin/lshttpd -V'
|
||||
expiration = ProcessUtilities.outputExecutioner(command)
|
||||
|
||||
final_dic = {'status': 1, "erroMessage": 0, 'lsSerial': serial, 'lsexpiration': expiration}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
final_dic = {'status': 0, 'erroMessage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except KeyError, msg:
|
||||
final_dic = {'status': 0, 'erroMessage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def changeLicense(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('status', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
newKey = data['newKey']
|
||||
|
||||
command = 'sudo chown -R cyberpanel:cyberpanel /usr/local/lsws/conf'
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
serialPath = '/usr/local/lsws/conf/serial.no'
|
||||
serialFile = open(serialPath, 'w')
|
||||
serialFile.write(newKey)
|
||||
serialFile.close()
|
||||
|
||||
command = 'sudo chown -R lsadm:lsadm /usr/local/lsws/conf'
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
command = 'sudo /usr/local/lsws/bin/lshttpd -r'
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
command = 'sudo /usr/local/lsws/bin/lswsctrl restart'
|
||||
ProcessUtilities.executioner(command)
|
||||
|
||||
final_dic = {'status': 1, "erroMessage": 'None'}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
final_dic = {'status': 0, 'erroMessage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except KeyError, msg:
|
||||
final_dic = {'status': 0, 'erroMessage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
|
||||
def topProcesses(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
templateName = "serverStatus/topProcesses.html"
|
||||
proc = httpProc(request, templateName)
|
||||
return proc.renderPre()
|
||||
|
||||
except KeyError, msg:
|
||||
logging.CyberCPLogFileWriter.writeToFile(str(msg) + "[litespeedStatus]")
|
||||
return redirect(loadLoginPage)
|
||||
|
||||
|
||||
def topProcessesStatus(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadError()
|
||||
|
||||
with open("/home/cyberpanel/top", "w") as outfile:
|
||||
subprocess.call("top -n1 -b", shell=True, stdout=outfile)
|
||||
|
||||
data = open('/home/cyberpanel/top', 'r').readlines()
|
||||
|
||||
json_data = "["
|
||||
checker = 0
|
||||
counter = 0
|
||||
|
||||
loadAVG = data[0].split(' ')
|
||||
loadAVG = filter(lambda a: a != '', loadAVG)
|
||||
|
||||
loadNow = data[2].split(' ')
|
||||
loadNow = filter(lambda a: a != '', loadNow)
|
||||
|
||||
memory = data[3].split(' ')
|
||||
memory = filter(lambda a: a != '', memory)
|
||||
|
||||
swap = data[4].split(' ')
|
||||
swap = filter(lambda a: a != '', swap)
|
||||
|
||||
processes = data[1].split(' ')
|
||||
processes = filter(lambda a: a != '', processes)
|
||||
|
||||
for items in data:
|
||||
counter = counter + 1
|
||||
if counter <= 7:
|
||||
continue
|
||||
|
||||
points = items.split(' ')
|
||||
points = filter(lambda a: a != '', points)
|
||||
|
||||
dic = {'PID': points[0], 'User': points[1], 'VIRT': points[4],
|
||||
'RES': points[5], 'S': points[7], 'CPU': points[8], 'MEM': points[9],
|
||||
'Time': points[10], 'Command': points[11]
|
||||
}
|
||||
|
||||
if checker == 0:
|
||||
json_data = json_data + json.dumps(dic)
|
||||
checker = 1
|
||||
else:
|
||||
json_data = json_data + ',' + json.dumps(dic)
|
||||
|
||||
json_data = json_data + ']'
|
||||
|
||||
data = {}
|
||||
data['status'] = 1
|
||||
data['error_message'] = 'None'
|
||||
data['data'] = json_data
|
||||
|
||||
## CPU
|
||||
data['cpuNow'] = loadNow[1]
|
||||
data['cpuOne'] = loadAVG[-3].rstrip(',')
|
||||
data['cpuFive'] = loadAVG[-2].rstrip(',')
|
||||
data['cpuFifteen'] = loadAVG[-1]
|
||||
|
||||
## CPU Time spent
|
||||
|
||||
data['ioWait'] = loadNow[9] + '%'
|
||||
data['idleTime'] = loadNow[7] + '%'
|
||||
data['hwInterrupts'] = loadNow[11] + '%'
|
||||
data['Softirqs'] = loadNow[13] + '%'
|
||||
|
||||
## Memory
|
||||
data['totalMemory'] = str(int(float(memory[3]) / 1024)) + 'MB'
|
||||
data['freeMemory'] = str(int(float(memory[5]) / 1024)) + 'MB'
|
||||
data['usedMemory'] = str(int(float(memory[7]) / 1024)) + 'MB'
|
||||
data['buffCache'] = str(int(float(memory[9]) / 1024)) + 'MB'
|
||||
|
||||
## Swap
|
||||
|
||||
data['swapTotalMemory'] = str(int(float(swap[2]) / 1024)) + 'MB'
|
||||
data['swapFreeMemory'] = str(int(float(swap[4]) / 1024)) + 'MB'
|
||||
data['swapUsedMemory'] = str(int(float(swap[6]) / 1024)) + 'MB'
|
||||
data['swapBuffCache'] = str(int(float(swap[8]) / 1024)) + 'MB'
|
||||
|
||||
## Processes
|
||||
|
||||
data['totalProcesses'] = processes[1]
|
||||
data['runningProcesses'] = processes[3]
|
||||
data['sleepingProcesses'] = processes[5]
|
||||
data['stoppedProcesses'] = processes[7]
|
||||
data['zombieProcesses'] = processes[9]
|
||||
|
||||
## CPU Details
|
||||
|
||||
command = 'sudo cat /proc/cpuinfo'
|
||||
output = ProcessUtilities.outputExecutioner(command).splitlines()
|
||||
|
||||
import psutil
|
||||
|
||||
data['cores'] = psutil.cpu_count()
|
||||
|
||||
for items in output:
|
||||
if items.find('model name') > -1:
|
||||
modelName = items.split(':')[1].strip(' ')
|
||||
index = modelName.find('CPU')
|
||||
data['modelName'] = modelName[0:index]
|
||||
elif items.find('cpu MHz') > -1:
|
||||
data['cpuMHZ'] = items.split(':')[1].strip(' ')
|
||||
elif items.find('cache size') > -1:
|
||||
data['cacheSize'] = items.split(':')[1].strip(' ')
|
||||
break
|
||||
|
||||
final_json = json.dumps(data)
|
||||
return HttpResponse(final_json)
|
||||
|
||||
except BaseException, msg:
|
||||
data_ret = {'status': 0, 'error_message': str(msg)}
|
||||
json_data = json.dumps(data_ret)
|
||||
return HttpResponse(json_data)
|
||||
|
||||
|
||||
def killProcess(request):
|
||||
try:
|
||||
userID = request.session['userID']
|
||||
|
||||
try:
|
||||
currentACL = ACLManager.loadedACL(userID)
|
||||
|
||||
if currentACL['admin'] == 1:
|
||||
pass
|
||||
else:
|
||||
return ACLManager.loadErrorJson('status', 0)
|
||||
|
||||
data = json.loads(request.body)
|
||||
pid = data['pid']
|
||||
|
||||
ProcessUtilities.executioner('sudo kill ' + pid)
|
||||
|
||||
proc = httpProc(request, None)
|
||||
return proc.ajax(1, None)
|
||||
|
||||
except BaseException, msg:
|
||||
final_dic = {'status': 0, 'erroMessage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
except KeyError, msg:
|
||||
final_dic = {'status': 0, 'erroMessage': str(msg)}
|
||||
final_json = json.dumps(final_dic)
|
||||
return HttpResponse(final_json)
|
||||
Reference in New Issue
Block a user