* * @author Double Bastion LLC * * @license GNU AGPL version 3 or any later version * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE * License as published by the Free Software Foundation; either * version 3 of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU AFFERO GENERAL PUBLIC LICENSE for more details. * * You should have received a copy of the GNU Affero General Public * License along with this program. If not, see . * */ define('ACCESSCONST', TRUE); require('db-connect.php'); foreach (glob("version-scripts/*.php") as $scriptname) { include $scriptname; } session_start(); if ($_SESSION['loggedtorspanel'] == true) { ?> RED SCARF Suite Panel

Services Status

No"; } else { $needsrestart = " Security updates were automatically installed and THE SERVER NEEDS TO BE RESTARTED."; } $hostdomain = gethostname(); $hostip = gethostbyname($hostdomain); print_r("Host: " . $nameofhost . " • Uptime: " . $uptimefin . " • Needs restart: " . $needsrestart . "
IP:
" . $hostip . "
Check IP reputation "); ?>
", $failedservsplit); $getfailedservtert = $failedservsplit[$countlines - 3]; $getfailedlines = []; foreach ($failedservsplit as $failedkey => $failedvalue) { if (strpos($failedvalue, "●") !== false) { $getfailedlines[] = str_replace("● ", "", $failedvalue); } } $tablerows = []; foreach ($getfailedlines as $tablelines) { $valuesplit = explode(" ", $tablelines); $getdatainit = array_filter(array_map('trim', $valuesplit)); $getwords = array_values($getdatainit); $getremaininginit = array_slice($getwords, 4); $getremaining = implode(" ", $getremaininginit); $tablerows[] = "".$getwords[0]."".$getwords[1]."".$getwords[2]."".$getwords[3]."".$getremaining.""; } $finaltablehead = ""; array_unshift($tablerows, $finaltablehead); array_push($tablerows, "
UNITLOADACTIVESUBDESCRIPTION
"); $finaltablerows = implode("", $tablerows); // If there are failed processes, list them in a table if ($getfailedservtert[0] != 0){ echo "The following ".$getfailedservtert[0]." services are in failed state:".$finaltablerows." LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type."; } else echo "

There are no services in failed state !

"; ?>

ClamAV Detections by Periodic Scanning

query("SELECT id, detdir FROM detectionsdir WHERE id = 1"); $clamavdet = $detectresult->fetch_array(); $clamavreportdir = $clamavdet[1]; echo "ClamAV detections directory: " . $clamavreportdir . ""; ?>
$lnvalue) { if (strpos($lnvalue, "SCAN SUMMARY") !== false) { $gosel = false; } if (trim($lnvalue) == '') { $gosel = false; } if ($gosel) { $lnsplit = explode(":", $lnvalue); $lnsplitreminit = array_slice($lnsplit, 2); $lnsplitrem = implode(":", $lnsplitreminit); $lndircolor = $lnsplit[0] . ":" . $lnsplit[1]; $lndirsplit = explode("/", $lndircolor); $lndirlast = end($lndirsplit); reset($lndirsplit); $lndirproc = array_pop($lndirsplit); $lndirprocfin = implode("/", $lndirsplit); $lncolored = "" . $lndirprocfin . "/" . $lndirlast . " :" . $lnsplitrem; $getdetmaillnarr[$p] = $lncolored; $p++; } if (strpos($lnvalue, "---------------------------") !== false) { $gosel = true; } } $maildetlnbr = implode("

", $getdetmaillnarr); } } else { $mailfilecheck = false; } // Search for the infected files lines in the Nextcloud scan report if (is_file($nextdetectrep)) { $nextfilecheck = true; $readnextdetrep = file_get_contents($nextdetectrep); $infectedfltxt = strstr($readnextdetrep, $targetstr); $txtbreakln = explode("\n", $infectedfltxt); $nbofinfectedinit = explode("Infected files: ", $txtbreakln[0]); $nbinfctdflsnext = $nbofinfectedinit[1]; if ($nbinfctdflsnext != 0) { $getdetnextlines = file($nextdetectrep); $getdetnextlinesarr = array(); $goselnext = false; $b = 0; foreach ($getdetnextlines as $lnextkey => $lnextvalue) { if (strpos($lnextvalue, "SCAN SUMMARY") !== false) { $goselnext = false; } if (trim($lnextvalue) == '') { $goselnext = false; } if ($goselnext) { $lnextsplit = explode(":", $lnextvalue); $lnextreminit = array_slice($lnextsplit, 1); $lnextsplitrem = implode(":", $lnextreminit); $lnextdirsplit = explode("/", $lnextsplit[0]); $lnextend = end($lnextdirsplit); reset($lnextdirsplit); $lnextproc = array_pop($lnextdirsplit); $lnextprocfin = implode("/", $lnextdirsplit); $lnextcolored = "" . $lnextprocfin . "/" . $lnextend . " :" . $lnextsplitrem; $getdetnextlinesarr[$b] = $lnextcolored; $b++; } if (strpos($lnextvalue, "---------------------------") !== false) { $goselnext = true; } } $nextdetlnbr = implode("

", $getdetnextlinesarr); } } else { $nextfilecheck = false; } if ($mailfilecheck == false && $nextfilecheck == false) { $clamdetfilesmissing = "
Error! The files containing the ClamAV antivirus detections weren't found ! Please verify that the detections directory set up in 'Settings > Detections Directory' is correct and that the crontab jobs for ClamAV periodic scanning are correct.
"; } elseif ($mailfilecheck == false && $nextfilecheck == true) { $clamdetfilesmissing = "
Error! The file containing the detections made by ClamAV in the '/var/vmail' directory wasn't found ! Please verify ClamAV status and the crontab jobs for ClamAV periodic scanning.
"; } elseif ($mailfilecheck == true && $nextfilecheck == false) { $clamdetfilesmissing = "
Error! The file containing the detections made by ClamAV in the '/var/www/cloud.example.com/data' directory wasn't found ! Please verify ClamAV status and the crontab jobs for ClamAV periodic scanning.
"; } else $clamdetfilesmissing = ""; if (($maildetlnbr != "") && ($nextdetlnbr != "")) { $clamavperiodicdetect = "
ClamAV antivirus has made the following detections by periodic scanning:

  • Viruses detected in received emails directories (You should remove them manually):

  • " . $maildetlnbr . "

  • Viruses detected in Nextcloud upload directories (You should remove them manually):

  • " . $nextdetlnbr . "
"; } elseif (($maildetlnbr != "") && ($nextdetlnbr == "")) { $clamavperiodicdetect = "
ClamAV antivirus has made the following detections by periodic scanning:

  • Viruses detected in received emails directories (You should remove them manually):

  • " . $maildetlnbr . "
" . $clamdetfilesmissing; } elseif (($maildetlnbr == "") && ($nextdetlnbr != "")) { $clamavperiodicdetect = "
ClamAV antivirus has made the following detections by periodic scanning:

  • Viruses detected in Nextcloud upload directories (You should remove them manually):

  • " . $nextdetlnbr . "
" . $clamdetfilesmissing; } elseif ((($maildetlnbr == "") && ($nextdetlnbr == "")) && ($mailfilecheck == true && $nextfilecheck == true)) { $clamavperiodicdetect = "
ClamAV didn't detect any problems by periodic scanning !
"; } elseif ((($maildetlnbr == "") && ($nextdetlnbr == "")) && ($mailfilecheck == false && $nextfilecheck == false)) { $clamavperiodicdetect = $clamdetfilesmissing; } elseif ((($maildetlnbr == "") && ($nextdetlnbr == "")) && ($mailfilecheck == false && $nextfilecheck == true)) { $clamavperiodicdetect = "
Error! The file containing the detections made by ClamAV in the '/var/vmail' directory wasn't found ! Please verify ClamAV status and the crontab jobs for ClamAV periodic scanning.
"; } elseif ((($maildetlnbr == "") && ($nextdetlnbr == "")) && ($mailfilecheck == true && $nextfilecheck == false)) { $clamavperiodicdetect = "
Error! The file containing the detections made by ClamAV in the '/var/www/cloud.example.com/data' directory wasn't found ! Please verify ClamAV status and the crontab jobs for ClamAV periodic scanning.
"; } echo $clamavperiodicdetect; ?>

Storage

".$freediskgb." gibibytes from a total of ".$totaldiskgb." gibibytes."; echo $infodisk . "

" . $diskwarn; ?>

Network Usage

Total Sent: " . $totalSent . " GiB • Total Received: " . $totalReceived . " GiB
TX Dropped: " . $txDropped . " MiB • RX Dropped: " . $rxDropped . " MiB • TX Errors: " . $txErrors . " • RX Errors: " . $rxErrors . "
"); ?>

CPU Usage

" . $resultprocfourth . ""; $cpucores = exec("nproc"); $infocpu = "CPU MHz: " . $resultfin . " • CPU Cores: " . $cpucores . ""; print_r($infocpu); ?>

RAM Usage

" . $totalRam . " GiB • Total SWAP: " . $totalSwap . " GiB"); ?>
Components
query("SELECT id, orderno, component, componentrole, componentplace, imagename, versionscript, info FROM components"); $getcompname = []; while ($result_fetch = $sqlquery->fetch_row()) { $inddbid = $result_fetch[0]; $comporderno = $result_fetch[1]; $componentname = $result_fetch[2]; $componentrole = $result_fetch[3]; $componentplace = $result_fetch[4]; $indimagename = $result_fetch[5]; $versionscript = $result_fetch[6]; $popupinfo = htmlspecialchars_decode($result_fetch[7]); $getcompname[] = [$inddbid, $comporderno, $componentname, $componentrole, $componentplace, $indimagename, $versionscript, $popupinfo]; } $sqlquery->close(); $comptablerowsinit = []; for ($r = 0; $r < count($getcompname); $r++) { $compPlace = str_replace(" ","", $getcompname[$r][4]); $compRole = str_replace(" ","", $getcompname[$r][3]); if ($getcompname[$r][6] != '') { if (strpos($getcompname[$r][6], ".php") !== false) { $currentFunction = str_replace(".php", "", $getcompname[$r][6]); $compVersion = $currentFunction(); } else { $compVersion = $getcompname[$r][6]; } } else $compVersion = ''; $currentorderno = $getcompname[$r][1]; $comptablerowsinit[$currentorderno] = ''; } ksort($comptablerowsinit); $comptablerows = array_combine(range(1, count($comptablerowsinit)), array_values($comptablerowsinit)); for ($n = 1; $n <= count($comptablerows); $n++) { echo '' . $comptablerows[$n]; } ?>
No Component
'.$getcompname[$r][1].''.$getcompname[$r][2].''.$compVersion.''.$getcompname[$r][7].'
'.$n.'
ColorIndentation
blue squareKernel ComponentFirst LevelOperating system
purple squareShell ComponentSecond LevelApplications installed inside the operating system
green squareHull ComponentThird LevelApplications installed inside the preceding second level applications
Launch Application
query("SELECT orderno, nameonbutton, buttonurl, imgname FROM buttons"); $buttondata = []; while ($results = $buttonquery->fetch_row()) { $indorderno = $results[0]; $indnameonbutton = $results[1]; $indbuttonurl = $results[2]; $indimgname = $results[3]; $buttondata[] = [$indorderno, $indnameonbutton, $indbuttonurl, $indimgname]; } $buttonquery->close(); $buttontablerowsinit = []; for ($r = 0; $r < count($buttondata); $r++) { $currentbuttonno = $buttondata[$r][0]; $buttontablerowsinit[$currentbuttonno] = ''; } ksort($buttontablerowsinit); $buttontablerows = array_combine(range(1, count($buttontablerowsinit)), array_values($buttontablerowsinit)); for ($b = 1; $b <= count($buttontablerows); $b++) { echo '' . $buttontablerows[$b]; } ?>
No Application
'.$buttondata[$r][0].''.$buttondata[$r][1].'
'.$b.'