tbrehm
2009-05-21 68e9172bd430954f237472e951446bd6d1aa2ddb
Merged revisions 1199-1202
4 files modified
32 ■■■■■ changed files
interface/web/dns/dns_wizard.php 6 ●●●● patch | view | raw | blame | history
server/mods-available/monitor_core_module.inc.php 2 ●●● patch | view | raw | blame | history
server/plugins-available/apache2_plugin.inc.php 10 ●●●●● patch | view | raw | blame | history
server/plugins-available/shelluser_base_plugin.inc.php 14 ●●●●● patch | view | raw | blame | history
interface/web/dns/dns_wizard.php
@@ -41,7 +41,7 @@
$app->tpl->setInclude('content_tpl','templates/dns_wizard.htm');
// import variables
$template_id = (isset($_POST['template_id']))?intval($_POST['template_id']):1;
$template_id = (isset($_POST['template_id']))?intval($_POST['template_id']):0;
$sys_groupid = (isset($_POST['client_group_id']))?intval($_POST['client_group_id']):0;
// get the correct server_id
@@ -57,10 +57,14 @@
// Load the templates
$records = $app->db->queryAllRecords("SELECT * FROM dns_template WHERE visible = 'Y'");
$template_id_option = '';
$n = 0;
foreach($records as $rec){
    $checked = ($rec['template_id'] == $template_id)?' SELECTED':'';
    $template_id_option .= '<option value="'.$rec['template_id'].'"'.$checked.'>'.$rec['name'].'</option>';
    if($n == 0 && $template_id == 0) $template_id = $rec['template_id'];
    $n++;
}
unset($n);
$app->tpl->setVar("template_id_option",$template_id_option);
// If the user is administrator
server/mods-available/monitor_core_module.inc.php
@@ -221,7 +221,7 @@
                $usePercent = floatval($data[$i]['percent']);
                
                //* We dont want to check the cdrom drive as a cd / dvd is always 100% full
                if($data[$i]['type'] != 'iso9660' && $data[$i]['type'] != 'cramfs') {
                if($data[$i]['type'] != 'iso9660' && $data[$i]['type'] != 'cramfs' && $data[$i]['type'] != 'udf') {
                    if ($usePercent > 75) $state = $this->_setState($state, 'info');
                    if ($usePercent > 80) $state = $this->_setState($state, 'warning');
                    if ($usePercent > 90) $state = $this->_setState($state, 'critical');
server/plugins-available/apache2_plugin.inc.php
@@ -270,12 +270,18 @@
            exec('mv '.$data["old"]["document_root"].' '.$new_dir);
            $app->log("Moving site to new document root: ".'mv '.$data["old"]["document_root"].' '.$new_dir,LOGLEVEL_DEBUG);
            
            //* Change the owner of the website files to the new website owner
            exec('chown --recursive --from='.escapeshellcmd($data["old"]["system_user"]).':'.escapeshellcmd($data['old']['system_group']).' '.escapeshellcmd($data["new"]["system_user"]).':'.escapeshellcmd($data['new']['system_group']).' '.$new_dir);
            //* Change the home directory and group of the website user
            $command = 'usermod';
            $command .= ' --home '.escapeshellcmd($data["new"]["document_root"]);
            $command .= ' --gid '.escapeshellcmd($data['new']['system_group']);
            $command .= ' '.escapeshellcmd($data["new"]["system_user"]);
            exec($command);
            
        }
        
@@ -577,12 +583,14 @@
            if (!is_dir($fastcgi_starter_path))
            {
                exec("mkdir -p ".escapeshellcmd($fastcgi_starter_path));
                exec("chown ".$data["new"]["system_user"].":".$data["new"]["system_group"]." ".escapeshellcmd($fastcgi_starter_path));
                //exec("chown ".$data["new"]["system_user"].":".$data["new"]["system_group"]." ".escapeshellcmd($fastcgi_starter_path));
                
                
                $app->log("Creating fastcgi starter script directory: $fastcgi_starter_path",LOGLEVEL_DEBUG);
            }
            
            exec("chown -R ".$data["new"]["system_user"].":".$data["new"]["system_group"]." ".escapeshellcmd($fastcgi_starter_path));
            $fcgi_tpl = new tpl();
            $fcgi_tpl->newTemplate("php-fcgi-starter.master");
                
server/plugins-available/shelluser_base_plugin.inc.php
@@ -89,6 +89,11 @@
                $app->log("Executed command: ".$command,LOGLEVEL_DEBUG);
                $app->log("Added shelluser: ".$data['new']['username'],LOGLEVEL_DEBUG);
                
                //* Create .bash_history file
                exec('touch '.escapeshellcmd($data['new']['dir']).'/.bash_history');
                exec('chmod 755 '.escapeshellcmd($data['new']['dir']).'/.bash_history');
                exec('chown '.escapeshellcmd($data['new']['username']).':'.escapeshellcmd($data['new']['pgroup']).' '.escapeshellcmd($data['new']['dir']).'/.bash_history');
                //* Disable shell user temporarily if we use jailkit
                if($data['new']['chroot'] == 'jailkit') {
                    $command = 'usermod -L '.escapeshellcmd($data['new']['username']);
@@ -128,6 +133,15 @@
                    exec($command);
                    $app->log("Executed command: $command ",LOGLEVEL_DEBUG);
                    $app->log("Updated shelluser: ".$data['old']['username'],LOGLEVEL_DEBUG);
                    //* Create .bash_history file
                    if(!is_file($data['new']['dir']).'/.bash_history') {
                        exec('touch '.escapeshellcmd($data['new']['dir']).'/.bash_history');
                        exec('chmod 755 '.escapeshellcmd($data['new']['dir']).'/.bash_history');
                        exec('chown '.escapeshellcmd($data['new']['username']).':'.escapeshellcmd($data['new']['pgroup']).' '.escapeshellcmd($data['new']['dir']).'/.bash_history');
                    }
                } else {
                    // The user does not exist, so we insert it now
                    $this->insert($event_name,$data);