Project

General

Profile

Download (18.6 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php
2
<?php
3
/*
4
	system_advanced.php
5
	part of m0n0wall (http://m0n0.ch/wall)
6

    
7
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
8
	All rights reserved.
9

    
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12

    
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15

    
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19

    
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31

    
32
require("guiconfig.inc");
33

    
34
$pconfig['disablefilter'] = $config['system']['disablefilter'];
35
$pconfig['disableftpproxy'] = $config['system']['disableftpproxy'];
36
$pconfig['filteringbridge_enable'] = isset($config['bridge']['filteringbridge']);
37
$pconfig['ipv6nat_enable'] = isset($config['diag']['ipv6nat']['enable']);
38
$pconfig['ipv6nat_ipaddr'] = $config['diag']['ipv6nat']['ipaddr'];
39
$pconfig['cert'] = base64_decode($config['system']['webgui']['certificate']);
40
$pconfig['key'] = base64_decode($config['system']['webgui']['private-key']);
41
$pconfig['disableconsolemenu'] = isset($config['system']['disableconsolemenu']);
42
$pconfig['disablefirmwarecheck'] = isset($config['system']['disablefirmwarecheck']);
43
$pconfig['expanddiags'] = isset($config['system']['webgui']['expanddiags']);
44
if ($g['platform'] == "generic-pc")
45
	$pconfig['harddiskstandby'] = $config['system']['harddiskstandby'];
46
$pconfig['noantilockout'] = isset($config['system']['webgui']['noantilockout']);
47
$pconfig['tcpidletimeout'] = $config['filter']['tcpidletimeout'];
48

    
49
$pconfig['schedulertype'] = $config['system']['schedulertype'];
50

    
51
if ($_POST) {
52

    
53
	unset($input_errors);
54
	$pconfig = $_POST;
55

    
56
	/* input validation */
57
	if ($_POST['ipv6nat_enable'] && !is_ipaddr($_POST['ipv6nat_ipaddr'])) {
58
		$input_errors[] = "You must specify an IP address to NAT IPv6 packets.";
59
	}
60
	if ($_POST['tcpidletimeout'] && !is_numericint($_POST['tcpidletimeout'])) {
61
		$input_errors[] = "The TCP idle timeout must be an integer.";
62
	}
63
	if (($_POST['cert'] && !$_POST['key']) || ($_POST['key'] && !$_POST['cert'])) {
64
		$input_errors[] = "Certificate and key must always be specified together.";
65
	} else if ($_POST['cert'] && $_POST['key']) {
66
		if (!strstr($_POST['cert'], "BEGIN CERTIFICATE") || !strstr($_POST['cert'], "END CERTIFICATE"))
67
			$input_errors[] = "This certificate does not appear to be valid.";
68
		if (!strstr($_POST['key'], "BEGIN RSA PRIVATE KEY") || !strstr($_POST['key'], "END RSA PRIVATE KEY"))
69
			$input_errors[] = "This key does not appear to be valid.";
70
	}
71

    
72
	if (!$input_errors) {
73
		if($_POST['disablefilter'] == "yes") {
74
			$config['system']['disablefilter'] = "enabled";
75
		} else {
76
			unset($config['system']['disablefilter']);
77
		}
78
		if($_POST['disableftpproxy'] == "yes") {
79
			$config['system']['disableftpproxy'] = "enabled";
80
		} else {
81
			unset($config['system']['disableftpproxy']);
82
		}
83
		$config['bridge']['filteringbridge'] = $_POST['filteringbridge_enable'] ? true : false;
84
		$config['diag']['ipv6nat']['enable'] = $_POST['ipv6nat_enable'] ? true : false;
85
		$config['diag']['ipv6nat']['ipaddr'] = $_POST['ipv6nat_ipaddr'];
86
		$oldcert = $config['system']['webgui']['certificate'];
87
		$oldkey = $config['system']['webgui']['private-key'];
88
		$config['system']['webgui']['certificate'] = base64_encode($_POST['cert']);
89
		$config['system']['webgui']['private-key'] = base64_encode($_POST['key']);
90
		$config['system']['disableconsolemenu'] = $_POST['disableconsolemenu'] ? true : false;
91
		$config['system']['disablefirmwarecheck'] = $_POST['disablefirmwarecheck'] ? true : false;
92
		$config['system']['webgui']['expanddiags'] = $_POST['expanddiags'] ? true : false;
93

    
94
		if ($g['platform'] == "generic-pc") {
95
			$oldharddiskstandby = $config['system']['harddiskstandby'];
96
			$config['system']['harddiskstandby'] = $_POST['harddiskstandby'];
97
		}
98
		$config['system']['webgui']['noantilockout'] = $_POST['noantilockout'] ? true : false;
99
		$config['filter']['tcpidletimeout'] = $_POST['tcpidletimeout'];
100

    
101
		$config['system']['schedulertype'] = $_POST['schedulertype'];
102

    
103
		write_config();
104

    
105
		if (($config['system']['webgui']['certificate'] != $oldcert)
106
				|| ($config['system']['webgui']['private-key'] != $oldkey)) {
107
			touch($d_sysrebootreqd_path);
108
		} else if (($g['platform'] == "generic-pc") && ($config['system']['harddiskstandby'] != $oldharddiskstandby)) {
109
			if (!$config['system']['harddiskstandby']) {
110
				// Reboot needed to deactivate standby due to a stupid ATA-protocol
111
				touch($d_sysrebootreqd_path);
112
				unset($config['system']['harddiskstandby']);
113
			} else {
114
				// No need to set the standby-time if a reboot is needed anyway
115
				system_set_harddisk_standby();
116
			}
117
		}
118

    
119
		$retval = 0;
120
		if (!file_exists($d_sysrebootreqd_path)) {
121
			config_lock();
122
			$retval = filter_configure();
123
			$retval |= interfaces_optional_configure();
124
			config_unlock();
125
		}
126
		$savemsg = get_std_save_message($retval);
127
	}
128
}
129
?>
130
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
131
<html>
132
<head>
133
<title><?=gentitle("System: Advanced functions");?></title>
134
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
135
<link href="gui.css" rel="stylesheet" type="text/css">
136
<script language="JavaScript">
137
<!--
138
function enable_change(enable_over) {
139
	if (document.iform.ipv6nat_enable.checked || enable_over) {
140
		document.iform.ipv6nat_ipaddr.disabled = 0;
141
	} else {
142
		document.iform.ipv6nat_ipaddr.disabled = 1;
143
	}
144
}
145
// -->
146
</script>
147
</head>
148

    
149
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
150
<form action="system_advanced.php" method="post" name="iform" id="iform">
151
<?php include("fbegin.inc"); ?>
152
      <p class="pgtitle">System: Advanced functions</p>
