diff --git a/README.md b/README.md index a9e87c980..0f63d1085 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,7 @@ net/pptp -- End of life, no replacement net/relayd -- Relayd Load Balancer net/shadowsocks -- Secure socks5 proxy net/siproxd -- Siproxd is a proxy daemon for the SIP protocol +net/tayga -- Tayga is a stateless NAT64 daemon net/upnp -- Universal Plug and Play Service net/vnstat -- vnStat is a console-based network traffic monitor net/wireguard -- WireGuard VPN service diff --git a/net/tayga/Makefile b/net/tayga/Makefile new file mode 100644 index 000000000..2799992bf --- /dev/null +++ b/net/tayga/Makefile @@ -0,0 +1,7 @@ +PLUGIN_NAME= tayga +PLUGIN_VERSION= 0.1 +PLUGIN_COMMENT= Tayga IPv6 64NAT +PLUGIN_DEPENDS= tayga +PLUGIN_MAINTAINER= m.muenz@gmail.com + +.include "../../Mk/plugins.mk" diff --git a/net/tayga/pkg-descr b/net/tayga/pkg-descr new file mode 100644 index 000000000..17dc5ca6c --- /dev/null +++ b/net/tayga/pkg-descr @@ -0,0 +1,14 @@ +TAYGA is an out-of-kernel stateless NAT64 implementation that uses +the TUN driver to exchange IPv4 and IPv6 packets with the kernel. +It is intended to provide production-quality NAT64 service for +networks where dedicated NAT64 hardware would be overkill. + + +Plugin Changelog +================ + +1.0 + +* Support for IPv6 prefix and IPv4 pool + +WWW: http://www.litech.org/tayga/ diff --git a/net/tayga/src/etc/inc/plugins.inc.d/tayga.inc b/net/tayga/src/etc/inc/plugins.inc.d/tayga.inc new file mode 100644 index 000000000..9938b03cf --- /dev/null +++ b/net/tayga/src/etc/inc/plugins.inc.d/tayga.inc @@ -0,0 +1,63 @@ + + * 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 tayga_enabled() +{ + $model = new \OPNsense\Tayga\General(); + + return (string)$model->enabled == '1'; +} + +function tayga_services() +{ + $services = array(); + + if (tayga_enabled()) { + $services[] = array( + 'description' => gettext('Tayga'), + 'configd' => array( + 'restart' => array('tayga restart'), + 'start' => array('tayga start'), + 'stop' => array('tayga stop'), + ), + 'name' => 'tayga', + 'pidfile' => '/var/run/tayga.pid' + ); + } + + return $services; +} + +function tayga_xmlrpc_sync() +{ + $result = array(); + $result['id'] = 'taygavpn'; + $result['section'] = 'OPNsense.tayga'; + $result['description'] = gettext('Tayga'); + return array($result); +} diff --git a/net/tayga/src/etc/rc.d/opnsense-tayga b/net/tayga/src/etc/rc.d/opnsense-tayga new file mode 100644 index 000000000..78ed736fc --- /dev/null +++ b/net/tayga/src/etc/rc.d/opnsense-tayga @@ -0,0 +1,35 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: opnsense-tayga +# REQUIRE: SERVERS +# KEYWORD: shutdown +# + +. /etc/rc.subr + +name=tayga + +stop_cmd=tayga_stop +rcvar=tayga_enable + +load_rc_config opnsense-tayga +pidfile=/var/run/${name}.pid +command=/usr/local/sbin/${name} +command_args="-p ${pidfile}" + +[ -z "$tayga_enable" ] && tayga_enable="NO" + +tayga_stop() +{ + if [ -n "$rc_pid" ]; then + echo "stopping tayga" + kill -2 ${rc_pid} + ifconfig nat64 destroy + else + echo "${name} is not running." + fi +} + +run_rc_command $1 diff --git a/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/Api/GeneralController.php b/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/Api/GeneralController.php new file mode 100644 index 000000000..974e3d339 --- /dev/null +++ b/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/Api/GeneralController.php @@ -0,0 +1,37 @@ + + * 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. + */ + +namespace OPNsense\Tayga\Api; + +use OPNsense\Base\ApiMutableModelControllerBase; + +class GeneralController extends ApiMutableModelControllerBase +{ + protected static $internalModelClass = '\OPNsense\Tayga\General'; + protected static $internalModelName = 'general'; +} diff --git a/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/Api/ServiceController.php b/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/Api/ServiceController.php new file mode 100644 index 000000000..4c82981ce --- /dev/null +++ b/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/Api/ServiceController.php @@ -0,0 +1,39 @@ + + * 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. + */ + +namespace OPNsense\Tayga\Api; + +use OPNsense\Base\ApiMutableServiceControllerBase; + +class ServiceController extends ApiMutableServiceControllerBase +{ + protected static $internalServiceClass = '\OPNsense\Tayga\General'; + protected static $internalServiceTemplate = 'OPNsense/Tayga'; + protected static $internalServiceEnabled = 'enabled'; + protected static $internalServiceName = 'tayga'; +} diff --git a/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/GeneralController.php b/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/GeneralController.php new file mode 100644 index 000000000..6cf94562b --- /dev/null +++ b/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/GeneralController.php @@ -0,0 +1,38 @@ + + * 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. + */ + +namespace OPNsense\Tayga; + +class GeneralController extends \OPNsense\Base\IndexController +{ + public function indexAction() + { + $this->view->generalForm = $this->getForm("general"); + $this->view->pick('OPNsense/Tayga/general'); + } +} diff --git a/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/forms/general.xml b/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/forms/general.xml new file mode 100644 index 000000000..e75b05a16 --- /dev/null +++ b/net/tayga/src/opnsense/mvc/app/controllers/OPNsense/Tayga/forms/general.xml @@ -0,0 +1,32 @@ +
diff --git a/net/tayga/src/opnsense/mvc/app/models/OPNsense/Tayga/ACL/ACL.xml b/net/tayga/src/opnsense/mvc/app/models/OPNsense/Tayga/ACL/ACL.xml new file mode 100644 index 000000000..9e494c24f --- /dev/null +++ b/net/tayga/src/opnsense/mvc/app/models/OPNsense/Tayga/ACL/ACL.xml @@ -0,0 +1,9 @@ +