diff --git a/README.md b/README.md index 16ad199a7..d4c5c0f97 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ dns/rfc2136 -- RFC-2136 Support mail/postfix -- SMTP mail relay mail/rspamd -- Protect your network from spam net-mgmt/collectd -- Collect system and application performance metrics periodically +net-mgmt/lldpd -- LLDP allows you to know exactly on which port is a server net-mgmt/snmp -- SNMP Server via bsnmpd net-mgmt/telegraf -- Agent for collecting metrics and data net-mgmt/zabbix-agent -- Enterprise-class open source distributed monitoring agent diff --git a/net-mgmt/lldpd/Makefile b/net-mgmt/lldpd/Makefile new file mode 100644 index 000000000..21f9efc8b --- /dev/null +++ b/net-mgmt/lldpd/Makefile @@ -0,0 +1,8 @@ +PLUGIN_NAME= lldpd +PLUGIN_VERSION= 0.1 +PLUGIN_COMMENT= LLDP allows you to know exactly on which port is a server +PLUGIN_DEPENDS= lldpd +PLUGIN_MAINTAINER= m.muenz@gmail.com +PLUGIN_DEVEL= yes + +.include "../../Mk/plugins.mk" diff --git a/net-mgmt/lldpd/pkg-descr b/net-mgmt/lldpd/pkg-descr new file mode 100644 index 000000000..81e62b6a3 --- /dev/null +++ b/net-mgmt/lldpd/pkg-descr @@ -0,0 +1,7 @@ +LLDP is an industry standard protocol designed to supplant +proprietary Link-Layer protocols such as EDP or CDP. +The goal of LLDP is to provide an inter-vendor compatible +mechanism to deliver Link-Layer notifications to adjacent +network devices. + +WWW: https://vincentbernat.github.io/lldpd/ diff --git a/net-mgmt/lldpd/src/etc/inc/plugins.inc.d/lldpd.inc b/net-mgmt/lldpd/src/etc/inc/plugins.inc.d/lldpd.inc new file mode 100644 index 000000000..0a538d58f --- /dev/null +++ b/net-mgmt/lldpd/src/etc/inc/plugins.inc.d/lldpd.inc @@ -0,0 +1,49 @@ + gettext('lldpd daemon'), + 'configd' => array( + 'restart' => array('lldpd restart'), + 'start' => array('lldpd start'), + 'stop' => array('lldpd stop'), + ), + 'name' => 'lldpd', + 'pidfile' => '/var/run/lldpd.pid' + ); + } + + return $services; +} diff --git a/net-mgmt/lldpd/src/opnsense/mvc/app/controllers/OPNsense/Lldpd/Api/GeneralController.php b/net-mgmt/lldpd/src/opnsense/mvc/app/controllers/OPNsense/Lldpd/Api/GeneralController.php new file mode 100644 index 000000000..3190d9671 --- /dev/null +++ b/net-mgmt/lldpd/src/opnsense/mvc/app/controllers/OPNsense/Lldpd/Api/GeneralController.php @@ -0,0 +1,40 @@ +configdRun("lldpd neighbor"); + return array("response" => $response); + } +} diff --git a/net-mgmt/lldpd/src/opnsense/mvc/app/controllers/OPNsense/Lldpd/GeneralController.php b/net-mgmt/lldpd/src/opnsense/mvc/app/controllers/OPNsense/Lldpd/GeneralController.php new file mode 100644 index 000000000..c444db60d --- /dev/null +++ b/net-mgmt/lldpd/src/opnsense/mvc/app/controllers/OPNsense/Lldpd/GeneralController.php @@ -0,0 +1,38 @@ +view->generalForm = $this->getForm("general"); + $this->view->pick('OPNsense/Lldpd/general'); + } +} diff --git a/net-mgmt/lldpd/src/opnsense/mvc/app/controllers/OPNsense/Lldpd/forms/general.xml b/net-mgmt/lldpd/src/opnsense/mvc/app/controllers/OPNsense/Lldpd/forms/general.xml new file mode 100644 index 000000000..145254a3b --- /dev/null +++ b/net-mgmt/lldpd/src/opnsense/mvc/app/controllers/OPNsense/Lldpd/forms/general.xml @@ -0,0 +1,32 @@ +
+ + general.enabled + + checkbox + This will activate the LLDPD service. + + + general.cdp + + checkbox + This will activate the Cisco Discovery Protocol. + + + general.fdp + + checkbox + This will activate the Foundry Discovery Protocol. + + + general.edp + + checkbox + This will activate the Extreme Discovery Protocol. + + + general.sonmp + + checkbox + This will activate the SONMP Protocol by Nortel. + +
diff --git a/net-mgmt/lldpd/src/opnsense/mvc/app/models/OPNsense/Lldpd/ACL/ACL.xml b/net-mgmt/lldpd/src/opnsense/mvc/app/models/OPNsense/Lldpd/ACL/ACL.xml new file mode 100644 index 000000000..9e0cfe186 --- /dev/null +++ b/net-mgmt/lldpd/src/opnsense/mvc/app/models/OPNsense/Lldpd/ACL/ACL.xml @@ -0,0 +1,9 @@ + + + Services: Lldpd + + ui/lldpd/* + api/lldpd/* + + + diff --git a/net-mgmt/lldpd/src/opnsense/mvc/app/models/OPNsense/Lldpd/General.php b/net-mgmt/lldpd/src/opnsense/mvc/app/models/OPNsense/Lldpd/General.php new file mode 100644 index 000000000..8f32307ad --- /dev/null +++ b/net-mgmt/lldpd/src/opnsense/mvc/app/models/OPNsense/Lldpd/General.php @@ -0,0 +1,35 @@ + + //OPNsense/lldpd/general + Lldpd configuration + 1.0.0 + + + 0 + Y + + + 0 + Y + + + 0 + Y + + + 0 + Y + + + 0 + Y + + + diff --git a/net-mgmt/lldpd/src/opnsense/mvc/app/models/OPNsense/Lldpd/Menu/Menu.xml b/net-mgmt/lldpd/src/opnsense/mvc/app/models/OPNsense/Lldpd/Menu/Menu.xml new file mode 100644 index 000000000..3383f917b --- /dev/null +++ b/net-mgmt/lldpd/src/opnsense/mvc/app/models/OPNsense/Lldpd/Menu/Menu.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/net-mgmt/lldpd/src/opnsense/mvc/app/views/OPNsense/Lldpd/general.volt b/net-mgmt/lldpd/src/opnsense/mvc/app/views/OPNsense/Lldpd/general.volt new file mode 100644 index 000000000..01149fccd --- /dev/null +++ b/net-mgmt/lldpd/src/opnsense/mvc/app/views/OPNsense/Lldpd/general.volt @@ -0,0 +1,77 @@ +{# + # Copyright (C) 2014-2017 Deciso B.V. + # Copyright (C) 2017 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-mgmt/lldpd/src/opnsense/service/conf/actions.d/actions_lldpd.conf b/net-mgmt/lldpd/src/opnsense/service/conf/actions.d/actions_lldpd.conf new file mode 100644 index 000000000..1bcc3b9c8 --- /dev/null +++ b/net-mgmt/lldpd/src/opnsense/service/conf/actions.d/actions_lldpd.conf @@ -0,0 +1,29 @@ +[start] +command:/usr/local/etc/rc.d/lldpd start +parameters: +type:script +message:starting Lldpd + +[stop] +command:/usr/local/etc/rc.d/lldpd stop +parameters: +type:script +message:stopping Lldpd + +[restart] +command:/usr/local/etc/rc.d/lldpd restart +parameters: +type:script +message:restarting Lldpd + +[status] +command:/usr/local/etc/rc.d/lldpd status +parameters: +type:script_output +message:request Lldpd status + +[neighbor] +command:/usr/local/sbin/lldpcli show neighbors +parameters: +type:script_output +message:show lldp neighbors diff --git a/net-mgmt/lldpd/src/opnsense/service/templates/OPNsense/Lldpd/+TARGETS b/net-mgmt/lldpd/src/opnsense/service/templates/OPNsense/Lldpd/+TARGETS new file mode 100644 index 000000000..8c11bd438 --- /dev/null +++ b/net-mgmt/lldpd/src/opnsense/service/templates/OPNsense/Lldpd/+TARGETS @@ -0,0 +1,2 @@ +lldpd:/etc/rc.conf.d/lldpd +lldpd.conf:/usr/local/etc/lldpd.conf diff --git a/net-mgmt/lldpd/src/opnsense/service/templates/OPNsense/Lldpd/lldpd b/net-mgmt/lldpd/src/opnsense/service/templates/OPNsense/Lldpd/lldpd new file mode 100644 index 000000000..2d4a82917 --- /dev/null +++ b/net-mgmt/lldpd/src/opnsense/service/templates/OPNsense/Lldpd/lldpd @@ -0,0 +1,6 @@ +{% if helpers.exists('OPNsense.lldpd.general.enabled') and OPNsense.lldpd.general.enabled == '1' %} +lldpd_enable="YES" +lldpd_flags="{% if helpers.exists('OPNsense.lldpd.general.cdp') and OPNsense.lldpd.general.cdp == '1' %}-c{% endif %}{% if helpers.exists('OPNsense.lldpd.general.fdp') and OPNsense.lldpd.general.fdp == '1' %} -f{% endif %}{% if helpers.exists('OPNsense.lldpd.general.edp') and OPNsense.lldpd.general.edp == '1' %} -e{% endif %}{% if helpers.exists('OPNsense.lldpd.general.sonmp') and OPNsense.lldpd.general.sonmp == '1' %} -s{% endif %}" +{% else %} +lldpd_enable="NO" +{% endif %} diff --git a/net-mgmt/lldpd/src/opnsense/service/templates/OPNsense/Lldpd/lldpd.conf b/net-mgmt/lldpd/src/opnsense/service/templates/OPNsense/Lldpd/lldpd.conf new file mode 100644 index 000000000..7218b0cb8 --- /dev/null +++ b/net-mgmt/lldpd/src/opnsense/service/templates/OPNsense/Lldpd/lldpd.conf @@ -0,0 +1,2 @@ +{% if helpers.exists('OPNsense.lldpd.general.enabled') and OPNsense.lldpd.general.enabled == '1' %} +{% endif %}