Project

General

Profile

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

    
67
// AddPassword method defines
68
define('DMYPWD', "********");
69

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

    
124
/* IP TOS flags */
125
$iptos = array("lowdelay", "throughput", "reliability");
126

    
127
/* TCP flags */
128
$tcpflags = array("syn", "ack", "fin", "rst", "psh", "urg", "ece", "cwr");
129

    
130
if (file_exists("/etc/version.patch")) {
131
	$g["product_version_patch"] = trim(file_get_contents("/etc/version.patch"), " \n");
132
} else {
133
	$g["product_version_patch"] = "0";
134
}
135

    
136
$g['product_version_string'] = $g['product_version'];
137
if (is_numeric($g["product_version_patch"]) && $g["product_version_patch"] != "0") {
138
	$g['product_version_string'] .= "-p{$g['product_version_patch']}";
139
}
140

    
141
if (file_exists("/etc/platform")) {
142
	$g['update_manifest']="https://updates.pfsense.org/manifest";
143
	$g['platform'] = trim(file_get_contents("/etc/platform"));
144
	if ($g['platform'] == "nanobsd") {
145
		$g['hidebackupbeforeupgrade'] = true;
146
		$g['default_config_backup_count'] = 5;
147
	} else {
148
		$g['default_config_backup_count'] = 30;
149
	}
150
} else {
151
	// shouldn't happen but "just in case" no platform were detected
152
	$g['platform'] = 'undetected';
153
	$g['default_config_backup_count'] = 30;
154
}
155

    
156

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

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

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

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

    
221
function platform_booting($on_console = false) {
222
	global $g;
223

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

    
230
	return false;
231
}
232

    
233
if (file_exists("{$g['cf_conf_path']}/enableserial_force")) {
234
	$g['enableserial_force'] = true;
235
}
236

    
237
$config_parsed = false;
238

    
239
/* Factory default check IP service. */
240
$factory_default_checkipservice = array(
241
	"enable" => true,
242
	"name" => 'Default',
243
	"url" => 'http://checkip.dyndns.org',
244
//	"username" => '',
245
//	"password" => '',
246
//	"verifysslpeer" => true,
247
	"descr" => 'Default Check IP Service'
248
);
249

    
250
$dyndns_split_domain_types = array("namecheap", "cloudflare", "cloudflare-v6", "gratisdns");
251
?>
(23-23/67)