public inbox for pmg-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Christoph Heiss <c.heiss@proxmox.com>
To: pmg-devel@lists.proxmox.com
Subject: [pmg-devel] [PATCH v2 pmg-gui 3/4] fix #2437: proxy: Add 'TLS Inbound Domains' panel
Date: Mon, 20 Mar 2023 11:35:47 +0100	[thread overview]
Message-ID: <20230320103548.382757-4-c.heiss@proxmox.com> (raw)
In-Reply-To: <20230320103548.382757-1-c.heiss@proxmox.com>

This panel can be used to configure sender domains for which TLS will be
enforced my postfix. As this takes the usual transport domain format,
either a FQDN or .FQDN (for matching subdomains) can be specified.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
Changes v1 -> v2:
 * Rename to 'TLS Inbound Domains' from 'TLS Inbound Policy'
 * Change to renamed API endpoint (`tlsinboundpolicy` -> `tlsinbounddomains`)

 js/MailProxyTLSInboundDomains.js | 93 ++++++++++++++++++++++++++++++++
 js/MailProxyTLSPanel.js          |  8 ++-
 js/Makefile                      |  1 +
 3 files changed, 101 insertions(+), 1 deletion(-)
 create mode 100644 js/MailProxyTLSInboundDomains.js

diff --git a/js/MailProxyTLSInboundDomains.js b/js/MailProxyTLSInboundDomains.js
new file mode 100644
index 0000000..27f8fcd
--- /dev/null
+++ b/js/MailProxyTLSInboundDomains.js
@@ -0,0 +1,93 @@
+Ext.define('pmg-tls-inbound-domains', {
+    extend: 'Ext.data.Model',
+    fields: ['domain'],
+    idProperty: 'domain',
+    proxy: {
+	type: 'proxmox',
+	url: '/api2/json/config/tlsinbounddomains',
+    },
+    sorters: {
+	property: 'domain',
+	direction: 'ASC',
+    },
+});
+
+Ext.define('PMG.TLSInboundDomainsEdit', {
+    extend: 'Proxmox.window.Edit',
+    xtype: 'pmgTLSInboundDomainsEdit',
+    onlineHelp: 'pmgconfig_mailproxy_tls',
+
+    subject: gettext('TLS Inbound domains'),
+    url: '/api2/extjs/config/tlsinbounddomains',
+    method: 'POST',
+
+    items: [
+	{
+	    xtype: 'proxmoxtextfield',
+	    name: 'domain',
+	    fieldLabel: gettext('Domain'),
+	},
+    ],
+});
+
+Ext.define('PMG.MailProxyTLSInboundDomains', {
+    extend: 'Ext.grid.GridPanel',
+    alias: ['widget.pmgMailProxyTLSInboundDomains'],
+
+    viewConfig: {
+	trackOver: false,
+    },
+
+    columns: [
+	{
+	    header: gettext('Domain'),
+	    flex: 1,
+	    sortable: true,
+	    dataIndex: 'domain',
+	},
+    ],
+
+    initComponent: function() {
+	const me = this;
+
+	const rstore = Ext.create('Proxmox.data.UpdateStore', {
+	    model: 'pmg-tls-inbound-domains',
+	    storeid: 'pmg-mailproxy-tls-inbound-domains-store-' + ++Ext.idSeed,
+	});
+
+	const store = Ext.create('Proxmox.data.DiffStore', { rstore: rstore });
+	const reload = () => rstore.load();
+	me.selModel = Ext.create('Ext.selection.RowModel', {});
+	Proxmox.Utils.monStoreErrors(me, store, true);
+
+	Ext.apply(me, {
+	    store,
+	    tbar: [
+		{
+		    text: gettext('Create'),
+		    handler: () => {
+			Ext.createWidget('pmgTLSInboundDomainsEdit', {
+			    autoShow: true,
+			    listeners: {
+				destroy: reload,
+			    },
+			});
+		    },
+		},
+		{
+		    xtype: 'proxmoxStdRemoveButton',
+		    baseurl: '/config/tlsinbounddomains',
+		    callback: reload,
+		    waitMsgTarget: me,
+		},
+	    ],
+	    listeners: {
+		activate: rstore.startUpdate,
+		destroy: rstore.stopUpdate,
+		deactivate: rstore.stopUpdate,
+	    },
+	});
+
+	me.callParent();
+    },
+});
diff --git a/js/MailProxyTLSPanel.js b/js/MailProxyTLSPanel.js
index 82dc3f8..96b24de 100644
--- a/js/MailProxyTLSPanel.js
+++ b/js/MailProxyTLSPanel.js
@@ -26,11 +26,17 @@ Ext.define('PMG.MailProxyTLSPanel', {
 	    flex: 1,
 	});

-	me.items = [tlsSettings, tlsDestinations];
+	const tlsInboundDomains = Ext.create('PMG.MailProxyTLSInboundDomains', {
+	    title: gettext('TLS Inbound Domains'),
+	    flex: 1,
+	});
+
+	me.items = [tlsSettings, tlsDestinations, tlsInboundDomains];

 	me.callParent();

 	tlsSettings.relayEvents(me, ['activate', 'deactivate', 'destroy']);
 	tlsDestinations.relayEvents(me, ['activate', 'deactivate', 'destroy']);
+	tlsInboundDomains.relayEvents(me, ['activate', 'deactivate', 'destroy']);
     },
 });
diff --git a/js/Makefile b/js/Makefile
index 9a2bcf2..fad2bd6 100644
--- a/js/Makefile
+++ b/js/Makefile
@@ -50,6 +50,7 @@ JSSRC=							\
 	MailProxyTLS.js					\
 	MailProxyTLSPanel.js				\
 	MailProxyTLSDestinations.js			\
+	MailProxyTLSInboundDomains.js			\
 	Transport.js					\
 	MyNetworks.js					\
 	RelayDomains.js					\
--
2.39.2





  parent reply	other threads:[~2023-03-20 10:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 10:35 [pmg-devel] [PATCH v2 pmg-{api, gui, docs} 0/4] fix #2437: Add TLS enforcment option for inbound domains Christoph Heiss
2023-03-20 10:35 ` [pmg-devel] [PATCH v2 pmg-api 1/4] fix #2437: config: Add new tls_inbound_domains postfix map Christoph Heiss
2023-03-20 10:35 ` [pmg-devel] [PATCH v2 pmg-api 2/4] fix #2437: api: Add endpoint for managing tls_inbound_domains entries Christoph Heiss
2023-03-20 10:35 ` Christoph Heiss [this message]
2023-03-20 10:35 ` [pmg-devel] [PATCH v2 pmg-docs 4/4] pmgconfig: Explain new TLS inbound domains configuration Christoph Heiss
2023-03-20 21:01 ` [pmg-devel] applied-series: [PATCH v2 pmg-{api, gui, docs} 0/4] fix #2437: Add TLS enforcment option for inbound domains Stoiko Ivanov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230320103548.382757-4-c.heiss@proxmox.com \
    --to=c.heiss@proxmox.com \
    --cc=pmg-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal