Project

General

Profile

Download (8.77 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* ====================================================================
3
 *	Copyright (c)  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
4
 *
5
 *	Redistribution and use in source and binary forms, with or without modification,
6
 *	are permitted provided that the following conditions are met:
7
 *
8
 *	1. Redistributions of source code must retain the above copyright notice,
9
 *		this list of conditions and the following disclaimer.
10
 *
11
 *	2. Redistributions in binary form must reproduce the above copyright
12
 *		notice, this list of conditions and the following disclaimer in
13
 *		the documentation and/or other materials provided with the
14
 *		distribution.
15
 *
16
 *	3. All advertising materials mentioning features or use of this software
17
 *		must display the following acknowledgment:
18
 *		"This product includes software developed by the pfSense Project
19
 *		 for use in the pfSense software distribution. (http://www.pfsense.org/).
20
 *
21
 *	4. The names "pfSense" and "pfSense Project" must not be used to
22
 *		 endorse or promote products derived from this software without
23
 *		 prior written permission. For written permission, please contact
24
 *		 coreteam@pfsense.org.
25
 *
26
 *	5. Products derived from this software may not be called "pfSense"
27
 *		nor may "pfSense" appear in their names without prior written
28
 *		permission of the Electric Sheep Fencing, LLC.
29
 *
30
 *	6. Redistributions of any form whatsoever must retain the following
31
 *		acknowledgment:
32
 *
33
 *	"This product includes software developed by the pfSense Project
34
 *	for use in the pfSense software distribution (http://www.pfsense.org/).
35
 *
36
 *	THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
37
 *	EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38
 *	IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
39
 *	PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
40
 *	ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41
 *	SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42
 *	NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43
 *	LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44
 *	HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45
 *	STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46
 *	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47
 *	OF THE POSSIBILITY OF SUCH DAMAGE.
48
 *
49
 *	====================================================================
50
 *
51
 */
52

    
53

    
54
// Global defines
55

    
56
// Automatic panel collapse
57
define('COLLAPSIBLE', 0x08);
58
define('SEC_CLOSED', 0x04);
59
define('SEC_OPEN', 0x00);
60

    
61
// AddPassword method defines
62
define('DMYPWD', "********");
63

    
64
global $g;
65
$g = array(
66
	"base_packages" => "siproxd",
67
	"event_address" => "unix:///var/run/check_reload_status",
68
	"factory_shipped_username" => "admin",
69
	"factory_shipped_password" => "pfsense",
70
	"upload_path" => "/root",
71
	"dhcpd_chroot_path" => "/var/dhcpd",
72
	"unbound_chroot_path" => "/var/unbound",
73
	"var_path" => "/var",
74
	"varrun_path" => "/var/run",
75
	"varetc_path" => "/var/etc",
76
	"vardb_path" => "/var/db",
77
	"varlog_path" => "/var/log",
78
	"etc_path" => "/etc",
79
	"tmp_path" => "/tmp",
80
	"conf_path" => "/conf",
81
	"conf_default_path" => "/conf.default",
82
	"cf_path" => "/cf",
83
	"cf_conf_path" => "/cf/conf",
84
	"www_path" => "/usr/local/www",
85
	"xml_rootobj" => "pfsense",
86
	"admin_group" => "admins",
87
	"product_name" => "pfSense",
88
	"product_version" => trim(file_get_contents("/etc/version"), " \n"),
89
	"product_copyright" => "Electric Sheep Fencing LLC",
90
	"product_copyright_url" => "https://pfsense.org/license",
91
	"product_copyright_years" => "2004 - ".date("Y"),
92
	"product_website" => "www.pfsense.org",
93
	"product_website_footer" => "https://www.pfsense.org/?gui=bootstrap",
94
	"product_email" => "coreteam@pfsense.org",
95
	"hideplatform" => false,
96
	"hidebackupbeforeupgrade" => false,
97
	"disablehelpmenu" => false,
98
	"disablehelpicon" => false,
99
	"disablecrashreporter" => false,
100
	"crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php",
101
	"debug" => false,
102
	"latest_config" => "15.4",
103
	"nopkg_platforms" => array("cdrom"),
104
	"minimum_ram_warning" => "101",
105
	"minimum_ram_warning_text" => "128 MB",
106
	"wan_interface_name" => "wan",
107
	"captiveportal_path" => "/usr/local/captiveportal",
108
	"captiveportal_element_path" => "/var/db/cpelements",
109
	"captiveportal_element_sizelimit" => 1048576,
110
	"services_dhcp_server_enable" => true,
111
	"wireless_regex" => "/^(ndis|wi|ath|an|ral|ural|iwi|wlan|rum|run|bwn|zyd|mwl|bwi|ipw|iwn|malo|uath|upgt|urtw|wpi)/",
112
	"help_base_url" => "/help.php",
113
	"pkg_prefix" => "pfSense-pkg-",
114
	"default_timezone" => "Etc/UTC",
115
	"language" => "en_US"
116
);
117

    
118
/* IP TOS flags */
119
$iptos = array("lowdelay", "throughput", "reliability");
120

    
121
/* TCP flags */
122
$tcpflags = array("syn", "ack", "fin", "rst", "psh", "urg", "ece", "cwr");
123

    
124
if (file_exists("/etc/version.patch")) {
125
	$g["product_version_patch"] = trim(file_get_contents("/etc/version.patch"), " \n");
126
} else {
127
	$g["product_version_patch"] = "0";
128
}
129

    
130
$g['product_version_string'] = $g['product_version'];
131
if (is_numeric($g["product_version_patch"]) && $g["product_version_patch"] != "0") {
132
	$g['product_version_string'] .= "-p{$g['product_version_patch']}";
133
}
134

    
135
if (file_exists("/etc/platform")) {
136
	$arch = php_uname("m");
137

    
138
	if (strstr($g['product_version'], "-RELEASE")) {
139
		/* This is only necessary for RELEASE */
140
		$arch = ($arch == "i386") ? "" : '/' . $arch;
141
		/* Full installs and NanoBSD use the same update directory and manifest in 2.x */
142
		$g['update_url']="https://updates.pfsense.org/_updaters{$arch}";
143
		$g['update_manifest']="https://updates.pfsense.org/manifest";
144
	} else {
145
		/* Full installs and NanoBSD use the same update directory and manifest in 2.x */
146
		$g['update_url']="https://snapshots.pfsense.org/FreeBSD_releng/10.1/{$arch}/pfSense_HEAD/.updaters/";
147
		$g['update_manifest']="https://updates.pfSense.org/manifest";
148
	}
149

    
150
	$g['platform'] = trim(file_get_contents("/etc/platform"));
151
	if ($g['platform'] == "nanobsd") {
152
		$g['firmware_update_text']="pfSense-*.img.gz";
153
		$g['hidebackupbeforeupgrade'] = true;
154

    
155
	} else {
156
		$g['firmware_update_text']="pfSense-*.tgz";
157
	}
158
}
159

    
160
if (file_exists("{$g['etc_path']}/default-config-flavor")) {
161
	$flavor_array = file("{$g['etc_path']}/default-config-flavor");
162
	$g['default-config-flavor'] = chop($flavor_array[0]);
163
} else {
164
	$g['default-config-flavor'] = '';
165
}
166

    
167
/* Default sysctls */
168
$sysctls = array("net.inet.ip.portrange.first" => "1024",
169
	"net.inet.tcp.blackhole" => "2",
170
	"net.inet.udp.blackhole" => "1",
171
	"net.inet.ip.random_id" => "1",
172
	"net.inet.tcp.drop_synfin" => "1",
173
	"net.inet.ip.redirect" => "1",
174
	"net.inet6.ip6.redirect" => "1",
175
	"net.inet6.ip6.use_tempaddr" => "0",
176
	"net.inet6.ip6.prefer_tempaddr" => "0",
177
	"net.inet.tcp.syncookies" => "1",
178
	"net.inet.tcp.recvspace" => "65228",
179
	"net.inet.tcp.sendspace" => "65228",
180
	"net.inet.tcp.delayed_ack" => "0",
181
	"net.inet.udp.maxdgram" => "57344",
182
	"net.link.bridge.pfil_onlyip" => "0",
183
	"net.link.bridge.pfil_member" => "1",
184
	"net.link.bridge.pfil_bridge" => "0",
185
	"net.link.tap.user_open" => "1",
186
	"kern.randompid" => "347",
187
	"net.inet.ip.intr_queue_maxlen" => "1000",
188
	"hw.syscons.kbd_reboot" => "0",
189
	"net.inet.tcp.log_debug" => "0",
190
	"net.inet.tcp.tso" => "1",
191
	"net.inet.icmp.icmplim" => "0",
192
	"vfs.read_max" => "32",
193
	"kern.ipc.maxsockbuf" => "4262144",
194
	"net.inet.ip.process_options" => 0,
195
	"kern.random.sys.harvest.interrupt" => 0,
196
	"kern.random.sys.harvest.point_to_point" => 0,
197
	"kern.random.sys.harvest.ethernet" => 0,
198
	"net.route.netisr_maxqlen" => 1024,
199
	"net.inet.udp.checksum" => 1,
200
	"net.inet.icmp.reply_from_interface" => 1,
201
	"net.inet6.ip6.rfc6204w3" => 1,
202
	"net.enc.out.ipsec_bpf_mask" => "0x0001",
203
	"net.enc.out.ipsec_filter_mask" => "0x0001",
204
	"net.enc.in.ipsec_bpf_mask" => "0x0002",
205
	"net.enc.in.ipsec_filter_mask" => "0x0002",
206
	"net.key.preferred_oldsa" => "0",
207
	"net.inet.carp.senderr_demotion_factor" => 0, /* Do not demote CARP for interface send errors */
208
	"net.pfsync.carp_demotion_factor" => 0, /* Do not demote CARP for pfsync errors */
209
	"net.raw.recvspace" => 65536,
210
	"net.raw.sendspace" => 65536,
211
	"net.inet.raw.recvspace" => 131072,
212
	"net.inet.raw.maxdgram" => 131072,
213
	"kern.corefile" => "/root/%N.core" /* Write all core files to /root/ so they do not consume space on other slices */
214
);
215

    
216
/* Include override values for the above if needed. If the file doesn't exist, don't try to load it. */
217
if (file_exists("/etc/inc/globals_override.inc")) {
218
	@include("globals_override.inc");
219
}
220

    
221
/* Read all XML files in following dir and load menu entries */
222
$g["ext_menu_path"] = "/usr/local/share/{$g['product_name']}/menu";
223

    
224
function platform_booting($on_console = false) {
225
	global $g;
226

    
227
	if ($g['booting'] || file_exists("{$g['varrun_path']}/booting")) {
228
		if ($on_console == false || php_sapi_name() != 'fpm-fcgi') {
229
			return true;
230
		}
231
	}
232

    
233
	return false;
234
}
235

    
236
if (file_exists("{$g['cf_conf_path']}/enableserial_force")) {
237
	$g['enableserial_force'] = true;
238
}
239

    
240
$config_parsed = false;
241

    
242
?>
(21-21/65)