fix: update package list and improve privilege revocation logic

This commit is contained in:
Divarion-D
2026-04-18 17:33:21 +03:00
parent e1a88509fa
commit 3aa7ca23ce
3 changed files with 12 additions and 5 deletions
+3 -3
View File
@@ -68,7 +68,7 @@ class BalancerCommand implements CommandInterface {
$rInstallDir = BIN_PATH . 'install/';
if ($rType == 1) {
$rPackages = array('iproute2', 'net-tools', 'libcurl4', 'libxslt1-dev', 'libonig-dev', 'e2fsprogs', 'wget', 'sysstat', 'mcrypt', 'python3', 'certbot', 'iptables-persistent', 'libjpeg-dev', 'libpng-dev', 'libssh2-1', 'xz-utils', 'zip', 'unzip', 'cron');
$rPackages = array('iproute2', 'net-tools', 'libcurl4', 'libcurl3-gnutls', 'libxslt1-dev', 'libonig-dev', 'e2fsprogs', 'wget', 'sysstat', 'mcrypt', 'python3', 'certbot', 'iptables-persistent', 'libjpeg-dev', 'libpng-dev', 'libssh2-1', 'xz-utils', 'zip', 'unzip', 'cron');
$rInstallFiles = 'proxy.tar.gz';
} elseif ($rType == 2) {
$rPackages = array('cpufrequtils', 'iproute2', 'python', 'net-tools', 'dirmngr', 'gpg-agent', 'software-properties-common', 'libmaxminddb0', 'libmaxminddb-dev', 'mmdb-bin', 'libcurl4', 'libgeoip-dev', 'libxslt1-dev', 'libonig-dev', 'e2fsprogs', 'wget', 'sysstat', 'alsa-utils', 'v4l-utils', 'mcrypt', 'python3', 'certbot', 'iptables-persistent', 'libjpeg-dev', 'libpng-dev', 'libssh2-1', 'xz-utils', 'zip', 'unzip', 'cron', 'libfribidi-dev', 'libharfbuzz-dev', 'libogg0');
@@ -147,9 +147,9 @@ class BalancerCommand implements CommandInterface {
if ($rType == 1) {
if ($this->sendFileSSH($rConn, $rInstallDir . $rInstallFiles, '/tmp/' . $rInstallFiles, true)) {
echo "Extracting to directory\n";
$this->runSSH($rConn, 'sudo rm -rf ' . MAIN_HOME . 'console.php');
$this->runSSH($rConn, 'sudo rm -rf ' . MAIN_HOME . 'service');
$this->runSSH($rConn, 'sudo tar -zxvf "/tmp/' . $rInstallFiles . '" -C "' . MAIN_HOME . '"');
$rRemoteCheck = trim($this->runSSH($rConn, 'test -f ' . MAIN_HOME . 'console.php && echo OK')['output']);
$rRemoteCheck = trim($this->runSSH($rConn, 'test -f ' . MAIN_HOME . 'service && echo OK')['output']);
if ($rRemoteCheck !== 'OK') {
$db->query('UPDATE `servers` SET `status` = 4 WHERE `id` = ?;', $rServerID);
echo "Failed to extract files! Exiting\n";
+7
View File
@@ -100,6 +100,13 @@ class BackupService {
* @param array $config Database config
*/
public static function revokePrivileges($host, $db, $config) {
if ($db->query('SELECT COUNT(*) AS `count` FROM `mysql`.`db` WHERE `User` = ? AND `Host` = ? AND `Db` = ?;', $config['username'], $host, $config['database'])) {
$rGrantRow = $db->get_row();
if (empty($rGrantRow) || intval($rGrantRow['count']) === 0) {
return;
}
}
$db->query("REVOKE ALL PRIVILEGES ON `" . $config['database'] . "`.* FROM '" . $config['username'] . "'@'" . $host . "';");
}
@@ -16,9 +16,9 @@ class ProxiesController extends BaseAdminController {
public function index() {
$this->requirePermission();
ServerRepository::getAll(true);
$rServers = ServerRepository::getAll(true);
$this->setTitle('Proxy Servers');
$this->render('proxies');
$this->render('proxies', compact('rServers'));
}
}