Code improvements/fixes and dashboard cosmetic changes
This commit is contained in:
@@ -3,7 +3,8 @@
|
|||||||
======================
|
======================
|
||||||
Version Description
|
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.30......Add auto and live export modes, add ZST compression support.
|
||||||
1.2.29......Fix jail backup.
|
1.2.29......Fix jail backup.
|
||||||
1.2.28......Minor cosmetic/wording changes.
|
1.2.28......Minor cosmetic/wording changes.
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
Copyright (c) 2019-2025, Jose Rivera
|
Copyright (c) 2019-2026, Jose Rivera
|
||||||
All rights reserved.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
+1
-1
@@ -9,7 +9,7 @@
|
|||||||
# Debug script
|
# Debug script
|
||||||
#set -x
|
#set -x
|
||||||
|
|
||||||
# Copyright (c) 2019-2025, José Rivera (joserprg@gmail.com).
|
# Copyright (c) 2019-2026, José Rivera (joserprg@gmail.com).
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
bastille_manager-lib.inc
|
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.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
@@ -219,87 +219,90 @@ function get_jail_infos() {
|
|||||||
$r['name'] = '-';
|
$r['name'] = '-';
|
||||||
endif;
|
endif;
|
||||||
$r['jailname'] = $r['name'];
|
$r['jailname'] = $r['name'];
|
||||||
|
|
||||||
// Set the JID on the running jails.
|
|
||||||
$item = $r['jailname'];
|
$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']):
|
if (!$r['id']):
|
||||||
$r['id'] = "-";
|
$r['id'] = "-";
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Set the IP address on the running jails using bastille list command instead.
|
// Set the jail Boot.
|
||||||
//$r['ip'] = exec("/usr/bin/grep -w 'ip4.addr' {$jail_dir}/{$item}/jail.conf | /usr/bin/awk '{print $3}' | /usr/bin/tr -d ';'");
|
$r['boot'] = $boot;
|
||||||
$r['ip'] = exec("/usr/local/bin/bastille list {$item} | awk '{print $7}' | sed 1d");
|
if (!$r['boot']):
|
||||||
if (!$r['ip']):
|
$r['boot'] = "-";
|
||||||
$r['ip'] = exec("/usr/bin/grep -w 'ip6.addr' {$jail_dir}/{$item}/jail.conf | /usr/bin/awk '{print $3}' | /usr/bin/tr -d ';'");
|
|
||||||
endif;
|
endif;
|
||||||
// Try to get ip from vnet config.
|
|
||||||
if(!$r['ip']):
|
// Set the jail Prio.
|
||||||
$r['ip'] = exec("/usr/local/bin/bastille cmd {$item} cat /etc/rc.conf | /usr/bin/grep 'ifconfig_vnet0=' | cut -d'\"' -f2 | sed 's/inet //'");
|
$r['prio'] = $prio;
|
||||||
|
if (!$r['prio']):
|
||||||
|
$r['prio'] = "-";
|
||||||
endif;
|
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']):
|
if (!$r['ip']):
|
||||||
$r['ip'] = "-";
|
$r['ip'] = "-";
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Display release.
|
// Set the jail Published Ports.
|
||||||
$r['rel'] = exec("/usr/sbin/jexec {$item} freebsd-version 2>/dev/null");
|
$r['ports'] = $ports;
|
||||||
if (!$r['rel']):
|
if (!$r['ports']):
|
||||||
if(is_file("{$jail_dir}/{$item}/root/etc/os-release")):
|
$r['ports'] = "-";
|
||||||
$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;
|
|
||||||
endif;
|
endif;
|
||||||
// We can't get release version info or jail stopped.
|
|
||||||
|
// Set the jail Release.
|
||||||
|
$r['rel'] = $release;
|
||||||
if (!$r['rel']):
|
if (!$r['rel']):
|
||||||
$r['rel'] = "-";
|
$r['rel'] = "-";
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Display interface name for VNET jails.
|
// Set the jail Tags.
|
||||||
if (exec("/usr/bin/grep -w '.*vnet.interface.*=.*;' {$jail_dir}/{$item}/jail.conf")):
|
$r['tags'] = $tags;
|
||||||
$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['tags']):
|
||||||
if (!$r['nic']):
|
$r['tags'] = "-";
|
||||||
$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'];
|
|
||||||
endif;
|
endif;
|
||||||
|
|
||||||
// Display running status icons.
|
// Display running status icons.
|
||||||
$jail_running = exec("/usr/sbin/jls name | /usr/bin/awk '/^{$item}\$/'");
|
if ($state == "Up"):
|
||||||
if ($jail_running):
|
|
||||||
$r['stat'] = $img_path['ena'];
|
$r['stat'] = $img_path['ena'];
|
||||||
else:
|
else:
|
||||||
$r['stat'] = $img_path['dis'];
|
$r['stat'] = $img_path['dis'];
|
||||||
endif;
|
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.
|
// Display custom template icons if available.
|
||||||
$template_icon = "{$jail_dir}/{$item}/plugin_icon.png";
|
$template_icon = "{$jail_dir}/{$item}/plugin_icon.png";
|
||||||
if(file_exists($template_icon)):
|
if(file_exists($template_icon)):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
bastille_manager_add.php
|
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.
|
All rights reserved.
|
||||||
|
|
||||||
Portions of XigmaNAS® (https://www.xigmanas.com).
|
Portions of XigmaNAS® (https://www.xigmanas.com).
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
bastille_manager_config.php
|
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.
|
All rights reserved.
|
||||||
|
|
||||||
Copyright (c) 2018 Andreas Schmidhuber
|
Copyright (c) 2018 Andreas Schmidhuber
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
bastille_manager_editor.php
|
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.
|
All rights reserved.
|
||||||
|
|
||||||
Portions of XigmaNAS® (https://www.xigmanas.com).
|
Portions of XigmaNAS® (https://www.xigmanas.com).
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
bastille_manager_gui.php
|
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.
|
All rights reserved.
|
||||||
|
|
||||||
Portions of XigmaNAS® (https://www.xigmanas.com).
|
Portions of XigmaNAS® (https://www.xigmanas.com).
|
||||||
@@ -284,32 +284,38 @@ $document->render();
|
|||||||
</table>
|
</table>
|
||||||
<table class="area_data_selection">
|
<table class="area_data_selection">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col style="width:5%">
|
<col style="width:2%">
|
||||||
<col style="width:5%">
|
<col style="width:2%">
|
||||||
<col style="width:12%">
|
<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:10%">
|
<col style="width:10%">
|
||||||
|
<col style="width:5%">
|
||||||
<col style="width:10%">
|
<col style="width:10%">
|
||||||
<col style="width:25%">
|
<col style="width:3%">
|
||||||
<col style="width:5%">
|
<col style="width:3%">
|
||||||
<col style="width:5%">
|
|
||||||
<col style="width:5%">
|
|
||||||
<col style="width:5%">
|
<col style="width:5%">
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<thead>
|
<thead>
|
||||||
<?php
|
<?php
|
||||||
html_separator2();
|
html_separator2();
|
||||||
html_titleline2(gettext('Overview'), 11);
|
html_titleline2(gettext('Overview'), 14);
|
||||||
?>
|
?>
|
||||||
<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('IP Address');?></th>
|
|
||||||
<th class="lhell"><?=gtext('Name');?></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('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('Active');?></th>
|
||||||
<th class="lhell"><?=gtext('Template');?></th>
|
<th class="lhell"><?=gtext('Template');?></th>
|
||||||
<th class="lhebl"><?=gtext('Toolbox');?></th>
|
<th class="lhebl"><?=gtext('Toolbox');?></th>
|
||||||
@@ -338,12 +344,15 @@ $document->render();
|
|||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td class="lcell"><?=htmlspecialchars($sphere_record['id']);?> </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['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['rel']);?> </td>
|
||||||
<td class="lcell"><?=htmlspecialchars($sphere_record['nic']);?> </td>
|
<td class="lcell"><?=htmlspecialchars($sphere_record['tags']);?> </td>
|
||||||
<td class="lcell"><?=htmlspecialchars($sphere_record['path']);?> </td>
|
|
||||||
<td class="lcell"><img src="<?=$sphere_record['boot'];?>"></td>
|
|
||||||
<td class="lcell"><img src="<?=$sphere_record['stat'];?>"></td>
|
<td class="lcell"><img src="<?=$sphere_record['stat'];?>"></td>
|
||||||
<td class="lcell"><img src="<?=$sphere_record['logo'];?>"></td>
|
<td class="lcell"><img src="<?=$sphere_record['logo'];?>"></td>
|
||||||
<td class="lcebld">
|
<td class="lcebld">
|
||||||
@@ -381,7 +390,7 @@ $document->render();
|
|||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="lcenl" colspan="10"></td>
|
<td class="lcenl" colspan="13"></td>
|
||||||
<td class="lceadd">
|
<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>
|
<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>
|
</td>
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
bastille_manager_info.php
|
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.
|
All rights reserved.
|
||||||
|
|
||||||
Portions of XigmaNAS® (https://www.xigmanas.com).
|
Portions of XigmaNAS® (https://www.xigmanas.com).
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
bastille_manager_jconf.inc
|
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.
|
All rights reserved.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
bastille_manager_maintenance.php
|
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.
|
All rights reserved.
|
||||||
|
|
||||||
Copyright (c) 2016 Andreas Schmidhuber
|
Copyright (c) 2016 Andreas Schmidhuber
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
bastille_manager_tarballs.php
|
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.
|
All rights reserved.
|
||||||
|
|
||||||
Portions of XigmaNAS® (https://www.xigmanas.com).
|
Portions of XigmaNAS® (https://www.xigmanas.com).
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/*
|
/*
|
||||||
bastille_manager_util.php
|
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.
|
All rights reserved.
|
||||||
|
|
||||||
Portions of XigmaNAS® (https://www.xigmanas.com).
|
Portions of XigmaNAS® (https://www.xigmanas.com).
|
||||||
|
|||||||
Executable → Regular
+1
-1
@@ -10,7 +10,7 @@
|
|||||||
# Debug script
|
# Debug script
|
||||||
#set -x
|
#set -x
|
||||||
|
|
||||||
# Copyright (c) 2019-2025, José Rivera (joserprg@gmail.com).
|
# Copyright (c) 2019-2026, José Rivera (joserprg@gmail.com).
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
|||||||
Reference in New Issue
Block a user