Project

General

Profile

Download (6.72 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/* $Id$ */
3
/*
4
	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

    
33
	pfSense_MODULE:	utils
34

    
35
*/
36

    
37
global $g;
38
$g = array(
39
	"base_packages" => "siproxd",
40
	"event_address" => "unix:///var/run/check_reload_status",
41
	"factory_shipped_username" => "admin",
42
	"factory_shipped_password" => "pfsense",
43
	"upload_path" => "/root",
44
	"dhcpd_chroot_path" => "/var/dhcpd",
45
	"unbound_chroot_path" => "/var/unbound",
46
	"var_path" => "/var",
47
	"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
	"product_name" => "pfSense",
61
	"product_version" => trim(file_get_contents("/etc/version"), " \n"),
62
	"product_copyright" => "Electric Sheep Fencing LLC",
63
	"product_copyright_url" => "http://www.electricsheepfencing.com",
64
	"product_copyright_years" => "2004 - ".date("Y"),
65
	"product_website" => "www.pfsense.org",
66
	"product_website_footer" => "https://www.pfsense.org/?gui=bootstrap",
67
	"product_email" => "coreteam@pfsense.org",
68
	"hideplatform" => false,
69
	"hidedownloadbackup" => false,
70
	"hidebackupbeforeupgrade" => false,
71
	"disablethemeselection" => false,
72
	"disablehelpmenu" => false,
73
	"disablehelpicon" => false,
74
	"disablecrashreporter" => false,
75
	"crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php",
76
	"debug" => false,
77
	"latest_config" => "12.3",
78
	"nopkg_platforms" => array("cdrom"),
79
	"minimum_ram_warning" => "101",
80
	"minimum_ram_warning_text" => "128 MB",
81
	"wan_interface_name" => "wan",
82
	"captiveportal_path" => "/usr/local/captiveportal",
83
	"captiveportal_element_path" => "/var/db/cpelements",
84
	"captiveportal_element_sizelimit" => 1048576,
85
	"services_dhcp_server_enable" => true,
86
	"wireless_regex" => "/^(ndis|wi|ath|an|ral|ural|iwi|wlan|rum|run|bwn|zyd|mwl|bwi|ipw|iwn|malo|uath|upgt|urtw|wpi)/",
87
	"help_base_url" => "/help.php",
88
	"pkg_prefix" => "pfSense-pkg-",
89
	"default_timezone" => "Etc/UTC"
90
);
91

    
92
/* IP TOS flags */
93
$iptos = array("lowdelay", "throughput", "reliability");
94

    
95
/* TCP flags */
96
$tcpflags = array("syn", "ack", "fin", "rst", "psh", "urg", "ece", "cwr");
97

    
98
if (file_exists("/etc/platform")) {
99
	$arch = php_uname("m");
100

    
101
	if (strstr($g['product_version'], "-RELEASE")) {
102
		/* This is only necessary for RELEASE */
103
		$arch = ($arch == "i386") ? "" : '/' . $arch;
104
		/* Full installs and NanoBSD use the same update directory and manifest in 2.x */
105
		$g['update_url']="https://updates.pfsense.org/_updaters{$arch}";
106
		$g['update_manifest']="https://updates.pfsense.org/manifest";
107
	} else {
108
		/* Full installs and NanoBSD use the same update directory and manifest in 2.x */
109
		$g['update_url']="https://snapshots.pfsense.org/FreeBSD_releng/10.1/{$arch}/pfSense_HEAD/.updaters/";
110
		$g['update_manifest']="https://updates.pfSense.org/manifest";
111
	}
112

    
113
	$g['platform'] = trim(file_get_contents("/etc/platform"));
114
	if ($g['platform'] == "nanobsd") {
115
		$g['firmware_update_text']="pfSense-*.img.gz";
116
		$g['hidedownloadbackup'] = true;
117
		$g['hidebackupbeforeupgrade'] = true;
118

    
119
	} else {
120
		$g['firmware_update_text']="pfSense-*.tgz";
121
	}
122
}
123

    
124
/* Default sysctls */
125
$sysctls = array("net.inet.ip.portrange.first" => "1024",
126
	"net.inet.tcp.blackhole" => "2",
127
	"net.inet.udp.blackhole" => "1",
128
	"net.inet.ip.random_id" => "1",
129
	"net.inet.tcp.drop_synfin" => "1",
130
	"net.inet.ip.redirect" => "1",
131
	"net.inet6.ip6.redirect" => "1",
132
	"net.inet6.ip6.use_tempaddr" => "0",
133
	"net.inet6.ip6.prefer_tempaddr" => "0",
134
	"net.inet.tcp.syncookies" => "1",
135
	"net.inet.tcp.recvspace" => "65228",
136
	"net.inet.tcp.sendspace" => "65228",
137
	"net.inet.ip.fastforwarding" => "0",
138
	"net.inet.tcp.delayed_ack" => "0",
139
	"net.inet.udp.maxdgram" => "57344",
140
	"net.link.bridge.pfil_onlyip" => "0",
141
	"net.link.bridge.pfil_member" => "1",
142
	"net.link.bridge.pfil_bridge" => "0",
143
	"net.link.tap.user_open" => "1",
144
	"kern.randompid" => "347",
145
	"net.inet.ip.intr_queue_maxlen" => "1000",
146
	"hw.syscons.kbd_reboot" => "0",
147
	"net.inet.tcp.log_debug" => "0",
148
	"net.inet.tcp.tso" => "1",
149
	"net.inet.icmp.icmplim" => "0",
150
	"vfs.read_max" => "32",
151
	"kern.ipc.maxsockbuf" => "4262144",
152
	"net.inet.ip.process_options" => 0,
153
	"kern.random.sys.harvest.interrupt" => 0,
154
	"kern.random.sys.harvest.point_to_point" => 0,
155
	"kern.random.sys.harvest.ethernet" => 0,
156
	"net.route.netisr_maxqlen" => 1024,
157
	"net.inet.udp.checksum" => 1,
158
	"net.inet.icmp.reply_from_interface" => 1,
159
	"net.inet6.ip6.rfc6204w3" => 1,
160
	"net.enc.out.ipsec_bpf_mask" => "0x0001",
161
	"net.enc.out.ipsec_filter_mask" => "0x0001",
162
	"net.enc.in.ipsec_bpf_mask" => "0x0002",
163
	"net.enc.in.ipsec_filter_mask" => "0x0002",
164
	"net.key.preferred_oldsa" => "0",
165
	"net.inet.carp.senderr_demotion_factor" => 0, /* Do not demote CARP for interface send errors */
166
	"net.pfsync.carp_demotion_factor" => 0 /* Do not demote CARP for pfsync errors */
167
);
168

    
169
/* Include override values for the above if needed. If the file doesn't exist, don't try to load it. */
170
if (file_exists("/etc/inc/globals_override.inc")) {
171
	@include("globals_override.inc");
172
}
173

    
174
function platform_booting($on_console = false) {
175
	global $g;
176

    
177
	if ($g['booting'] || file_exists("{$g['varrun_path']}/booting")) {
178
		if ($on_console == false || php_sapi_name() != 'fpm-fcgi') {
179
			return true;
180
		}
181
	}
182

    
183
	return false;
184
}
185

    
186
if (file_exists("{$g['cf_conf_path']}/enableserial_force")) {
187
	$g['enableserial_force'] = true;
188
}
189

    
190
$config_parsed = false;
191

    
192
?>
(22-22/67)