mirror of
https://github.com/JRGTH/xigmanas-bastille-extension.git
synced 2025-12-11 01:10:57 +01:00
Disable basic interface to comply with bastille new syntax
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
======================
|
======================
|
||||||
Version Description
|
Version Description
|
||||||
|
|
||||||
|
1.1.49......Disable basic interface to comply with bastille new syntax.
|
||||||
1.1.48......Add action to set priority value from utilities.
|
1.1.48......Add action to set priority value from utilities.
|
||||||
1.1.47......Cosmetic changes and improvements.
|
1.1.47......Cosmetic changes and improvements.
|
||||||
1.1.46......Display jail IP using bastille list buil-in command.
|
1.1.46......Display jail IP using bastille list buil-in command.
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ $pconfig['jname'] = "$container";
|
|||||||
$pconfig['hostname'] = exec("/usr/bin/grep '.*host.hostname.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'");
|
$pconfig['hostname'] = exec("/usr/bin/grep '.*host.hostname.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'");
|
||||||
$pconfig['ipv4'] = exec("/usr/bin/grep '.*ip4.addr.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'");
|
$pconfig['ipv4'] = exec("/usr/bin/grep '.*ip4.addr.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'");
|
||||||
$pconfig['ipv6'] = exec("/usr/bin/grep '.*ip6.addr.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'");
|
$pconfig['ipv6'] = exec("/usr/bin/grep '.*ip6.addr.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'");
|
||||||
$pconfig['interface'] = exec("/usr/bin/grep '.*interface.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'");
|
//$pconfig['interface'] = exec("/usr/bin/grep '.*interface.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'");
|
||||||
$pconfig['securelevel'] = exec("/usr/bin/grep '.*securelevel.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'");
|
$pconfig['securelevel'] = exec("/usr/bin/grep '.*securelevel.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'");
|
||||||
$pconfig['devfs_ruleset'] = exec("/usr/bin/grep '.*devfs_ruleset.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'");
|
$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['enforce_statfs'] = exec("/usr/bin/grep '.*enforce_statfs.*=' $jail_config | cut -d '=' -f2 | tr -d ' ;'");
|
||||||
@@ -86,11 +86,12 @@ $jail_name_def = $pconfig['jname'];
|
|||||||
$jail_hostname_def = $pconfig['hostname'];
|
$jail_hostname_def = $pconfig['hostname'];
|
||||||
$jail_ipv4_def = $pconfig['ipv4'];
|
$jail_ipv4_def = $pconfig['ipv4'];
|
||||||
$jail_ipv6_def = $pconfig['ipv6'];
|
$jail_ipv6_def = $pconfig['ipv6'];
|
||||||
$jail_interface_def = $pconfig['interface'];
|
//$jail_interface_def = $pconfig['interface'];
|
||||||
$jail_securelevel_def = $pconfig['securelevel'];
|
$jail_securelevel_def = $pconfig['securelevel'];
|
||||||
$jail_devfs_ruleset_def = $pconfig['devfs_ruleset'];
|
$jail_devfs_ruleset_def = $pconfig['devfs_ruleset'];
|
||||||
$jail_enforce_statfs_def = $pconfig['enforce_statfs'];
|
$jail_enforce_statfs_def = $pconfig['enforce_statfs'];
|
||||||
$jail_vnet_interface_def = $pconfig['vnet_interface'];
|
$jail_vnet_interface_def = $pconfig['vnet_interface'];
|
||||||
|
$jail_boot_prio_def = $pconfig['boot_prio'];
|
||||||
|
|
||||||
// Check if is a Linux jail.
|
// Check if is a Linux jail.
|
||||||
$is_linux_jail = exec("/usr/bin/grep linsysfs {$jail_dir}/{$jail_name_def}/fstab");
|
$is_linux_jail = exec("/usr/bin/grep linsysfs {$jail_dir}/{$jail_name_def}/fstab");
|
||||||
@@ -179,9 +180,9 @@ if ($_POST):
|
|||||||
if(isset($pconfig['ipv6'])):
|
if(isset($pconfig['ipv6'])):
|
||||||
$jail_ipv6 = $pconfig['ipv6'];
|
$jail_ipv6 = $pconfig['ipv6'];
|
||||||
endif;
|
endif;
|
||||||
if(isset($pconfig['interface'])):
|
//if(isset($pconfig['interface'])):
|
||||||
$jail_interface = $pconfig['interface'];
|
// $jail_interface = $pconfig['interface'];
|
||||||
endif;
|
//endif;
|
||||||
if(isset($pconfig['securelevel'])):
|
if(isset($pconfig['securelevel'])):
|
||||||
$jail_securelevel = $pconfig['securelevel'];
|
$jail_securelevel = $pconfig['securelevel'];
|
||||||
endif;
|
endif;
|
||||||
@@ -212,9 +213,9 @@ if ($_POST):
|
|||||||
if(isset($_POST['ipv6']) && ($jail_ipv6_def !== $jail_ipv6)):
|
if(isset($_POST['ipv6']) && ($jail_ipv6_def !== $jail_ipv6)):
|
||||||
$is_changed = "1";
|
$is_changed = "1";
|
||||||
endif;
|
endif;
|
||||||
if(isset($_POST['interface']) && ($jail_interface_def !== $jail_interface)):
|
//if(isset($_POST['interface']) && ($jail_interface_def !== $jail_interface)):
|
||||||
$is_changed = "1";
|
// $is_changed = "1";
|
||||||
endif;
|
//endif;
|
||||||
// Don't check "securelevel" if Linux jail.
|
// Don't check "securelevel" if Linux jail.
|
||||||
if(!$is_linux_jail):
|
if(!$is_linux_jail):
|
||||||
if($jail_securelevel_def !== $jail_securelevel):
|
if($jail_securelevel_def !== $jail_securelevel):
|
||||||
@@ -279,19 +280,19 @@ if ($_POST):
|
|||||||
endif;
|
endif;
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
if (isset($_POST['interface']) && $_POST['interface']):
|
//if (isset($_POST['interface']) && $_POST['interface']):
|
||||||
if($jail_interface_def !== $jail_interface):
|
// if($jail_interface_def !== $jail_interface):
|
||||||
if ($_POST['interface'] !== 'Config'):
|
// if ($_POST['interface'] !== 'Config'):
|
||||||
$cmd = "/usr/bin/sed -i '' 's|.*interface.*=.*;| interface = $jail_interface;|' $jail_config";
|
// $cmd = "/usr/bin/sed -i '' 's|.*interface.*=.*;| interface = $jail_interface;|' $jail_config";
|
||||||
unset($output,$retval);mwexec2($cmd,$output,$retval);
|
// unset($output,$retval);mwexec2($cmd,$output,$retval);
|
||||||
if($retval == 0):
|
// if($retval == 0):
|
||||||
//$savemsg .= gtext("Interface changed successfully.");
|
// //$savemsg .= gtext("Interface changed successfully.");
|
||||||
else:
|
// else:
|
||||||
$input_errors[] = gtext("Failed to save interface.");
|
// $input_errors[] = gtext("Failed to save interface.");
|
||||||
endif;
|
// endif;
|
||||||
endif;
|
// endif;
|
||||||
endif;
|
// endif;
|
||||||
endif;
|
//endif;
|
||||||
|
|
||||||
if (isset($_POST['vnet_interface']) && $_POST['vnet_interface']):
|
if (isset($_POST['vnet_interface']) && $_POST['vnet_interface']):
|
||||||
if($jail_vnet_interface_def !== $jail_vnet_interface):
|
if($jail_vnet_interface_def !== $jail_vnet_interface):
|
||||||
@@ -422,7 +423,6 @@ endif;
|
|||||||
$a_action = $l_interfaces;
|
$a_action = $l_interfaces;
|
||||||
html_titleline2(gtext("Jail Configuration"));
|
html_titleline2(gtext("Jail Configuration"));
|
||||||
html_inputbox("jname", gtext("Name"), $pconfig['jname'], gtext("Set the desired jail name, for example: jail_1. Warning: renaming a jail will also rename the directory/dataset."), true, 40);
|
html_inputbox("jname", gtext("Name"), $pconfig['jname'], gtext("Set the desired jail name, for example: jail_1. Warning: renaming a jail will also rename the directory/dataset."), true, 40);
|
||||||
|
|
||||||
html_inputbox("hostname", gtext("Hostname"), $pconfig['hostname'], gtext("Set the desired jail hostname, for example: jail.com, not to be confused with the jail name."), true, 40);
|
html_inputbox("hostname", gtext("Hostname"), $pconfig['hostname'], gtext("Set the desired jail hostname, for example: jail.com, not to be confused with the jail name."), true, 40);
|
||||||
if ($jail_ipv4_def):
|
if ($jail_ipv4_def):
|
||||||
html_inputbox("ipv4", gtext("IPv4"), $pconfig['ipv4'], gtext("Set the desired jail IPv4 address, for example: 192.168.1.100, or 192.168.1.100/24."), true, 40);
|
html_inputbox("ipv4", gtext("IPv4"), $pconfig['ipv4'], gtext("Set the desired jail IPv4 address, for example: 192.168.1.100, or 192.168.1.100/24."), true, 40);
|
||||||
@@ -430,9 +430,9 @@ endif;
|
|||||||
if ($jail_ipv6_def):
|
if ($jail_ipv6_def):
|
||||||
html_inputbox("ipv6", gtext("IPv6"), $pconfig['ipv6'], gtext("Set the desired jail IPv4 address, for example: 2001:cdba::3257:9652, or 2001:cdba::3257:9652/64."), true, 40);
|
html_inputbox("ipv6", gtext("IPv6"), $pconfig['ipv6'], gtext("Set the desired jail IPv4 address, for example: 2001:cdba::3257:9652, or 2001:cdba::3257:9652/64."), true, 40);
|
||||||
endif;
|
endif;
|
||||||
if (!$is_vnet):
|
//if (!$is_vnet):
|
||||||
html_combobox('interface', gtext('Interface'),$pconfig['interface'], $a_action, gtext("Set the network interface available from the dropdown menu, usually should not be changed unless replacing/renaming interface or moving jail from host."), true, false, 'action_change()');
|
// html_combobox('interface', gtext('Interface'),$pconfig['interface'], $a_action, gtext("Set the network interface available from the dropdown menu, usually should not be changed unless replacing/renaming interface or moving jail from host."), true, false, 'action_change()');
|
||||||
endif;
|
//endif;
|
||||||
if(!$is_linux_jail):
|
if(!$is_linux_jail):
|
||||||
html_inputbox("securelevel", gtext("securelevel"), $pconfig['securelevel'], gtext("The value of the jail's kern.securelevel. A jail never has a lower securelevel than its parent system, but by setting this parameter it may have a higher one, default is 2."), false, 20);
|
html_inputbox("securelevel", gtext("securelevel"), $pconfig['securelevel'], gtext("The value of the jail's kern.securelevel. A jail never has a lower securelevel than its parent system, but by setting this parameter it may have a higher one, default is 2."), false, 20);
|
||||||
endif;
|
endif;
|
||||||
|
|||||||
Reference in New Issue
Block a user