diff --git a/README.md b/README.md index a4578871f..e8d349d06 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ net/haproxy -- Reliable, high performance TCP/HTTP load balancer net/igmp-proxy -- IGMP-Proxy Service net/l2tp -- L2TP server based on MPD5 net/mdns-repeater -- Proxy multicast DNS between networks +net/ntopng -- Traffic Analysis and Flow Collection net/pppoe -- PPPoE server based on MPD5 net/pptp -- PPTP server based on MPD5 net/quagga -- End of life, superseded by FRR plugin diff --git a/net/ntopng/Makefile b/net/ntopng/Makefile new file mode 100644 index 000000000..4ae7e5d1c --- /dev/null +++ b/net/ntopng/Makefile @@ -0,0 +1,8 @@ +PLUGIN_NAME= ntopng +PLUGIN_VERSION= 0.1 +PLUGIN_COMMENT= Traffic Analysis and Flow Collection +PLUGIN_DEPENDS= ntopng redis +PLUGIN_MAINTAINER= m.muenz@gmail.com +PLUGIN_DEVEL= yes + +.include "../../Mk/plugins.mk" diff --git a/net/ntopng/pkg-descr b/net/ntopng/pkg-descr new file mode 100644 index 000000000..ad7b4e38e --- /dev/null +++ b/net/ntopng/pkg-descr @@ -0,0 +1,7 @@ +ntopng is the next generation version of the original ntop, +a network traffic probe that monitors network usage. ntopng +is based on libpcap and it has been written in a portable +way in order to virtually run on every Unix platform, MacOSX +and on Windows as well. + +WWW: https://www.ntop.org/products/traffic-analysis/ntop/ diff --git a/net/ntopng/src/etc/inc/plugins.inc.d/ntopng.inc b/net/ntopng/src/etc/inc/plugins.inc.d/ntopng.inc new file mode 100644 index 000000000..4768bedea --- /dev/null +++ b/net/ntopng/src/etc/inc/plugins.inc.d/ntopng.inc @@ -0,0 +1,55 @@ +enabled == '1'; +} + +function ntopng_services() +{ + $services = array(); + + if (!ntopng_enabled()) { + return $services; + } + + $services[] = array( + 'description' => gettext('ntopng'), + 'configd' => array( + 'restart' => array('ntopng restart'), + 'start' => array('ntopng start'), + 'stop' => array('ntopng stop'), + ), + 'name' => 'ntopng', + 'pid' => '/var/run/ntopng/ntopng.pid' + ); + + return $services; +} diff --git a/net/ntopng/src/opnsense/mvc/app/controllers/OPNsense/Ntopng/Api/GeneralController.php b/net/ntopng/src/opnsense/mvc/app/controllers/OPNsense/Ntopng/Api/GeneralController.php new file mode 100644 index 000000000..d8a6d8642 --- /dev/null +++ b/net/ntopng/src/opnsense/mvc/app/controllers/OPNsense/Ntopng/Api/GeneralController.php @@ -0,0 +1,39 @@ +configdRun("firmware plugin redis"); + return $response; + } +} diff --git a/net/ntopng/src/opnsense/mvc/app/controllers/OPNsense/Ntopng/GeneralController.php b/net/ntopng/src/opnsense/mvc/app/controllers/OPNsense/Ntopng/GeneralController.php new file mode 100644 index 000000000..28154a3ba --- /dev/null +++ b/net/ntopng/src/opnsense/mvc/app/controllers/OPNsense/Ntopng/GeneralController.php @@ -0,0 +1,38 @@ +view->generalForm = $this->getForm("general"); + $this->view->pick('OPNsense/Ntopng/general'); + } +} diff --git a/net/ntopng/src/opnsense/mvc/app/controllers/OPNsense/Ntopng/forms/general.xml b/net/ntopng/src/opnsense/mvc/app/controllers/OPNsense/Ntopng/forms/general.xml new file mode 100644 index 000000000..47d8dce6a --- /dev/null +++ b/net/ntopng/src/opnsense/mvc/app/controllers/OPNsense/Ntopng/forms/general.xml @@ -0,0 +1,26 @@ +
+ + general.enabled + + checkbox + This will activate ntopng. + + + general.interface + + dropdown + Select the interface to listen to. + + + general.httpport + + text + HTTP Port this service listens on. + + + general.dnsmode + + dropdown + Sets the DNS resolution mode. + +
diff --git a/net/ntopng/src/opnsense/mvc/app/models/OPNsense/Ntopng/ACL/ACL.xml b/net/ntopng/src/opnsense/mvc/app/models/OPNsense/Ntopng/ACL/ACL.xml new file mode 100644 index 000000000..8a39e4c55 --- /dev/null +++ b/net/ntopng/src/opnsense/mvc/app/models/OPNsense/Ntopng/ACL/ACL.xml @@ -0,0 +1,9 @@ + + + Services: ntopng + + ui/ntopng/* + api/ntopng/* + + + diff --git a/net/ntopng/src/opnsense/mvc/app/models/OPNsense/Ntopng/General.php b/net/ntopng/src/opnsense/mvc/app/models/OPNsense/Ntopng/General.php new file mode 100644 index 000000000..5c39185ae --- /dev/null +++ b/net/ntopng/src/opnsense/mvc/app/models/OPNsense/Ntopng/General.php @@ -0,0 +1,35 @@ + + //OPNsense/ntopng/general + ntopng configuration + 0.0.1 + + + 0 + Y + + + N + N + + + Y + 3000 + + + N + + Decode DNS responses and resolve only local numeric IPs + Decode DNS responses and resolve all numeric IPs + Decode DNS responses and do not resolve numeric IPs + Do not decode DNS responses and do not resolve numeric IPs + + + + diff --git a/net/ntopng/src/opnsense/mvc/app/models/OPNsense/Ntopng/Menu/Menu.xml b/net/ntopng/src/opnsense/mvc/app/models/OPNsense/Ntopng/Menu/Menu.xml new file mode 100644 index 000000000..ad52ba732 --- /dev/null +++ b/net/ntopng/src/opnsense/mvc/app/models/OPNsense/Ntopng/Menu/Menu.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/net/ntopng/src/opnsense/mvc/app/views/OPNsense/Ntopng/general.volt b/net/ntopng/src/opnsense/mvc/app/views/OPNsense/Ntopng/general.volt new file mode 100644 index 000000000..832e4f320 --- /dev/null +++ b/net/ntopng/src/opnsense/mvc/app/views/OPNsense/Ntopng/general.volt @@ -0,0 +1,80 @@ +{# + +OPNsense® is Copyright © 2014 – 2018 by Deciso B.V. +This file is Copyright © 2018 by Michael Muenz +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. + +#} + + + + + + +
+
+
+ {{ partial("layout_partials/base_form",['fields':generalForm,'id':'frm_general_settings'])}} +
+
+ +
+
+
+
+ + diff --git a/net/ntopng/src/opnsense/scripts/OPNsense/Ntopng/setup.sh b/net/ntopng/src/opnsense/scripts/OPNsense/Ntopng/setup.sh new file mode 100755 index 000000000..41fb211a3 --- /dev/null +++ b/net/ntopng/src/opnsense/scripts/OPNsense/Ntopng/setup.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +mkdir -p /var/run/ntopng/ +chmod 755 /var/run/ntopng +chown ntopng:ntopng /var/run/ntopng + +mkdir -p /var/tmp/ntopng/ +chmod 755 /var/tmp/ntopng +chown ntopng:wheel /var/tmp/ntopng diff --git a/net/ntopng/src/opnsense/service/conf/actions.d/actions_ntopng.conf b/net/ntopng/src/opnsense/service/conf/actions.d/actions_ntopng.conf new file mode 100644 index 000000000..d023859ab --- /dev/null +++ b/net/ntopng/src/opnsense/service/conf/actions.d/actions_ntopng.conf @@ -0,0 +1,23 @@ +[start] +command:/usr/local/opnsense/scripts/OPNsense/Ntopng/setup.sh;/usr/local/etc/rc.d/ntopng start +parameters: +type:script +message:starting ntopng + +[stop] +command:/usr/local/etc/rc.d/ntopng stop +parameters: +type:script +message:stopping ntopng + +[restart] +command:/usr/local/opnsense/scripts/OPNsense/Ntopng/setup.sh;/usr/local/etc/rc.d/ntopng restart +parameters: +type:script +message:restarting ntopng + +[status] +command:sh /usr/local/etc/rc.d/ntopng status;exit 0 +parameters: +type:script_output +message:ntopng status diff --git a/net/ntopng/src/opnsense/service/templates/OPNsense/Ntopng/+TARGETS b/net/ntopng/src/opnsense/service/templates/OPNsense/Ntopng/+TARGETS new file mode 100644 index 000000000..ed270077e --- /dev/null +++ b/net/ntopng/src/opnsense/service/templates/OPNsense/Ntopng/+TARGETS @@ -0,0 +1,2 @@ +ntopng:/etc/rc.conf.d/ntopng +ntopng.conf:/usr/local/etc/ntopng.conf diff --git a/net/ntopng/src/opnsense/service/templates/OPNsense/Ntopng/ntopng b/net/ntopng/src/opnsense/service/templates/OPNsense/Ntopng/ntopng new file mode 100644 index 000000000..84d4a2dbf --- /dev/null +++ b/net/ntopng/src/opnsense/service/templates/OPNsense/Ntopng/ntopng @@ -0,0 +1,7 @@ +{% if helpers.exists('OPNsense.ntopng.general.enabled') and OPNsense.ntopng.general.enabled == '1' %} +ntopng_var_script="/usr/local/opnsense/scripts/OPNsense/Ntopng/setup.sh" +ntopng_enable="YES" +ntopng_flags="/usr/local/etc/ntopng.conf" +{% else %} +ntopng_enable="NO" +{% endif %} diff --git a/net/ntopng/src/opnsense/service/templates/OPNsense/Ntopng/ntopng.conf b/net/ntopng/src/opnsense/service/templates/OPNsense/Ntopng/ntopng.conf new file mode 100644 index 000000000..e9fff19f2 --- /dev/null +++ b/net/ntopng/src/opnsense/service/templates/OPNsense/Ntopng/ntopng.conf @@ -0,0 +1,12 @@ +{% if helpers.exists('OPNsense.ntopng.general.enabled') and OPNsense.ntopng.general.enabled == '1' %} +{% from 'OPNsense/Macros/interface.macro' import physical_interface %} +{% if helpers.exists('OPNsense.ntopng.general.interface') and OPNsense.ntopng.general.interface != '' %} +-i={{ physical_interface(OPNsense.ntopng.general.interface) }} +{% endif %} +{% if helpers.exists('OPNsense.ntopng.general.httpport') and OPNsense.ntopng.general.httpport != '' %} +-w={{ OPNsense.ntopng.general.httpport }} +{% endif %} +{% if helpers.exists('OPNsense.ntopng.general.dnsmode') and OPNsense.ntopng.general.dnsmode != '' %} +-n={{ OPNsense.ntopng.general.dnsmode }} +{% endif %} +{% endif %}