153
            <?php if ($input_errors) print_input_errors($input_errors); ?>
154
            <?php if ($savemsg) print_info_box($savemsg); ?>
155
            <p><span class="vexpl"><span class="red"><strong>Note: </strong></span>the
156
              options on this page are intended for use by advanced users only,
157
              and there's <strong>NO</strong> support for them.</span></p><br>
158

    
159
              <table width="100%" border="0" cellpadding="6" cellspacing="0">
160
                <tr>
161
                  <td colspan="2" valign="top" class="listtopic">FTP Proxy</td>
162
                </tr>
163
                <tr>
164
                  <td width="22%" valign="top" class="vncell">&nbsp;</td>
165
                  <td width="78%" class="vtable">
166
                    <input name="disableftpproxy" type="checkbox" id="disableftpproxy" value="yes" <?php if (isset($config['system']['disableftpproxy'])) echo "checked"; ?> onclick="enable_change(false)">
167
                    <strong class="vexpl">Disable the userland FTP-Proxy application</strong><br>
168
                </tr>
169
                <tr>
170
                  <td width="22%" valign="top">&nbsp;</td>
171
                  <td width="78%">
172
                    <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
173
                  </td>
174
                </tr>
175
                <tr>
176
                  <td colspan="2" class="list" height="12"></td>
177
                </tr>
178

    
179
                <tr>
180
                  <td colspan="2" valign="top" class="listtopic">Traffic Shaper Scheduler Type</td>
181
                </tr>
182
		<tr>
183
		  <td width="22%" valign="top" class="vncell"><b>Scheduler</b> </td>
184
		  <td width="78%" class="vtable">
185
		    <select id="schedulertype" name="schedulertype">
186
		    <?php
187
			    if($pconfig['schedulertype'] == 'priq')
188
				    echo "<option value=\"priq\">Priority based queueing</option>";
189
			    if($pconfig['schedulertype'] == 'cbq')
190
				    echo "<option value=\"cbq\">Class based queueing</option>";
191
			    if($pconfig['schedulertype'] == 'hfsc')
192
				    echo "<option value=\"hfsc\">Hierarchical Fair Service Curve queueing</option>";
193
		    ?>
194
			    <option value="priq">Priority based queueing</option>
195
			    <option value="cbq">Class based queueing</option>
196
			    <option value="hfsc">Hierarchical Fair Service Curve queueing</option>
197
		    </select>
198
		    <br> <span class="vexpl">Select which type of queueing you would like to use
199
		    </span></td>
200
		</tr>
201
                <tr>
202
                  <td width="22%" valign="top">&nbsp;</td>
203
                  <td width="78%">
204
                    <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
205
                  </td>
206
                </tr>
207
                <tr>
208
                  <td colspan="2" class="list" height="12"></td>
209
                </tr>
210

    
211
		<tr>
212
                  <td colspan="2" valign="top" class="listtopic">Disable Firewalling</td>
213
                </tr>
214
                <tr>
215
                  <td width="22%" valign="top" class="vncell">&nbsp;</td>
216
                  <td width="78%" class="vtable">
217
                    <input name="disablefilter" type="checkbox" id="disablefilter" value="yes" <?php if (isset($config['system']['disablefilter'])) echo "checked"; ?> onclick="enable_change(false)">
218
                    <strong>Disable the firewalls filter altogether.</strong><br>
219
                    <span class="vexpl">NOTE!  This basically converts pfSense into a routing only platform!</span></td>
220
                </tr>
221
                <tr>
222
                  <td width="22%" valign="top">&nbsp;</td>
223
                  <td width="78%">
224
                    <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
225
                  </td>
226
                </tr>
227
                <tr>
228
                  <td colspan="2" class="list" height="12"></td>
229
                </tr>
230

    
231
                <tr>
232
                  <td colspan="2" valign="top" class="listtopic">IPv6 tunneling</td>
233
                </tr>
234
                <tr>
235
                  <td width="22%" valign="top" class="vncell">&nbsp;</td>
236
                  <td width="78%" class="vtable">
237
                    <input name="ipv6nat_enable" type="checkbox" id="ipv6nat_enable" value="yes" <?php if ($pconfig['ipv6nat_enable']) echo "checked"; ?> onclick="enable_change(false)">
238
                    <strong>NAT encapsulated IPv6 packets (IP protocol 41/RFC2893)
239
                    to:</strong><br> <br> <input name="ipv6nat_ipaddr" type="text" class="formfld" id="ipv6nat_ipaddr" size="20" value="<?=htmlspecialchars($pconfig['ipv6nat_ipaddr']);?>">
240
                    &nbsp;(IP address)<span class="vexpl"><br>
241
                    Don't forget to add a firewall rule to permit IPv6 packets!</span></td>
242
                </tr>
243
                <tr>
244
                  <td width="22%" valign="top">&nbsp;</td>
245
                  <td width="78%">
246
                    <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
247
                  </td>
248
                </tr>
249
                <tr>
250
                  <td colspan="2" class="list" height="12"></td>
251
                </tr>
252
		<tr>
253
                  <td colspan="2" valign="top" class="listtopic">Filtering bridge</td>
254
                </tr>
255
                <tr>
256
                  <td width="22%" valign="top" class="vncell">&nbsp;</td>
257
                  <td width="78%" class="vtable">
258
                    <input name="filteringbridge_enable" type="checkbox" id="filteringbridge_enable" value="yes" <?php if ($pconfig['filteringbridge_enable']) echo "checked"; ?>>
259
                    <strong>Enable filtering bridge</strong><span class="vexpl"><br>
260
                    This will cause bridged packets to pass through the packet
261
                    filter in the same way as routed packets do (by default bridged
262
                    packets are always passed). If you enable this option, you'll
263
                    have to add filter rules to selectively permit traffic from
264
                    bridged interfaces.</span></td>
265
                </tr>
266
                <tr>
267
                  <td width="22%" valign="top">&nbsp;</td>
268
                  <td width="78%">
269
                    <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
270
                  </td>
271
                </tr>
272
                <tr>
273
                  <td colspan="2" class="list" height="12"></td>
274
                </tr>
275
                <tr>
276
                  <td colspan="2" valign="top" class="listtopic">webGUI SSL certificate/key</td>
277
                </tr>
278
                <tr>
279
                  <td width="22%" valign="top" class="vncell">Certificate</td>
280
                  <td width="78%" class="vtable">
281
                    <textarea name="cert" cols="65" rows="7" id="cert" class="formpre"><?=htmlspecialchars($pconfig['cert']);?></textarea>
282
                    <br>
283
                    Paste a signed certificate in X.509 PEM format here. <A target="_new" HREF='system_advanced_create_certs.php'>Create</a> certificates automatically.</td>
284
                </tr>
285
                <tr>
286
                  <td width="22%" valign="top" class="vncell">Key</td>
287
                  <td width="78%" class="vtable">
288
                    <textarea name="key" cols="65" rows="7" id="key" class="formpre"><?=htmlspecialchars($pconfig['key']);?></textarea>
289
                    <br>
290
                    Paste an RSA private key in PEM format here.</td>
291
                </tr>
292
                <tr>
293
                  <td width="22%" valign="top">&nbsp;</td>
294
                  <td width="78%">
295
                    <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
296
                  </td>
297
                </tr>
