mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-15 17:14:46 +00:00
relayd: use plugin hooks
This commit is contained in:
parent
8986792ddd
commit
bd6c048d45
1
plist
1
plist
@ -46,6 +46,7 @@
|
||||
/usr/local/etc/inc/plugins.inc.d/if_ipsec.inc
|
||||
/usr/local/etc/inc/plugins.inc.d/if_openvpn.inc
|
||||
/usr/local/etc/inc/plugins.inc.d/miniupnpd.inc
|
||||
/usr/local/etc/inc/plugins.inc.d/relayd.inc
|
||||
/usr/local/etc/inc/plugins.inc.d/shaper.inc
|
||||
/usr/local/etc/inc/plugins.inc.d/squid.inc
|
||||
/usr/local/etc/inc/plugins.inc.d/suricata.inc
|
||||
|
||||
@ -480,7 +480,6 @@ function filter_configure_sync()
|
||||
$rules .= "{$natrules}\n";
|
||||
$rules .= $fw->anchorToText('nat,binat,rdr', 'tail');
|
||||
$rules .= $fw->anchorToText('fw', 'head');
|
||||
$rules .= "anchor \"relayd/*\"\n"; // relayd
|
||||
$rules .= filter_rules_legacy($FilterIflist);
|
||||
$rules .= $fw->outputFilterRules();
|
||||
$rules .= "{$pfrules}\n";
|
||||
@ -1716,9 +1715,6 @@ function filter_nat_rules_generate(&$FilterIflist)
|
||||
unset($tonathosts, $tonathosts_array, $numberofnathosts);
|
||||
}
|
||||
|
||||
$natrules .= "\n# Load balancing\n";
|
||||
$natrules .= "rdr-anchor \"relayd/*\"\n";
|
||||
|
||||
// prevent redirection on ports with "lock out" protection
|
||||
if (!isset($config['system']['webgui']['noantilockout'])) {
|
||||
$alports = filter_get_antilockout_ports();
|
||||
|
||||
66
src/etc/inc/plugins.inc.d/relayd.inc
Normal file
66
src/etc/inc/plugins.inc.d/relayd.inc
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
Copyright (C) 2016 Franco Fichtner <franco@opnsense.org>
|
||||
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.
|
||||
*/
|
||||
|
||||
function relayd_firewall($fw)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset($config['load_balancer']['virtual_server']) && isset($config['load_balancer']['lbpool']) &&
|
||||
count($config['load_balancer']['virtual_server']) && count($config['load_balancer']['lbpool'])) {
|
||||
$fw->registerAnchor('relayd/*', 'rdr');
|
||||
$fw->registerAnchor('relayd/*', 'fw');
|
||||
}
|
||||
}
|
||||
|
||||
function relayd_services()
|
||||
{
|
||||
global $config;
|
||||
|
||||
$services = array();
|
||||
|
||||
if (isset($config['load_balancer']['virtual_server']) && isset($config['load_balancer']['lbpool']) &&
|
||||
count($config['load_balancer']['virtual_server']) && count($config['load_balancer']['lbpool'])) {
|
||||
$pconfig = array();
|
||||
$pconfig['name'] = 'relayd';
|
||||
$pconfig['description'] = gettext('Server load balancing daemon');
|
||||
$pconfig['php']['restart'] = array('relayd_configure', 'filter_configure');
|
||||
$pconfig['php']['start'] = array('relayd_configure', 'filter_configure');
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
|
||||
return $services;
|
||||
}
|
||||
|
||||
function relayd_syslog()
|
||||
{
|
||||
$logfacilities = array();
|
||||
|
||||
$logfacilities['relayd'] = array('facility' => array('relayd'), 'remote' => 'relayd');
|
||||
|
||||
return $logfacilities;
|
||||
}
|
||||
@ -2505,15 +2505,6 @@ function services_get()
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
|
||||
if (isset($config['load_balancer']['virtual_server']) && isset($config['load_balancer']['lbpool']) && count($config['load_balancer']['virtual_server']) && count($config['load_balancer']['lbpool'])) {
|
||||
$pconfig = array();
|
||||
$pconfig['name'] = "relayd";
|
||||
$pconfig['description'] = gettext("Server load balancing daemon");
|
||||
$pconfig['php']['restart'] = array('relayd_configure', 'filter_configure');
|
||||
$pconfig['php']['start'] = array('relayd_configure', 'filter_configure');
|
||||
$services[] = $pconfig;
|
||||
}
|
||||
|
||||
if (isset($config['OPNsense']['captiveportal']['zones']['zone'])) {
|
||||
$enabled = false;
|
||||
if (!empty($config['OPNsense']['captiveportal']['zones']['zone']['enabled'])) {
|
||||
|
||||
@ -800,7 +800,6 @@ function system_syslogd_start()
|
||||
$syslogconfs['ntpd'] = array('facility' => array('ntp', 'ntpd', 'ntpdate'));
|
||||
$syslogconfs['portalauth'] = array('facility' => array('captiveportal'), 'remote' => 'portalauth');
|
||||
$syslogconfs['ppps'] = array('facility' => array('ppp'));
|
||||
$syslogconfs['relayd'] = array('facility' => array('relayd'), 'remote' => 'relayd');
|
||||
$syslogconfs['resolver'] = array('facility' => array('dnsmasq', 'filterdns', 'unbound'));
|
||||
$syslogconfs['routing'] = array('facility' => array('radvd', 'routed', 'rtsold', 'olsrd', 'zebra', 'ospfd', 'bgpd', 'miniupnpd'));
|
||||
$syslogconfs['wireless'] = array('facility' => array('hostapd'), 'remote' => 'hostapd');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user