diff --git a/server/mods-available/monitor_core_module.inc.php b/server/mods-available/monitor_core_module.inc.php index dcdeac7128d44e41645c346c10f0d72b745b078a..c6879980e3733762e68f0e8208d0a7d991de21a5 100644 --- a/server/mods-available/monitor_core_module.inc.php +++ b/server/mods-available/monitor_core_module.inc.php @@ -921,20 +921,17 @@ class monitor_core_module { * Then test the upgrade. * if there is any output, then there is a needed update */ - $emergeData = shell_exec('emerge -puDNt --color n --nospinner --quiet world'); + $emergeData = shell_exec('glsa-check -t affected'); if ($emergeData == '') { /* There is nothing to update! */ $state = 'ok'; + $data['output'] = 'No unapplied GLSA\'s found on the system.'; } else { /* There is something to update! */ - $state = 'warning'; + $state = 'info'; + $data['output'] = shell_exec('glsa-check -pv --nocolor affected 2>/dev/null'); } - - /* - * Fetch the output - */ - $data['output'] = shell_exec('emerge -pvuDNt --color n --nospinner world'); } else { /* diff --git a/server/mods-available/remoteaction_core_module.inc.php b/server/mods-available/remoteaction_core_module.inc.php index e5e8868dac1e680d9fe00fad24d207a8541b9362..7d9bf5127218dc45a159270d74456e67ef6ce55d 100644 --- a/server/mods-available/remoteaction_core_module.inc.php +++ b/server/mods-available/remoteaction_core_module.inc.php @@ -27,7 +27,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -class remoteaction_core_module { +class remoteaction_core_module extends modules_base { var $module_name = 'remoteaction_core_module'; var $class_name = 'remoteaction_core_module'; /* No actions at this time. maybe later... */ @@ -132,9 +132,15 @@ class remoteaction_core_module { /* * Do the update */ - exec("aptitude update"); - exec("aptitude upgrade -y"); - + //TODO : change this when distribution information has been integrated into server record + if(file_exists('/etc/gentoo-release')) { + exec("glsa-check -f --nocolor affected"); + } + else { + exec("aptitude update"); + exec("aptitude upgrade -y"); + } + /* * All well done! */ diff --git a/server/plugins-available/bind_plugin.inc.php b/server/plugins-available/bind_plugin.inc.php index 7a8c6cd94fcd114ed8f9944e504fdbf1577bae80..9d67eda7705852186e8fe87fc990f1b9a43813cc 100644 --- a/server/plugins-available/bind_plugin.inc.php +++ b/server/plugins-available/bind_plugin.inc.php @@ -105,8 +105,14 @@ class bind_plugin { $records = $app->db->queryAllRecords("SELECT * FROM dns_rr WHERE zone = ".$zone['id']." AND active = 'Y'"); $tpl->setLoop('zones',$records); - - $filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.substr($zone['origin'],0,-1)); + //TODO : change this when distribution information has been integrated into server record + if (file_exists('/etc/gentoo-release')) { + $filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri/'.substr($zone['origin'],0,-1)); + } + else { + $filename = escapeshellcmd($dns_config['bind_zonefiles_dir'].'/pri.'.substr($zone['origin'],0,-1)); + } + $app->log("Writing BIND domain file: ".$filename,LOGLEVEL_DEBUG); file_put_contents($filename,$tpl->grab()); chown($filename, escapeshellcmd($dns_config['bind_user'])); @@ -124,7 +130,14 @@ class bind_plugin { //* Delete old domain file, if domain name has been changed if($data['old']['origin'] != $data['new']['origin']) { - $filename = $dns_config['bind_zonefiles_dir'].'/pri.'.substr($data['old']['origin'],0,-1); + //TODO : change this when distribution information has been integrated into server record + if (file_exists('/etc/gentoo-release')) { + $filename = $dns_config['bind_zonefiles_dir'].'/pri/'.substr($data['old']['origin'],0,-1); + } + else { + $filename = $dns_config['bind_zonefiles_dir'].'/pri.'.substr($data['old']['origin'],0,-1); + } + if(is_file($filename)) unset($filename); } @@ -144,7 +157,14 @@ class bind_plugin { $this->write_named_conf($data,$dns_config); //* Delete the domain file - $zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri.'.substr($data['old']['origin'],0,-1); + //TODO : change this when distribution information has been integrated into server record + if (file_exists('/etc/gentoo-release')) { + $zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri/'.substr($data['old']['origin'],0,-1); + } + else { + $zone_file_name = $dns_config['bind_zonefiles_dir'].'/pri.'.substr($data['old']['origin'],0,-1); + } + if(is_file($zone_file_name)) unlink($zone_file_name); $app->log("Deleting BIND domain file: ".$zone_file_name,LOGLEVEL_DEBUG); @@ -177,7 +197,14 @@ class bind_plugin { //* Delete old domain file, if domain name has been changed if($data['old']['origin'] != $data['new']['origin']) { - $filename = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.substr($data['old']['origin'],0,-1); + //TODO : change this when distribution information has been integrated into server record + if (file_exists('/etc/gentoo-release')) { + $filename = $dns_config['bind_zonefiles_dir'].'/sec/'.substr($data['old']['origin'],0,-1); + } + else { + $filename = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.substr($data['old']['origin'],0,-1); + } + if(is_file($filename)) unset($filename); } @@ -198,7 +225,14 @@ class bind_plugin { $this->write_named_conf($data,$dns_config); //* Delete the domain file - $zone_file_name = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.substr($data['old']['origin'],0,-1); + //TODO : change this when distribution information has been integrated into server record + if (file_exists('/etc/gentoo-release')) { + $zone_file_name = $dns_config['bind_zonefiles_dir'].'/sec/'.substr($data['old']['origin'],0,-1); + } + else { + $zone_file_name = $dns_config['bind_zonefiles_dir'].'/slave/sec.'.substr($data['old']['origin'],0,-1); + } + if(is_file($zone_file_name)) unlink($zone_file_name); $app->log("Deleting BIND domain file for secondary zone: ".$zone_file_name,LOGLEVEL_DEBUG); @@ -260,6 +294,17 @@ class bind_plugin { } else { $exclude_zone = ''; } + + //TODO : change this when distribution information has been integrated into server record + if (file_exists('/etc/gentoo-release')) { + $pri_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/pri/'; + $sec_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/sec/'; + + } + else { + $pri_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/pri.'; + $sec_zonefiles_path = $dns_config['bind_zonefiles_dir'].'/slave/sec.'; + } //* Loop trough zones foreach($tmps as $tmp) { @@ -274,7 +319,7 @@ class bind_plugin { if($tmp['origin'] != $exclude_zone) { $zones[] = array( 'zone' => substr($tmp['origin'],0,-1), - 'zonefile_path' => $dns_config['bind_zonefiles_dir'].'/pri.'.substr($tmp['origin'],0,-1), + 'zonefile_path' => $pri_zonefiles_path.substr($tmp['origin'],0,-1), 'options' => $options ); } @@ -299,7 +344,7 @@ class bind_plugin { $zones_sec[] = array( 'zone' => substr($tmp['origin'],0,-1), - 'zonefile_path' => $dns_config['bind_zonefiles_dir'].'/slave/sec.'.substr($tmp['origin'],0,-1), + 'zonefile_path' => $sec_zonefiles_path.substr($tmp['origin'],0,-1), 'options' => $options ); diff --git a/server/plugins-available/cron_plugin.inc.php b/server/plugins-available/cron_plugin.inc.php index 068dc35e430a06fe98a599ae0574d5fce6b5a8df..388ca651305579f6b0e74a1da4fe37145b4d2611 100644 --- a/server/plugins-available/cron_plugin.inc.php +++ b/server/plugins-available/cron_plugin.inc.php @@ -133,6 +133,14 @@ class cron_plugin { exec("setquota -T -u $username 604800 604800 -a &> /dev/null"); } + //TODO : change this when distribution information has been integrated into server record + //* Gentoo requires a user to be part of the crontab group. + if (file_exists('/etc/gentoo-release')) { + if (strpos($app->system->get_user_groups($username), 'crontab') === false) { + $app->system->add_user_to_group('crontab', $username); + } + } + // make temp directory writable for the apache and website users chmod(escapeshellcmd($parent_domain["document_root"].'/tmp'), 0777); @@ -214,6 +222,12 @@ class cron_plugin { } $cron_file = escapeshellcmd($cron_config["crontab_dir"].'/ispc_'.$this->parent_domain["system_user"]); + //TODO : change this when distribution information has been integrated into server record + //* Gentoo vixie-cron requires files to end with .cron in the cron.d directory + if (file_exists('/etc/gentoo-release')) { + $cron_file .= '.cron'; + } + if($cmd_count > 0) { file_put_contents($cron_file, $cron_content); $app->log("Wrote Cron file $cron_file with content:\n$cron_content",LOGLEVEL_DEBUG);