Project

General

Profile

Download (5.59 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
	$pkg_interface = 'console';
38
	$g['booting'] = TRUE;
39
	touch("{$g['varrun_path']}/booting");
40

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

    
45
	echo "Loading configuration... ";
46
	parse_config_bootup();
47
	echo "done.\n";
48

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

    
52
	/*
53
	 *  Deterimine if we need to throw a interface exception
54
         *  and ask the user to reassign interfaces.  This will
55
         *  avoid a reboot and thats a good thing.
56
	 */
57
	$do_assign = 0;
58
	/* we need to ignore the vlan interface checks) */
59
	if(stristr($lan_if,"vlan") == false or stristr($wan_if,"vlan") == false) {
60
		if(does_interface_exist($lan_if) == false) {
61
			echo "\n\n\nLAN {$lan_if} interface mismatch.";
62
			$do_assign = 1;
63
		}
64
		if($config['interfaces']['wan']['ipaddr'] <> "pppoe" && $config['interfaces']['wan']['ipaddr'] <> "pptp" && $do_assign == 0) {
65
			if(does_interface_exist($wan_if) == false) {
66
				echo "\n\n\nWAN {$wan_if} interface mismatch.";
67
				$do_assign = 1;
68
			}
69
		}
70
		if($do_assign == 1) {
71
			$noreboot = true;
72
			echo " -- Running interface assignment option.\n";
73
			set_networking_interfaces_ports();
74
		}
75
	}
76

    
77
	/* convert config and clean backups */
78
	echo "Updating configuration... ";
79
	convert_config();
80
	echo "done.\n";
81

    
82
	echo "Cleaning backup cache... ";
83
	cleanup_backupcache(true);
84
	echo "done.\n";
85
	
86
	/* read in /etc/sysctl.conf and set values if needed */
87
	system_setup_sysctl();
88

    
89
	/* run any early shell commands specified in config.xml */
90
	system_do_shell_commands(1);
91

    
92
	/* save dmesg output to file */
93
	system_dmesg_save();
94

    
95
	/* set up our timezone */
96
	system_timezone_configure();
97

    
98
	/* set up our hostname */
99
	system_hostname_configure();
100

    
101
	/* make hosts file */
102
	system_hosts_generate();
103

    
104
	/* generate resolv.conf */
105
	system_resolvconf_generate();
106

    
107
	/* start pccardd */
108
	if (!in_array($g['platform'], $g['nopccard_platforms']))
109
		system_pccard_start();
110

    
111
	/* configure loopback interface */
112
	interfaces_loopback_configure();
113

    
114
	/* set up VLAN virtual interfaces */
115
	interfaces_vlan_configure();
116

    
117
	/* set up LAN interface */
118
	echo "Configuring LAN interface... ";
119
	mute_kernel_msgs();
120
	interfaces_lan_configure();
121
	unmute_kernel_msgs();
122
	echo "done.\n";
123

    
124
	/* set up WAN interface */
125
	echo "Configuring WAN interface... ";
126
	mute_kernel_msgs();
127
	interfaces_wan_configure();
128
	unmute_kernel_msgs();
129
	echo "done.\n";
130

    
131
	/* set up Optional interfaces */
132
	echo "Configuring OPT interfaces... ";
133
	mute_kernel_msgs();
134
	interfaces_optional_configure();
135
	unmute_kernel_msgs();
136
	echo "done.\n";
137
	
138
	/* setup carp interfaces */
139
	interfaces_carp_configure();
140

    
141
	unmute_kernel_msgs();
142

    
143
	/* start pflog */
144
	filter_pflog_start();
145

    
146
	/* setup altq + pf */
147
	echo "Configuring firewall... ";
148
	mute_kernel_msgs();
149
	filter_configure();
150
	unmute_kernel_msgs();
151
	echo "done.\n";
152

    
153
	/* bring up carp interfaces */
154
	interfaces_carp_bringup();
155

    
156
	/* start OpenVPN server & clients */
157
	ovpn_configure();
158

    
159
	/* set up static routes */
160
	system_routing_configure();
161

    
162
	/* enable routing */
163
	system_routing_enable();
164

    
165
	/* start syslogd */
166
	system_syslogd_start();
167

    
168
	/* start web server */
169
	system_webgui_start();
170

    
171
	/* configure console menu */
172
	system_console_configure();
173

    
174
	/* start dnsmasq service */
175
	services_dnsmasq_configure();
176

    
177
	/* start dyndns service */
178
	services_dyndns_configure();
179

    
180
	/* start DHCP service */
181
	services_dhcpd_configure();
182

    
183
	/* start SNMP service */
184
	services_snmpd_configure();
185

    
186
	/* start proxy ARP service */
187
	services_proxyarp_configure();
188

    
189
	/* start the NTP client */
190
	system_ntp_configure();
191

    
192
	/* start pptpd */
193
	vpn_pptpd_configure();
194

    
195
	/* start the captive portal */
196
	captiveportal_configure();
197

    
198
	/* execute the rc scripts of extensions */
199
	system_do_extensions();
200

    
201
	/* run any shell commands specified in config.xml */
202
	system_do_shell_commands();
203

    
204
	/* start ftp proxy helpers if they are enabled */
205
	echo "Starting FTP helpers... ";
206
	system_start_ftp_helpers();
207
	echo "done.\n";
208

    
209
	/* start IPsec tunnels */
210
	vpn_ipsec_configure();
211

    
212
	/* setup interface microcode which improves tcp/ip speed */
213
	setup_microcode();
214

    
215
	/* done */
216
	unlink("{$g['varrun_path']}/booting");
217
	$g['booting'] = FALSE;
218

    
219
?>
(22-22/52)