mirror of
https://git.proxmox.com/git/pmg-gui
synced 2025-08-13 18:08:15 +00:00
Add DKIM Tab to MailProxy configuration
This adds another panel to the MailProxy configuration for DKIM-Settings. Additionally the index-template now includes the css-file from proxmox-widget-toolkit (for the pmx-hint user-class), needed in the Settings-panel. The Panel consists of 2 Grids: * DKIM Settings * DKIM Domains DKIMDomains is a list of domain, currently like RelayDomains (hence the code-reuse). The DKIM settings grid binds to the dkim-related settings in pmg.conf, but the edit-window for the selector uses the /config/dkim/selector route in the PMG-API. Additionally 2 checks for invalid configurations are excluded (you cannot enable DKIM-Signing without creating a private key first) The warnings were inspired by PVE's handling of EFIDisks and BIOS. Finally the 'View DNS Record' button displays the DKIM TXT record for the current key in the same format that opendkim-genkey writes it out. Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
This commit is contained in:
parent
35cf797dff
commit
295fbab8a1
201
js/DKIMSettings.js
Normal file
201
js/DKIMSettings.js
Normal file
@ -0,0 +1,201 @@
|
||||
Ext.define('PMG.DKIMEnableEdit', {
|
||||
extend: 'Proxmox.window.Edit',
|
||||
xtype: 'pmgDKIMEnableEdit',
|
||||
|
||||
items: [
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
userCls: 'pmx-hint',
|
||||
value: gettext('You need to create a Selector before enabling DKIM Signing'),
|
||||
hidden: true
|
||||
},
|
||||
{
|
||||
xtype: 'proxmoxcheckbox',
|
||||
name: 'dkim_sign',
|
||||
uncheckedValue: 0,
|
||||
defaultValue: 0,
|
||||
checked: false,
|
||||
deleteDefaultValue: false,
|
||||
fieldLabel: gettext('Sign Outgoing Mails'),
|
||||
}
|
||||
],
|
||||
listeners: {
|
||||
'show': function() {
|
||||
var me = this;
|
||||
var disablefn = function(errormsg){
|
||||
Ext.Msg.alert(gettext('Error'), errormsg);
|
||||
me.down('displayfield').setVisible(true);
|
||||
me.down('proxmoxcheckbox').setDisabled(true);
|
||||
me.close();
|
||||
};
|
||||
|
||||
Proxmox.Utils.API2Request({
|
||||
url : '/config/dkim/selector',
|
||||
method : 'GET',
|
||||
failure : function(response, opts) {
|
||||
disablefn(response.htmlStatus)
|
||||
},
|
||||
success : function(response, opts) {
|
||||
if (!Ext.isDefined(response.result.data.record)) {
|
||||
disablefn('Could not read private key - please create a selector first!');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Ext.define('PMG.SelectorViewer', {
|
||||
extend: 'Proxmox.window.Edit',
|
||||
xtype: 'pmgDKIMSelectorView',
|
||||
|
||||
url: '/config/dkim/selector',
|
||||
title: gettext('Selector'),
|
||||
|
||||
width: 800,
|
||||
resizable: true,
|
||||
|
||||
items: [
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
fieldLabel: gettext('Selector'),
|
||||
name: 'selector'
|
||||
},
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
fieldLabel: gettext('Key Size'),
|
||||
name: 'keysize'
|
||||
},
|
||||
{
|
||||
xtype: 'textarea',
|
||||
editable: false,
|
||||
grow: true,
|
||||
growMin: 150,
|
||||
growMax: 400,
|
||||
fieldLabel: gettext('DNS TXT Record'),
|
||||
name: 'record',
|
||||
value: 'Could not read private key!'
|
||||
}
|
||||
],
|
||||
|
||||
initComponent: function() {
|
||||
var me = this;
|
||||
|
||||
me.callParent();
|
||||
|
||||
// hide OK/Reset button, because we just want to show data
|
||||
me.down('toolbar[dock=bottom]').setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
Ext.define('PMG.DKIMSettings', {
|
||||
extend: 'Proxmox.grid.ObjectGrid',
|
||||
xtype: 'pmgDKIM',
|
||||
|
||||
monStoreErrors: true,
|
||||
|
||||
initComponent : function() {
|
||||
var me = this;
|
||||
|
||||
me.rows = {};
|
||||
var enable_sign_text = gettext('Enable DKIM Signing');
|
||||
me.rows.dkim_sign = {
|
||||
required: true,
|
||||
defaultValue: 0,
|
||||
header: enable_sign_text,
|
||||
renderer: Proxmox.Utils.format_boolean,
|
||||
editor: {
|
||||
xtype: 'pmgDKIMEnableEdit',
|
||||
subject: enable_sign_text,
|
||||
}
|
||||
};
|
||||
|
||||
var selector_text = gettext('Selector');
|
||||
me.rows.dkim_selector = {
|
||||
required: true,
|
||||
header: selector_text,
|
||||
editor: {
|
||||
xtype: 'proxmoxWindowEdit',
|
||||
subject: selector_text,
|
||||
isCreate: true,
|
||||
method: 'POST',
|
||||
url: '/config/dkim/selector',
|
||||
items: [
|
||||
{
|
||||
xtype: 'displayfield',
|
||||
name: 'warning',
|
||||
userCls: 'pmx-hint',
|
||||
value: gettext('Warning: You need to update the _domainkey DNS records of all signed domains!'),
|
||||
},
|
||||
{
|
||||
xtype: 'proxmoxtextfield',
|
||||
fieldLabel: selector_text,
|
||||
name: 'selector',
|
||||
allowBlank: false,
|
||||
required: true,
|
||||
defaultValue: 'pmg'
|
||||
},
|
||||
{
|
||||
xtype: 'proxmoxKVComboBox',
|
||||
fieldLabel: gettext('Key Size'),
|
||||
name: 'keysize',
|
||||
value: '2048',
|
||||
allowBlank: false,
|
||||
deleteEmpty: false,
|
||||
required: true,
|
||||
comboItems: [
|
||||
['1024', '1024'],
|
||||
['2048', '2048'],
|
||||
['4096', '4096'],
|
||||
['8192', '8192']
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
me.add_boolean_row('dkim_sign_all_mail', gettext('Sign all Outgoing Mail'));
|
||||
|
||||
var baseurl = '/config/admin';
|
||||
|
||||
me.selModel = Ext.create('Ext.selection.RowModel', {});
|
||||
|
||||
Ext.apply(me, {
|
||||
tbar: [{
|
||||
text: gettext('View DNS Record'),
|
||||
xtype: 'proxmoxButton',
|
||||
disabled: true,
|
||||
handler: function() {
|
||||
var win = Ext.create('PMG.SelectorViewer', {});
|
||||
win.load();
|
||||
win.show();
|
||||
},
|
||||
selModel: me.selModel,
|
||||
},
|
||||
{
|
||||
text: gettext('Edit'),
|
||||
xtype: 'proxmoxButton',
|
||||
disabled: true,
|
||||
handler: function() { me.run_editor(); },
|
||||
selModel: me.selModel
|
||||
}],
|
||||
url: '/api2/json' + baseurl,
|
||||
editorConfig: {
|
||||
url: '/api2/extjs' + baseurl,
|
||||
onlineHelp: 'pmgconfig_mailproxy_dkim'
|
||||
},
|
||||
interval: 5000,
|
||||
cwidth1: 200,
|
||||
listeners: {
|
||||
itemdblclick: me.run_editor
|
||||
}
|
||||
});
|
||||
|
||||
me.callParent();
|
||||
|
||||
me.on('activate', me.rstore.startUpdate);
|
||||
me.on('destroy', me.rstore.stopUpdate);
|
||||
me.on('deactivate', me.rstore.stopUpdate);
|
||||
}
|
||||
});
|
||||
|
@ -44,6 +44,11 @@ Ext.define('PMG.MailProxyConfiguration', {
|
||||
title: gettext('TLS'),
|
||||
xtype: 'pmgMailProxyTLSPanel'
|
||||
},
|
||||
{
|
||||
itemId: 'dkim',
|
||||
title: gettext('DKIM'),
|
||||
xtype: 'pmgMailProxyDKIMPanel'
|
||||
},
|
||||
{
|
||||
itemId: 'whitelist',
|
||||
title: gettext('Whitelist'),
|
||||
|
44
js/MailProxyDKIMPanel.js
Normal file
44
js/MailProxyDKIMPanel.js
Normal file
@ -0,0 +1,44 @@
|
||||
Ext.define('PMG.DKIMDomains', {
|
||||
extend: 'PMG.RelayDomains',
|
||||
alias: ['widget.pmgDKIMDomains'],
|
||||
|
||||
baseurl: '/config/dkim/domains',
|
||||
domain_desc: gettext('Sign Domain'),
|
||||
onlineHelp: 'pmgconfig_mailproxy_dkim'
|
||||
});
|
||||
|
||||
Ext.define('PMG.MailProxyDKIMPanel', {
|
||||
extend: 'Ext.panel.Panel',
|
||||
alias: 'widget.pmgMailProxyDKIMPanel',
|
||||
|
||||
layout: {
|
||||
type: 'vbox',
|
||||
align: 'stretch'
|
||||
},
|
||||
|
||||
bodyPadding: '0 0 10 0',
|
||||
defaults: {
|
||||
collapsible: true,
|
||||
animCollapse: false,
|
||||
margin: '10 10 0 10'
|
||||
},
|
||||
|
||||
initComponent: function() {
|
||||
var me = this;
|
||||
|
||||
var DKIMSettings = Ext.create('PMG.DKIMSettings', {
|
||||
title: gettext('Settings')
|
||||
});
|
||||
|
||||
var DKIMDomains = Ext.create('PMG.DKIMDomains', {
|
||||
title: gettext('Sign Domains')
|
||||
});
|
||||
|
||||
me.items = [ DKIMSettings, DKIMDomains ];
|
||||
|
||||
me.callParent();
|
||||
|
||||
DKIMSettings.relayEvents(me, ['activate', 'deactivate', 'destroy']);
|
||||
DKIMDomains.relayEvents(me, ['activate', 'deactivate', 'destroy']);
|
||||
}
|
||||
});
|
@ -46,6 +46,8 @@ JSSRC= \
|
||||
Transport.js \
|
||||
MyNetworks.js \
|
||||
RelayDomains.js \
|
||||
DKIMSettings.js \
|
||||
MailProxyDKIMPanel.js \
|
||||
MailProxyConfiguration.js \
|
||||
SpamDetectorLanguages.js \
|
||||
SpamDetectorOptions.js \
|
||||
|
@ -12,6 +12,7 @@
|
||||
<link rel="stylesheet" type="text/css" href="/pve2/ext6/crisp/resources/charts-all.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/fontawesome/css/font-awesome.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/pve2/css/ext6-pmg.css" />
|
||||
<link rel="stylesheet" type="text/css" href="/pwt/css/ext6-pmx.css" />
|
||||
[% IF langfile %]
|
||||
<script type='text/javascript' src='/pve2/locale/pmg-lang-[% lang %].js'></script>
|
||||
[% ELSE %]
|
||||
|
Loading…
Reference in New Issue
Block a user