Projet

Général

Profil

Télécharger (25,2 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / wizards / setup_wizard.xml @ a03943d2

1
<?xml version="1.0" encoding="utf-8" ?>
2
<pfsensewizard>
3
<copyright>
4
/* $Id$ */
5
/*
6
	setup.xml
7
        part of pfSense (https://www.pfsense.org/)
8

    
9
	Copyright (C) 2004, 2005 Scott Ullrich
10
        All rights reserved.
11

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

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

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

    
22
        THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
23
        INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
24
        AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25
        AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
26
        OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
        SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
        INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
        CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
        ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
        POSSIBILITY OF SUCH DAMAGE.
32
*/
33
</copyright>
34
<totalsteps>10</totalsteps>
35
<step>
36
	<id>1</id>
37
	<title>pfSense Setup Wizard</title>
38
	<disableheader>true</disableheader>
39
	<description>This wizard will guide you through the initial configuration of pfSense.&lt;br/&gt;&lt;br/&gt; The wizard may be stopped at any time by clicking the logo image at the top of the screen.</description>
40
	<fields>
41
		<field>
42
			<name>Next</name>
43
			<type>submit</type>
44
		</field>
45
	</fields>
46
	<stepbeforeformdisplay>
47
		conf_mount_rw();
48
		unlink_if_exists('/conf/trigger_initial_wizard');
49
		conf_mount_ro();
50
	</stepbeforeformdisplay>
51
</step>
52
<step>
53
	<id>2</id>
54
	<title>Bling your pfSense with pfSense Gold</title>
55
	<disableheader>true</disableheader>
56
	<description>Feel the power of a pfSense Gold subscription. Receive special benefits while supporting ongoing development of the Open Source pfSense project.&lt;br/&gt; &lt;br/&gt; Benefits include access to our AutoConfigBackup secure cloud based backup service for up to 10 hosts, pre-publication access to the updated pfSense: The Definitive Guide book in PDF, fully updated for the pfSense 2.1 release, and a monthly online MeetUp! Video conference to discuss and demonstrate advanced features and architectures using pfSense. &lt;br/&gt; &lt;br/&gt; Go to &lt;a href="https://www.pfsense.org/gold" target="_blank"&gt; pfSense Gold Subscriptions&lt;/a&gt; to sign up now &lt;br/&gt; &lt;br/&gt; </description>
57
	<fields>
58
		<field>
59
			<name>Next</name>
60
			<type>submit</type>
61
		</field>
62
	</fields>
63
</step>
64
<step>
65
	<id>3</id>
66
	<title>General Information</title>
67
	<description>On this screen you will set the general pfSense parameters.</description>
68
	<fields>
69
		<field>
70
			<name>Hostname</name>
71
			<type>input</type>
72
			<bindstofield>wizardtemp->system->hostname</bindstofield>
73
			<description>EXAMPLE: myserver</description>
74
			<validate>^[a-z0-9.|-]+$</validate>
75
			<message>Invalid Hostname</message>
76
		</field>
77
		<field>
78
			<name>Domain</name>
79
			<type>input</type>
80
			<bindstofield>wizardtemp->system->domain</bindstofield>
81
			<description>EXAMPLE: mydomain.com</description>
82
			<validate>^[a-z0-9.|-]+$</validate>
83
			<message>Domain name field is invalid</message>
84
		</field>
85
		<field>
86
			<name>Primary DNS Server</name>
87
			<type>input</type>
88
			<bindstofield>system->dnsserver</bindstofield>
89
			<!-- we must unset the fields because this is an array. -->
90
			<unsetfield>yes</unsetfield>
91
			<arraynum>0</arraynum>
92
			<validate>^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$</validate>
93
			<message>Primary DNS Server field is invalid</message>
94
		</field>
95
		<field>
96
			<name>Secondary DNS Server</name>
97
			<type>input</type>
98
			<bindstofield>system->dnsserver</bindstofield>
99
			<arraynum>1</arraynum>
100
			<validate>^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$</validate>
101
			<message>Secondary DNS Server field is invalid</message>
102
		</field>
103
		<field>
104
			<name>Override DNS</name>
105
			<description>Allow DNS servers to be overridden by DHCP/PPP on WAN</description>
106
			<type>checkbox</type>
107
			<bindstofield>system->dnsallowoverride</bindstofield>
108
		</field>
109
		<field>
110
			<name>Next</name>
111
			<type>submit</type>
112
		</field>
113
	</fields>
114
	<stepbeforeformdisplay>
115
		<![CDATA[
116
		$config['wizardtemp'] = array();
117
		$config['wizardtemp']['system'] = array();
118
		$config['wizardtemp']['system']['hostname'] = $config['system']['hostname'];
119
		$config['wizardtemp']['system']['domain'] = $config['system']['domain'];
120
		]]>
121
	</stepbeforeformdisplay>
122
	<stepsubmitphpaction>
123
		<![CDATA[
124
		if(empty($_POST['hostname']) || !is_hostname($_POST['hostname'])) {
125
			print_info_box_np("Hostname is invalid. Please press back in your browser window and correct.");
126
			die;
127
		}
128
		if(empty($_POST['domain']) || !is_domain($_POST['domain'])) {
129
			print_info_box_np("Domain is invalid. Please press back in your browser window and correct.");
130
			die;
131
		}
132
		if(!empty($_POST['primarydnsserver']) && !is_ipaddr($_POST['primarydnsserver'])) {
133
			print_info_box_np("Primary DNS server is invalid. Please press back in your browser window and correct.");
134
			die;
135
		}
136
		if(!empty($_POST['secondarydnsserver']) && !is_ipaddr($_POST['secondarydnsserver'])) {
137
			print_info_box_np("Second DNS server is invalid. Please press back in your browser window and correct.");
138
			die;
139
		}
140
		]]>
141
	</stepsubmitphpaction>
142
</step>
143
<step>
144
	<id>4</id>
145
	<title>Time Server Information</title>
146
	<description>Please enter the time, date and time zone.</description>
147
	<fields>
148
		<field>
149
			<name>Time server hostname</name>
150
			<description>Enter the hostname (FQDN) of the time server.</description>
151
			<type>input</type>
152
			<bindstofield>system->timeservers</bindstofield>
153
		</field>
154
		<field>
155
			<name>Timezone</name>
156
			<type>timezone_select</type>
157
			<bindstofield>system->timezone</bindstofield>
158
		</field>
159
		<field>
160
			<name>Next</name>
161
			<type>submit</type>
162
		</field>
163
	</fields>
164
	<stepsubmitphpaction>
165
		<![CDATA[
166
		foreach (explode(' ', $_POST['timeserverhostname']) as $ts) {
167
			if (!is_domain($ts)) {
168
				print_info_box_np(gettext("NTP Time Server names may only contain the characters a-z, 0-9, '-' and '.'. Entries may be separated by spaces. Please press back in your browser window and correct."));
169
				die;
170
			}
171
		}
172
		]]>
173
	</stepsubmitphpaction>
174
</step>
175
<step>
176
	<id>5</id>
177
	<disableallfieldsbydefault>true</disableallfieldsbydefault>
178
	<title>Configure WAN Interface</title>
179
	<description>On this screen we will configure the Wide Area Network information.</description>
180
	<javascriptafterformdisplay>
181
		var selectedItem = 0;
182
		if(document.forms[0].ipaddress.value == 'dhcp') {
183
			selectedItem = 1;
184
			document.forms[0].ipaddress.value = '';
185
		} else if(document.forms[0].ipaddress.value == 'pppoe') {
186
			selectedItem = 2;
187
			document.forms[0].ipaddress.value = '';
188
		} else if(document.forms[0].ipaddress.value == 'pptp') {
189
			selectedItem = 3;
190
			document.forms[0].ipaddress.value = '';
191
		} else if(document.forms[0].ipaddress.value == 'ppp' || document.forms[0].ipaddress.value == 'l2tp') {
192
			document.forms[0].ipaddress.value = '';
193
		} else {
194
			selectedItem = 0;
195
		}
196
		document.forms[0].selectedtype.selectedIndex = selectedItem;
197
		enableitems(selectedItem);
198
	</javascriptafterformdisplay>
199
	<fields>
200
		<field>
201
			<name>SelectedType</name>
202
			<type>select</type>
203
			<donotdisable>true</donotdisable>
204
			<options>
205
				<option>
206
					<name>Static</name>
207
					<value>Static</value>
208
					<enablefields>ipaddress,subnetmask,upstreamgateway</enablefields>
209
				</option>
210
				<option>
211
					<name>DHCP</name>
212
					<value>dhcp</value>
213
					<enablefields>dhcphostname</enablefields>
214
				</option>
215
				<option>
216
					<name>PPPoE</name>
217
					<value>pppoe</value>
218
					<enablefields>pppoeusername,pppoepassword,pppoeservicename,pppoedialondemand,pppoeidletimeout</enablefields>
219
				</option>
220
				<option>
221
					<name>PPTP</name>
222
					<value>pptp</value>
223
					<enablefields>pptpusername,pptppassword,pptplocalipaddress,pptplocalsubnet,pptpremoteipaddress,pptpdialondemand,pptpidletimeout
224
					</enablefields>
225
				</option>
226
			</options>
227
		</field>
228
		<field>
229
			<name>General configuration</name>
230
			<type>listtopic</type>
231
		</field>
232
		<field>
233
			<donotdisable>true</donotdisable>
234
			<name>MAC Address</name>
235
			<bindstofield>interfaces->wan->spoofmac</bindstofield>
236
			<type>input</type>
237
			<description> This field can be used to modify ("spoof") the MAC address of the WAN interface (may be required with some cable connections). Enter a MAC address in the following format: xx:xx:xx:xx:xx:xx or leave blank.</description>
238
			<validate>^([0-9a-f]{2}([:-]||$)){6}$</validate>
239
			<message>MAC Address field is invalid</message>
240
		</field>
241
		<field>
242
			<donotdisable>true</donotdisable>
243
			<name>MTU</name>
244
			<type>input</type>
245
			<bindstofield>interfaces->wan->mtu</bindstofield>
246
			<description> Set the MTU of the WAN interface. If you leave this field blank, an MTU of 1492 bytes for PPPoE and 1500 bytes for all other connection types will be assumed.</description>
247
		</field>
248
		<field>
249
			<donotdisable>true</donotdisable>
250
			<name>MSS</name>
251
			<type>input</type>
252
			<bindstofield>interfaces->wan->mss</bindstofield>
253
			<description> If you enter a value in this field, then MSS clamping for TCP connections to the value entered above minus 40 (TCP/IP header size) will be in effect. If you leave this field blank, an MSS of 1492 bytes for PPPoE and 1500 bytes for all other connection types will be assumed. This should match the above MTU value in most all cases.</description>
254
		</field>
255
		<field>
256
			<name>Static IP Configuration</name>
257
			<type>listtopic</type>
258
		</field>
259
		<field>
260
			<name>IP Address</name>
261
			<bindstofield>interfaces->wan->ipaddr</bindstofield>
262
			<type>input</type>
263
			<typehint> / </typehint>
264
			<combinefieldsbegin>true</combinefieldsbegin>
265
			<validate>^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$</validate>
266
			<message>IP Address field is invalid</message>
267
		</field>
268
		<field>
269
			<combinefieldsend>true</combinefieldsend>
270
			<dontdisplayname>true</dontdisplayname>
271
			<dontcombinecells>true</dontcombinecells>
272
			<name>Subnet Mask</name>
273
			<bindstofield>interfaces->wan->subnet</bindstofield>
274
			<type>subnet_select</type>
275
		</field>
276
		<field>
277
			<name>Upstream Gateway</name>
278
			<bindstofield>wizardtemp->wangateway</bindstofield>
279
			<type>input</type>
280
			<validate>^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$</validate>
281
			<message>Gateway IP Address field is invalid</message>
282
		</field>
283
		<field>
284
			<name>DHCP client configuration</name>
285
			<type>listtopic</type>
286
		</field>
287
		<field>
288
			<name>DHCP Hostname</name>
289
			<type>input</type>
290
			<bindstofield>interfaces->wan->dhcphostname</bindstofield>
291
			<description> The value in this field is sent as the DHCP client identifier and hostname when requesting a DHCP lease. Some ISPs may require this (for client identification).</description>
292
		</field>
293
		<field>
294
			<name>PPPoE configuration</name>
295
			<type>listtopic</type>
296
		</field>
297
		<field>
298
			<name>PPPoE Username</name>
299
			<type>input</type>
300
			<bindstofield>wizardtemp->wan->username</bindstofield>
301
		</field>
302
		<field>
303
			<name>PPPoE Password</name>
304
			<type>input</type>
305
			<bindstofield>wizardtemp->wan->password</bindstofield>
306
		</field>
307
		<field>
308
			<name>PPPoE Service name</name>
309
			<type>input</type>
310
			<description>Hint: this field can usually be left empty</description>
311
			<bindstofield>wizardtemp->wan->provider</bindstofield>
312
		</field>
313
		<field>
314
			<name>PPPoE Dial on demand</name>
315
			<typehint>Enable Dial-On-Demand mode</typehint>
316
			<type>checkbox</type>
317
			<description>This option causes the interface to operate in dial-on-demand mode, allowing you to have a virtual full time connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</description>
318
			<bindstofield>wizardtemp->wan->ondemand</bindstofield>
319
		</field>
320
		<field>
321
			<name>PPPoE Idle timeout</name>
322
			<type>input</type>
323
			<description>If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</description>
324
			<bindstofield>wizardtemp->wan->idletimeout</bindstofield>
325
		</field>
326
		<field>
327
			<name>PPTP configuration</name>
328
			<type>listtopic</type>
329
		</field>
330
		<field>
331
			<name>PPTP Username</name>
332
			<type>input</type>
333
			<bindstofield>wizardtemp->wan->pptpusername</bindstofield>
334
		</field>
335
		<field>
336
			<name>PPTP Password</name>
337
			<type>input</type>
338
			<bindstofield>wizardtemp->wan->pptppassword</bindstofield>
339
		</field>
340
		<field>
341
			<combinefieldsbegin>true</combinefieldsbegin>
342
			<name>PPTP Local IP Address</name>
343
			<type>input</type>
344
			<typehint> / </typehint>
345
			<bindstofield>wizardtemp->wan->localip</bindstofield>
346
			<validate>^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$</validate>
347
			<message>PPTP Local IP Address field is invalid</message>
348
		</field>
349
		<field>
350
			<combinefieldsend>true</combinefieldsend>
351
			<dontdisplayname>true</dontdisplayname>
352
			<dontcombinecells>true</dontcombinecells>
353
			<name>pptplocalsubnet</name>
354
			<bindstofield>wizardtemp->wan->subnet</bindstofield>
355
			<type>subnet_select</type>
356
		</field>
357
		<field>
358
			<name>PPTP Remote IP Address</name>
359
			<bindstofield>wizardtemp->wan->gateway</bindstofield>
360
			<type>input</type>
361
			<validate>^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$</validate>
362
			<message>PPTP Remote IP Address field is invalid</message>
363
		</field>
364
		<field>
365
			<name>PPTP Dial on demand</name>
366
			<typehint>Enable Dial-On-Demand mode</typehint>
367
			<type>checkbox</type>
368
			<bindstofield>wizardtemp->wan->pptpondemand</bindstofield>			
369
			<description>This option causes the interface to operate in dial-on-demand mode, allowing you to have a virtual full time connection. The interface is configured, but the actual connection of the link is delayed until qualifying outgoing traffic is detected.</description>
370
		</field>
371
		<field>
372
			<name>PPTP Idle timeout</name>
373
			<type>input</type>			
374
			<bindstofield>wizardtemp->wan->pptpidletimeout</bindstofield>
375
			<description>If no qualifying outgoing packets are transmitted for the specified number of seconds, the connection is brought down. An idle timeout of zero disables this feature.</description>
376
		</field>
377
		<field>
378
			<name>RFC1918 Networks</name>
379
			<type>listtopic</type>
380
		</field>
381
		<field>
382
			<donotdisable>true</donotdisable>
383
			<name>Block RFC1918 Private Networks</name>
384
			<description> When set, this option blocks traffic from IP addresses that are reserved for private networks as per RFC 1918 (10/8, 172.16/12, 192.168/16) as well as loopback addresses (127/8). You should generally leave this option turned on, unless your WAN network lies in such a private address space, too.</description>
385
			<type>checkbox</type>
386
			<bindstofield>interfaces->wan->blockpriv</bindstofield>
387
			<typehint>Block private networks from entering via WAN</typehint>
388
		</field>
389
		<field>
390
			<name>Block bogon networks</name>
391
			<type>listtopic</type>
392
		</field>
393
		<field>
394
			<donotdisable>true</donotdisable>
395
			<name>Block bogon networks</name>
396
			<description>When set, this option blocks traffic from IP addresses that are reserved (but not RFC 1918) or not yet assigned by IANA. Bogons are prefixes that should never appear in the Internet routing table, and obviously should not appear as the source address in any packets you receive.</description>
397
			<type>checkbox</type>
398
			<bindstofield>interfaces->wan->blockbogons</bindstofield>
399
			<typehint>Block non-Internet routed networks from entering via WAN</typehint>
400
		</field>
401
		<field>
402
			<name>Next</name>
403
			<type>submit</type>
404
		</field>
405
	</fields>
406
	<stepbeforeformdisplay>
407
		<![CDATA[
408
		if (is_array($config['gateways']['gateway_item']))
409
			foreach ($config['gateways']['gateway_item'] as $gw)
410
				if ($gw['name'] == 'WANGW' || (!empty($config['wizardtemp']['wangateway']) && $gw['gateway'] == $config['wizardtemp']['wangateway']))
411
					$config['wizardtemp']['wangateway'] = $gw['gateway'];
412
		]]>
413
	</stepbeforeformdisplay>
414
	<stepsubmitphpaction>
415
		<![CDATA[
416
		if(!empty($_POST['mtu']) && ($_POST['mtu'] < 576)) {
417
			print_info_box_np("MTU Must be at least 576 (Per RFC 791). Please press back in your browser window and correct.");
418
			die;
419
		}
420
		if(!empty($_POST['macaddress']) && !is_macaddr($_POST['macaddress'])) {
421
			print_info_box_np("Invalid MAC Address. Please press back in your browser window and correct.");
422
			die;
423
		}
424
		if(!empty($_POST['ipaddress']) && ($_POST['selectedtype'] == "Static")) {
425
			if (!is_ipaddr($_POST['ipaddress'])) {
426
				print_info_box_np("Invalid WAN IP Address. Please press back in your browser window and correct.");
427
				die;
428
			}
429
			if ($_POST['subnetmask'] < 31 &&
430
			    ($_POST['ipaddress'] == gen_subnet($_POST['ipaddress'], $_POST['subnetmask']) ||
431
			     $_POST['ipaddress'] == gen_subnet_max($_POST['ipaddress'], $_POST['subnetmask']))) {
432
				print_info_box_np("Invalid WAN IP Address. Please press back in your browser window and correct.");
433
				die;
434
			}
435
		}
436
		if(!empty($_POST['dhcphostname']) && !is_hostname($_POST['dhcphostname'])) {
437
			print_info_box_np("Invalid DHCP Hostname. Please press back in your browser window and correct.");
438
			die;
439
		}
440
		if(!empty($_POST['pptplocalipaddress']) && !is_ipaddr($_POST['pptplocalipaddress'])) {
441
			print_info_box_np("Invalid PPTP Local IP Address. Please press back in your browser window and correct.");
442
			die;
443
		}
444
		if(!empty($_POST['pptpremoteipaddress']) && !is_ipaddr($_POST['pptpremoteipaddress'])) {
445
			print_info_box_np("Invalid PPTP Remopte IP Address. Please press back in your browser window and correct.");
446
			die;
447
		}
448
		$type = $_POST['selectedtype'];
449

    
450
		if (!is_array($config['ppps']['ppp']))
451
			$config['ppps']['ppp'] = array();
452
		if (count($config['ppps']['ppp'])) {
453
			foreach ($config['ppps']['ppp'] as $pppid => $ppp) {
454
				if ($ppp['ptpid'] == "0") {
455
					if ((substr($config['interfaces']['wan']['if'],0,5) == "pppoe") || (substr($config['interfaces']['wan']['if'],0,4) == "pptp")) {
456
						$oldif = explode(",", $ppp['ports']);
457
						$config['interfaces']['wan']['if'] = $oldif[0];
458
					}
459
					if ($type == "pppoe" || $type == "pptp")
460
						unset($config['ppps']['ppp'][$pppid]);
461
				}
462
			}
463
		}
464

    
465
		if ($type == "pppoe" || $type == "pptp") {
466
			if ($type == "pptp") {
467
				$config['wizardtemp']['wan']['username'] = $config['wizardtemp']['wan']['pptpusername'];
468
				$config['wizardtemp']['wan']['password'] = $config['wizardtemp']['wan']['pptppassword'];
469
				$config['wizardtemp']['wan']['ondemand'] = $config['wizardtemp']['wan']['pptpondemand'];
470
				$config['wizardtemp']['wan']['idletimeout'] = $config['wizardtemp']['wan']['pptpidletimeout'];
471
				unset($config['wizardtemp']['wan']['pptpusername']);
472
				unset($config['wizardtemp']['wan']['pptppassword']);
473
				unset($config['wizardtemp']['wan']['pptpondemand']);
474
				unset($config['wizardtemp']['wan']['pptpidletimeout']);
475
			}
476
			$config['wizardtemp']['wan']['password'] = base64_encode($config['wizardtemp']['wan']['password']);
477
			$tmp = array();
478
			$tmp['ptpid'] = "0";
479
			$tmp['type'] = $type;
480
			$tmp['if'] = $type . "0";
481
			$tmp['ports'] = $config['interfaces']['wan']['if'];
482
			$config['ppps']['ppp'][] = array_merge($tmp, $config['wizardtemp']['wan']);
483
			unset($tmp);
484
			$config['interfaces']['wan']['if'] = $type."0";
485
		}
486
		unset($config['wizardtemp']['wan']);
487
		]]>
488
	</stepsubmitphpaction>
489
	<stepsubmitbeforesave>
490
		<![CDATA[
491
			if($_POST['selectedtype'] == "Static") { 
492
			
493
			} else {
494
				$_POST['ipaddress'] = $_POST['selectedtype'];
495
				$config['interfaces']['wan']['ipaddr'] = $_POST['selectedtype'];
496
				write_config();
497
				if(!$config['interfaces']['lan']) 
498
					header("Location: /wizard.php?xml=setup_wizard.xml&stepid=6&next=Next");
499
			}
500
		]]>
501
	</stepsubmitbeforesave>
502
</step>
503
<step>
504
	<id>6</id>
505
	<title>Configure LAN Interface</title>
506
	<description>On this screen we will configure the Local Area Network information.</description>
507
	<fields>
508
		<field>
509
			<name>LAN IP Address</name>
510
			<type>input</type>
511
			<bindstofield>interfaces->lan->ipaddr</bindstofield>
512
			<description>Type dhcp if this interface uses DHCP to obtain its IP address.</description>
513
			<validate>^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$</validate>
514
			<message>LAN IP Address field is invalid</message>
515
		</field>
516
				<field>
517
			<name>Subnet Mask</name>
518
			<type>subnet_select</type>
519
			<bindstofield>interfaces->lan->subnet</bindstofield>
520
		</field>
521
		<field>
522
			<name>Next</name>
523
			<type>submit</type>
524
		</field>
525
	</fields>
526
	<stepsubmitphpaction>
527
		<![CDATA[
528
		if(empty($_POST['lanipaddress']) || !is_ipaddr($_POST['lanipaddress'])) {
529
			print_info_box_np("Invalid LAN IP Address. Please press back in your browser window and correct.");
530
			die;
531
		}
532
		if ($_POST['subnetmask'] < 31 &&
533
		    ($_POST['lanipaddress'] == gen_subnet($_POST['lanipaddress'], $_POST['subnetmask']) ||
534
		     $_POST['lanipaddress'] == gen_subnet_max($_POST['lanipaddress'], $_POST['subnetmask']))) {
535
			print_info_box_np("Invalid LAN IP Address. Please press back in your browser window and correct.");
536
			die;
537
		}
538
		$ft = explode(".", $_POST['lanipaddress']);
539
		$ft_ip = $ft[0] . "." . $ft[1] . "." . $ft[2] . ".";
540
		$config['dhcpd']['lan']['range']['from'] = $ft_ip . "10";
541
		$highestip = gen_subnet_max($_POST['lanipaddress'], $config['interfaces']['lan']['subnet']);
542
		$hi = explode(".", $highestip);
543
		$highestip = $hi[3]-10;
544
		$config['dhcpd']['lan']['range']['to'] = $ft_ip . $highestip;
545
		]]>
546
	</stepsubmitphpaction>
547
</step>
548
<step>
549
	<id>7</id>
550
	<title>Set Admin WebGUI Password</title>
551
	<description>On this screen we will set the admin password, which is used to access the WebGUI and also SSH services if you wish to enable them.</description>
552
	<fields>
553
		<field>
554
			<name>Admin Password</name>
555
			<type>password</type>
556
		</field>
557
		<field>
558
			<name>Admin Password AGAIN</name>
559
			<type>password</type>
560
		</field>
561
		<field>
562
			<name>Next</name>
563
			<type>submit</type>
564
		</field>
565
	</fields>
566
	<stepsubmitphpaction>
567
	if($_POST['adminpassword'] != "") {
568
		if($_POST['adminpassword'] == $_POST['adminpasswordagain']) {
569
			$admin_user =&amp; getUserEntryByUID(0);
570
			local_user_set_password($admin_user, $_POST['adminpassword']);
571
			local_user_set($admin_user);
572
			write_config();
573
		} else {
574
			print_info_box_np("Passwords do not match!  Please press back in your browser window and correct.");
575
			die;
576
		}
577
	}
578
	</stepsubmitphpaction>
579
</step>
580
<step>
581
	<id>8</id>
582
	<title>Reload configuration</title>
583
	<disableheader>true</disableheader>
584
	<description>Click 'Reload' to reload pfSense with new changes.</description>
585
	<fields>
586
		<field>
587
			<name>Reload</name>
588
			<type>submit</type>
589
		</field>
590
	</fields>
591
</step>
592
<step>
593
	<id>9</id>
594
	<title>Reload in progress</title>
595
	<description>
596
		A reload is now in progress.  Please wait. &lt;p&gt; 
597
		&lt;meta http-equiv="refresh" content="5; url=wizard.php?xml=setup_wizard.xml&amp;stepid=9" &gt;
598
		&lt;p&gt;
599
		The wizard will redirect to the next step once the reload is completed.
600
	</description>
601
	<stepafterformdisplay>
602
		<![CDATA[
603
		$config['system']['hostname'] = $config['wizardtemp']['system']['hostname'];
604
		$config['system']['domain'] = $config['wizardtemp']['system']['domain'];
605
		if (!empty($config['wizardtemp']['wangateway'])) {
606
			if (!is_array($config['gateways']['gateway_item']))
607
				$config['gateways']['gateway_item'] = array();
608
			$found = false;
609
			$defaultgw_found = false;
610
			foreach ($config['gateways']['gateway_item'] as & $gw) {
611
				if ($gw['interface'] != "wan")
612
					continue;
613
				if (isset($gw['defaultgw']))
614
					$defaultgw_found = true;
615
				if ($gw['name'] == 'WANGW' || (!empty($config['wizardtemp']['wangateway']) && $gw['gateway'] == $config['wizardtemp']['wangateway'])) {
616
					$found = true;
617
					$gw['gateway'] = $config['wizardtemp']['wangateway'];
618
					$config['interfaces']['wan']['gateway'] = $gw['name'];
619
				}
620
			}
621
			if (!$found) {
622
				$newgw = array();
623
				$newgw['interface'] = "wan";
624
				$newgw['gateway'] = $config['wizardtemp']['wangateway'];
625
				$newgw['name'] = "WANGW";
626
				$newgw['weight'] = 1;
627
				$newgw['descr'] = "WAN Gateway";
628
				$newgw['defaultgw'] = !$defaultgw_found;
629
				$config['gateways']['gateway_item'][] = $newgw;
630
				$config['interfaces']['wan']['gateway'] = "WANGW";
631
			}
632
		}
633
		unset($config['wizardtemp']);
634
		write_config();
635
		reload_all();
636
		mwexec_bg("/etc/rc.update_bogons.sh now");
637
		]]>
638
	</stepafterformdisplay>
639
</step>
640
<step>
641
	<id>10</id>
642
	<title>Wizard completed.</title>
643
	<stepbeforeformdisplay>
644
	<![CDATA[
645
		if($g['product_name'] <> 'pfSense') {
646
			header("Location: " . fixup_string("\$myurl"));
647
			exit;
648
		}	
649
	]]>
650
	</stepbeforeformdisplay>
651
	<description>
652
	<![CDATA[
653
		Congratulations!  pfSense is now configured.<p/>
654
		Please consider donating to the project to help us with our overhead costs.<p/>
655
		Click <a target='_new' href='https://www.pfsense.org/j.php?jumpto=donate'>here</a> to donate or purchase services offered by the pfSense team.<p/>
656
		Click <a href='$myurl'>here</a> to continue on to pfSense webConfigurator.
657
	]]>
658
	</description>
659
</step>
660
</pfsensewizard>
(3-3/7)