aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rwxr-xr-xconfig/dansguardian/dansguardian.inc17
-rw-r--r--config/dansguardian/dansguardian.xml6
-rw-r--r--config/dansguardian/dansguardian_ips_header.template (renamed from config/dansguardian/dansguardian_ips_header.xml.template)0
-rw-r--r--config/dansguardian/dansguardian_ldap.php12
-rw-r--r--config/dansguardian/dansguardian_users_footer.template (renamed from config/dansguardian/dansguardian_users_footer.xml.template)0
-rw-r--r--config/dansguardian/dansguardian_users_header.template99
6 files changed, 119 insertions, 15 deletions
diff --git a/config/dansguardian/dansguardian.inc b/config/dansguardian/dansguardian.inc
index e3a9e87c..8177fe3f 100755
--- a/config/dansguardian/dansguardian.inc
+++ b/config/dansguardian/dansguardian.inc
@@ -765,6 +765,7 @@ function sync_package_dansguardian($via_rpc=false,$install_process=false) {
$dansguardian_groups[$group]=(preg_match("/$group/",$dansguardian_groups['group_options'])?"on":"off");
}
+
#create group list files
$lists=array("phraseacl" => array("bannedphrase","weightedphrase","exceptionphrase"),
"siteacl" => array("bannedsite","greysite","exceptionsite","exceptionfilesite","logsite"),
@@ -775,16 +776,16 @@ function sync_package_dansguardian($via_rpc=false,$install_process=false) {
"searchacl" => array("searchengineregexp","bannedsearchterm","weightedsearchterm","exceptionsearchterm")
);
foreach ($lists as $list_key => $list_array){
+ // verify groups acls to avoid errors on empty acl group options
+ if (!preg_match("/\w+/",$dansguardian_groups[$list_key])){
+ log_error("dansguardian - Config warning, Group {$dansguardian_group_name} {$list_key} cannot be empty! Trying to load sample values");
+ }
foreach ($list_array as $list_value){
#read all access lists applied tho this group option
foreach (explode(",",$dansguardian_groups[$list_key]) as $dacl){
if (! is_array(${$list_value}))
${$list_value}=array();
- // try to avoid errors on empty acl group options
- if (!preg_match("/\d+/",$dacl)){
- log_error("dansguardian - Config error, Group {$dansguardian_group_name} {$list_key} cannot be empty! Trying to load default acl values");
- $dacl=0;
- }
+ $dacl=(preg_match("/\w+/",$dacl)? $dacl : "sample");
$file_temp=file_get_contents(DANSGUARDIAN_DIR . "/etc/dansguardian/lists/{$list_value}list.{$dacl}")."\n";
${$list_value}=array_merge(explode("\n",$file_temp),${$list_value});
}
@@ -907,9 +908,9 @@ EOF;
#Create/update filtergroupsiplist
file_put_contents($dansguardian_dir."/lists/authplugins/ipgroups",$filtergroupsiplist,LOCK_EX);
#Create/update userlist xml file
- $ips_xml_header=file_get_contents("/usr/local/pkg/dansguardian_ips_header.xml.template");
- $user_xml_header=file_get_contents("/usr/local/pkg/dansguardian_users_header.xml.template");
- $user_xml_footer=file_get_contents("/usr/local/pkg/dansguardian_users_footer.xml.template");
+ $ips_xml_header=file_get_contents("/usr/local/pkg/dansguardian_ips_header.template");
+ $user_xml_header=file_get_contents("/usr/local/pkg/dansguardian_users_header.template");
+ $user_xml_footer=file_get_contents("/usr/local/pkg/dansguardian_users_footer.template");
file_put_contents("/usr/local/pkg/dansguardian_users.xml",$user_xml_header.$user_xml.$user_xml_footer,LOCK_EX);
file_put_contents("/usr/local/pkg/dansguardian_ips.xml",$ips_xml_header.$ips_xml.$user_xml_footer,LOCK_EX);
diff --git a/config/dansguardian/dansguardian.xml b/config/dansguardian/dansguardian.xml
index 26d87825..34d4156c 100644
--- a/config/dansguardian/dansguardian.xml
+++ b/config/dansguardian/dansguardian.xml
@@ -84,17 +84,17 @@
<chmod>0755</chmod>
</additional_files_needed>
<additional_files_needed>
- <item>http://www.pfsense.org/packages/config/dansguardian/dansguardian_ips_header.xml.template</item>
+ <item>http://www.pfsense.org/packages/config/dansguardian/dansguardian_ips_header.template</item>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
</additional_files_needed>
<additional_files_needed>
- <item>http://www.pfsense.org/packages/config/dansguardian/dansguardian_users_header.xml.template</item>
+ <item>http://www.pfsense.org/packages/config/dansguardian/dansguardian_users_header.template</item>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
</additional_files_needed>
<additional_files_needed>
- <item>http://www.pfsense.org/packages/config/dansguardian/dansguardian_users_footer.xml.template</item>
+ <item>http://www.pfsense.org/packages/config/dansguardian/dansguardian_users_footer.template</item>
<prefix>/usr/local/pkg/</prefix>
<chmod>0755</chmod>
</additional_files_needed>
diff --git a/config/dansguardian/dansguardian_ips_header.xml.template b/config/dansguardian/dansguardian_ips_header.template
index 48eb3e68..48eb3e68 100644
--- a/config/dansguardian/dansguardian_ips_header.xml.template
+++ b/config/dansguardian/dansguardian_ips_header.template
diff --git a/config/dansguardian/dansguardian_ldap.php b/config/dansguardian/dansguardian_ldap.php
index beb57ee0..33cbee91 100644
--- a/config/dansguardian/dansguardian_ldap.php
+++ b/config/dansguardian/dansguardian_ldap.php
@@ -130,9 +130,11 @@ if (is_array($config['installedpackages']['dansguardiangroups']['config']))
}
}
if (empty($members)){
- $config['installedpackages']['dansguardianusers']['config'][0][strtolower($group['name'])] = NULL;
- $apply_config++;
- }
+ if (!is_null($config['installedpackages']['dansguardianusers']['config'][0][strtolower($group['name'])])){
+ $config['installedpackages']['dansguardianusers']['config'][0][strtolower($group['name'])] = NULL;
+ $apply_config++;
+ }
+ }
else{
$import_users = explode("\n", $members);
asort($import_users);
@@ -146,11 +148,13 @@ if (is_array($config['installedpackages']['dansguardiangroups']['config']))
$id++;
}
if ($apply_config > 0){
- print "user list from LDAP is different from current group, applying new configuration...";
+ print "User list from LDAP is different from current group, applying new configuration...";
write_config();
include("/usr/local/pkg/dansguardian.inc");
sync_package_dansguardian();
print "done\n";
+}else {
+ print "User list from LDAP is already the same as current group, no changes made\n";
}
#mount filesystem read-only
diff --git a/config/dansguardian/dansguardian_users_footer.xml.template b/config/dansguardian/dansguardian_users_footer.template
index 1288b919..1288b919 100644
--- a/config/dansguardian/dansguardian_users_footer.xml.template
+++ b/config/dansguardian/dansguardian_users_footer.template
diff --git a/config/dansguardian/dansguardian_users_header.template b/config/dansguardian/dansguardian_users_header.template
new file mode 100644
index 00000000..1cc038d5
--- /dev/null
+++ b/config/dansguardian/dansguardian_users_header.template
@@ -0,0 +1,99 @@
+<?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[
+/* $Id$ */
+/* ========================================================================== */
+/*
+ dansguardian_users.xml
+ part of the dansguardian for pfSense
+ Copyright (C) 2012-2013 Marcello Coutinho
+
+ 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>Describe your package here</description>
+ <requirements>Describe your package requirements here</requirements>
+ <faq>Currently there are no FAQ items provided.</faq>
+ <name>dansguardianusers</name>
+ <version>1.0</version>
+ <title>Services: Dansguardian</title>
+ <include_file>/usr/local/pkg/dansguardian.inc</include_file>
+ <tabs><tab>
+ <text>Daemon</text>
+ <url>/pkg_edit.php?xml=dansguardian.xml&amp;id=0</url>
+ </tab>
+ <tab>
+ <text>General</text>
+ <url>/pkg_edit.php?xml=dansguardian_config.xml&amp;id=0</url>
+ </tab>
+ <tab>
+ <text>Limits</text>
+ <url>/pkg_edit.php?xml=dansguardian_limits.xml&amp;id=0</url>
+ </tab>
+ <tab>
+ <text>Blacklist</text>
+ <url>/pkg_edit.php?xml=dansguardian_blacklist.xml&amp;id=0</url>
+ </tab>
+ <tab>
+ <text>ACLs</text>
+ <url>/pkg.php?xml=dansguardian_site_acl.xml</url>
+ </tab>
+ <tab>
+ <text>LDAP</text>
+ <url>/pkg.php?xml=dansguardian_ldap.xml</url>
+ </tab>
+ <tab>
+ <text>Groups</text>
+ <url>/pkg.php?xml=dansguardian_groups.xml</url>
+ </tab>
+ <tab>
+ <text>Users</text>
+ <url>/pkg_edit.php?xml=dansguardian_users.xml</url>
+ <active/>
+ </tab>
+ <tab>
+ <text>IPs</text>
+ <url>/pkg_edit.php?xml=dansguardian_ips.xml</url>
+ </tab>
+ <tab>
+ <text>Report and log</text>
+ <url>/pkg_edit.php?xml=dansguardian_log.xml&amp;id=0</url>
+ </tab>
+ <tab>
+ <text>Sync</text>
+ <url>/pkg_edit.php?xml=dansguardian_sync.xml&amp;id=0</url>
+ </tab>
+ <tab>
+ <text>Help</text>
+ <url>/dansguardian_about.php</url>
+ </tab>
+</tabs>
+ <fields>