]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blame - html/html/clwarn.cgi
suricata: Change midstream policy to "pass-flow"
[people/pmueller/ipfire-2.x.git] / html / html / clwarn.cgi
CommitLineData
0fc9925c
CS
1#!/usr/bin/perl
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
5# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
21
22use CGI qw(param);
2a0d7a03 23use HTML::Entities();
0fc9925c
CS
24
25# enable only the following on debugging purpose
26use warnings;
27use CGI::Carp 'fatalsToBrowser';
28
29$swroot="/var/ipfire";
30&readhash("$swroot/ethernet/settings", \%netsettings);
31
32my $TITLE_VIRUS = "SquidClamAv Virus detection";
33
2a0d7a03
MT
34my $url = &HTML::Entities::encode_entities(param('url') || '');
35my $virus = &HTML::Entities::encode_entities(param('virus') || '');
36my $source = &HTML::Entities::encode_entities(param('source') || '');
0fc9925c 37$source =~ s/\/-//;
2a0d7a03 38my $user = &HTML::Entities::encode_entities(param('user') || '');
0fc9925c
CS
39
40
41# Remove clamd infos
42$virus =~ s/stream: //;
43$virus =~ s/ FOUND//;
44
45print "Pragma: no-cache\n";
46print "Cache-control: no-cache\n";
47print "Connection: close\n";
48print "Content-type: text/html\n\n";
49
50print <<END
51
52<html>
53<head>
54<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
55<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
56<title>ACCESS MESSAGE</title>
57</head>
58
59<body>
60<table width="100%" height='100%' border="0">
61<tr>
62 <td colspan='3' width='100%' height='130' align="center" background="http://$netsettings{'GREEN_ADDRESS'}:81/images/background.gif">
63<tr> <td width='10%'><td align='center' bgcolor='#CC000000' width='80%'><font face="verdana, arial, sans serif" color="#FFFFFF" size="5">
64 <b>$TITLE_VIRUS</b>
65 </font>
66 <td width='10%'>
67END
68;
69
70if (!($virus eq ""))
71{
72 print <<END
73 <tr> <td colspan='3' align='center'>
74 <font face="verdana, arial, sans serif" color="#CC000000" size="1">
75 <b>$virus found</b>
76 </font>
77END
78;
79}
80print <<END
81<tr>
82 <td colspan='3' align="center">
83 <font face="verdana, arial, sans serif" color="#000000" size="4">
84 <b>Access to the requested page has been denied</b>
85 </font>
86 <font face="verdana,arial,sans serif" color="#000000" size="2">
87END
88;
89
90if (!($url eq ""))
91{
92print <<END
93 <p>URL: <a href="$url">$url</a>
94END
95;
96}
97
98if (!($source eq ""))
99{
100print <<END
101 <p>Client IP address: <i>$source</i>
102END
103;
104}
105
106print <<END
107 <br><p>Please contact the Network Administrator if you think there has been an error
108 </font>
109
110<tr>
111 <td colspan='3' height='60%' valign="bottom" align="right">
112 <font face="verdana,arial,sans serif" color="#656565" size="1">Web Filtering by
113 </font>
114 <a href="http://www.ipfire.org" target="_blank"><b>
115 <font face="verdana,arial,sans serif" color="#656565" size="1">IPFire</b></a>
116 </font>
117
118</table>
119</body>
120
121</html>
122END
123;
124
125sub readhash
126{
127 my $filename = $_[0];
128 my $hash = $_[1];
129 my ($var, $val);
130
131 if (-e $filename)
132 {
133 open(FILE, $filename) or die "Unable to read file $filename";
134 while (<FILE>)
135 {
136 chop;
137 ($var, $val) = split /=/, $_, 2;
138 if ($var)
139 {
140 $val =~ s/^\'//g;
141 $val =~ s/\'$//g;
142
143 # Untaint variables read from hash
144 $var =~ /([A-Za-z0-9_-]*)/; $var = $1;
145 $val =~ /([\w\W]*)/; $val = $1;
146 $hash->{$var} = $val;
147 }
148 }
149 close FILE;
150 }
151}