aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/bacula-client/bacula-client.inc182
-rw-r--r--config/bacula-client/bacula-client.xml149
-rw-r--r--config/bacula-client/bacula-client_fd.xml120
-rw-r--r--config/bacula-client/bacula-client_view_config.php85
4 files changed, 536 insertions, 0 deletions
diff --git a/config/bacula-client/bacula-client.inc b/config/bacula-client/bacula-client.inc
new file mode 100644
index 00000000..7cb27b1f
--- /dev/null
+++ b/config/bacula-client/bacula-client.inc
@@ -0,0 +1,182 @@
+<?php
+
+* ========================================================================== */
+/*
+ bacula-client.inc
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2012 Marcio Carlos
+ All rights reserved.
+
+ Based on m0n0wall (http://m0n0.ch/wall)
+ Copyright (C) 2003-2006 Manuel Kasper <mk@neon1.net>.
+ 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.
+ */
+/* ========================================================================== */
+ require_once("config.inc");
+ require_once("util.inc");
+
+function restart_bacula-client(){
+ //backup /usr/local/etc/bacula-fd.conf before any change
+ $etc_bacula-client=" /usr/local/etc/bacula-fd.conf";
+ $pfsense_version=preg_replace("/\s/","",file_get_contents("/etc/version"));
+ if (!file_exists('/root/'.$pfsense_version.'.bacula-fd.backup')){
+ copy ($etc_bacula-client,'/root/'.$pfsense_version.'.bacula-fd.backup');
+ }
+
+ //patch /usr/local/etc/bacula-fd.conf if need
+ $sshd_file=file($etc_bacula-client);
+ $sshd_new_file="";
+ foreach ($sshd_file as $line){
+ if (preg_match('/sshconf .= "Port/',$line)){
+ $sshd_new_file.= $line;
+ $sshd_new_file.= "\t".'if(file_exists("/etc/ssh/sshd_extra")){$sshconf.=file_get_contents("/etc/ssh/sshd_extra");}'."\n";
+ }
+ elseif(!preg_match('/sshd_extra/',$line)){
+ $sshd_new_file.= $line;
+ }
+ }
+ file_put_contents($etc_sshd,$sshd_new_file,LOCK_EX);
+ mwexec_bg($etc_sshd);
+ }
+
+function bacula-client_custom_php_install_command(){
+ global $g, $config;
+ conf_mount_rw();
+ $fd = fopen("/usr/local/etc/rc.d/bacula-fd", "w");
+ if(!$fd) {
+ log_error("Could not open /usr/local/etc/rc.d/bacula-fd for writing.");
+ return;
+ }
+
+ // Ensure svscan.sh has a+rx
+ exec("chmod a+rx /usr/local/etc/rc.d/bacula-fd");
+
+ $bacula-fd = <<<EOD
+#!/bin/sh
+#
+# $FreeBSD: ports/sysutils/bacula-server/files/bacula-fd.in,v 1.7 2012/01/14 08:56:57 dougb Exp $
+#
+# PROVIDE: bacula_fd
+# REQUIRE: DAEMON
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# bacula_fd_enable (bool): Set to NO by default.
+# Set it to YES to enable bacula_fd.
+# bacula_fd_flags (params): Set params used to start bacula_fd.
+#
+
+. /etc/rc.subr
+
+name="bacula_fd"
+rcvar=bacula_fd_enable
+command=/usr/local/sbin/bacula-fd
+
+load_rc_config $name
+
+: ${bacula_fd_enable="YES"}
+: ${bacula_fd_flags=" -u root -g wheel -v -c /usr/local/etc/bacula-fd.conf"}
+: ${bacula_fd_pidfile="/var/run/bacula-fd.9102.pid"}
+
+pidfile="${bacula_fd_pidfile}"
+
+run_rc_command "$1"
+
+EOD;
+
+ fwrite($fd, $bacula-fd);
+ fclose($fd);
+ conf_mount_ro();
+ }
+
+function bacula-client_custom_php_deinstall_command(){
+ global $g, $config;
+
+ conf_mount_rw();
+
+ // 1. Delete our config file
+ unlink_if_exists("/usr/local/etc/bacula-fd.conf");
+
+ // 2. Re-run sshd config generation script
+ exec("/usr/local/etc/rc.d/bacula-fd stop");
+
+ conf_mount_ro();
+ }
+
+function bacula-client_custom_php_write_config(){
+ global $g, $config;
+ $fd = fopen("/usr/local/etc/bacula-fd.conf", "w");
+ if(!$fd) {
+ log_error("Could not open /usr/local/etc/bacula-fd.conf for writing.");
+ return;
+ }
+ if (is_array($config['installedpackages']['bacula-client']['config'])){
+ // Mount Read-write
+ conf_mount_rw();
+ // Make Head
+ $baculaclient_conf .= <<<EOD
+ #
+ # Default Bacula File Daemon Configuration file
+ #
+ # For Bacula release 5.2.6 (21 February 2012) -- pfsense 2.0.x
+ #
+ # There is not much to change here except perhaps the
+ #
+ # List Directors who are permitted to contact this File daemon
+ #
+ EOD;
+ // Read config
+ foreach ($config['installedpackages']['bacula-client']['config'] as $baculaclient){
+ foreach ($baculaclient['row'] as $bc){
+ // create Director
+ if $bc['type'] < 2
+ $baculaclient_conf .= "Director { \n\t Name = $bc['director']-dir #$bc['description']\n\t Password = ".'"'.$bc['password'].'"'."\n}\n";
+ if $bc['type'] > 0
+ $baculaclient_conf .= "Director { \n\t Name = $bc['director']-mon #$bc['description']\n\t Password = ".'"'.$bc['password'].'"'."\n\t Monitor = yes\n}\n";
+ if $bc['type'] = 1
+ $LocalDirector = $bc['director']
+ }
+ }
+ // create Messages
+ $baculaclient_conf .= "Messages { \n\t Name = Standard \n\t director = ".$LocalDirector."-dir = all, !skipped, !restored\n\t \n}\n";
+ // create FielDaemon
+
+ $port = $config['installedpackages']['bacula-client']['config'][0]['port'];
+ $dir = $config['installedpackages']['bacula-client']['config'][0]['dir'];
+ $jobs = $config['installedpackages']['bacula-client']['config'][0]['jobs']
+ $baculaclient_conf .= "FileDaemon { \n\t Name = $filedaemon-fd #\n\t FDport = $port\n\t WorkingDirectory = $dir\n\t Maximun Concurrent Jobs = $jobs\n \n}\n";
+ fwrite($fd, $baculaclient_conf);
+ fclose($fd);
+ }
+}
+
+ // Mount Read-only
+ conf_mount_ro();
+
+
+ ?> \ No newline at end of file
diff --git a/config/bacula-client/bacula-client.xml b/config/bacula-client/bacula-client.xml
new file mode 100644
index 00000000..11ce0641
--- /dev/null
+++ b/config/bacula-client/bacula-client.xml
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd">
+<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?>
+<packagegui>
+ <copyright>
+ <![CDATA[
+/* ========================================================================== */
+/*
+ bacula-client.xml
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2010 Scott Ullrich <sullrich@gmail.com>
+ Copyright (C) 2011 Brian Scholer
+ Copyright (C) 2012 Márcio Carlos Braga Antão
+ 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.
+ */
+/* ========================================================================== */
+ ]]>
+ </copyright>
+ <description>Client Install for Bacula 5.2.6 Backup</description>
+ <requirements>Bacula Server Installed in or network</requirements>
+ <faq>Currently there are no FAQ items provided.</faq>
+ <name>bacula-client</name>
+ <version>5.2.6</version>
+ <title>Bacula-Client Setting</title>
+ <aftersaveredirect>pkg_edit.php?xml=bacula-client.xml&amp;id=0</aftersaveredirect>
+ <include_file>/usr/local/pkg/bacula-client.inc</include_file>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/bacula-client/bacula-client.inc</item>
+ </additional_files_needed>
+ <menu>
+ <name>bacula-client</name>
+ <tooltiptext>bacula backup client</tooltiptext>
+ <section>sysutils</section>
+ <configfile>bacula-client.xml</configfile>
+ </menu>
+ <tabs>
+ <tab>
+ <text>Directors</text>
+ <url>/pkg.php?xml=bacula-client.xml</url>
+ <active/>
+ </tab>
+ <tab>
+ <text>FileDaemon</text>
+ <url>/pkg.php?xml=bacula-client-fd.xml</url>
+ <active/>
+ </tab>
+ <tab>
+ <text>View Configuration</text>
+ <url>/bacula-client_view_config.php</url>
+ </tab>
+ </tabs>
+ <adddeleteeditpagefields>
+ <columnitem>
+ <fielddescr>Server Director</fielddescr>
+ <fieldname>director</fieldname>
+ </columnitem>
+ <columnitem>
+ <fielddescr>Type</fielddescr>
+ <fieldname>type</fieldname>
+ </columnitem>
+ <columnitem>
+ <fielddescr>Description</fielddescr>
+ <fieldname>description</fieldname>
+ </columnitem>
+ </adddeleteeditpagefields>
+ <fields>
+ <field>
+ <type>listtopic</type>
+ <fieldname>temp</fieldname>
+ <name>File configuration</name>
+ </field>
+ <field>
+ <fielddescr>Director Name</fielddescr>
+ <fieldname>director</fieldname>
+ <type>input</type>
+ <size>60</size>
+ <description>Name of director</description>
+ <required/>
+ </field>
+ <field>
+ <fielddescr>Description</fielddescr>
+ <fieldname>description</fieldname>
+ <description>Enter a description for this file.</description>
+ <type>input</type>
+ <size>60</size>
+ </field>
+ <field>
+ <fielddescr>Password</fielddescr>
+ <fieldname>password</fieldname>
+ <type>input</type>
+ <size>30</size>
+ <description><![CDATA[Enter password for DIrector use to Access.]]></description>
+ </field>
+
+ <field>
+ <fielddescr>Director tyoe</fielddescr>
+ <fieldname>type</fieldname>
+ <type>select</type>
+ <options>
+ <option><name>director</name><value>0</value></option>
+ <option><name>local</name><value>1</value></option>
+ <option><name>monitor</name><value>2</value></option>
+
+ </options>
+ <description>This is a Local Director?</description>
+ </field>
+ </fields>
+ <custom_php_install_command>
+ bacula-client_custom_php_install_command();
+ </custom_php_install_command>
+ <custom_php_command_before_form>
+ </custom_php_command_before_form>
+ <custom_php_validation_command>
+ bacula-client_settings_post_validate($_POST, &amp;$input_errors);
+ </custom_php_validation_command>
+ <custom_delete_php_command>
+ bacula-client_custom_php_write_config()
+ </custom_delete_php_command>
+ <custom_add_php_command>
+ bacula-client_custom_php_write_config()
+ </custom_add_php_command>
+ <custom_php_resync_config_command>
+ </custom_php_resync_config_command>
+</packagegui> \ No newline at end of file
diff --git a/config/bacula-client/bacula-client_fd.xml b/config/bacula-client/bacula-client_fd.xml
new file mode 100644
index 00000000..98c2dbec
--- /dev/null
+++ b/config/bacula-client/bacula-client_fd.xml
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!DOCTYPE packagegui SYSTEM "./schema/packages.dtd">
+<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?>
+<packagegui>
+ <copyright>
+ <![CDATA[
+/* ========================================================================== */
+/*
+ bacula-client.xml
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2012 Márcio Carlos Braga Antão
+ 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.
+ */
+/* ========================================================================== */
+ ]]>
+ </copyright>
+ <description>Client Install for Bacula 5.2.6 Backup</description>
+ <requirements>Bacula Server Installed in or network</requirements>
+ <faq>Currently there are no FAQ items provided.</faq>
+ <name>bacula-client</name>
+ <version>5.2.6</version>
+ <title>Bacula-Client Setting</title>
+ <aftersaveredirect>pkg_edit.php?xml=bacula-client.xml&amp;id=0</aftersaveredirect>
+ <include_file>/usr/local/pkg/bacula-client.inc</include_file>
+ <additional_files_needed>
+ <prefix>/usr/local/pkg/</prefix>
+ <chmod>0755</chmod>
+ <item>http://www.pfsense.com/packages/config/bacula-client/bacula-client.inc</item>
+ </additional_files_needed>
+ <menu>
+ <name>bacula-client</name>
+ <tooltiptext>bacula backup client</tooltiptext>
+ <section>sysutils</section>
+ <configfile>bacula-client.xml</configfile>
+ </menu>
+ <tabs>
+ <tab>
+ <text>Directors</text>
+ <url>/pkg.php?xml=bacula-client.xml</url>
+ <active/>
+ </tab>
+ <tab>
+ <text>FileDaemon</text>
+ <url>/pkg.php?xml=bacula-client_fd.xml</url>
+ <active/>
+ </tab>
+ <tab>
+ <text>View Configuration</text>
+ <url>/bacula-client_view_config.php</url>
+ </tab>
+ </tabs>
+ <fields>
+ <field>
+ <type>listtopic</type>
+ <fieldname>temp</fieldname>
+ <name>File configuration</name>
+ </field>
+ <field>
+ <fielddescr>File Daemon Port</fielddescr>
+ <fieldname>port</fieldname>
+ <type>input</type>
+ <size>4</size>
+ <description>Port for a File Daemon</description>
+ <required/>
+ </field>
+ <field>
+ <fielddescr>WorkingDirectory</fielddescr>
+ <fieldname>dir</fieldname>
+ <description>Working Directory</description>
+ <type>input</type>
+ <size>60</size>
+ </field>
+ <field>
+ <fielddescr>Maximun Concurrent Jobs</fielddescr>
+ <fieldname>jobs</fieldname>
+ <type>input</type>
+ <size>3</size>
+ <description>Maximun Concurrent Jobs</description>
+ </field>
+
+ </fields>
+ <custom_php_install_command>
+ bacula-client_custom_php_install_command();
+ </custom_php_install_command>
+ <custom_php_command_before_form>
+ </custom_php_command_before_form>
+ <custom_php_validation_command>
+ </custom_php_validation_command>
+ <custom_delete_php_command>
+ bacula-client_custom_php_write_config()
+ </custom_delete_php_command>
+ <custom_add_php_command>
+ bacula-client_custom_php_write_config()
+ </custom_add_php_command>
+ <custom_php_resync_config_command>
+ </custom_php_resync_config_command>
+</packagegui> \ No newline at end of file
diff --git a/config/bacula-client/bacula-client_view_config.php b/config/bacula-client/bacula-client_view_config.php
new file mode 100644
index 00000000..d0d16dc1
--- /dev/null
+++ b/config/bacula-client/bacula-client_view_config.php
@@ -0,0 +1,85 @@
+<?php
+/*
+ bacula-client_view_config.php
+ part of pfSense (http://www.pfsense.com/)
+ Copyright (C) 2010 Scott Ullrich <sullrich@gmail.com>
+ Copyright (C) 2012 Márcio Carlos Antão
+ 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.
+*/
+
+require("guiconfig.inc");
+
+$pfSversion = str_replace("\n", "", file_get_contents("/etc/version"));
+if(strstr($pfSversion, "1.2"))
+ $one_two = true;
+
+$pgtitle = "Bacula-Client: View Configuration";
+include("head.inc");
+
+?>
+<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
+<?php include("fbegin.inc"); ?>
+
+<?php if($one_two): ?>
+<p class="pgtitle"><?=$pgtitle?></font></p>
+<?php endif; ?>
+
+<?php if ($savemsg) print_info_box($savemsg); ?>
+
+<form action="bacula-client_view_config.php" method="post">
+
+<div id="mainlevel">
+ <table width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr><td>
+<?php
+ $tab_array = array();
+ $tab_array[] = array(gettext("Settings"), false, "/pkg_edit.php?xml=varnish_settings.xml&id=0");
+ $tab_array[] = array(gettext("View Configuration"), true, "/bacula-client_view_config.php");
+ display_top_tabs($tab_array);
+?>
+ </td></tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td class="tabcont" >
+ <textarea id="varnishlogs" rows="50" cols="100%">
+<?php
+ $config_file = file_get_contents("/usr/local/etc/bacula-fd.conf");
+ echo $config_file;
+?>
+ </textarea>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
+ </table>
+</div>
+</form>
+<?php include("fend.inc"); ?>
+</body>
+</html> \ No newline at end of file