]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - config/urlfilter/redirect_wrapper
Switch collectd from mbmon -> sensors, reenabled iptables
[people/teissler/ipfire-2.x.git] / config / urlfilter / redirect_wrapper
index 076764188abbe562714cda383443ce40d0e340df..7f66cd89dc4ca6c51dd69dcb7b5f85674b9fc39b 100644 (file)
@@ -28,6 +28,23 @@ use IO::Handle;
 # define here your redirectors (use a comma sperated list)
 my $redirectors = [ '/usr/bin/squidGuard', '/usr/sbin/updxlrator' ];
 
+require '/var/ipfire/general-functions.pl';
+
+my %proxysettings=();
+$proxysettings{'ENABLE_FILTER'} = 'off';
+$proxysettings{'ENABLE_CLAMAV'} = 'off';
+$proxysettings{'ENABLE_UPDXLRATOR'} = 'off';
+&General::readhash("${General::swroot}/proxy/settings", \%proxysettings);
+
+# define here your redirectors (use a comma sperated list)
+if ( $proxysettings{'ENABLE_FILTER'} eq 'on' && $proxysettings{'ENABLE_CLAMAV'} eq 'on' && $proxysettings{'ENABLE_UPDXLRATOR'} eq 'on' ){my $redirectors = [ '/usr/bin/squidGuard', '/usr/bin/squidclamav', '/usr/sbin/updxlrator' ];}
+if ( $proxysettings{'ENABLE_FILTER'} eq 'on' && $proxysettings{'ENABLE_CLAMAV'} eq 'on' && $proxysettings{'ENABLE_UPDXLRATOR'} eq 'off' ){my $redirectors = [ '/usr/bin/squidGuard', '/usr/bin/squidclamav' ];}
+if ( $proxysettings{'ENABLE_FILTER'} eq 'on' && $proxysettings{'ENABLE_CLAMAV'} eq 'off' && $proxysettings{'ENABLE_UPDXLRATOR'} eq 'on' ){my $redirectors = [ '/usr/bin/squidGuard', '/usr/sbin/updxlrator' ];}
+if ( $proxysettings{'ENABLE_FILTER'} eq 'on' && $proxysettings{'ENABLE_CLAMAV'} eq 'off' && $proxysettings{'ENABLE_UPDXLRATOR'} eq 'off' ){my $redirectors = [ '/usr/bin/squidGuard' ];}
+if ( $proxysettings{'ENABLE_FILTER'} eq 'off' && $proxysettings{'ENABLE_CLAMAV'} eq 'on' && $proxysettings{'ENABLE_UPDXLRATOR'} eq 'on' ){my $redirectors = [ '/usr/bin/squidclamav', '/usr/sbin/updxlrator' ];}
+if ( $proxysettings{'ENABLE_FILTER'} eq 'off' && $proxysettings{'ENABLE_CLAMAV'} eq 'on' && $proxysettings{'ENABLE_UPDXLRATOR'} eq 'off' ){my $redirectors = [ '/usr/bin/squidclamav' ];}
+if ( $proxysettings{'ENABLE_FILTER'} eq 'off' && $proxysettings{'ENABLE_CLAMAV'} eq 'off' && $proxysettings{'ENABLE_UPDXLRATOR'} eq 'on' ){my $redirectors = [ '/usr/sbin/updxlrator' ];}
+
 # Attention: keep in mind that the order of your redirectors is important.
 # It doesn't make sense to scan for viruses on pages you restrict access to...
 # So place first your tools which restrict access, then the tools which do the
@@ -42,6 +59,7 @@ STDOUT->autoflush(1);
 my $line;
 my $return;
 my $i;
+my $debug=0; # enable only for debugging
 
 # open progamms
 my $pidlist = [];
@@ -60,5 +78,15 @@ while($line = <>) {
                                                                # break if redirector changes data
         }
         print $return;
+
+                               if ($debug){
+                chomp $line;
+                chomp $return;
+                if ( $line ne $return ){
+                open(DATEI, ">>/var/log/squid/redirector_debug") || die "Unable to acces file /var/log/redirector_debug";
+                                        print DATEI "Requested ".$line."\nAnswer    ".$return."\n";
+                                        close(DATEI);
+                                        }
+                               }
 }
 exit 0;