summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
Diffstat (limited to 'etc')
-rw-r--r--etc/inc/globals.inc2
-rw-r--r--etc/inc/gwlb.inc2
-rw-r--r--etc/inc/pkg-utils.inc12
-rw-r--r--etc/inc/rrd.inc35
-rw-r--r--etc/inc/service-utils.inc14
-rw-r--r--etc/inc/upgrade_config.inc40
-rw-r--r--etc/inc/vpn.inc3
-rw-r--r--etc/phpshellsessions/gitsync2
-rwxr-xr-xetc/rc.filter_synchronize7
-rwxr-xr-xetc/rc.start_packages80
-rwxr-xr-xetc/rc.stop_packages79
11 files changed, 206 insertions, 70 deletions
diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc
index 6993148..3bd0de2 100644
--- a/etc/inc/globals.inc
+++ b/etc/inc/globals.inc
@@ -91,7 +91,7 @@ $g = array(
"disablecrashreporter" => false,
"crashreporterurl" => "http://crashreporter.pfsense.org/crash_reporter.php",
"debug" => false,
- "latest_config" => "7.9",
+ "latest_config" => "8.0",
"nopkg_platforms" => array("cdrom"),
"minimum_ram_warning" => "101",
"minimum_ram_warning_text" => "128 MB",
diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc
index ce5a328..bb7e66b 100644
--- a/etc/inc/gwlb.inc
+++ b/etc/inc/gwlb.inc
@@ -372,6 +372,7 @@ function return_gateway_groups_array() {
$gateways_arr = return_gateways_array();
$gateway_groups_array = array();
+ if (0) {
/*
* NOTE: The code below is meant to replace the default gateway when it goes down.
* This facilitates services running on pfSense itself and are not handled by a PBR to continue working.
@@ -405,6 +406,7 @@ function return_gateway_groups_array() {
}
}
unset($upgw, $dfltgwfound, $dfltgwdown, $gwname, $gwsttng);
+ }
if (is_array($config['gateways']['gateway_group'])) {
foreach($config['gateways']['gateway_group'] as $group) {
diff --git a/etc/inc/pkg-utils.inc b/etc/inc/pkg-utils.inc
index 5c21428..070dade 100644
--- a/etc/inc/pkg-utils.inc
+++ b/etc/inc/pkg-utils.inc
@@ -42,6 +42,7 @@
require_once("globals.inc");
require_once("xmlrpc.inc");
+require_once("service-utils.inc");
if(file_exists("/cf/conf/use_xmlreader"))
require_once("xmlreader.inc");
else
@@ -324,6 +325,8 @@ function uninstall_package($pkg_name) {
}
}
+ stop_service($pkg_name);
+
$id = get_pkg_id($pkg_name);
if ($id >= 0) {
$pkg_depends =& $config['installedpackages']['package'][$id]['depends_on_package'];
@@ -892,7 +895,7 @@ function delete_package($pkg) {
}
function delete_package_xml($pkg) {
- global $g, $config, $static_output, $pkg_interface;
+ global $g, $config, $static_output, $pkg_interface, $rcfileprefix;
conf_mount_rw();
@@ -964,6 +967,13 @@ function delete_package_xml($pkg) {
if($instservice['name'] == $service['name']) {
if($g['booting'] != true)
stop_service($service['name']);
+ if($service['rcfile']) {
+ $prefix = $rcfileprefix;
+ if (!empty($service['prefix']))
+ $prefix = $service['prefix'];
+ if (file_exists("{$prefix}{$service['rcfile']}"))
+ @unlink("{$prefix}{$service['rcfile']}");
+ }
unset($services[$key]);
}
}
diff --git a/etc/inc/rrd.inc b/etc/inc/rrd.inc
index 529080c..d3de377 100644
--- a/etc/inc/rrd.inc
+++ b/etc/inc/rrd.inc
@@ -744,42 +744,7 @@ function enable_rrd_graphing() {
$rrdupdatesh .= "# polling Captive Portal for number of logged in users\n";
$rrdupdatesh .= "CP=`$php -q $captiveportal_gather loggedin`\n";
$rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$captiveportalloggedin \${CP}\n";
-
- $ifname= "captiveportal";
- if (!file_exists("$rrddbpath$ifname$captiveportaltotalusers")) {
- $rrdcreate = "$rrdtool create $rrddbpath$ifname$captiveportaltotalusers --step $rrdcaptiveportalinterval ";
- $rrdcreate .= "DS:totalusers:GAUGE:$captiveportalvalid:0:10000 ";
- $rrdcreate .= "RRA:AVERAGE:0.5:1:1000 ";
- $rrdcreate .= "RRA:AVERAGE:0.5:5:1100 ";
- $rrdcreate .= "RRA:AVERAGE:0.5:60:1175 ";
- $rrdcreate .= "RRA:AVERAGE:0.5:720:3000 ";
- $rrdcreate .= "RRA:MIN:0.5:1:1000 ";
- $rrdcreate .= "RRA:MIN:0.5:5:1100 ";
- $rrdcreate .= "RRA:MIN:0.5:60:1175 ";
- $rrdcreate .= "RRA:MIN:0.5:720:3000 ";
- $rrdcreate .= "RRA:MAX:0.5:1:1000 ";
- $rrdcreate .= "RRA:MAX:0.5:5:1100 ";
- $rrdcreate .= "RRA:MAX:0.5:60:1175 ";
- $rrdcreate .= "RRA:MAX:0.5:720:3000 ";
- $rrdcreate .= "RRA:LAST:0.5:1:1000 ";
- $rrdcreate .= "RRA:LAST:0.5:5:1100 ";
- $rrdcreate .= "RRA:LAST:0.5:60:1175 ";
- $rrdcreate .= "RRA:LAST:0.5:720:3000 ";
- create_new_rrd($rrdcreate);
- }
-
- /* enter UNKNOWN values in the RRD so it knows we rebooted. */
- if($g['booting']) {
- mwexec("$rrdtool update $rrddbpath$ifname$captiveportaltotalusers N:U");
- }
-
- /* the Captive Portal stats gathering function. */
- $rrdupdatesh .= "\n";
- $rrdupdatesh .= "# polling Captive Portal for number of concurrent users\n";
- $rrdupdatesh .= "CP=`$php -q $captiveportal_gather total`\n";
- $rrdupdatesh .= "$rrdtool update $rrddbpath$ifname$captiveportaltotalusers \${CP}\n";
-
}
$rrdupdatesh .= "sleep 60\n";
diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc
index 895eb57..57b1719 100644
--- a/etc/inc/service-utils.inc
+++ b/etc/inc/service-utils.inc
@@ -82,6 +82,9 @@ function start_service($name) {
global $config;
global $rcfileprefix;
+ if (empty($name))
+ return;
+
/* make sure service is stopped before starting */
stop_service($name);
sleep(2);
@@ -114,6 +117,9 @@ function stop_service($name) {
global $config;
global $rcfileprefix;
+ if (empty($name))
+ return;
+
if ($config['installedpackages']['service']) {
foreach($config['installedpackages']['service'] as $service) {
if(strtolower($service['name']) == strtolower($name)) {
@@ -122,7 +128,10 @@ function stop_service($name) {
if(!empty($service['prefix'])) {
$prefix =& $service['prefix'];
}
- mwexec_bg("{$prefix}{$service['rcfile']} stop");
+ if(file_exists("{$prefix}{$service['rcfile']}")) {
+ mwexec_bg("{$prefix}{$service['rcfile']} stop");
+ }
+ return;
}
if (!empty($service['stopcmd']))
eval($service['stopcmd']);
@@ -144,6 +153,9 @@ function stop_service($name) {
function restart_service($name) {
global $config;
+ if (empty($name))
+ return;
+
stop_service($name);
start_service($name);
diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc
index 77a8682..1646292 100644
--- a/etc/inc/upgrade_config.inc
+++ b/etc/inc/upgrade_config.inc
@@ -1804,13 +1804,26 @@ function upgrade_053_to_054() {
$lbpool_srv_arr = array();
$gateway_group_arr = array();
$gateways = return_gateways_array();
+ $group_name_changes = array();
if (! is_array($config['gateways']['gateway_item']))
$config['gateways']['gateway_item'] = array();
$a_gateways =& $config['gateways']['gateway_item'];
foreach($lbpool_arr as $lbpool) {
if($lbpool['type'] == "gateway") {
- $gateway_group['name'] = $lbpool['name'];
+ // Gateway Groups have to have valid names in pf, old lb pools did not. Clean them up.
+ $group_name = ereg_replace("[^A-Za-z0-9]", "", $lbpool['name'] );
+ // If we made and changes, check for collisions and note the change.
+ if ($group_name != $lbpool['name']) {
+ // Make sure the name isn't already in use.
+ foreach ($gateway_group_arr as $gwg) {
+ // If the name is in use, add some random bits to avoid collision.
+ if ($gwg['name'] == $group_name)
+ $group_name .= uniqid();
+ }
+ $group_name_changes[$lbpool['name']] = $group_name;
+ }
+ $gateway_group['name'] = $group_name;
$gateway_group['descr'] = $lbpool['descr'];
$gateway_group['trigger'] = "down";
$gateway_group['item'] = array();
@@ -1855,6 +1868,11 @@ function upgrade_053_to_054() {
// Only set the gateway group array if we converted any
if (count($gateway_group_arr) != 0) {
$config['gateways']['gateway_group'] = $gateway_group_arr;
+ // Update any rules that had a gateway change, if any.
+ if (count($group_name_changes) > 0)
+ foreach ($config['filter']['rule'] as & $rule)
+ if (!empty($rule["gateway"]) && array_key_exists($rule["gateway"], $group_name_changes))
+ $rule["gateway"] = $group_name_changes[$rule["gateway"]];
}
}
@@ -2456,6 +2474,24 @@ function upgrade_076_to_077() {
}
function upgrade_077_to_078() {
+ if (is_array($config['pptpd']) && is_array($config['pptpd']['radius'])
+ && !is_array($config['pptpd']['radius']['server'])) {
+ $radarr = array();
+ $radsvr = array();
+ $radsvr['ip'] = $config['pptpd']['radius']['server'];
+ $radsvr['secret'] = $config['pptpd']['radius']['secret'];
+ $radsvr['port'] = 1812;
+ $radsvr['acctport'] = 1813;
+ $radsvr['enable'] = isset($config['pptpd']['radius']['enable']);
+ $radarr['accounting'] = isset($config['pptpd']['radius']['accounting']);
+ if ($radarr['accounting'])
+ $radarr['acct_update'] = $radsvr['ip'];
+ $radarr['server'] = $radsvr;
+ $config['pptpd']['radius'] = $radarr;
+ }
+}
+
+function upgrade_078_to_079() {
global $config;
global $g;
@@ -2541,7 +2577,7 @@ function upgrade_077_to_078() {
}
}
-function upgrade_078_to_079() {
+function upgrade_079_to_080() {
global $config;
/* enable the allow IPv6 toggle */
$config['system']['ipv6allow'] = true;
diff --git a/etc/inc/vpn.inc b/etc/inc/vpn.inc
index 24e5956..80e3a85 100644
--- a/etc/inc/vpn.inc
+++ b/etc/inc/vpn.inc
@@ -282,7 +282,8 @@ function vpn_ipsec_configure($ipchg = false)
break;
}
- $pskconf .= "{$peerid_data}\t{$ph1ent['pre-shared-key']}\n";
+ if (!empty($peerid_data) && !empty($ph1ent['pre-shared-key']))
+ $pskconf .= trim($peerid_data) . "\t" . trim($ph1ent['pre-shared-key']) . "\n";
}
}
diff --git a/etc/phpshellsessions/gitsync b/etc/phpshellsessions/gitsync
index 0ff40e1..81ea653 100644
--- a/etc/phpshellsessions/gitsync
+++ b/etc/phpshellsessions/gitsync
@@ -13,7 +13,7 @@ require_once("pfsense-utils.inc");
conf_mount_rw();
-$GIT_REPO="http://gitweb.pfsense.org/pfsense/mainline.git";
+$GIT_REPO="git://github.com/bsdperimeter/pfsense.git";
$CODIR = "/root/pfsense/";
global $g;
diff --git a/etc/rc.filter_synchronize b/etc/rc.filter_synchronize
index d588e8a..0fe4c15 100755
--- a/etc/rc.filter_synchronize
+++ b/etc/rc.filter_synchronize
@@ -323,9 +323,10 @@ if (is_array($config['installedpackages']['carpsettings']['config'])) {
if ($carp['synchronizetrafficshaper'] != "" and is_array($config['shaper'])) {
$sections[] = 'shaper';
}
- if ($carp['synchronizetrafficshaper'] != "") {
- if (!is_array($config['l7shaper']))
- $config['l7shaper'] = array();
+ if ($carp['synchronizetrafficshaperlimiter'] != "" and is_array($config['dnshaper'])) {
+ $sections[] = 'dnshaper';
+ }
+ if ($carp['synchronizetrafficshaperlayer7'] != "" and is_array($config['l7shaper'])) {
$sections[] = 'l7shaper';
}
if ($carp['synchronizestaticroutes'] != "") {
diff --git a/etc/rc.start_packages b/etc/rc.start_packages
index 4025e58..ddd288d 100755
--- a/etc/rc.start_packages
+++ b/etc/rc.start_packages
@@ -1,17 +1,73 @@
-#!/bin/sh
+#!/usr/local/bin/php -f
+<?php
+/* $Id$ */
+/*
+ rc.start_packages
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2004 Scott Ullrich
+ All rights reserved.
-# Set our operating platform
-PLATFORM=`cat /etc/platform`
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
-if [ ! "$PLATFORM" = "cdrom" ]; then
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- /etc/rc.packages 2>/dev/null
+ 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.
- echo "Executing rc.d items... "
- for FILE in /usr/local/etc/rc.d/*.sh; do
- echo -n " Starting ${FILE}..."
- sh $FILE start >>/tmp/bootup_messages 2>&1 &
- echo "done."
- done
-fi
+ 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.
+*/
+require_once("config.inc");
+require_once("functions.inc");
+require_once("filter.inc");
+require_once("shaper.inc");
+require_once("captiveportal.inc");
+require_once("pkg-utils.inc");
+require_once("pfsense-utils.inc");
+require_once("service-utils.inc");
+
+log_error("Restarting/Starting all packages.");
+
+$rcfiles = glob("{$rcfileprefix}*.sh");
+if (!$rcfiles)
+ $rcfiles = array();
+else {
+ $rcfiles = array_flip($rcfiles);
+ if (!$rcfiles)
+ $rcfiles = array();
+}
+
+if (is_array($config['installedpackages']['package'])) {
+ foreach($config['installedpackages']['package'] as $package) {
+ echo " Starting package {$package['name']}...";
+ sync_package($package['name']);
+ start_service($package['name']);
+ unset($rcfiles["{$rcfileprefix}{$package['name']}.sh"]);
+ echo "done.\n";
+ }
+}
+
+$shell = @popen("/bin/sh", "w");
+if ($shell) {
+ foreach ($rcfiles as $rcfile) {
+ echo " Starting {$rcfile}...";
+ fwrite($shell, "{$rcfile} start >>/tmp/bootup_messages 2>&1 &");
+ echo "done.\n";
+ }
+
+ pclose($shell);
+}
+
+?>
diff --git a/etc/rc.stop_packages b/etc/rc.stop_packages
index 4ff9ed9..181d2ea 100755
--- a/etc/rc.stop_packages
+++ b/etc/rc.stop_packages
@@ -1,18 +1,71 @@
-#!/bin/sh
+#!/usr/local/bin/php -f
+<?php
+/* $Id$ */
+/*
+ rc.stop_packages
+ part of pfSense (http://www.pfSense.com)
+ Copyright (C) 2004 Scott Ullrich
+ All rights reserved.
-# Set our operating platform
-PLATFORM=`cat /etc/platform`
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
-if [ ! "$PLATFORM" = "cdrom" ]; then
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- echo "Syncing packages..."
- /etc/rc.packages 2>/dev/null
+ 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.
- echo "Executing rc.d items... "
- for FILE in /usr/local/etc/rc.d/*.sh; do
- echo -n " Stopping ${FILE}..."
- sh $FILE stop >>/tmp/bootup_messages 2>&1
- echo "done."
- done
-fi
+ 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.
+*/
+require_once("config.inc");
+require_once("functions.inc");
+require_once("filter.inc");
+require_once("shaper.inc");
+require_once("captiveportal.inc");
+require_once("pkg-utils.inc");
+require_once("pfsense-utils.inc");
+require_once("service-utils.inc");
+
+log_error("Stopping all packages.");
+
+$rcfiles = glob("{$rcfileprefix}*.sh");
+if (!$rcfiles)
+ $rcfiles = array();
+else {
+ $rcfiles = array_flip($rcfiles);
+ if (!$rcfiles)
+ $rcfiles = array();
+}
+
+if (is_array($config['installedpackages']['package'])) {
+ foreach($config['installedpackages']['package'] as $package) {
+ echo " Stoping package {$package['name']}...";
+ stop_service($package['name']);
+ unset($rcfiles["{$rcfileprefix}{$package['name']}.sh"]);
+ echo "done.\n";
+ }
+}
+
+$shell = @popen("/bin/sh", "w");
+if ($shell) {
+ foreach ($rcfiles as $rcfile) {
+ echo " Stoping {$rcfile}...";
+ fwrite($shell, "{$rcfile} stop >>/tmp/bootup_messages 2>&1");
+ echo "done.\n";
+ }
+
+ pclose($shell);
+}
+?>
OpenPOWER on IntegriCloud