1
|
<?php
|
2
|
/* ====================================================================
|
3
|
* Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
|
4
|
*
|
5
|
* Redistribution and use in source and binary forms, with or without modification,
|
6
|
* are permitted provided that the following conditions are met:
|
7
|
*
|
8
|
* 1. Redistributions of source code must retain the above copyright notice,
|
9
|
* this list of conditions and the following disclaimer.
|
10
|
*
|
11
|
* 2. Redistributions in binary form must reproduce the above copyright
|
12
|
* notice, this list of conditions and the following disclaimer in
|
13
|
* the documentation and/or other materials provided with the
|
14
|
* distribution.
|
15
|
*
|
16
|
* 3. All advertising materials mentioning features or use of this software
|
17
|
* must display the following acknowledgment:
|
18
|
* "This product includes software developed by the pfSense Project
|
19
|
* for use in the pfSense software distribution. (http://www.pfsense.org/).
|
20
|
*
|
21
|
* 4. The names "pfSense" and "pfSense Project" must not be used to
|
22
|
* endorse or promote products derived from this software without
|
23
|
* prior written permission. For written permission, please contact
|
24
|
* coreteam@pfsense.org.
|
25
|
*
|
26
|
* 5. Products derived from this software may not be called "pfSense"
|
27
|
* nor may "pfSense" appear in their names without prior written
|
28
|
* permission of the Electric Sheep Fencing, LLC.
|
29
|
*
|
30
|
* 6. Redistributions of any form whatsoever must retain the following
|
31
|
* acknowledgment:
|
32
|
*
|
33
|
* "This product includes software developed by the pfSense Project
|
34
|
* for use in the pfSense software distribution (http://www.pfsense.org/).
|
35
|
*
|
36
|
* THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
|
37
|
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
38
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
39
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
|
40
|
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
41
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
42
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
43
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
44
|
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
45
|
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
46
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
47
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
48
|
*
|
49
|
* ====================================================================
|
50
|
*
|
51
|
*/
|
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
|
// AddPassword method defines
|
62
|
define(DMYPWD, "********");
|
63
|
|
64
|
global $g;
|
65
|
$g = array(
|
66
|
"base_packages" => "siproxd",
|
67
|
"event_address" => "unix:///var/run/check_reload_status",
|
68
|
"factory_shipped_username" => "admin",
|
69
|
"factory_shipped_password" => "pfsense",
|
70
|
"upload_path" => "/root",
|
71
|
"dhcpd_chroot_path" => "/var/dhcpd",
|
72
|
"unbound_chroot_path" => "/var/unbound",
|
73
|
"var_path" => "/var",
|
74
|
"varrun_path" => "/var/run",
|
75
|
"varetc_path" => "/var/etc",
|
76
|
"vardb_path" => "/var/db",
|
77
|
"varlog_path" => "/var/log",
|
78
|
"etc_path" => "/etc",
|
79
|
"tmp_path" => "/tmp",
|
80
|
"conf_path" => "/conf",
|
81
|
"conf_default_path" => "/conf.default",
|
82
|
"cf_path" => "/cf",
|
83
|
"cf_conf_path" => "/cf/conf",
|
84
|
"www_path" => "/usr/local/www",
|
85
|
"xml_rootobj" => "pfsense",
|
86
|
"admin_group" => "admins",
|
87
|
"product_name" => "pfSense",
|
88
|
"product_version" => trim(file_get_contents("/etc/version"), " \n"),
|
89
|
"product_copyright" => "Electric Sheep Fencing LLC",
|
90
|
"product_copyright_url" => "https://pfsense.org/license",
|
91
|
"product_copyright_years" => "2004 - ".date("Y"),
|
92
|
"product_website" => "www.pfsense.org",
|
93
|
"product_website_footer" => "https://www.pfsense.org/?gui=bootstrap",
|
94
|
"product_email" => "coreteam@pfsense.org",
|
95
|
"hideplatform" => false,
|
96
|
"hidebackupbeforeupgrade" => false,
|
97
|
"disablehelpmenu" => false,
|
98
|
"disablehelpicon" => false,
|
99
|
"disablecrashreporter" => false,
|
100
|
"crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php",
|
101
|
"debug" => false,
|
102
|
"latest_config" => "13.4",
|
103
|
"nopkg_platforms" => array("cdrom"),
|
104
|
"minimum_ram_warning" => "101",
|
105
|
"minimum_ram_warning_text" => "128 MB",
|
106
|
"wan_interface_name" => "wan",
|
107
|
"captiveportal_path" => "/usr/local/captiveportal",
|
108
|
"captiveportal_element_path" => "/var/db/cpelements",
|
109
|
"captiveportal_element_sizelimit" => 1048576,
|
110
|
"services_dhcp_server_enable" => true,
|
111
|
"wireless_regex" => "/^(ndis|wi|ath|an|ral|ural|iwi|wlan|rum|run|bwn|zyd|mwl|bwi|ipw|iwn|malo|uath|upgt|urtw|wpi)/",
|
112
|
"help_base_url" => "/help.php",
|
113
|
"pkg_prefix" => "pfSense-pkg-",
|
114
|
"default_timezone" => "Etc/UTC"
|
115
|
);
|
116
|
|
117
|
/* IP TOS flags */
|
118
|
$iptos = array("lowdelay", "throughput", "reliability");
|
119
|
|
120
|
/* TCP flags */
|
121
|
$tcpflags = array("syn", "ack", "fin", "rst", "psh", "urg", "ece", "cwr");
|
122
|
|
123
|
if (file_exists("/etc/platform")) {
|
124
|
$arch = php_uname("m");
|
125
|
|
126
|
if (strstr($g['product_version'], "-RELEASE")) {
|
127
|
/* This is only necessary for RELEASE */
|
128
|
$arch = ($arch == "i386") ? "" : '/' . $arch;
|
129
|
/* Full installs and NanoBSD use the same update directory and manifest in 2.x */
|
130
|
$g['update_url']="https://updates.pfsense.org/_updaters{$arch}";
|
131
|
$g['update_manifest']="https://updates.pfsense.org/manifest";
|
132
|
} else {
|
133
|
/* Full installs and NanoBSD use the same update directory and manifest in 2.x */
|
134
|
$g['update_url']="https://snapshots.pfsense.org/FreeBSD_releng/10.1/{$arch}/pfSense_HEAD/.updaters/";
|
135
|
$g['update_manifest']="https://updates.pfSense.org/manifest";
|
136
|
}
|
137
|
|
138
|
$g['platform'] = trim(file_get_contents("/etc/platform"));
|
139
|
if ($g['platform'] == "nanobsd") {
|
140
|
$g['firmware_update_text']="pfSense-*.img.gz";
|
141
|
$g['hidebackupbeforeupgrade'] = true;
|
142
|
|
143
|
} else {
|
144
|
$g['firmware_update_text']="pfSense-*.tgz";
|
145
|
}
|
146
|
}
|
147
|
|
148
|
/* Default sysctls */
|
149
|
$sysctls = array("net.inet.ip.portrange.first" => "1024",
|
150
|
"net.inet.tcp.blackhole" => "2",
|
151
|
"net.inet.udp.blackhole" => "1",
|
152
|
"net.inet.ip.random_id" => "1",
|
153
|
"net.inet.tcp.drop_synfin" => "1",
|
154
|
"net.inet.ip.redirect" => "1",
|
155
|
"net.inet6.ip6.redirect" => "1",
|
156
|
"net.inet6.ip6.use_tempaddr" => "0",
|
157
|
"net.inet6.ip6.prefer_tempaddr" => "0",
|
158
|
"net.inet.tcp.syncookies" => "1",
|
159
|
"net.inet.tcp.recvspace" => "65228",
|
160
|
"net.inet.tcp.sendspace" => "65228",
|
161
|
"net.inet.tcp.delayed_ack" => "0",
|
162
|
"net.inet.udp.maxdgram" => "57344",
|
163
|
"net.link.bridge.pfil_onlyip" => "0",
|
164
|
"net.link.bridge.pfil_member" => "1",
|
165
|
"net.link.bridge.pfil_bridge" => "0",
|
166
|
"net.link.tap.user_open" => "1",
|
167
|
"kern.randompid" => "347",
|
168
|
"net.inet.ip.intr_queue_maxlen" => "1000",
|
169
|
"hw.syscons.kbd_reboot" => "0",
|
170
|
"net.inet.tcp.log_debug" => "0",
|
171
|
"net.inet.tcp.tso" => "1",
|
172
|
"net.inet.icmp.icmplim" => "0",
|
173
|
"vfs.read_max" => "32",
|
174
|
"kern.ipc.maxsockbuf" => "4262144",
|
175
|
"net.inet.ip.process_options" => 0,
|
176
|
"kern.random.sys.harvest.interrupt" => 0,
|
177
|
"kern.random.sys.harvest.point_to_point" => 0,
|
178
|
"kern.random.sys.harvest.ethernet" => 0,
|
179
|
"net.route.netisr_maxqlen" => 1024,
|
180
|
"net.inet.udp.checksum" => 1,
|
181
|
"net.inet.icmp.reply_from_interface" => 1,
|
182
|
"net.inet6.ip6.rfc6204w3" => 1,
|
183
|
"net.enc.out.ipsec_bpf_mask" => "0x0001",
|
184
|
"net.enc.out.ipsec_filter_mask" => "0x0001",
|
185
|
"net.enc.in.ipsec_bpf_mask" => "0x0002",
|
186
|
"net.enc.in.ipsec_filter_mask" => "0x0002",
|
187
|
"net.key.preferred_oldsa" => "0",
|
188
|
"net.inet.carp.senderr_demotion_factor" => 0, /* Do not demote CARP for interface send errors */
|
189
|
"net.pfsync.carp_demotion_factor" => 0 /* Do not demote CARP for pfsync errors */
|
190
|
);
|
191
|
|
192
|
/* Include override values for the above if needed. If the file doesn't exist, don't try to load it. */
|
193
|
if (file_exists("/etc/inc/globals_override.inc")) {
|
194
|
@include("globals_override.inc");
|
195
|
}
|
196
|
|
197
|
function platform_booting($on_console = false) {
|
198
|
global $g;
|
199
|
|
200
|
if ($g['booting'] || file_exists("{$g['varrun_path']}/booting")) {
|
201
|
if ($on_console == false || php_sapi_name() != 'fpm-fcgi') {
|
202
|
return true;
|
203
|
}
|
204
|
}
|
205
|
|
206
|
return false;
|
207
|
}
|
208
|
|
209
|
if (file_exists("{$g['cf_conf_path']}/enableserial_force")) {
|
210
|
$g['enableserial_force'] = true;
|
211
|
}
|
212
|
|
213
|
$config_parsed = false;
|
214
|
|
215
|
?>
|