tbrehm
2011-09-08 f5ea1b4fc06009b47d0647ca36d6bf8f1081680b
Implemented: FS#1418 - Change optionally the owner of the backup dir to the website user
- Added Limit fields for openvz in the database
- Limited several vm functions to be used by admin only.
13 files modified
1 files added
42 ■■■■ changed files
install/sql/incremental/upd_0015.sql 3 ●●●●● patch | view | raw | blame | history
install/sql/ispconfig3.sql 4 ●●● patch | view | raw | blame | history
interface/web/vm/form/openvz_vm.tform.php 2 ●●●●● patch | view | raw | blame | history
interface/web/vm/lib/module.conf.php 3 ●●●● patch | view | raw | blame | history
interface/web/vm/openvz_ip_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/vm/openvz_ip_edit.php 1 ●●●● patch | view | raw | blame | history
interface/web/vm/openvz_ip_list.php 1 ●●●● patch | view | raw | blame | history
interface/web/vm/openvz_ostemplate_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/vm/openvz_ostemplate_edit.php 1 ●●●● patch | view | raw | blame | history
interface/web/vm/openvz_ostemplate_list.php 1 ●●●● patch | view | raw | blame | history
interface/web/vm/openvz_template_del.php 1 ●●●● patch | view | raw | blame | history
interface/web/vm/openvz_template_edit.php 1 ●●●● patch | view | raw | blame | history
interface/web/vm/openvz_template_list.php 1 ●●●● patch | view | raw | blame | history
server/cron_daily.php 21 ●●●● patch | view | raw | blame | history
install/sql/incremental/upd_0015.sql
New file
@@ -0,0 +1,3 @@
ALTER TABLE  `cron` CHANGE  `command`  `command` TEXT NOT NULL;
ALTER TABLE  `client` ADD  `limit_openvz_vm` int(11) NOT NULL DEFAULT '0' AFTER  `limit_mailmailinglist` ,
ADD  `limit_openvz_vm_template_id` int(11) NOT NULL DEFAULT '0' AFTER  `limit_openvz_vm`;
install/sql/ispconfig3.sql
@@ -130,6 +130,8 @@
  `limit_traffic_quota` int(11) NOT NULL DEFAULT '-1',
  `limit_client` int(11) NOT NULL DEFAULT '0',
  `limit_mailmailinglist` int(11) NOT NULL DEFAULT '-1',
  `limit_openvz_vm` int(11) NOT NULL DEFAULT '0',
  `limit_openvz_vm_template` int(11) NOT NULL DEFAULT '0',
  `parent_client_id` int(11) unsigned NOT NULL DEFAULT '0',
  `username` varchar(64) DEFAULT NULL,
  `password` varchar(64) DEFAULT NULL,
@@ -222,7 +224,7 @@
  `server_id` int(11) unsigned NOT NULL default '0',
  `parent_domain_id` int(11) unsigned NOT NULL default '0',
  `type` enum('url','chrooted','full') NOT NULL default 'url',
  `command` varchar(255) NOT NULL,
  `command` TEXT NOT NULL,
  `run_min` varchar(100) NULL,
  `run_hour` varchar(100) NULL,
  `run_mday` varchar(100) NULL,
interface/web/vm/form/openvz_vm.tform.php
@@ -164,6 +164,7 @@
    )
);
if($_SESSION["s"]["user"]["typ"] == 'admin') {
$form["tabs"]['advanced'] = array (
    'title'     => "Advanced",
    'width'     => 100,
@@ -292,6 +293,7 @@
    ##################################
    )
);
}
?>
interface/web/vm/lib/module.conf.php
@@ -14,6 +14,7 @@
                  'link'    => 'vm/openvz_vm_list.php',
                  'html_id' => 'openvz_vm_list');
if($_SESSION["s"]["user"]["typ"] == 'admin') {
$items[] = array( 'title'     => 'OS Templates',
                  'target'     => 'content',
                  'link'    => 'vm/openvz_ostemplate_list.php',
@@ -28,7 +29,7 @@
                  'target'     => 'content',
                  'link'    => 'vm/openvz_ip_list.php',
                  'html_id' => 'openvz_ip_list');
}
if(count($items))
{
    $module['nav'][] = array(    'title'    => 'OpenVZ',
interface/web/vm/openvz_ip_del.php
@@ -44,6 +44,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('vm');
if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied');
$app->uses('tpl,tform');
$app->load('tform_actions');
interface/web/vm/openvz_ip_edit.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('vm');
if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied');
// Loading classes
$app->uses('tpl,tform');
interface/web/vm/openvz_ip_list.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('vm');
if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied');
$app->uses('listform_actions');
interface/web/vm/openvz_ostemplate_del.php
@@ -44,6 +44,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('vm');
if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied');
$app->uses('tpl,tform');
$app->load('tform_actions');
interface/web/vm/openvz_ostemplate_edit.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('vm');
if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied');
// Loading classes
$app->uses('tpl,tform');
interface/web/vm/openvz_ostemplate_list.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('vm');
if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied');
$app->uses('listform_actions');
interface/web/vm/openvz_template_del.php
@@ -44,6 +44,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('vm');
if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied');
$app->uses('tpl,tform');
$app->load('tform_actions');
interface/web/vm/openvz_template_edit.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('vm');
if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied');
// Loading classes
$app->uses('tpl,tform');
interface/web/vm/openvz_template_list.php
@@ -43,6 +43,7 @@
//* Check permissions for module
$app->auth->check_module_permissions('vm');
if($_SESSION["s"]["user"]["typ"] != 'admin') die('permission denied');
$app->uses('listform_actions');
server/cron_daily.php
@@ -501,12 +501,19 @@
                $web_group = $rec['system_group'];
                $web_id = $rec['domain_id'];
                $web_backup_dir = $backup_dir.'/web'.$web_id;
                if(!is_dir($web_backup_dir)) mkdir($web_backup_dir, 0755);
                chmod($web_backup_dir, 0755);
                chown($web_backup_dir, 'root');
                chgrp($web_backup_dir, 'root');
                if(!is_dir($web_backup_dir)) mkdir($web_backup_dir, 0750);
                chmod($web_backup_dir, 0750);
                if(isset($server_config['backup_dir_ftpread']) && $server_config['backup_dir_ftpread'] == 'y') {
                    chown($web_backup_dir, $rec['system_user']);
                    chgrp($web_backup_dir, $rec['system_group']);
                } else {
                    chown($web_backup_dir, 'root');
                    chgrp($web_backup_dir, 'root');
                }
                exec('cd '.escapeshellarg($web_path).' && sudo -u '.escapeshellarg($web_user).' find . -group '.escapeshellarg($web_group).' -print | zip -y '.escapeshellarg($web_backup_dir.'/web.zip').' -@');
                chown($web_backup_dir.'/web.zip', $rec['system_user']);
                chgrp($web_backup_dir.'/web.zip', $rec['system_group']);
                chmod($web_backup_dir.'/web.zip', 0750);
                
                // Rename or remove old backups
                $backup_copies = intval($rec['backup_copies']);
@@ -527,7 +534,9 @@
                // Create backupdir symlink
                if(is_link($web_path.'/backup')) unlink($web_path.'/backup');
                symlink($web_backup_dir,$web_path.'/backup');
                chmod($web_path.'/backup', 0755);
                // chmod($web_path.'/backup', 0755);
                chown($web_path.'/backup', $rec['system_user']);
                chgrp($web_path.'/backup', $rec['system_group']);
                
            }