]>
Commit | Line | Data |
---|---|---|
5595bc03 CS |
1 | #!/usr/bin/perl |
2 | # | |
3 | # SmoothWall CGIs | |
4 | # | |
5 | # This code is distributed under the terms of the GPL | |
6 | # | |
7 | # (c) The SmoothWall Team | |
8 | # | |
9 | # Copyright (C) 01-02-2002 Graham Smith <grhm@grhm.co.uk> | |
10 | # | |
11 | # $Id: optionsfw.cgi,v 1.1.2.10 2005/10/03 00:34:10 gespinasse Exp $ | |
12 | # | |
13 | # | |
14 | ||
15 | # enable only the following on debugging purpose | |
16 | #use warnings; | |
17 | #use CGI::Carp 'fatalsToBrowser'; | |
18 | ||
19 | require '/var/ipfire/general-functions.pl'; | |
20 | require "${General::swroot}/lang.pl"; | |
21 | require "${General::swroot}/header.pl"; | |
22 | ||
23 | ||
24 | my %checked =(); # Checkbox manipulations | |
25 | ||
26 | # File used | |
27 | my $filename = "${General::swroot}/optionsfw/settings"; | |
28 | ||
29 | our %settings=(); | |
30 | $settings{'DISABLEPING'} = 'NO'; | |
31 | $settings{'DROPNEWNOTSYN'} = 'on'; | |
32 | $settings{'DROPINPUT'} = 'on'; | |
6be0579b | 33 | $settings{'DROPFORWARD'} = 'on'; |
5d7faa45 | 34 | $settings{'DROPOUTGOING'} = 'on'; |
5595bc03 | 35 | $settings{'DROPPORTSCAN'} = 'on'; |
42dc0090 CS |
36 | $settings{'DROPWIRELESSINPUT'} = 'on'; |
37 | $settings{'DROPWIRELESSFORWARD'} = 'on'; | |
e28356b9 | 38 | $settings{'SHOWCOLORS'} = 'off'; |
96502a5a | 39 | $settings{'SHOWREMARK'} = 'on'; |
5595bc03 CS |
40 | |
41 | my $errormessage = ''; | |
42 | my $warnmessage = ''; | |
43 | ||
44 | &Header::showhttpheaders(); | |
45 | ||
46 | #Get GUI values | |
47 | &Header::getcgihash(\%settings); | |
48 | ||
49 | if ($settings{'ACTION'} eq $Lang::tr{'save'}) { | |
62fc8511 | 50 | |
5595bc03 | 51 | $errormessage = $Lang::tr{'new optionsfw later'}; |
62fc8511 AM |
52 | delete $settings{'__CGI__'}; |
53 | delete $settings{'x'}; | |
54 | delete $settings{'y'}; | |
5595bc03 | 55 | &General::writehash($filename, \%settings); # Save good settings |
62fc8511 AM |
56 | }else { |
57 | &General::readhash($filename, \%settings); # Get saved settings and reset to good if needed | |
58 | } | |
59 | system("/usr/local/bin/forwardfwctrl"); | |
5595bc03 CS |
60 | &Header::openpage($Lang::tr{'options fw'}, 1, ''); |
61 | &Header::openbigbox('100%', 'left', '', $errormessage); | |
62 | ||
63 | if ($errormessage) { | |
64 | &Header::openbox('100%', 'left', $Lang::tr{'warning messages'}); | |
65 | print "<font color='red'>$errormessage </font>"; | |
66 | &Header::closebox(); | |
67 | } | |
68 | ||
69 | $checked{'DROPNEWNOTSYN'}{'off'} = ''; | |
70 | $checked{'DROPNEWNOTSYN'}{'on'} = ''; | |
71 | $checked{'DROPNEWNOTSYN'}{$settings{'DROPNEWNOTSYN'}} = "checked='checked'"; | |
72 | $checked{'DROPINPUT'}{'off'} = ''; | |
73 | $checked{'DROPINPUT'}{'on'} = ''; | |
74 | $checked{'DROPINPUT'}{$settings{'DROPINPUT'}} = "checked='checked'"; | |
6be0579b AM |
75 | $checked{'DROPFORWARD'}{'off'} = ''; |
76 | $checked{'DROPFORWARD'}{'on'} = ''; | |
77 | $checked{'DROPFORWARD'}{$settings{'DROPFORWARD'}} = "checked='checked'"; | |
5d7faa45 AM |
78 | $checked{'DROPOUTGOING'}{'off'} = ''; |
79 | $checked{'DROPOUTGOING'}{'on'} = ''; | |
80 | $checked{'DROPOUTGOING'}{$settings{'DROPOUTGOING'}} = "checked='checked'"; | |
5595bc03 CS |
81 | $checked{'DROPPORTSCAN'}{'off'} = ''; |
82 | $checked{'DROPPORTSCAN'}{'on'} = ''; | |
83 | $checked{'DROPPORTSCAN'}{$settings{'DROPPORTSCAN'}} = "checked='checked'"; | |
42dc0090 CS |
84 | $checked{'DROPWIRELESSINPUT'}{'off'} = ''; |
85 | $checked{'DROPWIRELESSINPUT'}{'on'} = ''; | |
86 | $checked{'DROPWIRELESSINPUT'}{$settings{'DROPWIRELESSINPUT'}} = "checked='checked'"; | |
87 | $checked{'DROPWIRELESSFORWARD'}{'off'} = ''; | |
88 | $checked{'DROPWIRELESSFORWARD'}{'on'} = ''; | |
89 | $checked{'DROPWIRELESSFORWARD'}{$settings{'DROPWIRELESSFORWARD'}} = "checked='checked'"; | |
0aaef8e9 CS |
90 | $checked{'DROPPROXY'}{'off'} = ''; |
91 | $checked{'DROPPROXY'}{'on'} = ''; | |
92 | $checked{'DROPPROXY'}{$settings{'DROPPROXY'}} = "checked='checked'"; | |
93 | $checked{'DROPSAMBA'}{'off'} = ''; | |
94 | $checked{'DROPSAMBA'}{'on'} = ''; | |
95 | $checked{'DROPSAMBA'}{$settings{'DROPSAMBA'}} = "checked='checked'"; | |
15add1c8 AM |
96 | $checked{'SHOWCOLORS'}{'off'} = ''; |
97 | $checked{'SHOWCOLORS'}{'on'} = ''; | |
98 | $checked{'SHOWCOLORS'}{$settings{'SHOWCOLORS'}} = "checked='checked'"; | |
96502a5a AM |
99 | $checked{'SHOWREMARK'}{'off'} = ''; |
100 | $checked{'SHOWREMARK'}{'on'} = ''; | |
101 | $checked{'SHOWREMARK'}{$settings{'SHOWREMARK'}} = "checked='checked'"; | |
62fc8511 | 102 | $selected{'FWPOLICY'}{$settings{'FWPOLICY'}}= 'selected'; |
35fb9164 AM |
103 | $selected{'FWPOLICY1'}{$settings{'FWPOLICY1'}}= 'selected'; |
104 | ||
5595bc03 CS |
105 | |
106 | &Header::openbox('100%', 'center', $Lang::tr{'options fw'}); | |
107 | print "<form method='post' action='$ENV{'SCRIPT_NAME'}'>"; | |
108 | ||
109 | print <<END | |
110 | <form method='post' action='$ENV{'SCRIPT_NAME'}'> | |
111 | <table width='95%' cellspacing='0'> | |
112 | <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw logging'}</b></td></tr> | |
0b06ad05 | 113 | <tr><td align='left' width='60%'>$Lang::tr{'drop newnotsyn'}</td><td align='left'>on <input type='radio' name='DROPNEWNOTSYN' value='on' $checked{'DROPNEWNOTSYN'}{'on'} />/ |
5595bc03 | 114 | <input type='radio' name='DROPNEWNOTSYN' value='off' $checked{'DROPNEWNOTSYN'}{'off'} /> off</td></tr> |
0b06ad05 | 115 | <tr><td align='left' width='60%'>$Lang::tr{'drop input'}</td><td align='left'>on <input type='radio' name='DROPINPUT' value='on' $checked{'DROPINPUT'}{'on'} />/ |
5595bc03 | 116 | <input type='radio' name='DROPINPUT' value='off' $checked{'DROPINPUT'}{'off'} /> off</td></tr> |
6be0579b AM |
117 | <tr><td align='left' width='60%'>$Lang::tr{'drop forward'}</td><td align='left'>on <input type='radio' name='DROPFORWARD' value='on' $checked{'DROPFORWARD'}{'on'} />/ |
118 | <input type='radio' name='DROPFORWARD' value='off' $checked{'DROPFORWARD'}{'off'} /> off</td></tr> | |
5d7faa45 AM |
119 | <tr><td align='left' width='60%'>$Lang::tr{'drop outgoing'}</td><td align='left'>on <input type='radio' name='DROPOUTGOING' value='on' $checked{'DROPOUTGOING'}{'on'} />/ |
120 | <input type='radio' name='DROPOUTGOING' value='off' $checked{'DROPOUTGOING'}{'off'} /> off</td></tr> | |
0b06ad05 | 121 | <tr><td align='left' width='60%'>$Lang::tr{'drop portscan'}</td><td align='left'>on <input type='radio' name='DROPPORTSCAN' value='on' $checked{'DROPPORTSCAN'}{'on'} />/ |
5595bc03 | 122 | <input type='radio' name='DROPPORTSCAN' value='off' $checked{'DROPPORTSCAN'}{'off'} /> off</td></tr> |
0b06ad05 | 123 | <tr><td align='left' width='60%'>$Lang::tr{'drop wirelessinput'}</td><td align='left'>on <input type='radio' name='DROPWIRELESSINPUT' value='on' $checked{'DROPWIRELESSINPUT'}{'on'} />/ |
42dc0090 | 124 | <input type='radio' name='DROPWIRELESSINPUT' value='off' $checked{'DROPWIRELESSINPUT'}{'off'} /> off</td></tr> |
0b06ad05 | 125 | <tr><td align='left' width='60%'>$Lang::tr{'drop wirelessforward'}</td><td align='left'>on <input type='radio' name='DROPWIRELESSFORWARD' value='on' $checked{'DROPWIRELESSFORWARD'}{'on'} />/ |
42dc0090 | 126 | <input type='radio' name='DROPWIRELESSFORWARD' value='off' $checked{'DROPWIRELESSFORWARD'}{'off'} /> off</td></tr> |
5595bc03 | 127 | </table> |
15add1c8 AM |
128 | <br/> |
129 | ||
0aaef8e9 CS |
130 | <table width='95%' cellspacing='0'> |
131 | <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw blue'}</b></td></tr> | |
0b06ad05 | 132 | <tr><td align='left' width='60%'>$Lang::tr{'drop proxy'}</td><td align='left'>on <input type='radio' name='DROPPROXY' value='on' $checked{'DROPPROXY'}{'on'} />/ |
0aaef8e9 | 133 | <input type='radio' name='DROPPROXY' value='off' $checked{'DROPPROXY'}{'off'} /> off</td></tr> |
0b06ad05 | 134 | <tr><td align='left' width='60%'>$Lang::tr{'drop samba'}</td><td align='left'>on <input type='radio' name='DROPSAMBA' value='on' $checked{'DROPSAMBA'}{'on'} />/ |
0aaef8e9 CS |
135 | <input type='radio' name='DROPSAMBA' value='off' $checked{'DROPSAMBA'}{'off'} /> off</td></tr> |
136 | </table> | |
15add1c8 AM |
137 | <br> |
138 | <table width='95%' cellspacing='0'> | |
139 | <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw settings'}</b></td></tr> | |
140 | <tr><td align='left' width='60%'>$Lang::tr{'fw settings color'}</td><td align='left'>on <input type='radio' name='SHOWCOLORS' value='on' $checked{'SHOWCOLORS'}{'on'} />/ | |
141 | <input type='radio' name='SHOWCOLORS' value='off' $checked{'SHOWCOLORS'}{'off'} /> off</td></tr> | |
96502a5a AM |
142 | <tr><td align='left' width='60%'>$Lang::tr{'fw settings remark'}</td><td align='left'>on <input type='radio' name='SHOWREMARK' value='on' $checked{'SHOWREMARK'}{'on'} />/ |
143 | <input type='radio' name='SHOWREMARK' value='off' $checked{'SHOWREMARK'}{'off'} /> off</td></tr> | |
15add1c8 | 144 | </table> |
62fc8511 AM |
145 | <br /> |
146 | <table width='95%' cellspacing='0'> | |
147 | <tr bgcolor='$color{'color20'}'><td colspan='2' align='left'><b>$Lang::tr{'fw default drop'}</b></td></tr> | |
148 | <tr><td align='left' width='60%'>$Lang::tr{'drop action'}</td><td><select name='FWPOLICY'> | |
149 | <option value='DROP' $selected{'FWPOLICY'}{'DROP'}>DROP</option> | |
150 | <option value='REJECT' $selected{'FWPOLICY'}{'REJECT'}>REJECT</option></select> | |
151 | </td></tr> | |
5d7faa45 AM |
152 | <tr><td align='left' width='60%'>$Lang::tr{'drop action1'}</td><td><select name='FWPOLICY1'> |
153 | <option value='DROP' $selected{'FWPOLICY1'}{'DROP'}>DROP</option> | |
154 | <option value='REJECT' $selected{'FWPOLICY1'}{'REJECT'}>REJECT</option></select> | |
155 | </td></tr> | |
62fc8511 AM |
156 | </table> |
157 | ||
0aaef8e9 | 158 | <br /> |
5595bc03 CS |
159 | <table width='10%' cellspacing='0'> |
160 | <tr><td align='center'><form method='post' action='$ENV{'SCRIPT_NAME'}'> | |
62fc8511 AM |
161 | <input type='submit' name='ACTION' value=$Lang::tr{'save'} /> |
162 | </form></td></tr> | |
5595bc03 CS |
163 | </table> |
164 | </form> | |
165 | END | |
166 | ; | |
167 | &Header::closebox(); | |
168 | &Header::closebigbox(); | |
169 | &Header::closepage(); |