mail/postfix: domain masq and bcc maps (#1025)

This commit is contained in:
Michael 2018-11-28 07:57:02 +01:00 committed by Franco Fichtner
parent 3ee1ce7fb8
commit 9068502091
25 changed files with 606 additions and 115 deletions

View file

@ -0,0 +1,67 @@
<?php
/*
* Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com>
* 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);
}
}

View file

@ -0,0 +1,67 @@
<?php
/*
* Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com>
* 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);
}
}

View file

@ -0,0 +1,38 @@
<?php
/*
* Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com>
* 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');
}
}

View file

@ -0,0 +1,38 @@
<?php
/*
* Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com>
* 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');
}
}

View file

@ -0,0 +1,22 @@
<form>
<field>
<id>recipientbcc.enabled</id>
<label>Enabled</label>
<type>checkbox</type>
<help>This will enable or disable the BCC sender rewriting setting.</help>
</field>
<field>
<id>recipientbcc.from</id>
<label>Recipient Address</label>
<type>text</type>
<help>Set a pattern to match like user@example.com</help>
</field>
<field>
<id>recipientbcc.to</id>
<label>BCC To</label>
<style>tokenize</style>
<type>select_multiple</type>
<allownew>true</allownew>
<help>Set here the recipient address to send the mail as BCC.</help>
</field>
</form>

View file

@ -0,0 +1,22 @@
<form>
<field>
<id>senderbcc.enabled</id>
<label>Enabled</label>
<type>checkbox</type>
<help>This will enable or disable the BCC sender rewriting setting.</help>
</field>
<field>
<id>senderbcc.from</id>
<label>Sender Address</label>
<type>text</type>
<help>Set a pattern to match like user@example.com</help>
</field>
<field>
<id>senderbcc.to</id>
<label>BCC To</label>
<style>tokenize</style>
<type>select_multiple</type>
<allownew>true</allownew>
<help>Set here the recipient address to send the mail as BCC.</help>
</field>
</form>

View file

@ -69,6 +69,14 @@
<type>text</type>
<help>Set the max size for messages to accept, default is 501200000 Byte which is 50MB. Values must be entered in Bytes.</help>
</field>
<field>
<id>general.masquerade_domains</id>
<label>Masquerade Domains</label>
<style>tokenize</style>
<type>select_multiple</type>
<allownew>true</allownew>
<help>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.</help>
</field>
<field>
<id>general.disable_ssl</id>
<label>Allow TLS Only</label>

View file

@ -47,6 +47,11 @@
<default>51200000</default>
<Required>Y</Required>
</message_size_limit>
<masquerade_domains type="CSVListField">
<Required>N</Required>
<mask>/^([0-9a-z\.\-\_]{1,128})(,[0-9a-z\.\-\_]{1,128})*$/ui</mask>
<ValidationMessage>Only up to 128 of the following characters are allowed: 0-9a-zA-Z.-_</ValidationMessage>
</masquerade_domains>
<disable_ssl type="BooleanField">
<default>1</default>
<Required>Y</Required>

View file

@ -4,7 +4,9 @@
<General url="/ui/postfix/general/index" order="10"/>
<Domains url="/ui/postfix/domain/index" order="20"/>
<Recipients url="/ui/postfix/recipient/index" order="30"/>
<Recipientbcc VisibleName="Recipient BCC" url="/ui/postfix/recipientbcc/index" order="35"/>
<Senders url="/ui/postfix/sender/index" order="40"/>
<Senderbcc VisibleName="Sender BCC" url="/ui/postfix/senderbcc/index" order="45"/>
<Address VisibleName="Address Rewriting" url="/ui/postfix/address/index" order="50"/>
<LogFile VisibleName="Log File" order="50" url="/diag_logs_postfix.php"/>
</Postfix>

View file

@ -0,0 +1,30 @@
<?php
namespace OPNsense\Postfix;
use OPNsense\Base\BaseModel;
/*
Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com>
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
{
}

View file

@ -0,0 +1,21 @@
<model>
<mount>//OPNsense/postfix/recipientbcc</mount>
<description>Postfix Recipient BCC configuration</description>
<version>1.0.0</version>
<items>
<recipientbccs>
<recipientbcc type="ArrayField">
<enabled type="BooleanField">
<default>1</default>
<Required>Y</Required>
</enabled>
<from type="TextField">
<Required>Y</Required>
</from>
<to type="CSVListField">
<Required>Y</Required>
</to>
</recipientbcc>
</recipientbccs>
</items>
</model>

View file

@ -0,0 +1,30 @@
<?php
namespace OPNsense\Postfix;
use OPNsense\Base\BaseModel;
/*
Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com>
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
{
}

View file

@ -0,0 +1,21 @@
<model>
<mount>//OPNsense/postfix/senderbcc</mount>
<description>Postfix Sender BCC configuration</description>
<version>1.0.0</version>
<items>
<senderbccs>
<senderbcc type="ArrayField">
<enabled type="BooleanField">
<default>1</default>
<Required>Y</Required>
</enabled>
<from type="TextField">
<Required>Y</Required>
</from>
<to type="CSVListField">
<Required>Y</Required>
</to>
</senderbcc>
</senderbccs>
</items>
</model>

View file

@ -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' %}
});
</script>
<div class="tab-content content-box tab-content">
<div id="addresses" class="tab-pane fade in active">
<!-- tab page "addresses" -->
<table id="grid-addresses" class="table table-condensed table-hover table-striped table-responsive" data-editDialog="dialogEditPostfixAddress">
<table id="grid-addresses" class="table table-responsive" data-editDialog="dialogEditPostfixAddress">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="from" data-type="string" data-visible="true">{{ lang._('Rewrite From') }}</th>
<th data-column-id="to" data-type="string" data-visible="true">{{ lang._('Rewrite To') }}</th>
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th> </tr>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
</tr>
</thead>
<tbody>
</tbody>
@ -99,12 +75,12 @@ POSSIBILITY OF SUCH DAMAGE.
</tr>
</tfoot>
</table>
</div>
<div class="col-md-12">
<hr/>
<button class="btn btn-primary" id="reconfigureAct" type="button"><b>{{ lang._('Apply') }}</b> <i id="reconfigureAct_progress" class=""></i></button>
<br/><br/>
<div class="col-md-12">
<hr/>
<button class="btn btn-primary" id="reconfigureAct" type="button"><b>{{ lang._('Apply') }}</b> <i id="reconfigureAct_progress" class=""></i></button>
<br/><br/>
</div>
</div>
</div>
{{ 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')])}}

View file

@ -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", {});
}
});
});

View file

@ -1,7 +1,7 @@
{#
OPNsense® is Copyright © 2014 2017 by Deciso B.V.
Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
Copyright (C) 2017-2018 Michael Muenz <m.muenz@gmail.com>
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' %}
});
</script>
<div class="tab-content content-box tab-content">

View file

@ -1,7 +1,7 @@
{#
OPNsense® is Copyright © 2014 2017 by Deciso B.V.
Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
Copyright (C) 2017-2018 Michael Muenz <m.muenz@gmail.com>
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' %}
});
</script>
<div class="tab-content content-box tab-content">

View file

@ -0,0 +1,86 @@
{#
OPNsense® is Copyright © 2014 2017 by Deciso B.V.
Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com>
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.
#}
<script>
$( document ).ready(function() {
/*************************************************************************************************************
* link grid actions
*************************************************************************************************************/
$("#grid-recipientbccs").UIBootgrid(
{ 'search':'/api/postfix/recipientbcc/searchRecipientbcc',
'get':'/api/postfix/recipientbcc/getRecipientbcc/',
'set':'/api/postfix/recipientbcc/setRecipientbcc/',
'add':'/api/postfix/recipientbcc/addRecipientbcc/',
'del':'/api/postfix/recipientbcc/delRecipientbcc/',
'toggle':'/api/postfix/recipientbcc/toggleRecipientbcc/'
}
);
{% include 'OPNsense/Postfix/apply.volt' %}
});
</script>
<div class="tab-content content-box tab-content">
<div id="recipientbccs" class="tab-pane fade in active">
<!-- tab page "recipientbccs" -->
<table id="grid-recipientbccs" class="table table-responsive" data-editDialog="dialogEditPostfixRecipientbcc">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="from" data-type="string" data-visible="true">{{ lang._('Recipient Address') }}</th>
<th data-column-id="to" data-type="string" data-visible="true">{{ lang._('BCC To') }}</th>
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
<button data-action="deleteSelected" type="button" class="btn btn-xs btn-default"><span class="fa fa-trash-o"></span></button>
</td>
</tr>
</tfoot>
</table>
<div class="col-md-12">
<hr/>
<button class="btn btn-primary" id="reconfigureAct" type="button"><b>{{ lang._('Apply') }}</b> <i id="reconfigureAct_progress" class=""></i></button>
<br/><br/>
</div>
</div>
</div>
{{ partial("layout_partials/base_dialog",['fields':formDialogEditPostfixRecipientbcc,'id':'dialogEditPostfixRecipientbcc','label':lang._('Edit Recipient BCC')])}}

