X-Git-Url: http://git.ipfire.org/?p=people%2Fteissler%2Fipfire-2.x.git;a=blobdiff_plain;f=html%2Fcgi-bin%2Fp2p-block.cgi;fp=html%2Fcgi-bin%2Fp2p-block.cgi;h=1c69a0ea31d82833842d6e4ebc283afdc7fb1ef2;hp=0000000000000000000000000000000000000000;hb=7bf83f9d39d3101ac096b42d0fc43a8caef97c5e;hpb=6128ded855eefc07abc6904490cfed055e35647b
diff --git a/html/cgi-bin/p2p-block.cgi b/html/cgi-bin/p2p-block.cgi
new file mode 100755
index 000000000..1c69a0ea3
--- /dev/null
+++ b/html/cgi-bin/p2p-block.cgi
@@ -0,0 +1,142 @@
+#!/usr/bin/perl
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2012 #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see . #
+# #
+###############################################################################
+# #
+# Hi folks! I hope this code is useful for all. I needed something to handle #
+# my VPN Connections in a comfortable way. As a prerequisite i needed #
+# something that makes sure the vpn roadwarrior are able to have a fixed #
+# ip-address. So i developed the ccd extension for the vpn server. #
+# #
+# Now that the ccd extension is ready i am able to develop the main request. #
+# Any feedback is appreciated. #
+# #
+#Copymaster #
+###############################################################################
+
+use strict;
+no warnings 'uninitialized';
+# enable only the following on debugging purpose
+#use warnings;
+#use CGI::Carp 'fatalsToBrowser';
+
+require '/var/ipfire/general-functions.pl';
+require "${General::swroot}/lang.pl";
+require "${General::swroot}/header.pl";
+
+my $errormessage='';
+my $p2pfile = "${General::swroot}/forward/p2protocols";
+
+my @p2ps = ();
+my %fwdfwsettings=();
+my %color=();
+my %mainsettings=();
+
+&General::readhash("${General::swroot}/forward/settings", \%fwdfwsettings);
+&General::readhash("${General::swroot}/main/settings", \%mainsettings);
+&General::readhash("/srv/web/ipfire/html/themes/".$mainsettings{'THEME'}."/include/colors.txt", \%color);
+
+
+
+&Header::showhttpheaders();
+&Header::getcgihash(\%fwdfwsettings);
+&Header::openpage($Lang::tr{'fwdfw menu'}, 1, '');
+&Header::openbigbox('100%', 'center',$errormessage);
+
+if ($fwdfwsettings{'ACTION'} eq ''){
+&p2pblock;
+}
+if ($fwdfwsettings{'ACTION'} eq 'togglep2p')
+{
+ open( FILE, "< $p2pfile" ) or die "Unable to read $p2pfile";
+ @p2ps = ;
+ close FILE;
+ open( FILE, "> $p2pfile" ) or die "Unable to write $p2pfile";
+ foreach my $p2pentry (sort @p2ps)
+ {
+ my @p2pline = split( /\;/, $p2pentry );
+ if ($p2pline[1] eq $fwdfwsettings{'P2PROT'}) {
+ if($p2pline[2] eq 'on'){
+ $p2pline[2]='off';
+ }else{
+ $p2pline[2]='on';
+ }
+ }
+ print FILE "$p2pline[0];$p2pline[1];$p2pline[2];\n";
+ }
+ close FILE;
+ &rules;
+ &p2pblock;
+}
+if ($fwdfwsettings{'ACTION'} eq $Lang::tr{'fwdfw reread'})
+{
+ &reread_rules;
+ &p2pblock;
+}
+
+
+sub p2pblock
+{
+ if (-f "${General::swroot}/forward/reread"){
+ print "
";
+ }
+ my $gif;
+ open( FILE, "< $p2pfile" ) or die "Unable to read $p2pfile";
+ @p2ps = ;
+ close FILE;
+ &Header::openbox('100%', 'center', 'P2P-Block');
+ print <
+