298
                <tr>
299
                  <td colspan="2" class="list" height="12"></td>
300
                </tr>
301
                <tr>
302
                  <td colspan="2" valign="top" class="listtopic">Miscellaneous</td>
303
                </tr>
304
				<tr>
305
                  <td width="22%" valign="top" class="vncell">Console menu </td>
306
                  <td width="78%" class="vtable">
307
                    <input name="disableconsolemenu" type="checkbox" id="disableconsolemenu" value="yes" <?php if ($pconfig['disableconsolemenu']) echo "checked"; ?>>
308
                    <strong>Disable console menu</strong><span class="vexpl"><br>
309
                    Changes to this option will take effect after a reboot.</span></td>
310
                </tr>
311
				<tr>
312
                  <td valign="top" class="vncell">Firmware version check </td>
313
                  <td class="vtable">
314
                    <input name="disablefirmwarecheck" type="checkbox" id="disablefirmwarecheck" value="yes" <?php if ($pconfig['disablefirmwarecheck']) echo "checked"; ?>>
315
                    <strong>Disable firmware version check</strong><span class="vexpl"><br>
316
    This will cause pfSense not to check for newer firmware versions when the <a href="system_firmware.php">System: Firmware</a> page is viewed.</span></td>
317
			    </tr>
318
				<tr>
319
                  <td valign="top" class="vncell">TCP idle timeout </td>
320
                  <td class="vtable">                    <span class="vexpl">
321
                    <input name="tcpidletimeout" type="text" class="formfld" id="tcpidletimeout" size="8" value="<?=htmlspecialchars($pconfig['tcpidletimeout']);?>">
322
                    seconds<br>
323
    Idle TCP connections will be removed from the state table after no packets have been received for the specified number of seconds. Don't set this too high or your state table could become full of connections that have been improperly shut down. The default is 2.5 hours.</span></td>
324
			    </tr>
325
				<tr>
326
                  <td width="22%" valign="top" class="vncell">Hard disk standby time </td>
327
                  <td width="78%" class="vtable">
328
                    <select name="harddiskstandby" class="formfld">
329
					<?php
330
                        /* Values from ATA-2
331
                           http://www.t13.org/project/d0948r3-ATA-2.pdf
332
                           Page 66 */
333
						$sbvals = explode(" ", "0.5,6 1,12 2,24 3,36 4,48 5,60 7.5,90 10,120 15,180 20,240 30,241 60,242");
334
					?>
335
                      <option value="" <?php if(!$pconfig['harddiskstandby']) echo('selected');?>>Always on</option>
336
					<?php
337
					foreach ($sbvals as $sbval):
338
						list($min,$val) = explode(",", $sbval); ?>
339
                      <option value="<?=$val;?>" <?php if($pconfig['harddiskstandby'] == $val) echo('selected');?>><?=$min;?> minutes</option>
340
					<?php endforeach; ?>
341
                    </select>
342
                    <br>
343
                    Puts the hard disk into standby mode when the selected amount of time after the last
344
                    access has elapsed. <em>Do not set this for CF cards.</em></td>
345
				</tr>
346
				<tr>
347
                  <td width="22%" valign="top" class="vncell">Navigation</td>
348
                  <td width="78%" class="vtable">
349
                    <input name="expanddiags" type="checkbox" id="expanddiags" value="yes" <?php if ($pconfig['expanddiags']) echo "checked"; ?>>
350
                    <strong>Keep diagnostics in navigation expanded </strong></td>
351
                </tr>
352
				<tr>
353
                  <td width="22%" valign="top" class="vncell">webGUI anti-lockout</td>
354
                  <td width="78%" class="vtable">
355
                    <input name="noantilockout" type="checkbox" id="noantilockout" value="yes" <?php if ($pconfig['noantilockout']) echo "checked"; ?>>
356
                    <strong>Disable webGUI anti-lockout rule</strong><br>
357
					By default, access to the webGUI on the LAN interface is always permitted, regardless of the user-defined filter rule set. Enable this feature to control webGUI access (make sure to have a filter rule in place that allows you in, or you will lock yourself out!).<br>
358
					Hint:
359
					the &quot;set LAN IP address&quot; option in the console menu  resets this setting as well.</td>
360
                </tr>
361
                <tr>
362
                  <td width="22%" valign="top">&nbsp;</td>
363
                  <td width="78%">
364
                    <input name="Submit" type="submit" class="formbtn" value="Save" onclick="enable_change(true)">
365
                  </td>
366
                </tr>
367
              </table>
368
</form>
369
            <script language="JavaScript">
370
<!--
371
enable_change(false);
372
//-->
373
</script>
374
<?php include("fend.inc"); ?>
375
</body>
376
</html>
(82-82/99)