Project

General

Profile

Download (5.26 KB) Statistics
| Branch: | Tag: | Revision:
1
#!/usr/local/bin/php -f
2
<?php
3
/* $Id$ */
4
/*
5
	rc.bootup
6
	part of pfSense by Scott Ullrich
7
	originally based on m0n0wall (http://m0n0.ch/wall)
8

    
9
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
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

    
34
	require_once("globals.inc");
35

    
36
	/* let the other functions know we're booting */
37
	$g['booting'] = TRUE;
38
	touch("{$g['varrun_path']}/booting");
39

    
40
	/* parse the configuration and include all functions used below */
41
	require_once("config.inc");
42
	require_once("functions.inc");
43

    
44
	print "Loading configuration... ";
45
	parse_config_bootup();
46
	print "done.\n";
47

    
48
	$lan_if = $config['interfaces']['lan']['if'];
49
	$wan_if = get_real_wan_interface();
50

    
51
	$do_assign = 0;
52
	/* we need to ignore the vlan interface checks) */
53
	if(stristr($lan_if,"vlan") == false or stristr($wan_if,"vlan") == false) {
54
		if(does_interface_exist($lan_if) == false) {
55
			echo "\n\n\nLAN {$lan_if} interface mismatch.";
56
			$do_assign = 1;
57
		}
58
		if($config['interfaces']['wan']['ipaddr'] <> "pppoe" && $config['interfaces']['wan']['ipaddr'] <> "pptp" && $do_assign == 0) {
59
			if(does_interface_exist($wan_if) == false) {
60
				echo "\n\n\nWAN {$wan_if} interface mismatch.";
61
				$do_assign = 1;
62
			}
63
		}
64
		if($do_assign == 1) {
65
			$noreboot = true;
66
			echo " -- Running interface assignment option.\n";
67
			set_networking_interfaces_ports();
68
		}
69
	}
70

    
71
	/* convert config and clean backups */
72
	print "Updating configuration... ";
73
	convert_config();
74
	print "done.\n";
75

    
76
	print "Cleaning backup cache... ";
77
	cleanup_backupcache(true);
78
	
79
	/* read in /etc/sysctl.conf and set values if needed */
80
	system_setup_sysctl();
81

    
82
	/* run any early shell commands specified in config.xml */
83
	system_do_shell_commands(1);
84

    
85
	/* save dmesg output to file */
86
	system_dmesg_save();
87

    
88
	/* set up our timezone */
89
	system_timezone_configure();
90

    
91
	/* set up our hostname */
92
	system_hostname_configure();
93

    
94
	/* make hosts file */
95
	system_hosts_generate();
96

    
97
	/* generate resolv.conf */
98
	system_resolvconf_generate();
99

    
100
	/* start pccardd */
101
	if (!in_array($g['platform'], $g['nopccard_platforms']))
102
		system_pccard_start();
103

    
104
	/* configure loopback interface */
105
	interfaces_loopback_configure();
106

    
107
	/* set up VLAN virtual interfaces */
108
	interfaces_vlan_configure();
109

    
110
	/* set up LAN interface */
111
	print "Configuring LAN interface... ";
112
	mute_kernel_msgs();
113
	interfaces_lan_configure();
114
	unmute_kernel_msgs();
115
	print "done.\n";
116

    
117
	/* set up WAN interface */
118
	print "Configuring WAN interface... ";
119
	mute_kernel_msgs();
120
	interfaces_wan_configure();
121
	unmute_kernel_msgs();
122
	print "done.\n";
123

    
124
	/* set up Optional interfaces */
125
	mute_kernel_msgs();
126
	print "Configuring OPT interfaces...\n";
127
	interfaces_optional_configure();
128
	unmute_kernel_msgs();
129
	print "done.\n";
130
	
131
	/* setup carp interfaces */
132
	interfaces_carp_configure();
133

    
134
	unmute_kernel_msgs();
135

    
136
	/* start pflog */
137
	filter_pflog_start();
138

    
139
	/* setup altq + pf */
140
	print "Configuring firewall...\n";
141
	filter_configure();
142

    
143
	/* bring up carp interfaces */
144
	interfaces_carp_bringup();
145

    
146
	/* start OpenVPN server & clients */
147
	ovpn_configure();
148

    
149
	/* set up static routes */
150
	system_routing_configure();
151

    
152
	/* enable routing */
153
	system_routing_enable();
154

    
155
	/* start syslogd */
156
	system_syslogd_start();
157

    
158
	/* start web server */
159
	system_webgui_start();
160

    
161
	/* configure console menu */
162
	system_console_configure();
163

    
164
	/* start dnsmasq service */
165
	services_dnsmasq_configure();
166

    
167
	/* start dyndns service */
168
	services_dyndns_configure();
169

    
170
	/* start DHCP service */
171
	services_dhcpd_configure();
172

    
173
	/* start SNMP service */
174
	services_snmpd_configure();
175

    
176
	/* start proxy ARP service */
177
	services_proxyarp_configure();
178

    
179
	/* start the NTP client */
180
	system_ntp_configure();
181

    
182
	/* start pptpd */
183
	vpn_pptpd_configure();
184

    
185
	/* start the captive portal */
186
	captiveportal_configure();
187

    
188
	/* execute the rc scripts of extensions */
189
	system_do_extensions();
190

    
191
	/* run any shell commands specified in config.xml */
192
	system_do_shell_commands();
193

    
194
	/* start ftp proxy helpers if they are enabled */
195
	print "Starting FTP helpers... ";
196
	system_start_ftp_helpers();
197
	print "done.\n";
198

    
199
	/* start IPsec tunnels */
200
	vpn_ipsec_configure();
201

    
202
	setup_microcode();
203

    
204
	/* done */
205
	unlink("{$g['varrun_path']}/booting");
206
	$g['booting'] = FALSE;
207

    
208
?>
(22-22/52)