Project

General

Profile

Download (6.85 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
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12
 *
13
 * http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20
 */
21

    
22
// Global defines
23

    
24
// Automatic panel collapse
25
define('COLLAPSIBLE', 0x08);
26
define('SEC_CLOSED', 0x04);
27
define('SEC_OPEN', 0x00);
28

    
29
// IP address types
30
define("IPV4", 4);
31
define("IPV6", 6);
32
define("IPV4V6", 2);
33
define("ALIAS", 1);
34

    
35
// AddPassword method defines
36
define('DMYPWD', "********");
37

    
38
global $g;
39
$g = array(
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
	"tmp_path_user_code" => "/tmp/user_code",
54
	"conf_path" => "/conf",
55
	"conf_default_path" => "/conf.default",
56
	"cf_path" => "/cf",
57
	"cf_conf_path" => "/cf/conf",
58
	"www_path" => "/usr/local/www",
59
	"xml_rootobj" => "pfsense",
60
	"admin_group" => "admins",
61
	"product_name" => "pfSense",
62
	"product_version" => trim(file_get_contents("/etc/version"), " \n"),
63
	"product_copyright" => "Rubicon Communications, LLC (Netgate)",
64
	"product_copyright_url" => "https://pfsense.org/license",
65
	"product_copyright_years" => "2004 - ".date("Y"),
66
	"product_website" => "www.pfsense.org",
67
	"product_website_footer" => "https://www.pfsense.org/?gui=bootstrap",
68
	"product_email" => "coreteam@pfsense.org",
69
	"disablehelpmenu" => false,
70
	"disablehelpicon" => false,
71
	"disablecrashreporter" => false,
72
	"crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php",
73
	"debug" => false,
74
	"latest_config" => "17.0",
75
	"minimum_ram_warning" => "101",
76
	"minimum_ram_warning_text" => "128 MB",
77
	"wan_interface_name" => "wan",
78
	"captiveportal_path" => "/usr/local/captiveportal",
79
	"captiveportal_element_path" => "/var/db/cpelements",
80
	"captiveportal_element_sizelimit" => 1048576,
81
	"captiveportal_rules_interval" => 50,
82
	"services_dhcp_server_enable" => true,
83
	"wireless_regex" => "/^(ath|bwi|bwn|ipw|iwi|iwm|iwn|malo|mwl|ral|rsu|rum|run|uath|upgt|ural|urtw|urtwn|wi|wpi|wtap|zyd)[0-9]+/",
84
	"help_base_url" => "/help.php",
85
	"pkg_prefix" => "pfSense-pkg-",
86
	"default_timezone" => "Etc/UTC",
87
	"language" => "en_US",
88
	"default_config_backup_count" => 30
89
);
90

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

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

    
97
if (file_exists("/etc/version.patch")) {
98
	$g["product_version_patch"] = trim(file_get_contents("/etc/version.patch"), " \n");
99
} else {
100
	$g["product_version_patch"] = "0";
101
}
102

    
103
$g['product_version_string'] = $g['product_version'];
104
if (is_numeric($g["product_version_patch"]) && $g["product_version_patch"] != "0") {
105
	$g['product_version_string'] .= "-p{$g['product_version_patch']}";
106
}
107

    
108
/* XXX: Backward compatible */
109
$g['platform'] = $g['product_name'];
110

    
111
if (file_exists("{$g['etc_path']}/default-config-flavor")) {
112
	$flavor_array = file("{$g['etc_path']}/default-config-flavor");
113
	$g['default-config-flavor'] = chop($flavor_array[0]);
114
} else {
115
	$g['default-config-flavor'] = '';
116
}
117

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

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

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

    
175
/* Cache file used to store pfSense version */
176
$g["version_cache_file"] = "{$g['varrun_path']}/{$g['product_name']}_version";
177
$g['version_cache_refresh'] = 2 * 60 * 60; /* 2h */
178

    
179
function platform_booting($on_console = false) {
180
	global $g;
181

    
182
	if ($g['booting'] || file_exists("{$g['varrun_path']}/booting")) {
183
		if ($on_console == false || php_sapi_name() != 'fpm-fcgi') {
184
			return true;
185
		}
186
	}
187

    
188
	return false;
189
}
190

    
191
if (file_exists("{$g['cf_conf_path']}/enableserial_force")) {
192
	$g['enableserial_force'] = true;
193
}
194

    
195
$config_parsed = false;
196

    
197
/* Factory default check IP service. */
198
$factory_default_checkipservice = array(
199
	"enable" => true,
200
	"name" => 'Default',
201
	"url" => 'http://checkip.dyndns.org',
202
//	"username" => '',
203
//	"password" => '',
204
//	"verifysslpeer" => true,
205
	"descr" => 'Default Check IP Service'
206
);
207

    
208
$dyndns_split_domain_types = array("namecheap", "cloudflare", "cloudflare-v6", "gratisdns");
209
?>
(17-17/54)