View file

@ -1,7 +1,7 @@
{#
OPNsense® is Copyright © 2014 2017 by Deciso B.V.
Copyright (C) 2017 Michael Muenz <m.muenz@gmail.com>
Copyright (C) 2017-2018 Michael Muenz <m.muenz@gmail.com>
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' %}
});
</script>
<div class="tab-content content-box tab-content">

View file

@ -0,0 +1,86 @@
{#
OPNsense® is Copyright © 2014 2017 by Deciso B.V.
Copyright (C) 2018 Michael Muenz <m.muenz@gmail.com>
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.
#}
<script>
$( document ).ready(function() {
/*************************************************************************************************************
* link grid actions
*************************************************************************************************************/
$("#grid-senderbccs").UIBootgrid(
{ 'search':'/api/postfix/senderbcc/searchSenderbcc',
'get':'/api/postfix/senderbcc/getSenderbcc/',
'set':'/api/postfix/senderbcc/setSenderbcc/',
'add':'/api/postfix/senderbcc/addSenderbcc/',
'del':'/api/postfix/senderbcc/delSenderbcc/',
'toggle':'/api/postfix/senderbcc/toggleSenderbcc/'
}
);
{% include 'OPNsense/Postfix/apply.volt' %}
});
</script>
<div class="tab-content content-box tab-content">
<div id="senderbccs" class="tab-pane fade in active">
<!-- tab page "senderbccs" -->
<table id="grid-senderbccs" class="table table-responsive" data-editDialog="dialogEditPostfixSenderbcc">
<thead>
<tr>
<th data-column-id="enabled" data-type="string" data-formatter="rowtoggle">{{ lang._('Enabled') }}</th>
<th data-column-id="from" data-type="string" data-visible="true">{{ lang._('Sender Address') }}</th>
<th data-column-id="to" data-type="string" data-visible="true">{{ lang._('BCC To') }}</th>
<th data-column-id="uuid" data-type="string" data-identifier="true" data-visible="false">{{ lang._('ID') }}</th>
<th data-column-id="commands" data-formatter="commands" data-sortable="false">{{ lang._('Commands') }}</th>
</tr>
</thead>
<tbody>
</tbody>
<tfoot>
<tr>
<td></td>
<td>
<button data-action="add" type="button" class="btn btn-xs btn-default"><span class="fa fa-plus"></span></button>
<button data-action="deleteSelected" type="button" class="btn btn-xs btn-default"><span class="fa fa-trash-o"></span></button>
</td>
</tr>
</tfoot>
</table>
<div class="col-md-12">
<hr/>
<button class="btn btn-primary" id="reconfigureAct" type="button"><b>{{ lang._('Apply') }}</b> <i id="reconfigureAct_progress" class=""></i></button>
<br/><br/>
</div>
</div>
</div>
{{ partial("layout_partials/base_dialog",['fields':formDialogEditPostfixSenderbcc,'id':'dialogEditPostfixSenderbcc','label':lang._('Edit Sender BCC')])}}

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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 %}

View file

@ -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 %}