Add initial support for IPv6 and VNET

This commit is contained in:
Jose
2020-02-26 16:43:57 -04:00
parent 55d7978cce
commit 0176f72a1f
8 changed files with 27 additions and 13 deletions
+1
View File
@@ -3,6 +3,7 @@
====================== ======================
Version Description Version Description
1.0.37......Add initial support for IPv6 and VNET.
1.0.36......Remove obsolete code, update config. 1.0.36......Remove obsolete code, update config.
1.0.35......Use bastille built-in convert function. 1.0.35......Use bastille built-in convert function.
1.0.34......Use bastille built-in export/import functions. 1.0.34......Use bastille built-in export/import functions.
+5 -2
View File
@@ -762,6 +762,9 @@ zfs_activate()
jail_import() jail_import()
{ {
# Foreign jail import support using rsync. # Foreign jail import support using rsync.
# This will attempt to import a foreign(Thebrig) jail into Bastille,
# however only basic IOcage jails are officially supported by Bastille import.
# Since importing Thebrig jails is almost unsupported/untested, this function may be deprecated at any time.
USAGE="Usage: ${SCRIPTNAME} -I [path]" USAGE="Usage: ${SCRIPTNAME} -I [path]"
if [ -z "${TARGET}" ]; then if [ -z "${TARGET}" ]; then
@@ -821,10 +824,10 @@ jail_import()
if [ -f "${TARGET}/root/.profile" ]; then if [ -f "${TARGET}/root/.profile" ]; then
if [ -d "${bastille_jailsdir}" ]; then if [ -d "${bastille_jailsdir}" ]; then
if [ ! -d "${bastille_jailsdir}/${NAME_TRIM}" ]; then if [ ! -d "${bastille_jailsdir}/${NAME_TRIM}" ]; then
# Create required ZFS datasets. # Create required ZFS datasets, mountpoint should be inherited.
echo "Creating required ZFS datasets..." echo "Creating required ZFS datasets..."
zfs create ${bastille_zfs_options} ${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${NAME_TRIM} zfs create ${bastille_zfs_options} ${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${NAME_TRIM}
zfs create ${bastille_zfs_options} -o mountpoint=${bastille_jailsdir}/${NAME_TRIM}/root ${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${NAME_TRIM}/root zfs create ${bastille_zfs_options} ${bastille_zfs_zpool}/${bastille_zfs_prefix}/jails/${NAME_TRIM}/root
echo "Importing foreign jail '${NAME_TRIM}' to ${PRDNAME}..." echo "Importing foreign jail '${NAME_TRIM}' to ${PRDNAME}..."
echo "Synchronizing '${NAME_TRIM}' data to ${bastille_jailsdir}/${NAME_TRIM}..." echo "Synchronizing '${NAME_TRIM}' data to ${bastille_jailsdir}/${NAME_TRIM}..."
rsync -a ${EXCLUDE} ${TARGET}/ ${bastille_jailsdir}/${NAME_TRIM}/root/ rsync -a ${EXCLUDE} ${TARGET}/ ${bastille_jailsdir}/${NAME_TRIM}/root/
+4 -1
View File
@@ -56,7 +56,7 @@ $config_path = exec("/bin/cat {$configfile} | /usr/bin/grep 'BASTILLE_CONFIG=' |
$default_distfiles = exec("/bin/cat {$config_path} | /usr/bin/grep 'bastille_bootstrap_archives=' | /usr/bin/cut -d'\"' -f2"); $default_distfiles = exec("/bin/cat {$config_path} | /usr/bin/grep 'bastille_bootstrap_archives=' | /usr/bin/cut -d'\"' -f2");
$jail_dir = "{$rootfolder}/jails"; $jail_dir = "{$rootfolder}/jails";
$image_dir = "ext/bastille/images"; $image_dir = "ext/bastille/images";
$thick_jail = exec("/usr/local/bin/bastille create | grep -wo '\[option\]'"); $options_support = exec("/usr/local/bin/bastille create | grep -wo '\[option\]'");
$reldir = "{$rootfolder}/releases"; $reldir = "{$rootfolder}/releases";
$zfs_support = exec("/bin/cat {$configfile} | /usr/bin/grep 'ZFS_SUPPORT=' | /usr/bin/cut -d'\"' -f2"); $zfs_support = exec("/bin/cat {$configfile} | /usr/bin/grep 'ZFS_SUPPORT=' | /usr/bin/cut -d'\"' -f2");
@@ -174,6 +174,9 @@ function get_jail_infos() {
// Set the IPv4 on the running jails. // Set the IPv4 on the running jails.
//$r['ip'] = exec("/usr/sbin/jls | /usr/bin/grep {$item} | /usr/bin/awk '{print $2}'"); //$r['ip'] = exec("/usr/sbin/jls | /usr/bin/grep {$item} | /usr/bin/awk '{print $2}'");
$r['ip'] = exec("/usr/bin/grep -w 'ip4.addr' {$jail_dir}/{$item}/jail.conf | /usr/bin/awk '{print $3}' | /usr/bin/tr -d ';'"); $r['ip'] = exec("/usr/bin/grep -w 'ip4.addr' {$jail_dir}/{$item}/jail.conf | /usr/bin/awk '{print $3}' | /usr/bin/tr -d ';'");
if (!$r['ip']):
$r['ip'] = exec("/usr/bin/grep -w 'ip6.addr' {$jail_dir}/{$item}/jail.conf | /usr/bin/awk '{print $3}' | /usr/bin/tr -d ';'");
endif;
if (!$r['ip']): if (!$r['ip']):
$r['ip'] = "-"; $r['ip'] = "-";
endif; endif;
+12 -5
View File
@@ -81,10 +81,16 @@ if($_POST):
$thick_jail = ""; $thick_jail = "";
endif; endif;
if ($_POST['nowstart']): if($_POST['vnetjail']):
$cmd = ("/usr/local/bin/bastille create {$thick_jail} {$jname} {$release} {$ipaddr} {$interface} && /usr/local/bin/bastille start {$jname}"); $vnet_jail = "-V";
else: else:
$cmd = ("/usr/local/bin/bastille create {$thick_jail} {$jname} {$release} {$ipaddr} {$interface}"); $vnet_jail = "";
endif;
if ($_POST['nowstart']):
$cmd = ("/usr/local/bin/bastille create {$thick_jail} {$vnet_jail} {$jname} {$release} {$ipaddr} {$interface} && /usr/local/bin/bastille start {$jname}");
else:
$cmd = ("/usr/local/bin/bastille create {$thick_jail} {$vnet_jail} {$jname} {$release} {$ipaddr} {$interface}");
endif; endif;
if ($_POST['Create']): if ($_POST['Create']):
@@ -156,13 +162,14 @@ $document->render();
<tbody> <tbody>
<?php <?php
html_inputbox2('jailname',gettext('Friendly name'),$pconfig['jailname'],'',true,20); html_inputbox2('jailname',gettext('Friendly name'),$pconfig['jailname'],'',true,20);
html_inputbox2('ipaddress',gettext('IPv4 Address'),$pconfig['ipaddress'],'',true,20); html_inputbox2('ipaddress',gettext('IP Address'),$pconfig['ipaddress'],'',true,20);
$a_action = $l_interfaces; $a_action = $l_interfaces;
$b_action = $l_release; $b_action = $l_release;
html_combobox2('interface',gettext('Network interface'),$pconfig['interface'],$a_action,'',true,false,'action_change()'); html_combobox2('interface',gettext('Network interface'),$pconfig['interface'],$a_action,'',true,false,'action_change()');
html_combobox2('release',gettext('Base release'),$pconfig['release'],$b_action,'',true,false,'action_change()'); html_combobox2('release',gettext('Base release'),$pconfig['release'],$b_action,'',true,false,'action_change()');
if($thick_jail): if($options_support):
html_checkbox2('thickjail',gettext('Create a thick container'),!empty($pconfig['thickjail']) ? true : false,gettext('These containers consume more space, but are self contained.'),'',false); html_checkbox2('thickjail',gettext('Create a thick container'),!empty($pconfig['thickjail']) ? true : false,gettext('These containers consume more space, but are self contained.'),'',false);
html_checkbox2('vnetjail',gettext('Enable VNET(VIMAGE)'),!empty($pconfig['vnetjail']) ? true : false,gettext('VNET-enabled containers are attached to a virtual bridge interface for connectivity(Advanced).'),'',false);
endif; endif;
html_checkbox2('nowstart',gettext('Start after creation'),!empty($pconfig['nowstart']) ? true : false,gettext('Start the container after creation.'),'',false); html_checkbox2('nowstart',gettext('Start after creation'),!empty($pconfig['nowstart']) ? true : false,gettext('Start the container after creation.'),'',false);
html_checkbox2('autostart',gettext('Auto start on boot'),!empty($pconfig['autostart']) ? true : false,gettext('Automatically start the container at boot time.'),'',false); html_checkbox2('autostart',gettext('Auto start on boot'),!empty($pconfig['autostart']) ? true : false,gettext('Automatically start the container at boot time.'),'',false);
+2 -2
View File
@@ -239,10 +239,10 @@ $document->render();
<colgroup> <colgroup>
<col style="width:5%"> <col style="width:5%">
<col style="width:5%"> <col style="width:5%">
<col style="width:12%">
<col style="width:10%"> <col style="width:10%">
<col style="width:10%"> <col style="width:10%">
<col style="width:10%"> <col style="width:10%">
<col style="width:5%">
<col style="width:25%"> <col style="width:25%">
<col style="width:5%"> <col style="width:5%">
<col style="width:5%"> <col style="width:5%">
@@ -257,7 +257,7 @@ $document->render();
<tr> <tr>
<th class="lhelc"><?=gtext('Select');?></th> <th class="lhelc"><?=gtext('Select');?></th>
<th class="lhell"><?=gtext('JID');?></th> <th class="lhell"><?=gtext('JID');?></th>
<th class="lhell"><?=gtext('IPv4 Address');?></th> <th class="lhell"><?=gtext('IP Address');?></th>
<th class="lhell"><?=gtext('Hostname');?></th> <th class="lhell"><?=gtext('Hostname');?></th>
<th class="lhell"><?=gtext('Release');?></th> <th class="lhell"><?=gtext('Release');?></th>
<th class="lhell"><?=gtext('Interface');?></th> <th class="lhell"><?=gtext('Interface');?></th>
+1 -1
View File
@@ -164,7 +164,7 @@ if ($_POST) {
else: else:
if (is_file($backup_file)) { if (is_file($backup_file)) {
$cmd = ("/usr/local/bin/bastille import '{$filename_trim}'"); $cmd = ("/usr/local/bin/bastille import '{$filename_trim}'");
unset($retval);mwexec($cmd,$retval); unset($output,$retval);mwexec2($cmd,$output,$retval);
if ($retval == 0) { if ($retval == 0) {
$savemsg .= gtext("Container restored successfully."); $savemsg .= gtext("Container restored successfully.");
exec("echo '{$date}: {$application}: Container restored successfully from {$filename_trim}' >> {$logfile}"); exec("echo '{$date}: {$application}: Container restored successfully from {$filename_trim}' >> {$logfile}");
+1 -1
View File
@@ -296,7 +296,7 @@ if($_POST):
break; break;
else: else:
if ($_POST['nowstop']): if ($_POST['nowstop']):
$cmd = ("/usr/local/bin/bastille stop {$item} && /usr/local/bin/bastille destroy {$item}"); $cmd = ("/usr/local/bin/bastille destroy -f {$item}");
else: else:
$cmd = ("/usr/local/bin/bastille destroy {$item}"); $cmd = ("/usr/local/bin/bastille destroy {$item}");
endif; endif;
+1 -1
View File
@@ -1 +1 @@
1.0.36 1.0.37