From 9068502091efaf1f9df0edaced7af87f0fa7fdde Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 28 Nov 2018 07:57:02 +0100 Subject: [PATCH] mail/postfix: domain masq and bcc maps (#1025) --- .../Postfix/Api/RecipientbccController.php | 67 +++++++++++++++ .../Postfix/Api/SenderbccController.php | 67 +++++++++++++++ .../Postfix/RecipientbccController.php | 38 ++++++++ .../OPNsense/Postfix/SenderbccController.php | 38 ++++++++ .../forms/dialogEditPostfixRecipientbcc.xml | 22 +++++ .../forms/dialogEditPostfixSenderbcc.xml | 22 +++++ .../OPNsense/Postfix/forms/general.xml | 8 ++ .../app/models/OPNsense/Postfix/General.xml | 5 ++ .../app/models/OPNsense/Postfix/Menu/Menu.xml | 2 + .../models/OPNsense/Postfix/Recipientbcc.php | 30 +++++++ .../models/OPNsense/Postfix/Recipientbcc.xml | 21 +++++ .../app/models/OPNsense/Postfix/Senderbcc.php | 30 +++++++ .../app/models/OPNsense/Postfix/Senderbcc.xml | 21 +++++ .../app/views/OPNsense/Postfix/address.volt | 44 +++------- .../mvc/app/views/OPNsense/Postfix/apply.volt | 20 +++++ .../app/views/OPNsense/Postfix/domain.volt | 29 +------ .../app/views/OPNsense/Postfix/recipient.volt | 29 +------ .../views/OPNsense/Postfix/recipientbcc.volt | 86 +++++++++++++++++++ .../app/views/OPNsense/Postfix/sender.volt | 29 +------ .../app/views/OPNsense/Postfix/senderbcc.volt | 86 +++++++++++++++++++ .../scripts/OPNsense/Postfix/setup.sh | 2 + .../templates/OPNsense/Postfix/+TARGETS | 2 + .../templates/OPNsense/Postfix/main.cf | 5 ++ .../templates/OPNsense/Postfix/recipientbcc | 9 ++ .../templates/OPNsense/Postfix/senderbcc | 9 ++ 25 files changed, 606 insertions(+), 115 deletions(-) create mode 100644 mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/Api/RecipientbccController.php create mode 100644 mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/Api/SenderbccController.php create mode 100644 mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/RecipientbccController.php create mode 100644 mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/SenderbccController.php create mode 100644 mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/forms/dialogEditPostfixRecipientbcc.xml create mode 100644 mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/forms/dialogEditPostfixSenderbcc.xml create mode 100644 mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Recipientbcc.php create mode 100644 mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Recipientbcc.xml create mode 100644 mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Senderbcc.php create mode 100644 mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Senderbcc.xml create mode 100644 mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/apply.volt create mode 100644 mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/recipientbcc.volt create mode 100644 mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/senderbcc.volt create mode 100644 mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/recipientbcc create mode 100644 mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/senderbcc diff --git a/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/Api/RecipientbccController.php b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/Api/RecipientbccController.php new file mode 100644 index 000000000..3f642276c --- /dev/null +++ b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/Api/RecipientbccController.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\Postfix\Api; + +use \OPNsense\Base\ApiMutableModelControllerBase; + +class RecipientbccController extends ApiMutableModelControllerBase +{ + static protected $internalModelName = 'recipientbcc'; + static protected $internalModelClass = '\OPNsense\Postfix\Recipientbcc'; + + public function searchRecipientbccAction() + { + return $this->searchBase('recipientbccs.recipientbcc', array("enabled", "from", "to")); + } + + public function getRecipientbccAction($uuid = null) + { + return $this->getBase('recipientbcc', 'recipientbccs.recipientbcc', $uuid); + } + + public function addRecipientbccAction() + { + return $this->addBase('recipientbcc', 'recipientbccs.recipientbcc'); + } + + public function delRecipientbccAction($uuid) + { + return $this->delBase('recipientbccs.recipientbcc', $uuid); + } + + public function setRecipientbccAction($uuid) + { + return $this->setBase('recipientbcc', 'recipientbccs.recipientbcc', $uuid); + } + + public function toggleRecipientbccAction($uuid) + { + return $this->toggleBase('recipientbccs.recipientbcc', $uuid); + } +} diff --git a/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/Api/SenderbccController.php b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/Api/SenderbccController.php new file mode 100644 index 000000000..7b79f79af --- /dev/null +++ b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/Api/SenderbccController.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\Postfix\Api; + +use \OPNsense\Base\ApiMutableModelControllerBase; + +class SenderbccController extends ApiMutableModelControllerBase +{ + static protected $internalModelName = 'senderbcc'; + static protected $internalModelClass = '\OPNsense\Postfix\Senderbcc'; + + public function searchSenderbccAction() + { + return $this->searchBase('senderbccs.senderbcc', array("enabled", "from", "to")); + } + + public function getSenderbccAction($uuid = null) + { + return $this->getBase('senderbcc', 'senderbccs.senderbcc', $uuid); + } + + public function addSenderbccAction() + { + return $this->addBase('senderbcc', 'senderbccs.senderbcc'); + } + + public function delSenderbccAction($uuid) + { + return $this->delBase('senderbccs.senderbcc', $uuid); + } + + public function setSenderbccAction($uuid) + { + return $this->setBase('senderbcc', 'senderbccs.senderbcc', $uuid); + } + + public function toggleSenderbccAction($uuid) + { + return $this->toggleBase('senderbccs.senderbcc', $uuid); + } +} diff --git a/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/RecipientbccController.php b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/RecipientbccController.php new file mode 100644 index 000000000..fb6251648 --- /dev/null +++ b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/RecipientbccController.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\Postfix; + +class RecipientbccController extends \OPNsense\Base\IndexController +{ + public function indexAction() + { + $this->view->formDialogEditPostfixRecipientbcc = $this->getForm("dialogEditPostfixRecipientbcc"); + $this->view->pick('OPNsense/Postfix/recipientbcc'); + } +} diff --git a/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/SenderbccController.php b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/SenderbccController.php new file mode 100644 index 000000000..4f036a0e7 --- /dev/null +++ b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/SenderbccController.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\Postfix; + +class SenderbccController extends \OPNsense\Base\IndexController +{ + public function indexAction() + { + $this->view->formDialogEditPostfixSenderbcc = $this->getForm("dialogEditPostfixSenderbcc"); + $this->view->pick('OPNsense/Postfix/senderbcc'); + } +} diff --git a/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/forms/dialogEditPostfixRecipientbcc.xml b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/forms/dialogEditPostfixRecipientbcc.xml new file mode 100644 index 000000000..11d9e0f6e --- /dev/null +++ b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/forms/dialogEditPostfixRecipientbcc.xml @@ -0,0 +1,22 @@ +
+ + recipientbcc.enabled + + checkbox + This will enable or disable the BCC sender rewriting setting. + + + recipientbcc.from + + text + Set a pattern to match like user@example.com + + + recipientbcc.to + + + select_multiple + true + Set here the recipient address to send the mail as BCC. + +
diff --git a/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/forms/dialogEditPostfixSenderbcc.xml b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/forms/dialogEditPostfixSenderbcc.xml new file mode 100644 index 000000000..dea2e2c5a --- /dev/null +++ b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/forms/dialogEditPostfixSenderbcc.xml @@ -0,0 +1,22 @@ +
+ + senderbcc.enabled + + checkbox + This will enable or disable the BCC sender rewriting setting. + + + senderbcc.from + + text + Set a pattern to match like user@example.com + + + senderbcc.to + + + select_multiple + true + Set here the recipient address to send the mail as BCC. + +
diff --git a/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/forms/general.xml b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/forms/general.xml index 4d6ea164e..715ae7a56 100644 --- a/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/forms/general.xml +++ b/mail/postfix/src/opnsense/mvc/app/controllers/OPNsense/Postfix/forms/general.xml @@ -69,6 +69,14 @@ text Set the max size for messages to accept, default is 501200000 Byte which is 50MB. Values must be entered in Bytes. + + general.masquerade_domains + + + select_multiple + true + Masquerade internal domains to the outside. When you set example.com, the domain host.internal.example.com will be rewritten to exmaple.com when mail leaves the system. + general.disable_ssl diff --git a/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/General.xml b/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/General.xml index c19f4ec2f..80c232175 100644 --- a/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/General.xml +++ b/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/General.xml @@ -47,6 +47,11 @@ 51200000 Y + + N + /^([0-9a-z\.\-\_]{1,128})(,[0-9a-z\.\-\_]{1,128})*$/ui + Only up to 128 of the following characters are allowed: 0-9a-zA-Z.-_ + 1 Y diff --git a/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Menu/Menu.xml b/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Menu/Menu.xml index ff4e69047..3bcf13364 100644 --- a/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Menu/Menu.xml +++ b/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Menu/Menu.xml @@ -4,7 +4,9 @@ + +
diff --git a/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Recipientbcc.php b/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Recipientbcc.php new file mode 100644 index 000000000..b97f50513 --- /dev/null +++ b/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Recipientbcc.php @@ -0,0 +1,30 @@ + + 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. +*/ + +class Recipientbcc extends BaseModel +{ +} diff --git a/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Recipientbcc.xml b/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Recipientbcc.xml new file mode 100644 index 000000000..f763871c3 --- /dev/null +++ b/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Recipientbcc.xml @@ -0,0 +1,21 @@ + + //OPNsense/postfix/recipientbcc + Postfix Recipient BCC configuration + 1.0.0 + + + + + 1 + Y + + + Y + + + Y + + + + + diff --git a/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Senderbcc.php b/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Senderbcc.php new file mode 100644 index 000000000..9a4b340e9 --- /dev/null +++ b/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Senderbcc.php @@ -0,0 +1,30 @@ + + 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. +*/ + +class Senderbcc extends BaseModel +{ +} diff --git a/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Senderbcc.xml b/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Senderbcc.xml new file mode 100644 index 000000000..7f2610a92 --- /dev/null +++ b/mail/postfix/src/opnsense/mvc/app/models/OPNsense/Postfix/Senderbcc.xml @@ -0,0 +1,21 @@ + + //OPNsense/postfix/senderbcc + Postfix Sender BCC configuration + 1.0.0 + + + + + 1 + Y + + + Y + + + Y + + + + + diff --git a/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/address.volt b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/address.volt index 39ba106e9..8c200128e 100644 --- a/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/address.volt +++ b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/address.volt @@ -44,48 +44,24 @@ POSSIBILITY OF SUCH DAMAGE. } ); - /************************************************************************************************************* - * Commands - *************************************************************************************************************/ - - /** - * Reconfigure - */ - $("#reconfigureAct").click(function(){ - $("#reconfigureAct_progress").addClass("fa fa-spinner fa-pulse"); - ajaxCall("/api/postfix/service/reconfigure", {}, function(data,status) { - // when done, disable progress animation. - $("#reconfigureAct_progress").removeClass("fa fa-spinner fa-pulse"); - - if (status != "success" || data['status'] != 'ok') { - BootstrapDialog.show({ - type: BootstrapDialog.TYPE_WARNING, - title: "{{ lang._('Error reconfiguring Postfix') }}", - message: data['status'], - draggable: true - }); - } else { - ajaxCall("/api/postfix/service/reconfigure", {}); - } - }); - }); + {% include 'OPNsense/Postfix/apply.volt' %} }); -
- +
- + + @@ -99,12 +75,12 @@ POSSIBILITY OF SUCH DAMAGE.
{{ lang._('Enabled') }} {{ lang._('Rewrite From') }} {{ lang._('Rewrite To') }} {{ lang._('ID') }}{{ lang._('Commands') }}
{{ lang._('Commands') }}
-
-
-
- -

+
+
+ +

+
-{{ partial("layout_partials/base_dialog",['fields':formDialogEditPostfixAddress,'id':'dialogEditPostfixAddress','label':lang._('Edit Address Rewriting')])}} +{{ partial("layout_partials/base_dialog",['fields':formDialogEditPostfixAddress,'id':'dialogEditPostfixAddress','label':lang._('Edit Address Rewriting')])}} \ No newline at end of file diff --git a/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/apply.volt b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/apply.volt new file mode 100644 index 000000000..eb225b06f --- /dev/null +++ b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/apply.volt @@ -0,0 +1,20 @@ +/** + * Reconfigure + */ +$("#reconfigureAct").click(function(){ + $("#reconfigureAct_progress").addClass("fa fa-spinner fa-pulse"); + ajaxCall("/api/postfix/service/reconfigure", {}, function(data,status) { + // when done, disable progress animation. + $("#reconfigureAct_progress").removeClass("fa fa-spinner fa-pulse"); + if (status != "success" || data['status'] != 'ok') { + BootstrapDialog.show({ + type: BootstrapDialog.TYPE_WARNING, + title: "{{ lang._('Error reconfiguring Postfix') }}", + message: data['status'], + draggable: true + }); + } else { + ajaxCall("/api/postfix/service/reconfigure", {}); + } + }); +}); diff --git a/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/domain.volt b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/domain.volt index 64a843172..bf7e0b1af 100644 --- a/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/domain.volt +++ b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/domain.volt @@ -1,7 +1,7 @@ {# OPNsense® is Copyright © 2014 – 2017 by Deciso B.V. -Copyright (C) 2017 Michael Muenz +Copyright (C) 2017-2018 Michael Muenz All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -44,35 +44,10 @@ POSSIBILITY OF SUCH DAMAGE. } ); - /************************************************************************************************************* - * Commands - *************************************************************************************************************/ - - /** - * Reconfigure - */ - $("#reconfigureAct").click(function(){ - $("#reconfigureAct_progress").addClass("fa fa-spinner fa-pulse"); - ajaxCall(url="/api/postfix/service/reconfigure", sendData={}, callback=function(data,status) { - // when done, disable progress animation. - $("#reconfigureAct_progress").removeClass("fa fa-spinner fa-pulse"); - - if (status != "success" || data['status'] != 'ok') { - BootstrapDialog.show({ - type: BootstrapDialog.TYPE_WARNING, - title: "{{ lang._('Error reconfiguring Postfix') }}", - message: data['status'], - draggable: true - }); - } else { - ajaxCall(url="/api/postfix/service/reconfigure", sendData={}); - } - }); - }); + {% include 'OPNsense/Postfix/apply.volt' %} }); -
diff --git a/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/recipient.volt b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/recipient.volt index 8d24d2424..ed1e62be1 100644 --- a/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/recipient.volt +++ b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/recipient.volt @@ -1,7 +1,7 @@ {# OPNsense® is Copyright © 2014 – 2017 by Deciso B.V. -Copyright (C) 2017 Michael Muenz +Copyright (C) 2017-2018 Michael Muenz All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -44,35 +44,10 @@ POSSIBILITY OF SUCH DAMAGE. } ); - /************************************************************************************************************* - * Commands - *************************************************************************************************************/ - - /** - * Reconfigure - */ - $("#reconfigureAct").click(function(){ - $("#reconfigureAct_progress").addClass("fa fa-spinner fa-pulse"); - ajaxCall(url="/api/postfix/service/reconfigure", sendData={}, callback=function(data,status) { - // when done, disable progress animation. - $("#reconfigureAct_progress").removeClass("fa fa-spinner fa-pulse"); - - if (status != "success" || data['status'] != 'ok') { - BootstrapDialog.show({ - type: BootstrapDialog.TYPE_WARNING, - title: "{{ lang._('Error reconfiguring Postfix') }}", - message: data['status'], - draggable: true - }); - } else { - ajaxCall(url="/api/postfix/service/reconfigure", sendData={}); - } - }); - }); + {% include 'OPNsense/Postfix/apply.volt' %} }); -
diff --git a/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/recipientbcc.volt b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/recipientbcc.volt new file mode 100644 index 000000000..39bd7edc7 --- /dev/null +++ b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/recipientbcc.volt @@ -0,0 +1,86 @@ +{# + +OPNsense® is Copyright © 2014 – 2017 by Deciso B.V. +Copyright (C) 2018 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._('Recipient Address') }}{{ lang._('BCC To') }}{{ lang._('ID') }}{{ lang._('Commands') }}
+ + +
+
+
+ +

+
+
+
+ +{{ partial("layout_partials/base_dialog",['fields':formDialogEditPostfixRecipientbcc,'id':'dialogEditPostfixRecipientbcc','label':lang._('Edit Recipient BCC')])}} diff --git a/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/sender.volt b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/sender.volt index 91837481f..078e6d386 100644 --- a/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/sender.volt +++ b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/sender.volt @@ -1,7 +1,7 @@ {# OPNsense® is Copyright © 2014 – 2017 by Deciso B.V. -Copyright (C) 2017 Michael Muenz +Copyright (C) 2017-2018 Michael Muenz All rights reserved. Redistribution and use in source and binary forms, with or without modification, @@ -44,35 +44,10 @@ POSSIBILITY OF SUCH DAMAGE. } ); - /************************************************************************************************************* - * Commands - *************************************************************************************************************/ - - /** - * Reconfigure - */ - $("#reconfigureAct").click(function(){ - $("#reconfigureAct_progress").addClass("fa fa-spinner fa-pulse"); - ajaxCall(url="/api/postfix/service/reconfigure", sendData={}, callback=function(data,status) { - // when done, disable progress animation. - $("#reconfigureAct_progress").removeClass("fa fa-spinner fa-pulse"); - - if (status != "success" || data['status'] != 'ok') { - BootstrapDialog.show({ - type: BootstrapDialog.TYPE_WARNING, - title: "{{ lang._('Error reconfiguring Postfix') }}", - message: data['status'], - draggable: true - }); - } else { - ajaxCall(url="/api/postfix/service/reconfigure", sendData={}); - } - }); - }); + {% include 'OPNsense/Postfix/apply.volt' %} }); -
diff --git a/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/senderbcc.volt b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/senderbcc.volt new file mode 100644 index 000000000..3be240dde --- /dev/null +++ b/mail/postfix/src/opnsense/mvc/app/views/OPNsense/Postfix/senderbcc.volt @@ -0,0 +1,86 @@ +{# + +OPNsense® is Copyright © 2014 – 2017 by Deciso B.V. +Copyright (C) 2018 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._('Sender Address') }}{{ lang._('BCC To') }}{{ lang._('ID') }}{{ lang._('Commands') }}
+ + +
+
+
+ +

+
+
+
+ +{{ partial("layout_partials/base_dialog",['fields':formDialogEditPostfixSenderbcc,'id':'dialogEditPostfixSenderbcc','label':lang._('Edit Sender BCC')])}} \ No newline at end of file diff --git a/mail/postfix/src/opnsense/scripts/OPNsense/Postfix/setup.sh b/mail/postfix/src/opnsense/scripts/OPNsense/Postfix/setup.sh index 3022bdf01..bd75813f3 100755 --- a/mail/postfix/src/opnsense/scripts/OPNsense/Postfix/setup.sh +++ b/mail/postfix/src/opnsense/scripts/OPNsense/Postfix/setup.sh @@ -31,6 +31,8 @@ postmap /usr/local/etc/postfix/transport postmap /usr/local/etc/postfix/virtual postmap /usr/local/etc/postfix/recipient_access postmap /usr/local/etc/postfix/sender_access +postmap /usr/local/etc/postfix/senderbcc +postmap /usr/local/etc/postfix/recipientbcc postmap /usr/local/etc/postfix/smtp_auth # Check for aliases diff --git a/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/+TARGETS b/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/+TARGETS index 3065898ab..dc76ac076 100644 --- a/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/+TARGETS +++ b/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/+TARGETS @@ -5,4 +5,6 @@ transport:/usr/local/etc/postfix/transport virtual:/usr/local/etc/postfix/virtual recipient_access:/usr/local/etc/postfix/recipient_access sender_access:/usr/local/etc/postfix/sender_access +senderbcc:/usr/local/etc/postfix/senderbcc +recipientbcc:/usr/local/etc/postfix/recipientbcc smtp_auth:/usr/local/etc/postfix/smtp_auth diff --git a/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/main.cf b/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/main.cf index 57e09c05e..a54be40cc 100644 --- a/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/main.cf +++ b/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/main.cf @@ -32,6 +32,8 @@ shlib_directory = /usr/local/lib/postfix relay_domains = hash:/usr/local/etc/postfix/transport transport_maps = hash:/usr/local/etc/postfix/transport virtual_alias_maps = hash:/usr/local/etc/postfix/virtual +sender_bcc_maps = hash:/usr/local/etc/postfix/senderbcc +recipient_bcc_maps = hash:/usr/local/etc/postfix/recipientbcc ########################## # END SYSTEM DEFAULTS ########################## @@ -75,6 +77,9 @@ smtpd_banner = $myhostname ESMTP Postfix {% if helpers.exists('OPNsense.postfix.general.message_size_limit') and OPNsense.postfix.general.message_size_limit != '' %} message_size_limit = {{ OPNsense.postfix.general.message_size_limit }} {% endif %} +{% if helpers.exists('OPNsense.postfix.general.masquerade_domains') and OPNsense.postfix.general.masquerade_domains != '' %} +masquerade_domains = {{ OPNsense.postfix.general.masquerade_domains }} +{% endif %} {% if helpers.exists('OPNsense.postfix.general.disable_ssl') and OPNsense.postfix.general.disable_ssl == '1' %} smtpd_tls_mandatory_protocols=!SSLv2,!SSLv3 smtp_tls_mandatory_protocols=!SSLv2,!SSLv3 diff --git a/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/recipientbcc b/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/recipientbcc new file mode 100644 index 000000000..8bd798231 --- /dev/null +++ b/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/recipientbcc @@ -0,0 +1,9 @@ +{% if helpers.exists('OPNsense.postfix.general.enabled') and OPNsense.postfix.general.enabled == '1' %} +{% if helpers.exists('OPNsense.postfix.recipientbcc.recipientbccs.recipientbcc') %} +{% for recipient_list in helpers.toList('OPNsense.postfix.recipientbcc.recipientbccs.recipientbcc') %} +{% if recipient_list.enabled == '1' %} +{{ recipient_list.from }} {{ recipient_list.to }} +{% endif %} +{% endfor %} +{% endif %} +{% endif %} diff --git a/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/senderbcc b/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/senderbcc new file mode 100644 index 000000000..23129ac7a --- /dev/null +++ b/mail/postfix/src/opnsense/service/templates/OPNsense/Postfix/senderbcc @@ -0,0 +1,9 @@ +{% if helpers.exists('OPNsense.postfix.general.enabled') and OPNsense.postfix.general.enabled == '1' %} +{% if helpers.exists('OPNsense.postfix.senderbcc.senderbccs.senderbcc') %} +{% for sender_list in helpers.toList('OPNsense.postfix.senderbcc.senderbccs.senderbcc') %} +{% if sender_list.enabled == '1' %} +{{ sender_list.from }} {{ sender_list.to }} +{% endif %} +{% endfor %} +{% endif %} +{% endif %}