Project

General

Profile

Download (6.92 KB) Statistics
| Branch: | Tag: | Revision:
1
<?php
2
/*
3
 * globals.inc
4
 *
5
 * part of pfSense (https://www.pfsense.org)
6
 * Copyright (c) 2004-2018 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
// Interface Name Size
36
define("IF_NAMESIZE", 15);	/* 16 minus the terminating NULL */
37

    
38
// AddPassword method defines
39
define('DMYPWD', "********");
40

    
41
global $g;
42
$g = array(
43
	"event_address" => "unix:///var/run/check_reload_status",
44
	"factory_shipped_username" => "admin",
45
	"factory_shipped_password" => "pfsense",
46
	"upload_path" => "/root",
47
	"dhcpd_chroot_path" => "/var/dhcpd",
48
	"unbound_chroot_path" => "/var/unbound",
49
	"var_path" => "/var",
50
	"varrun_path" => "/var/run",
51
	"varetc_path" => "/var/etc",
52
	"vardb_path" => "/var/db",
53
	"varlog_path" => "/var/log",
54
	"etc_path" => "/etc",
55
	"tmp_path" => "/tmp",
56
	"tmp_path_user_code" => "/tmp/user_code",
57
	"conf_path" => "/conf",
58
	"conf_default_path" => "/conf.default",
59
	"cf_path" => "/cf",
60
	"cf_conf_path" => "/cf/conf",
61
	"www_path" => "/usr/local/www",
62
	"xml_rootobj" => "pfsense",
63
	"admin_group" => "admins",
64
	"product_name" => "pfSense",
65
	"product_version" => trim(file_get_contents("/etc/version"), " \n"),
66
	"product_copyright" => "Rubicon Communications, LLC (Netgate)",
67
	"product_copyright_url" => "https://pfsense.org/license",
68
	"product_copyright_years" => "2004 - ".date("Y"),
69
	"product_website" => "www.pfsense.org",
70
	"product_website_footer" => "https://www.pfsense.org/?gui=bootstrap",
71
	"product_email" => "coreteam@pfsense.org",
72
	"disablehelpmenu" => false,
73
	"disablehelpicon" => false,
74
	"disablecrashreporter" => false,
75
	"crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php",
76
	"debug" => false,
77
	"latest_config" => "17.5",
78
	"minimum_ram_warning" => "101",
79
	"minimum_ram_warning_text" => "128 MB",
80
	"wan_interface_name" => "wan",
81
	"captiveportal_path" => "/usr/local/captiveportal",
82
	"captiveportal_element_path" => "/var/db/cpelements",
83
	"captiveportal_element_sizelimit" => 1048576,
84
	"captiveportal_rules_interval" => 50,
85
	"services_dhcp_server_enable" => true,
86
	"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]+/",
87
	"help_base_url" => "/help.php",
88
	"pkg_prefix" => "pfSense-pkg-",
89
	"default_timezone" => "Etc/UTC",
90
	"language" => "en_US",
91
	"default_config_backup_count" => 30
92
);
93

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

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

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

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

    
111
/* XXX: Backward compatible */
112
$g['platform'] = $g['product_name'];
113

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

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

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

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

    
181
function platform_booting($on_console = false) {
182
	global $g;
183

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

    
190
	return false;
191
}
192

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

    
197
$config_parsed = false;
198

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

    
210
$dyndns_split_domain_types = array("namecheap", "cloudflare", "cloudflare-v6", "gratisdns", "cloudns", "godaddy", "godaddy-v6");
211
?>
(17-17/55)