Code improvements/fixes and dashboard cosmetic changes
This commit is contained in:
@@ -3,7 +3,8 @@
|
||||
======================
|
||||
Version Description
|
||||
|
||||
1.3.31......Minor cosmetic/wording changes.
|
||||
1.3.00......Code improvements/fixes and dashboard cosmetic changes.
|
||||
1.2.31......Minor cosmetic/wording changes.
|
||||
1.2.30......Add auto and live export modes, add ZST compression support.
|
||||
1.2.29......Fix jail backup.
|
||||
1.2.28......Minor cosmetic/wording changes.
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,5 +1,5 @@
|
||||
---------------------------------------------------------
|
||||
Copyright (c) 2019-2025, Jose Rivera
|
||||
Copyright (c) 2019-2026, Jose Rivera
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# Debug script
|
||||
#set -x
|
||||
|
||||
# Copyright (c) 2019-2025, José Rivera (joserprg@gmail.com).
|
||||
# Copyright (c) 2019-2026, José Rivera (joserprg@gmail.com).
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
bastille_manager-lib.inc
|
||||
|
||||
Copyright (c) 2019-2025 José Rivera (joserprg@gmail.com).
|
||||
Copyright (c) 2019-2026 José Rivera (joserprg@gmail.com).
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
@@ -219,87 +219,90 @@ function get_jail_infos() {
|
||||
$r['name'] = '-';
|
||||
endif;
|
||||
$r['jailname'] = $r['name'];
|
||||
|
||||
// Set the JID on the running jails.
|
||||
$item = $r['jailname'];
|
||||
$r['id'] = exec("/usr/sbin/jls | /usr/bin/awk '/{$item}\ /{print $1}'");
|
||||
|
||||
# Get some jail infos from 'bastille list' then dump data to temporary file.
|
||||
# JID Name Boot Prio State Type IP_Address Published_Ports Release Tags
|
||||
$jail_info = "bastille list | grep -w $item | while read _jid _name _boot _prio _state _type _ip _ports _release _tag; do \
|
||||
echo \$_jid \$_name \$_boot \$_prio \$_state \$_type \$_ip \$_ports \$_release \$_tag > /tmp/jail.$item.state; done";
|
||||
exec("$jail_info");
|
||||
$jid = exec("cat /tmp/jail.$item.state | awk '{print $1}'");
|
||||
$boot = exec("cat /tmp/jail.$item.state | awk '{print $3}'");
|
||||
$prio = exec("cat /tmp/jail.$item.state | awk '{print $4}'");
|
||||
$state = exec("cat /tmp/jail.$item.state | awk '{print $5}'");
|
||||
$type = exec("cat /tmp/jail.$item.state | awk '{print $6}'");
|
||||
$ipvx = exec("cat /tmp/jail.$item.state | awk '{print $7}'");
|
||||
$ports = exec("cat /tmp/jail.$item.state | awk '{print $8}'");
|
||||
$release = exec("cat /tmp/jail.$item.state | awk '{print $9}'");
|
||||
$tags = exec("cat /tmp/jail.$item.state | awk '{print $10}'");
|
||||
|
||||
// Set the jail JID.
|
||||
$r['id'] = $jid;
|
||||
if (!$r['id']):
|
||||
$r['id'] = "-";
|
||||
endif;
|
||||
|
||||
// Set the IP address on the running jails using bastille list command instead.
|
||||
//$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/local/bin/bastille list {$item} | awk '{print $7}' | sed 1d");
|
||||
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 ';'");
|
||||
// Set the jail Boot.
|
||||
$r['boot'] = $boot;
|
||||
if (!$r['boot']):
|
||||
$r['boot'] = "-";
|
||||
endif;
|
||||
// Try to get ip from vnet config.
|
||||
if(!$r['ip']):
|
||||
$r['ip'] = exec("/usr/local/bin/bastille cmd {$item} cat /etc/rc.conf | /usr/bin/grep 'ifconfig_vnet0=' | cut -d'\"' -f2 | sed 's/inet //'");
|
||||
|
||||
// Set the jail Prio.
|
||||
$r['prio'] = $prio;
|
||||
if (!$r['prio']):
|
||||
$r['prio'] = "-";
|
||||
endif;
|
||||
|
||||
// Set the jail State.
|
||||
$r['state'] = $state;
|
||||
if (!$r['state']):
|
||||
$r['state'] = "-";
|
||||
endif;
|
||||
|
||||
// Set the jail Type.
|
||||
$r['type'] = $type;
|
||||
if (!$r['type']):
|
||||
$r['type'] = "-";
|
||||
endif;
|
||||
|
||||
// Set the jail IP Address.
|
||||
$r['ip'] = $ipvx;
|
||||
if (!$r['ip']):
|
||||
$r['ip'] = "-";
|
||||
endif;
|
||||
|
||||
// Display release.
|
||||
$r['rel'] = exec("/usr/sbin/jexec {$item} freebsd-version 2>/dev/null");
|
||||
if (!$r['rel']):
|
||||
if(is_file("{$jail_dir}/{$item}/root/etc/os-release")):
|
||||
$r['rel'] = exec("/bin/cat {$jail_dir}/{$item}/root/etc/os-release | grep 'PRETTY_NAME=' | tr -d 'PRETTY_NAME=\"'");
|
||||
else:
|
||||
$r['rel'] = exec("/usr/sbin/jexec {$item} uname -o 2>/dev/null");
|
||||
endif;
|
||||
// Set the jail Published Ports.
|
||||
$r['ports'] = $ports;
|
||||
if (!$r['ports']):
|
||||
$r['ports'] = "-";
|
||||
endif;
|
||||
// We can't get release version info or jail stopped.
|
||||
|
||||
// Set the jail Release.
|
||||
$r['rel'] = $release;
|
||||
if (!$r['rel']):
|
||||
$r['rel'] = "-";
|
||||
endif;
|
||||
|
||||
// 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']):
|
||||
$r['path'] = "-";
|
||||
endif;
|
||||
|
||||
// Display auto-start settings.
|
||||
//$jail_autostart = exec("/usr/bin/grep -w {$item}_AUTO_START $configfile | cut -d'=' -f2 | tr -d '\"'");
|
||||
$jail_autostart = exec("/usr/bin/grep -w boot {$jail_dir}/{$item}/settings.conf | cut -d'=' -f2 | tr -d '\"'");
|
||||
if ($jail_autostart == 'on'):
|
||||
$r['boot'] = $img_path['ena'];
|
||||
elseif ($jail_autostart == 'off'):
|
||||
$r['boot'] = $img_path['dis'];
|
||||
else:
|
||||
$r['boot'] = $img_path['dis'];
|
||||
// Set the jail Tags.
|
||||
$r['tags'] = $tags;
|
||||
if (!$r['tags']):
|
||||
$r['tags'] = "-";
|
||||
endif;
|
||||
|
||||
// Display running status icons.
|
||||
$jail_running = exec("/usr/sbin/jls name | /usr/bin/awk '/^{$item}\$/'");
|
||||
if ($jail_running):
|
||||
if ($state == "Up"):
|
||||
$r['stat'] = $img_path['ena'];
|
||||
else:
|
||||
$r['stat'] = $img_path['dis'];
|
||||
endif;
|
||||
|
||||
# Cleanup temporary file.
|
||||
$info_tmpfile = "/tmp/jail.$item.state";
|
||||
if(is_file("$info_tmpfile")):
|
||||
unlink("$info_tmpfile");
|
||||
endif;
|
||||
|
||||
// Display custom template icons if available.
|
||||
$template_icon = "{$jail_dir}/{$item}/plugin_icon.png";
|
||||
if(file_exists($template_icon)):
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
bastille_manager_add.php
|
||||
|
||||
Copyright (c) 2019-2025 José Rivera (joserprg@gmail.com).
|
||||
Copyright (c) 2019-2026 José Rivera (joserprg@gmail.com).
|
||||
All rights reserved.
|
||||
|
||||
Portions of XigmaNAS® (https://www.xigmanas.com).
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
bastille_manager_config.php
|
||||
|
||||
Copyright (c) 2019-2025 José Rivera (joserprg@gmail.com).
|
||||
Copyright (c) 2019-2026 José Rivera (joserprg@gmail.com).
|
||||
All rights reserved.
|
||||
|
||||
Copyright (c) 2018 Andreas Schmidhuber
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
bastille_manager_editor.php
|
||||
|
||||
Copyright (c) 2019-2025 José Rivera (joserprg@gmail.com).
|
||||
Copyright (c) 2019-2026 José Rivera (joserprg@gmail.com).
|
||||
All rights reserved.
|
||||
|
||||
Portions of XigmaNAS® (https://www.xigmanas.com).
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
bastille_manager_gui.php
|
||||
|
||||
Copyright (c) 2019-2025 José Rivera (joserprg@gmail.com).
|
||||
Copyright (c) 2019-2026 José Rivera (joserprg@gmail.com).
|
||||
All rights reserved.
|
||||
|
||||
Portions of XigmaNAS® (https://www.xigmanas.com).
|
||||
@@ -284,32 +284,38 @@ $document->render();
|
||||
</table>
|
||||
<table class="area_data_selection">
|
||||
<colgroup>
|
||||
<col style="width:5%">
|
||||
<col style="width:5%">
|
||||
<col style="width:12%">
|
||||
<col style="width:2%">
|
||||
<col style="width:2%">
|
||||
<col style="width:10%">
|
||||
<col style="width:3%">
|
||||
<col style="width:3%">
|
||||
<col style="width:3%">
|
||||
<col style="width:3%">
|
||||
<col style="width:10%">
|
||||
<col style="width:10%">
|
||||
<col style="width:5%">
|
||||
<col style="width:10%">
|
||||
<col style="width:25%">
|
||||
<col style="width:5%">
|
||||
<col style="width:5%">
|
||||
<col style="width:5%">
|
||||
<col style="width:3%">
|
||||
<col style="width:3%">
|
||||
<col style="width:5%">
|
||||
</colgroup>
|
||||
<thead>
|
||||
<?php
|
||||
html_separator2();
|
||||
html_titleline2(gettext('Overview'), 11);
|
||||
html_titleline2(gettext('Overview'), 14);
|
||||
?>
|
||||
<tr>
|
||||
<th class="lhelc"><?=gtext('Select');?></th>
|
||||
<th class="lhell"><?=gtext('JID');?></th>
|
||||
<th class="lhell"><?=gtext('IP Address');?></th>
|
||||
<th class="lhell"><?=gtext('Name');?></th>
|
||||
<th class="lhell"><?=gtext('Release');?></th>
|
||||
<th class="lhell"><?=gtext('Interface');?></th>
|
||||
<th class="lhell"><?=gtext('Path');?></th>
|
||||
<th class="lhell"><?=gtext('Boot');?></th>
|
||||
<th class="lhell"><?=gtext('Prio');?></th>
|
||||
<th class="lhell"><?=gtext('State');?></th>
|
||||
<th class="lhell"><?=gtext('Type');?></th>
|
||||
<th class="lhell"><?=gtext('IP Address');?></th>
|
||||
<th class="lhell"><?=gtext('Published Ports');?></th>
|
||||
<th class="lhell"><?=gtext('Release');?></th>
|
||||
<th class="lhell"><?=gtext('Tags');?></th>
|
||||
<th class="lhell"><?=gtext('Active');?></th>
|
||||
<th class="lhell"><?=gtext('Template');?></th>
|
||||
<th class="lhebl"><?=gtext('Toolbox');?></th>
|
||||
@@ -338,12 +344,15 @@ $document->render();
|
||||
?>
|
||||
</td>
|
||||
<td class="lcell"><?=htmlspecialchars($sphere_record['id']);?> </td>
|
||||
<td class="lcell"><?=htmlspecialchars($sphere_record['ip']);?> </td>
|
||||
<td class="lcell"><?=htmlspecialchars($sphere_record['name']);?> </td>
|
||||
<td class="lcell"><?=htmlspecialchars($sphere_record['boot']);?> </td>
|
||||
<td class="lcell"><?=htmlspecialchars($sphere_record['prio']);?> </td>
|
||||
<td class="lcell"><?=htmlspecialchars($sphere_record['state']);?> </td>
|
||||
<td class="lcell"><?=htmlspecialchars($sphere_record['type']);?> </td>
|
||||
<td class="lcell"><?=htmlspecialchars($sphere_record['ip']);?> </td>
|
||||
<td class="lcell"><?=htmlspecialchars($sphere_record['ports']);?> </td>
|
||||
<td class="lcell"><?=htmlspecialchars($sphere_record['rel']);?> </td>
|
||||
<td class="lcell"><?=htmlspecialchars($sphere_record['nic']);?> </td>
|
||||
<td class="lcell"><?=htmlspecialchars($sphere_record['path']);?> </td>
|
||||
<td class="lcell"><img src="<?=$sphere_record['boot'];?>"></td>
|
||||
<td class="lcell"><?=htmlspecialchars($sphere_record['tags']);?> </td>
|
||||
<td class="lcell"><img src="<?=$sphere_record['stat'];?>"></td>
|
||||
<td class="lcell"><img src="<?=$sphere_record['logo'];?>"></td>
|
||||
<td class="lcebld">
|
||||
@@ -381,7 +390,7 @@ $document->render();
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="lcenl" colspan="10"></td>
|
||||
<td class="lcenl" colspan="13"></td>
|
||||
<td class="lceadd">
|
||||
<a href="bastille_manager_add.php"><img src="<?=$img_path['add'];?>" title="<?=$gt_record_add;?>" border="0" alt="<?=$gt_record_add;?>" class="spin oneemhigh"/></a>
|
||||
</td>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
bastille_manager_info.php
|
||||
|
||||
Copyright (c) 2019-2025 José Rivera (joserprg@gmail.com).
|
||||
Copyright (c) 2019-2026 José Rivera (joserprg@gmail.com).
|
||||
All rights reserved.
|
||||
|
||||
Portions of XigmaNAS® (https://www.xigmanas.com).
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
bastille_manager_jconf.inc
|
||||
|
||||
Copyright (c) 2019-2025 José Rivera (joserprg@gmail.com).
|
||||
Copyright (c) 2019-2026 José Rivera (joserprg@gmail.com).
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
bastille_manager_maintenance.php
|
||||
|
||||
Copyright (c) 2019-2025 José Rivera (joserprg@gmail.com).
|
||||
Copyright (c) 2019-2026 José Rivera (joserprg@gmail.com).
|
||||
All rights reserved.
|
||||
|
||||
Copyright (c) 2016 Andreas Schmidhuber
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
bastille_manager_tarballs.php
|
||||
|
||||
Copyright (c) 2019-2025 José Rivera (joserprg@gmail.com).
|
||||
Copyright (c) 2019-2026 José Rivera (joserprg@gmail.com).
|
||||
All rights reserved.
|
||||
|
||||
Portions of XigmaNAS® (https://www.xigmanas.com).
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/*
|
||||
bastille_manager_util.php
|
||||
|
||||
Copyright (c) 2019-2025 José Rivera (joserprg@gmail.com).
|
||||
Copyright (c) 2019-2026 José Rivera (joserprg@gmail.com).
|
||||
All rights reserved.
|
||||
|
||||
Portions of XigmaNAS® (https://www.xigmanas.com).
|
||||
|
||||
2
unionfs.sh
Executable file → Normal file
2
unionfs.sh
Executable file → Normal file
@@ -10,7 +10,7 @@
|
||||
# Debug script
|
||||
#set -x
|
||||
|
||||
# Copyright (c) 2019-2025, José Rivera (joserprg@gmail.com).
|
||||
# Copyright (c) 2019-2026, José Rivera (joserprg@gmail.com).
|
||||
# All rights reserved.
|
||||
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
|
||||
Reference in New Issue
Block a user