diff --git a/mail/fetchmail/Makefile b/mail/fetchmail/Makefile new file mode 100644 index 000000000..a2a871f38 --- /dev/null +++ b/mail/fetchmail/Makefile @@ -0,0 +1,8 @@ +PLUGIN_NAME= fetchmail +PLUGIN_VERSION= 0.1 +PLUGIN_COMMENT= Remote-mail retrieval utility +PLUGIN_DEPENDS= fetchmail +PLUGIN_MAINTAINER= m.muenz@gmail.com +PLUGIN_DEVEL= yes + +.include "../../Mk/plugins.mk" diff --git a/mail/fetchmail/pkg-descr b/mail/fetchmail/pkg-descr new file mode 100644 index 000000000..8ae714650 --- /dev/null +++ b/mail/fetchmail/pkg-descr @@ -0,0 +1,15 @@ +Fetchmail is a full-featured, robust, well-documented remote-mail retrieval and forwarding +utility intended to be used over on-demand TCP/IP links (such as SLIP or PPP connections). +It supports every remote-mail protocol now in use on the Internet: POP2, POP3, RPOP, APOP, +KPOP, all flavors of IMAP, ETRN, and ODMR. + +Plugin Changelog +================ + +1.0 + +* Allow fetching IMAP mailboxes +* Allow fetching POP3 mailboxes + + +WWW: https://www.fetchmail.info/ diff --git a/mail/fetchmail/src/etc/inc/plugins.inc.d/fetchmail.inc b/mail/fetchmail/src/etc/inc/plugins.inc.d/fetchmail.inc new file mode 100644 index 000000000..1243a3e6e --- /dev/null +++ b/mail/fetchmail/src/etc/inc/plugins.inc.d/fetchmail.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 fetchmail_services() +{ + global $config; + + $services = array(); + + if (isset($config['OPNsense']['fetchmail']['general']['enabled']) && $config['OPNsense']['fetchmail']['general']['enabled'] == 1) { + $services[] = array( + 'description' => gettext('Fetchmail'), + 'configd' => array( + 'restart' => array('fetchmail restart'), + 'start' => array('fetchmail start'), + 'stop' => array('fetchmail stop'), + ), + 'name' => 'fetchmail', + 'pidfile' => '/var/run/fetchmail/fetchmail.pid' + ); + } + + return $services; +} diff --git a/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/Api/GeneralController.php b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/Api/GeneralController.php new file mode 100644 index 000000000..3a9d3ba8f --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/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\Fetchmail\Api; + +use OPNsense\Base\ApiMutableModelControllerBase; + +class GeneralController extends ApiMutableModelControllerBase +{ + protected static $internalModelClass = '\OPNsense\Fetchmail\General'; + protected static $internalModelName = 'general'; +} diff --git a/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/Api/MailboxController.php b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/Api/MailboxController.php new file mode 100644 index 000000000..403c36152 --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/Api/MailboxController.php @@ -0,0 +1,67 @@ + + * 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\Fetchmail\Api; + +use OPNsense\Base\ApiMutableModelControllerBase; + +class MailboxController extends ApiMutableModelControllerBase +{ + protected static $internalModelName = 'mailbox'; + protected static $internalModelClass = '\OPNsense\Fetchmail\Mailbox'; + + public function searchMailboxAction() + { + return $this->searchBase('mailboxes.mailbox', array("enabled", "host", "protocol", "user", "password", "destinationmail", "destination")); + } + + public function getMailboxAction($uuid = null) + { + return $this->getBase('mailbox', 'mailboxes.mailbox', $uuid); + } + + public function addMailboxAction() + { + return $this->addBase('mailbox', 'mailboxes.mailbox'); + } + + public function delMailboxAction($uuid) + { + return $this->delBase('mailboxes.mailbox', $uuid); + } + + public function setMailboxAction($uuid) + { + return $this->setBase('mailbox', 'mailboxes.mailbox', $uuid); + } + + public function toggleMailboxAction($uuid) + { + return $this->toggleBase('mailboxes.mailbox', $uuid); + } +} diff --git a/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/Api/ServiceController.php b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/Api/ServiceController.php new file mode 100644 index 000000000..d3ea06f1a --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/Api/ServiceController.php @@ -0,0 +1,43 @@ + + * 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\Fetchmail\Api; + +use OPNsense\Base\ApiMutableServiceControllerBase; + +/** + * Class ServiceController + * @package OPNsense\Fetchmail + */ +class ServiceController extends ApiMutableServiceControllerBase +{ + protected static $internalServiceClass = '\OPNsense\Fetchmail\General'; + protected static $internalServiceTemplate = 'OPNsense/Fetchmail'; + protected static $internalServiceEnabled = 'enabled'; + protected static $internalServiceName = 'fetchmail'; +} diff --git a/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/GeneralController.php b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/GeneralController.php new file mode 100644 index 000000000..dde96e521 --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/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\Fetchmail; + +class GeneralController extends \OPNsense\Base\IndexController +{ + public function indexAction() + { + $this->view->generalForm = $this->getForm("general"); + $this->view->pick('OPNsense/Fetchmail/general'); + } +} diff --git a/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/MailboxController.php b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/MailboxController.php new file mode 100644 index 000000000..1417158fd --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/MailboxController.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\Fetchmail; + +class MailboxController extends \OPNsense\Base\IndexController +{ + public function indexAction() + { + $this->view->formDialogEditFetchmailMailbox = $this->getForm("dialogEditFetchmailMailbox"); + $this->view->pick('OPNsense/Fetchmail/mailbox'); + } +} diff --git a/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/forms/dialogEditFetchmailMailbox.xml b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/forms/dialogEditFetchmailMailbox.xml new file mode 100644 index 000000000..98307b4d4 --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/forms/dialogEditFetchmailMailbox.xml @@ -0,0 +1,56 @@ +
+ + mailbox.enabled + + checkbox + This will enable or disable the mailbox retrieving. + + + mailbox.host + + text + Hostname of the mail server where mailbox is located. + + + mailbox.protocol + + dropdown + Choose the protocol to use. + + + mailbox.user + + text + Username to authenticate against remote mail server. + + + mailbox.password + + text + Password to authenticate against remote mail server. + + + mailbox.destinationmail + + text + Set the mail address to deliver fetched mails to. + + + mailbox.destination + + text + Set the mail server hostname or IP to deliver fetched mails to. + + + mailbox.usessl + + checkbox + This will enable or disable usage of encrypted connections. For IMAP and POP3 it will switch the ports to 993 and 995. + + + mailbox.sslfingerprint + + text + If the server is using a self-signed certificate, the only option fetching mails is to enter the certficiate fingerprint here. + +
diff --git a/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/forms/general.xml b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/forms/general.xml new file mode 100644 index 000000000..ac0248189 --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/controllers/OPNsense/Fetchmail/forms/general.xml @@ -0,0 +1,14 @@ +
+ + general.enabled + + checkbox + This will activate the Fetchmail daemon. + + + general.interval + + text + Interval in seconds how often to retrieve mails. + +
diff --git a/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/ACL/ACL.xml b/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/ACL/ACL.xml new file mode 100644 index 000000000..e3727a40a --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/ACL/ACL.xml @@ -0,0 +1,9 @@ + + + Services: Fetchmail + + ui/fetchmail/* + api/fetchmail/* + + + diff --git a/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/General.php b/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/General.php new file mode 100644 index 000000000..7c5a75d76 --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/General.php @@ -0,0 +1,34 @@ + + * 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\Fetchmail; + +use OPNsense\Base\BaseModel; + +class General extends BaseModel +{ +} diff --git a/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/General.xml b/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/General.xml new file mode 100644 index 000000000..09cb296c5 --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/General.xml @@ -0,0 +1,15 @@ + + //OPNsense/fetchmail/general + Fetchmail configuration + 0.1 + + + 0 + Y + + + 600 + Y + + + diff --git a/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/Mailbox.php b/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/Mailbox.php new file mode 100644 index 000000000..e843ede94 --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/Mailbox.php @@ -0,0 +1,34 @@ + + * 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\Fetchmail; + +use OPNsense\Base\BaseModel; + +class Mailbox extends BaseModel +{ +} diff --git a/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/Mailbox.xml b/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/Mailbox.xml new file mode 100644 index 000000000..fe711b2c1 --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/Mailbox.xml @@ -0,0 +1,45 @@ + + //OPNsense/fetchmail/mailbox + Fetchmail configuration + 0.1 + + + + + 1 + Y + + + Y + + + Y + + POP3 + IMAP + + + + Y + + + Y + + + Y + + + Y + + + 1 + Y + + + N + /^[A-Fa-f0-9\:]$/ + + + + + diff --git a/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/Menu/Menu.xml b/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/Menu/Menu.xml new file mode 100644 index 000000000..59c8854d8 --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/models/OPNsense/Fetchmail/Menu/Menu.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/mail/fetchmail/src/opnsense/mvc/app/views/OPNsense/Fetchmail/general.volt b/mail/fetchmail/src/opnsense/mvc/app/views/OPNsense/Fetchmail/general.volt new file mode 100644 index 000000000..77f259c4c --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/views/OPNsense/Fetchmail/general.volt @@ -0,0 +1,61 @@ +{# + # + # Copyright (C) 2020 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/mail/fetchmail/src/opnsense/mvc/app/views/OPNsense/Fetchmail/mailbox.volt b/mail/fetchmail/src/opnsense/mvc/app/views/OPNsense/Fetchmail/mailbox.volt new file mode 100644 index 000000000..3be00f23d --- /dev/null +++ b/mail/fetchmail/src/opnsense/mvc/app/views/OPNsense/Fetchmail/mailbox.volt @@ -0,0 +1,91 @@ +{# + # + # Copyright (C) 2020 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. + #} +
+
+ + + + + + + + + + + + + + + + + + + + + +
{{ lang._('Enabled') }}{{ lang._('Host') }}{{ lang._('Protocol') }}{{ lang._('Username') }}{{ lang._('Password') }}{{ lang._('Destination') }}{{ lang._('ID') }}{{ lang._('Commands') }}
+ + +
+
+
+ +

+
+
+
+ +{{ partial("layout_partials/base_dialog",['fields':formDialogEditFetchmailMailbox,'id':'dialogEditFetchmailMailbox','label':lang._('Edit Mailbox')])}} + + diff --git a/mail/fetchmail/src/opnsense/scripts/OPNsense/Fetchmail/setup.sh b/mail/fetchmail/src/opnsense/scripts/OPNsense/Fetchmail/setup.sh new file mode 100644 index 000000000..394e49ce4 --- /dev/null +++ b/mail/fetchmail/src/opnsense/scripts/OPNsense/Fetchmail/setup.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +mkdir -p /var/run/fetchmail +chown fetchmail:wheel /var/run/fetchmail +chmod 755 /var/run/fetchmail diff --git a/mail/fetchmail/src/opnsense/service/conf/actions.d/actions_fetchmail.conf b/mail/fetchmail/src/opnsense/service/conf/actions.d/actions_fetchmail.conf new file mode 100644 index 000000000..9c38206db --- /dev/null +++ b/mail/fetchmail/src/opnsense/service/conf/actions.d/actions_fetchmail.conf @@ -0,0 +1,24 @@ +[start] +command:/usr/local/opnsense/scripts/OPNsense/Fetchmail/setup.sh;/usr/local/etc/rc.d/fetchmail start +parameters: +type:script +message:starting Fetchmail + +[stop] +command:/usr/local/etc/rc.d/fetchmail stop; exit 0 +parameters: +type:script +message:stopping Fetchmail + +[restart] +command:/usr/local/opnsense/scripts/OPNsense/Fetchmail/setup.sh;/usr/local/etc/rc.d/fetchmail restart +parameters: +type:script +message:restarting Fetchmail +description:Restart Fetchmail service + +[status] +command:/usr/local/etc/rc.d/fetchmail status;exit 0 +parameters: +type:script_output +message:request Fetchmail status diff --git a/mail/fetchmail/src/opnsense/service/templates/OPNsense/Fetchmail/+TARGETS b/mail/fetchmail/src/opnsense/service/templates/OPNsense/Fetchmail/+TARGETS new file mode 100644 index 000000000..014ce2e15 --- /dev/null +++ b/mail/fetchmail/src/opnsense/service/templates/OPNsense/Fetchmail/+TARGETS @@ -0,0 +1,2 @@ +fetchmailrc:/usr/local/etc/fetchmailrc +fetchmail:/etc/rc.conf.d/fetchmail diff --git a/mail/fetchmail/src/opnsense/service/templates/OPNsense/Fetchmail/fetchmail b/mail/fetchmail/src/opnsense/service/templates/OPNsense/Fetchmail/fetchmail new file mode 100644 index 000000000..4a21f3d9c --- /dev/null +++ b/mail/fetchmail/src/opnsense/service/templates/OPNsense/Fetchmail/fetchmail @@ -0,0 +1,6 @@ +{% if helpers.exists('OPNsense.fetchmail.general.enabled') and OPNsense.fetchmail.general.enabled == '1' %} +fetchmail_var_script="/usr/local/opnsense/scripts/OPNsense/Fetchmail/setup.sh" +fetchmail_enable="YES" +{% else %} +fetchmail_enable="NO" +{% endif %} diff --git a/mail/fetchmail/src/opnsense/service/templates/OPNsense/Fetchmail/fetchmailrc b/mail/fetchmail/src/opnsense/service/templates/OPNsense/Fetchmail/fetchmailrc new file mode 100644 index 000000000..3438c2fcf --- /dev/null +++ b/mail/fetchmail/src/opnsense/service/templates/OPNsense/Fetchmail/fetchmailrc @@ -0,0 +1,14 @@ +{% if helpers.exists('OPNsense.fetchmail.general.enabled') and OPNsense.fetchmail.general.enabled == '1' %} + +set daemon {{ OPNsense.fetchmail.general.interval }} +set syslog + +{% if helpers.exists('OPNsense.fetchmail.mailbox.mailboxes.mailbox') %} +{% for mailbox_list in helpers.toList('OPNsense.fetchmail.mailbox.mailboxes.mailbox') %} +{% if mailbox_list.enabled == '1' %} +poll {{ mailbox_list.host }} protocol {{ mailbox_list.protocol }} username "{{ mailbox_list.user }}" password "{{ mailbox_list.password }}" is {{ mailbox_list.destinationmail }} smtphost {{ mailbox_list.destination }} {% if mailbox_list.usessl == "0" %} sslproto '' {% endif %} {% if mailbox_list.sslfingerprint|default('') != '' %} sslfingerprint "{{ mailbox_list.sslfingerprint }}" {% endif %} +{% endif %} +{% endfor %} +{% endif %} + +{% endif %}