globals.inc 5.33 KB
Newer Older
Ad Schellevis's avatar
Ad Schellevis committed
1
<?php
2

Ad Schellevis's avatar
Ad Schellevis committed
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
/*
    Copyright (C) 2004-2010 Scott Ullrich
    Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
    All rights reserved.

    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions are met:

    1. Redistributions of source code must retain the above copyright notice,
       this list of conditions and the following disclaimer.

    2. Redistributions in binary form must reproduce the above copyright
       notice, this list of conditions and the following disclaimer in the
       documentation and/or other materials provided with the distribution.

    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    POSSIBILITY OF SUCH DAMAGE.
*/

global $g;
31 32 33 34

openlog('opnsense', LOG_ODELAY, LOG_USER);
register_shutdown_function('closelog');

Ad Schellevis's avatar
Ad Schellevis committed
35
$g = array(
36
	"base_packages" => "siproxd",
37
	"factory_shipped_username" => "root",
38
	"factory_shipped_password" => "opnsense",
Ad Schellevis's avatar
Ad Schellevis committed
39 40 41 42 43 44 45 46 47
	"upload_path" => "/root",
	"dhcpd_chroot_path" => "/var/dhcpd",
	"unbound_chroot_path" => "/var/unbound",
	"varrun_path" => "/var/run",
	"varetc_path" => "/var/etc",
	"vardb_path" => "/var/db",
	"varlog_path" => "/var/log",
	"xml_rootobj" => "pfsense",
	"admin_group" => "admins",
48
	"product_name" => "OPNsense",
49 50 51 52 53
	"product_website" => "https://opnsense.org",
	"product_email" => "project@opnsense.org",
	"product_copyright_owner" => "Deciso B.V.",
	"product_copyright_years" => "2014 - 2015",
	"product_copyright_url" => "https://www.deciso.com/",
54
	"crashreporterurl" => "https://crash.opnsense.org/",
Ad Schellevis's avatar
Ad Schellevis committed
55 56 57
	"latest_config" => "11.1",
	"minimum_ram_warning" => "101",
	"minimum_ram_warning_text" => "128 MB",
58
	"wan_interface_name" => "wan",
Ad Schellevis's avatar
Ad Schellevis committed
59
	"nopccard_platforms" => array("wrap", "net48xx"),
60
	"xmlrpcbaseurl" => "https://not.supported.opnsense.org",
Ad Schellevis's avatar
Ad Schellevis committed
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
	"captiveportal_path" => "/usr/local/captiveportal",
	"captiveportal_element_path" => "/var/db/cpelements",
	"captiveportal_element_sizelimit" => 1048576,
	"xmlrpcpath" => "/xmlrpc.php",
	"embeddedbootupslice" => "/dev/ad0a",
	"services_dhcp_server_enable" => true,
	"wireless_regex" => "/^(ndis|wi|ath|an|ral|ural|iwi|wlan|rum|run|bwn|zyd|mwl|bwi|ipw|iwn|malo|uath|upgt|urtw|wpi)/",
	"help_base_url" => "/help.php"
);

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

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

77
if(file_exists("/usr/local/etc/platform")) {
Ad Schellevis's avatar
Ad Schellevis committed
78 79 80 81 82
	$arch = php_uname("m");
	/* Do not remove this, it is not needed for the snapshots URL but is needed later for the -RELEASE/stable URLs */
	//$arch = ($arch == "i386") ? "" : '/' . $arch;

	/* Full installs and NanoBSD use the same update directory and manifest in 2.x */
83
	$g['update_url']="https://snapshots.opnsense.org/FreeBSD_releng/10.1/{$arch}/pfSense_HEAD/.updaters/";
84
	$g['update_manifest']="https://updates.opnsense.org/manifest";
Ad Schellevis's avatar
Ad Schellevis committed
85

86
	$g['platform'] = trim(file_get_contents("/usr/local/etc/platform"));
Ad Schellevis's avatar
Ad Schellevis committed
87
	if($g['platform'] == "nanobsd") {
88
		$g['firmware_update_text']="OPNsense-*.img.gz";
Ad Schellevis's avatar
Ad Schellevis committed
89
	} else {
90
		$g['firmware_update_text']="OPNsense-*.tgz";
Ad Schellevis's avatar
Ad Schellevis committed
91 92 93 94
	}
}

/* Default sysctls */
95 96
$sysctls = array(
	"net.inet.ip.portrange.first" => "1024",
97 98 99 100 101 102
	"net.inet.tcp.blackhole" => "2",
	"net.inet.udp.blackhole" => "1",
	"net.inet.ip.random_id" => "1",
	"net.inet.tcp.drop_synfin" => "1",
	"net.inet.ip.redirect" => "1",
	"net.inet6.ip6.redirect" => "1",
Ad Schellevis's avatar
Ad Schellevis committed
103 104
	"net.inet6.ip6.use_tempaddr" => "0",
	"net.inet6.ip6.prefer_tempaddr" => "0",
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
	"net.inet.tcp.syncookies" => "1",
	"net.inet.tcp.recvspace" => "65228",
	"net.inet.tcp.sendspace" => "65228",
	"net.inet.ip.fastforwarding" => "0",
	"net.inet.tcp.delayed_ack" => "0",
	"net.inet.udp.maxdgram" => "57344",
	"net.link.bridge.pfil_onlyip" => "0",
	"net.link.bridge.pfil_member" => "1",
	"net.link.bridge.pfil_bridge" => "0",
	"net.link.tap.user_open" => "1",
	"kern.randompid" => "347",
	"net.inet.ip.intr_queue_maxlen" => "1000",
	"hw.syscons.kbd_reboot" => "0",
	"net.inet.tcp.log_debug" => "0",
	"net.inet.tcp.tso" => "1",
Ad Schellevis's avatar
Ad Schellevis committed
120 121 122 123 124 125 126 127 128 129 130
	"net.inet.icmp.icmplim" => "0",
	"vfs.read_max" => "32",
	"kern.ipc.maxsockbuf" => "4262144",
	"debug.pfftpproxy" => "0",
	"net.inet.ip.process_options" => 0,
	"kern.random.sys.harvest.interrupt" => 0,
	"kern.random.sys.harvest.point_to_point" => 0,
	"kern.random.sys.harvest.ethernet" => 0,
	"net.route.netisr_maxqlen" => 1024,
	"net.inet.udp.checksum" => 1,
	"net.bpf.zerocopy_enable" => 1,
131 132
	"net.inet.icmp.reply_from_interface" => 1,
	"net.inet6.ip6.rfc6204w3" => 1,
Ad Schellevis's avatar
Ad Schellevis committed
133 134
);

135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
function is_install_media()
{
	/*
	 * Despite unionfs underneath, / is still not writeable,
	 * making the following the perfect test for install media.
	 */

	$file = '/.probe.for.install.media';
	$fd = @fopen($file, 'w');
	if ($fd) {
		fclose($fd);
		unlink($file);
		return false;
	}

	return true;
}

Ad Schellevis's avatar
Ad Schellevis committed
153
$config_parsed = false;