diff options
Diffstat (limited to 'config/bacula-client')
-rw-r--r-- | config/bacula-client/bacula-client.inc | 21 | ||||
-rw-r--r-- | config/bacula-client/bacula-client.priv.inc | 41 | ||||
-rw-r--r-- | config/bacula-client/bacula-client.xml | 12 | ||||
-rw-r--r-- | config/bacula-client/bacula-client_view_config.php | 8 |
4 files changed, 63 insertions, 19 deletions
diff --git a/config/bacula-client/bacula-client.inc b/config/bacula-client/bacula-client.inc index 07be3067..a251baae 100644 --- a/config/bacula-client/bacula-client.inc +++ b/config/bacula-client/bacula-client.inc @@ -44,19 +44,13 @@ function baculaclient_custom_php_install_command() { } function baculaclient_custom_php_deinstall_command(){ - conf_mount_rw(); - // Delete our config file unlink_if_exists(BACULA_LOCALBASE . "/etc/bacula/bacula-fd.conf"); - // Stop service and delete our rc file - stop_service("bacula-client"); - unlink_if_exists(BACULA_STARTUP_SCRIPT); - - conf_mount_ro(); } function baculaclient_custom_php_write_config(){ global $config, $LocalDirector; + $RemoteDirector = ""; conf_mount_rw(); // Check config_file @@ -79,21 +73,22 @@ function baculaclient_custom_php_write_config(){ switch ($bc['type']) { case "Director": $baculaclient_conf .= "Director { \n\tName = {$bc['director']}-dir #{$bc['description']}\n\tPassword = \"{$bc['password']}\"\n}\n"; + $RemoteDirector = $bc['director']; break; case "Monitor": $baculaclient_conf .= "Director { \n\tName = {$bc['director']}-mon #{$bc['description']}\n\tPassword = \"{$bc['password']}\"\n\tMonitor = yes\n}\n"; break; case "Local": - $baculaclient_conf .= "Director { \n\tName = {$bc['director']}-dir #{$bc['description']}\n\tPassword = \"{$bc['password']}\"\n}\n"; - $baculaclient_conf .= "Director { \n\tName = {$bc['director']}-mon #{$bc['description']}\n\tPassword = \"{$bc['password']}\"\n\tMonitor = yes\n}\n"; + $baculaclient_conf .= "Director { \n\tName = {$bc['director']}-fd #{$bc['description']}\n\tPassword = \"{$bc['password']}\"\n}\n"; $LocalDirector = $bc['director']; } } - // Create Messages - if (!empty($LocalDirector)) { - $baculaclient_conf .= "Messages { \n\tName = Standard \n\tdirector = {$LocalDirector}-dir = all, !skipped, !restored\n}\n"; + // Create Messages. + // Messages should be sent to the master Director + if (!empty($RemoteDirector)) { + $baculaclient_conf .= "Messages { \n\tName = Standard #send messages here\n\tdirector = {$RemoteDirector}-dir = all, !skipped, !restored\n}\n"; } // Create FileDaemon if (is_array($config['installedpackages']['baculaclientfd']['config'])) { @@ -101,7 +96,7 @@ function baculaclient_custom_php_write_config(){ $jobs = $config['installedpackages']['baculaclientfd']['config'][0]['jobs'] ?: '20'; } if (!empty($LocalDirector)) { - $baculaclient_conf .= "FileDaemon { \n\tName = {$LocalDirector}-fd #\n\tFDport = {$port}\n\tWorkingDirectory = /var/db/bacula\n\tPid Directory = /var/run\n\tMaximum Concurrent Jobs = {$jobs}\n}\n"; + $baculaclient_conf .= "FileDaemon { \n\tName = {$LocalDirector}-fd #this is the local pfSense Director\n\tFDport = {$port}\n\tWorkingDirectory = /var/db/bacula\n\tPid Directory = /var/run\n\tMaximum Concurrent Jobs = {$jobs}\n}\n"; } // Write config file and start service diff --git a/config/bacula-client/bacula-client.priv.inc b/config/bacula-client/bacula-client.priv.inc new file mode 100644 index 00000000..815768f0 --- /dev/null +++ b/config/bacula-client/bacula-client.priv.inc @@ -0,0 +1,41 @@ +<?php +/* + bacula-client.priv.inc + part of pfSense (http://www.pfSense.org/) + Copyright (C) 2015 ESF, LLC + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, + OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +global $priv_list; + +$priv_list['page-services-bacula-client'] = array(); +$priv_list['page-services-bacula-client']['name'] = "WebCfg - Services: bacula-client package"; +$priv_list['page-services-bacula-client']['descr'] = "Allow access to bacula-client package GUI"; + +$priv_list['page-services-bacula-client']['match'] = array(); +$priv_list['page-services-bacula-client']['match'][] = "pkg.php?xml=bacula-client.xml*"; +$priv_list['page-services-bacula-client']['match'][] = "pkg_edit.php?xml=bacula-client.xml*"; +$priv_list['page-services-bacula-client']['match'][] = "pkg_edit.php?xml=bacula-client_fd.xml*"; +$priv_list['page-services-bacula-client']['match'][] = "bacula-client_view_config.php*"; + +?> diff --git a/config/bacula-client/bacula-client.xml b/config/bacula-client/bacula-client.xml index ce07e77e..6f2f3424 100644 --- a/config/bacula-client/bacula-client.xml +++ b/config/bacula-client/bacula-client.xml @@ -44,7 +44,7 @@ </copyright> <requirements>Bacula Server Installed on your network.</requirements> <name>baculaclient</name> - <version>1.0.8</version> + <version>1.0.12</version> <title>Bacula Client: Settings</title> <aftersaveredirect>/pkg.php?xml=bacula-client.xml</aftersaveredirect> <include_file>/usr/local/pkg/bacula-client.inc</include_file> @@ -54,6 +54,10 @@ <item>https://packages.pfsense.org/packages/config/bacula-client/bacula-client.inc</item> </additional_files_needed> <additional_files_needed> + <prefix>/etc/inc/priv/</prefix> + <item>https://packages.pfsense.org/packages/config/bacula-client/bacula-client.priv.inc</item> + </additional_files_needed> + <additional_files_needed> <prefix>/usr/local/pkg/</prefix> <item>https://packages.pfsense.org/packages/config/bacula-client/bacula-client_fd.xml</item> </additional_files_needed> @@ -150,7 +154,13 @@ <custom_php_install_command> baculaclient_custom_php_install_command(); </custom_php_install_command> + <custom_php_deinstall_command> + baculaclient_custom_php_deinstall_command(); + </custom_php_deinstall_command> <custom_php_resync_config_command> baculaclient_custom_php_write_config(); </custom_php_resync_config_command> + <custom_delete_php_command> + baculaclient_custom_php_write_config(); + </custom_delete_php_command> </packagegui> diff --git a/config/bacula-client/bacula-client_view_config.php b/config/bacula-client/bacula-client_view_config.php index c10a0cda..dacdc98c 100644 --- a/config/bacula-client/bacula-client_view_config.php +++ b/config/bacula-client/bacula-client_view_config.php @@ -29,7 +29,7 @@ */ require("guiconfig.inc"); -$$pf_version = substr(trim(file_get_contents("/etc/version")), 0, 3); +$pf_version = substr(trim(file_get_contents("/etc/version")), 0, 3); if ($pf_version == "2.1" || $pf_version == "2.2") { define('BACULA_LOCALBASE', '/usr/pbi/bacula-' . php_uname("m")); } else { @@ -62,12 +62,10 @@ include("head.inc"); <div id="mainarea"> <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> <tr><td class="tabcont"> - <textarea id="varnishlogs" rows="50" cols="87%"> - <?php + <textarea rows="50" cols="87%"><?php $config_file = file_get_contents(BACULA_LOCALBASE."/etc/bacula/bacula-fd.conf"); echo $config_file; - ?> - </textarea> + ?></textarea> </td></tr> </table> </div> |