Project

General

Profile

Download (6.65 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
<?php
2 307cd525 Bill Marquette
/* $Id$ */
3 5b237745 Scott Ullrich
/*
4 9ba87997 Phil Davis
	globals.inc
5
	part of pfSense (https://www.pfsense.org)
6
	Copyright (C) 2004-2010 Scott Ullrich
7
8
	Originally Part of m0n0wall
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 523855b0 Scott Ullrich
33
	pfSense_MODULE:	utils
34
35 5b237745 Scott Ullrich
*/
36
37 8346b5c4 jim-p
global $g;
38 5b237745 Scott Ullrich
$g = array(
39 1180e4f0 Sjon Hortensius
	"base_packages" => "siproxd",
40 0ae6daf8 Ermal
	"event_address" => "unix:///var/run/check_reload_status",
41 4b96b367 mgrooms
	"factory_shipped_username" => "admin",
42 46974905 Chris Buechler
	"factory_shipped_password" => "pfsense",
43 1ef7b568 Scott Ullrich
	"upload_path" => "/root",
44 e9e7d501 Matthew Grooms
	"dhcpd_chroot_path" => "/var/dhcpd",
45 6671b7cd Warren Baker
	"unbound_chroot_path" => "/var/unbound",
46 563771b1 Renato Botelho
	"var_path" => "/var",
47 e9e7d501 Matthew Grooms
	"varrun_path" => "/var/run",
48
	"varetc_path" => "/var/etc",
49
	"vardb_path" => "/var/db",
50
	"varlog_path" => "/var/log",
51
	"etc_path" => "/etc",
52
	"tmp_path" => "/tmp",
53
	"conf_path" => "/conf",
54
	"conf_default_path" => "/conf.default",
55
	"cf_path" => "/cf",
56
	"cf_conf_path" => "/cf/conf",
57
	"www_path" => "/usr/local/www",
58
	"xml_rootobj" => "pfsense",
59
	"admin_group" => "admins",
60 36d0358b Scott Ullrich
	"product_name" => "pfSense",
61 70497688 Renato Botelho
	"product_version" => trim(file_get_contents("/etc/version"), " \n"),
62 90a27e64 Chris Buechler
	"product_copyright" => "Electric Sheep Fencing LLC",
63
	"product_copyright_url" => "http://www.electricsheepfencing.com",
64 2bb93345 Tuyan Ozipek
	"product_copyright_years" => "2004 - ".date("Y"),
65 73113ce9 Ermal Luci
	"product_website" => "www.pfsense.org",
66 1180e4f0 Sjon Hortensius
	"product_website_footer" => "https://www.pfsense.org/?gui=bootstrap",
67 c57e9f90 Chris Buechler
	"product_email" => "coreteam@pfsense.org",
68 3d7639eb Scott Ullrich
	"hideplatform" => false,
69 3ff39566 Scott Ullrich
	"hidedownloadbackup" => false,
70 9beebb5e Renato Botelho
	"hidebackupbeforeupgrade" => false,
71 3b29612f Chris Buechler
	"disablehelpmenu" => false,
72 28181237 Renato Botelho
	"disablehelpicon" => false,
73 36365f49 Scott Ullrich
	"disablecrashreporter" => false,
74 f3109fac Chris Buechler
	"crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php",
75 e9e7d501 Matthew Grooms
	"debug" => false,
76 b061a3c6 Matt Smith
	"latest_config" => "12.4",
77 e9e7d501 Matthew Grooms
	"nopkg_platforms" => array("cdrom"),
78 67b0ed57 Chris Buechler
	"minimum_ram_warning" => "101",
79 9f274393 Chris Buechler
	"minimum_ram_warning_text" => "128 MB",
80 1180e4f0 Sjon Hortensius
	"wan_interface_name" => "wan",
81 e9e7d501 Matthew Grooms
	"captiveportal_path" => "/usr/local/captiveportal",
82
	"captiveportal_element_path" => "/var/db/cpelements",
83 c2d0699f Scott Ullrich
	"captiveportal_element_sizelimit" => 1048576,
84 e3a13b00 Scott Ullrich
	"services_dhcp_server_enable" => true,
85 8c62fa48 jim-p
	"wireless_regex" => "/^(ndis|wi|ath|an|ral|ural|iwi|wlan|rum|run|bwn|zyd|mwl|bwi|ipw|iwn|malo|uath|upgt|urtw|wpi)/",
86 0bd239d9 Renato Botelho
	"help_base_url" => "/help.php",
87 60ff91f1 Renato Botelho
	"pkg_prefix" => "pfSense-pkg-",
88
	"default_timezone" => "Etc/UTC"
89 5b237745 Scott Ullrich
);
90
91 a03e3c1f Bill Marquette
/* IP TOS flags */
92 ec6adc21 Bill Marquette
$iptos = array("lowdelay", "throughput", "reliability");
93 a03e3c1f Bill Marquette
94
/* TCP flags */
95 79cc9e6b bcyrill
$tcpflags = array("syn", "ack", "fin", "rst", "psh", "urg", "ece", "cwr");
96 a03e3c1f Bill Marquette
97 9ba87997 Phil Davis
if (file_exists("/etc/platform")) {
98 9a7f6731 Ermal
	$arch = php_uname("m");
99 9633e518 jim-p
100 5779ade6 Renato Botelho
	if (strstr($g['product_version'], "-RELEASE")) {
101 f5b23288 Renato Botelho
		/* This is only necessary for RELEASE */
102
		$arch = ($arch == "i386") ? "" : '/' . $arch;
103
		/* Full installs and NanoBSD use the same update directory and manifest in 2.x */
104
		$g['update_url']="https://updates.pfsense.org/_updaters{$arch}";
105
		$g['update_manifest']="https://updates.pfsense.org/manifest";
106
	} else {
107
		/* Full installs and NanoBSD use the same update directory and manifest in 2.x */
108
		$g['update_url']="https://snapshots.pfsense.org/FreeBSD_releng/10.1/{$arch}/pfSense_HEAD/.updaters/";
109
		$g['update_manifest']="https://updates.pfSense.org/manifest";
110
	}
111 9633e518 jim-p
112 03cc2016 Erik
	$g['platform'] = trim(file_get_contents("/etc/platform"));
113 9ba87997 Phil Davis
	if ($g['platform'] == "nanobsd") {
114 b4a9785a jim-p
		$g['firmware_update_text']="pfSense-*.img.gz";
115 9beebb5e Renato Botelho
		$g['hidedownloadbackup'] = true;
116
		$g['hidebackupbeforeupgrade'] = true;
117 fdcd8ac7 jim-p
118 aadf2c9f Scott Ullrich
	} else {
119 b4a9785a jim-p
		$g['firmware_update_text']="pfSense-*.tgz";
120 aadf2c9f Scott Ullrich
	}
121 b24a7390 Scott Ullrich
}
122
123 3a35f55f Scott Ullrich
/* Default sysctls */
124 1180e4f0 Sjon Hortensius
$sysctls = array("net.inet.ip.portrange.first" => "1024",
125
	"net.inet.tcp.blackhole" => "2",
126
	"net.inet.udp.blackhole" => "1",
127
	"net.inet.ip.random_id" => "1",
128
	"net.inet.tcp.drop_synfin" => "1",
129
	"net.inet.ip.redirect" => "1",
130
	"net.inet6.ip6.redirect" => "1",
131 20a3b436 Renato Botelho
	"net.inet6.ip6.use_tempaddr" => "0",
132
	"net.inet6.ip6.prefer_tempaddr" => "0",
133 1180e4f0 Sjon Hortensius
	"net.inet.tcp.syncookies" => "1",
134
	"net.inet.tcp.recvspace" => "65228",
135
	"net.inet.tcp.sendspace" => "65228",
136
	"net.inet.tcp.delayed_ack" => "0",
137
	"net.inet.udp.maxdgram" => "57344",
138
	"net.link.bridge.pfil_onlyip" => "0",
139
	"net.link.bridge.pfil_member" => "1",
140
	"net.link.bridge.pfil_bridge" => "0",
141
	"net.link.tap.user_open" => "1",
142
	"kern.randompid" => "347",
143
	"net.inet.ip.intr_queue_maxlen" => "1000",
144
	"hw.syscons.kbd_reboot" => "0",
145
	"net.inet.tcp.log_debug" => "0",
146
	"net.inet.tcp.tso" => "1",
147 feae85bc Scott Ullrich
	"net.inet.icmp.icmplim" => "0",
148 abe7607f Scott Ullrich
	"vfs.read_max" => "32",
149 2b7ca9b2 Ermal
	"kern.ipc.maxsockbuf" => "4262144",
150 c06240db Ermal
	"net.inet.ip.process_options" => 0,
151 b2b002cd Ermal
	"kern.random.sys.harvest.interrupt" => 0,
152
	"kern.random.sys.harvest.point_to_point" => 0,
153 f06ce79d Ermal
	"kern.random.sys.harvest.ethernet" => 0,
154 7d8b75ab Ermal
	"net.route.netisr_maxqlen" => 1024,
155 a3a1b24e Ermal
	"net.inet.udp.checksum" => 1,
156 2f5488df Ermal
	"net.inet.icmp.reply_from_interface" => 1,
157 ec5753e7 Ermal LUÇI
	"net.inet6.ip6.rfc6204w3" => 1,
158 c46f9695 Ermal
	"net.enc.out.ipsec_bpf_mask" => "0x0001",
159
	"net.enc.out.ipsec_filter_mask" => "0x0001",
160 dd8df8e1 Luiz Otavio O Souza
	"net.enc.in.ipsec_bpf_mask" => "0x0003",
161
	"net.enc.in.ipsec_filter_mask" => "0x0003",
162 62dc93d1 Chris Buechler
	"net.key.preferred_oldsa" => "0",
163 1dbe220c jim-p
	"net.inet.carp.senderr_demotion_factor" => 0, /* Do not demote CARP for interface send errors */
164
	"net.pfsync.carp_demotion_factor" => 0 /* Do not demote CARP for pfsync errors */
165 feae85bc Scott Ullrich
);
166 3a35f55f Scott Ullrich
167 8346b5c4 jim-p
/* Include override values for the above if needed. If the file doesn't exist, don't try to load it. */
168 9ba87997 Phil Davis
if (file_exists("/etc/inc/globals_override.inc")) {
169 8346b5c4 jim-p
	@include("globals_override.inc");
170 9ba87997 Phil Davis
}
171 8346b5c4 jim-p
172 16d6c1df Renato Botelho
function platform_booting($on_console = false) {
173 285ef132 Ermal LUÇI
	global $g;
174
175 9ba87997 Phil Davis
	if ($g['booting'] || file_exists("{$g['varrun_path']}/booting")) {
176
		if ($on_console == false || php_sapi_name() != 'fpm-fcgi') {
177 16d6c1df Renato Botelho
			return true;
178 9ba87997 Phil Davis
		}
179
	}
180 285ef132 Ermal LUÇI
181
	return false;
182
}
183 b8d09280 Ermal LUÇI
184 9ba87997 Phil Davis
if (file_exists("{$g['cf_conf_path']}/enableserial_force")) {
185 719db60e Ermal LUÇI
	$g['enableserial_force'] = true;
186 9ba87997 Phil Davis
}
187 719db60e Ermal LUÇI
188 1883455a Ermal
$config_parsed = false;
189 9734b054 Scott Ullrich
190 2b7ca9b2 Ermal
?>