From 71ca5390d2defd7cae7d14cfdf7840bc926f0c3f Mon Sep 17 00:00:00 2001 From: JRGTH Date: Fri, 5 Sep 2025 21:52:05 -0400 Subject: [PATCH] Cosmetic changes and improvements --- CHANGELOG | 1 + gui/bastille_manager-lib.inc | 24 ++++++++++++++++++++---- gui/bastille_manager_jconf.php | 20 +++++++++++++++++++- version | 2 +- 4 files changed, 41 insertions(+), 6 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 645ead8..fbe65b0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ ====================== Version Description +1.1.47......Cosmetic changes and improvements. 1.1.46......Display jail IP using bastille list buil-in command. 1.1.45......Code update for recent bastille boot settings changes. 1.1.44......Fix bastille version display under maintenance tab. diff --git a/gui/bastille_manager-lib.inc b/gui/bastille_manager-lib.inc index 20dfdca..256102d 100644 --- a/gui/bastille_manager-lib.inc +++ b/gui/bastille_manager-lib.inc @@ -243,11 +243,27 @@ function get_jail_infos() { elseif (!$r['rel']): $r['rel'] = "-"; endif; - // Display interfaces. - $r['nic'] = exec("/usr/bin/grep -wE 'interface.*=.*;|vnet.interface.*=.*;' {$jail_dir}/{$item}/jail.conf | /usr/bin/awk '{print $3}' | /usr/bin/tr -d ';'"); - if (!$r['nic']): - $r['nic'] = "-"; + + // Display interface name for VNET jails. + if (exec("/usr/bin/grep -w '.*vnet.interface.*=.*;' {$jail_dir}/{$item}/jail.conf")): + $r['nic'] = exec("/usr/bin/grep -w '.*vnet.interface.*=.*;' {$jail_dir}/{$item}/jail.conf | /usr/bin/awk '{print $3}' | /usr/bin/tr -d ';'"); + if (!$r['nic']): + $r['nic'] = "-"; + endif; + // Display interface name from the previous jail.conf syntax for simple shared IP jails. + elseif (exec("/usr/bin/grep -w '.*interface.*=.*;' {$jail_dir}/{$item}/jail.conf")): + $r['nic'] = exec("/usr/bin/grep -w '.*interface.*=.*;' {$jail_dir}/{$item}/jail.conf | /usr/bin/awk '{print $3}' | /usr/bin/tr -d ';'"); + if (!$r['nic']): + $r['nic'] = "-"; + endif; + // Display interface name from the new jail.conf syntax for simple shared IP jails. + elseif (exec("/usr/bin/grep -w '.*ip4.addr.*=.*|.*' {$jail_dir}/{$item}/jail.conf")): + $r['nic'] = exec("/usr/bin/grep -w '.*ip4.addr.*=.*|.*' {$jail_dir}/{$item}/jail.conf | cut -d'|' -f1 | awk '{print $3}'"); + if (!$r['nic']): + $r['nic'] = "-"; + endif; endif; + // Display path. $r['path'] = exec("/usr/bin/grep -w 'path' {$jail_dir}/{$item}/jail.conf | /usr/bin/awk '{print $3}' | /usr/bin/tr -d ';'"); if (!$r['path']): diff --git a/gui/bastille_manager_jconf.php b/gui/bastille_manager_jconf.php index 52c425f..d3f66d1 100644 --- a/gui/bastille_manager_jconf.php +++ b/gui/bastille_manager_jconf.php @@ -79,6 +79,7 @@ $pconfig['securelevel'] = exec("/usr/bin/grep '.*securelevel.*=' $jail_config | $pconfig['devfs_ruleset'] = exec("/usr/bin/grep '.*devfs_ruleset.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'"); $pconfig['enforce_statfs'] = exec("/usr/bin/grep '.*enforce_statfs.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'"); $pconfig['vnet_interface'] = exec("/usr/bin/grep '.*vnet.interface.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'"); +$pconfig['boot_prio'] = exec("/usr/local/bin/bastille config {$item} get priority"); // Set the jail config default parameters. $jail_name_def = $pconfig['jname']; @@ -193,6 +194,9 @@ if ($_POST): if(isset($pconfig['vnet_interface'])): $jail_vnet_interface = $pconfig['vnet_interface']; endif; + if(isset($pconfig['boot_prio'])): + $jail_boot_prio = $pconfig['boot_prio']; + endif; // Check if the config has changed for each parameter. // This could be done with a nice foreach loop in the future. @@ -235,6 +239,7 @@ if ($_POST): // Skip jail running check. $retval = "1"; endif; + if($retval == 0): $input_errors[] = gtext("This jail is running, please stop it before making jail.conf changes."); else: @@ -368,6 +373,18 @@ if ($_POST): endif; endif; + if (isset($_POST['boot_prio']) || $_POST['boot_prio']): + if($jail_boot_prio_def !== $jail_boot_prio): + $cmd = "/usr/local/bin/bastille config {$item} set priority $jail_boot_prio"; + unset($output,$retval);mwexec2($cmd,$output,$retval); + if($retval == 0): + //$savemsg .= gtext("Priority changed successfully."); + else: + $input_errors[] = gtext("Failed to save priority ."); + endif; + endif; + endif; + if (isset($_POST['jname']) && $_POST['jname']): if($jail_name_def !== $jail_name): $cmd = "/usr/local/bin/bastille rename $jail_name_def $jail_name"; @@ -424,13 +441,14 @@ endif; html_inputbox("enforce_statfs", gtext("enforce_statfs"), $pconfig['enforce_statfs'], gtext("This determines what information processes in a jail are able to get about mount points. Affects the behaviour of the following syscalls: statfs, fstatfs, getfsstat and fhstatfs, default is 2."), false, 20); //endif; if ($is_vnet): - html_inputbox("vnet_interface", gtext("VNET Interface"), $pconfig['vnet_interface'], gtext("Set the VNET interface manually, usually should not be changed unless renaming the interface or moving jail from host."), false, 20); + html_inputbox("vnet_interface", gtext("VNET Interface"), $pconfig['vnet_interface'], gtext("Set the VNET interface manually, usually should not be changed unless renaming the interface or moving jail from host, Note: manual edit of the jail rc.conf file may be required."), false, 20); endif; ?> diff --git a/version b/version index b1468fd..d388d61 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.1.46 +1.1.47