diff --git a/ftp/tftp/Makefile b/ftp/tftp/Makefile new file mode 100644 index 000000000..6ae818903 --- /dev/null +++ b/ftp/tftp/Makefile @@ -0,0 +1,8 @@ +PLUGIN_NAME= tftp +PLUGIN_VERSION= 0.1 +PLUGIN_COMMENT= TFTP server +PLUGIN_DEPENDS= tftp-hpa +PLUGIN_DEVEL= yes +PLUGIN_MAINTAINER= m.muenz@gmail.com + +.include "../../Mk/plugins.mk" diff --git a/ftp/tftp/pkg-descr b/ftp/tftp/pkg-descr new file mode 100644 index 000000000..0fca4a310 --- /dev/null +++ b/ftp/tftp/pkg-descr @@ -0,0 +1,4 @@ +tftp-hpa is portable, BSD derived tftp server. It supports advanced +options such as blksize, blksize2, tsize, timeout, and utimeout. +It also supported rulebased security options. + diff --git a/ftp/tftp/src/etc/inc/plugins.inc.d/tftp.inc b/ftp/tftp/src/etc/inc/plugins.inc.d/tftp.inc new file mode 100644 index 000000000..71a0d9a39 --- /dev/null +++ b/ftp/tftp/src/etc/inc/plugins.inc.d/tftp.inc @@ -0,0 +1,49 @@ + + * 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 tftp_services() +{ + global $config; + + $services = array(); + + if (isset($config['OPNsense']['tftp']['general']['enabled']) && $config['OPNsense']['tftp']['general']['enabled'] == 1) { + $services[] = array( + 'description' => gettext('tftp daemon'), + 'configd' => array( + 'restart' => array('tftp restart'), + 'start' => array('tftp start'), + 'stop' => array('tftp stop'), + ), + 'name' => 'in.tftpd', + 'pidfile' => '/var/run/tftpd.pid' + ); + } + + return $services; +} diff --git a/ftp/tftp/src/opnsense/mvc/app/controllers/OPNsense/Tftp/Api/GeneralController.php b/ftp/tftp/src/opnsense/mvc/app/controllers/OPNsense/Tftp/Api/GeneralController.php new file mode 100644 index 000000000..8e99066c9 --- /dev/null +++ b/ftp/tftp/src/opnsense/mvc/app/controllers/OPNsense/Tftp/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\Tftp\Api; + +use OPNsense\Base\ApiMutableModelControllerBase; + +class GeneralController extends ApiMutableModelControllerBase +{ + protected static $internalModelClass = '\OPNsense\Tftp\General'; + protected static $internalModelName = 'general'; +} diff --git a/ftp/tftp/src/opnsense/mvc/app/controllers/OPNsense/Tftp/Api/ServiceController.php b/ftp/tftp/src/opnsense/mvc/app/controllers/OPNsense/Tftp/Api/ServiceController.php new file mode 100644 index 000000000..28efc5ea7 --- /dev/null +++ b/ftp/tftp/src/opnsense/mvc/app/controllers/OPNsense/Tftp/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\Tftp\Api; + +use OPNsense\Base\ApiMutableServiceControllerBase; + +class ServiceController extends ApiMutableServiceControllerBase +{ + protected static $internalServiceClass = '\OPNsense\Tftp\General'; + protected static $internalServiceTemplate = 'OPNsense/Tftp'; + protected static $internalServiceEnabled = 'enabled'; + protected static $internalServiceName = 'tftp'; +} diff --git a/ftp/tftp/src/opnsense/mvc/app/controllers/OPNsense/Tftp/GeneralController.php b/ftp/tftp/src/opnsense/mvc/app/controllers/OPNsense/Tftp/GeneralController.php new file mode 100644 index 000000000..baf4c7d0b --- /dev/null +++ b/ftp/tftp/src/opnsense/mvc/app/controllers/OPNsense/Tftp/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\Tftp; + +class GeneralController extends \OPNsense\Base\IndexController +{ + public function indexAction() + { + $this->view->generalForm = $this->getForm('general'); + $this->view->pick('OPNsense/Tftp/general'); + } +} diff --git a/ftp/tftp/src/opnsense/mvc/app/controllers/OPNsense/Tftp/forms/general.xml b/ftp/tftp/src/opnsense/mvc/app/controllers/OPNsense/Tftp/forms/general.xml new file mode 100644 index 000000000..85a19059b --- /dev/null +++ b/ftp/tftp/src/opnsense/mvc/app/controllers/OPNsense/Tftp/forms/general.xml @@ -0,0 +1,14 @@ +
diff --git a/ftp/tftp/src/opnsense/mvc/app/models/OPNsense/Tftp/ACL/ACL.xml b/ftp/tftp/src/opnsense/mvc/app/models/OPNsense/Tftp/ACL/ACL.xml new file mode 100644 index 000000000..19a816d40 --- /dev/null +++ b/ftp/tftp/src/opnsense/mvc/app/models/OPNsense/Tftp/ACL/ACL.xml @@ -0,0 +1,9 @@ +| + {{ lang._('The root folder for transfering files is /usr/local/tftp.') }} + | +