From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 0EDEA76967 for ; Tue, 19 Oct 2021 15:47:52 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id EF7CD2E781 for ; Tue, 19 Oct 2021 15:47:21 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 60E1A2E773 for ; Tue, 19 Oct 2021 15:47:21 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 16616468F1; Tue, 19 Oct 2021 15:47:21 +0200 (CEST) Message-ID: <1035b0be-8d58-9699-4120-15b212fa03e4@proxmox.com> Date: Tue, 19 Oct 2021 15:47:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:94.0) Gecko/20100101 Thunderbird/94.0 Content-Language: en-US To: Proxmox VE development discussion , Oguz Bektas References: <20211011105704.760773-1-o.bektas@proxmox.com> <20211011105704.760773-3-o.bektas@proxmox.com> From: Dominik Csapak In-Reply-To: <20211011105704.760773-3-o.bektas@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.287 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment NICE_REPLY_A -0.001 Looks like a legit reply (A) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH v4 manager 2/2] fix #1065: ui: fail2ban gui for nodes X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Oct 2021 13:47:52 -0000 looks mostly ok (besides my comment about the propertystring and options thing of the previous patch) comment inline: On 10/11/21 12:57, Oguz Bektas wrote: > adds a simple grid for fail2ban options into the node config panel > > --- > v4: > * no changes > > > www/manager6/Makefile | 1 + > www/manager6/grid/Fail2banOptions.js | 51 ++++++++++++++++++++++++++++ > www/manager6/node/Config.js | 7 ++++ > 3 files changed, 59 insertions(+) > create mode 100644 www/manager6/grid/Fail2banOptions.js > > diff --git a/www/manager6/Makefile b/www/manager6/Makefile > index 7d491f57..ad9fe58a 100644 > --- a/www/manager6/Makefile > +++ b/www/manager6/Makefile > @@ -74,6 +74,7 @@ JSSRC= \ > grid/BackupView.js \ > grid/FirewallAliases.js \ > grid/FirewallOptions.js \ > + grid/Fail2banOptions.js \ > grid/FirewallRules.js \ > grid/PoolMembers.js \ > grid/Replication.js \ > diff --git a/www/manager6/grid/Fail2banOptions.js b/www/manager6/grid/Fail2banOptions.js > new file mode 100644 > index 00000000..5de0c18c > --- /dev/null > +++ b/www/manager6/grid/Fail2banOptions.js > @@ -0,0 +1,51 @@ > +Ext.define('PVE.Fail2banOptions', { > + extend: 'Proxmox.grid.ObjectGrid', > + alias: ['widget.pveFail2banOptions'], > + > + base_url: undefined, > + > + initComponent: function() { > + var me = this; > + > + me.rows = {}; > + > + me.add_boolean_row('enable', gettext("Enable Fail2Ban")); > + me.add_integer_row('maxretry', gettext("Max retries")); > + me.add_integer_row('bantime', gettext("Minutes to ban")); > + > + var edit_btn = new Ext.Button({ > + text: gettext('Edit'), > + disabled: true, > + handler: function() { me.run_editor(); }, > + }); > + > + var set_button_status = function() { > + var sm = me.getSelectionModel(); > + var rec = sm.getSelection()[0]; > + > + if (!rec) { > + edit_btn.disable(); > + return; > + } > + var rowdef = me.rows[rec.data.key]; > + edit_btn.setDisabled(!rowdef.editor); > + }; > + > + Ext.apply(me, { > + url: "/api2/json" + me.base_url, > + tbar: [edit_btn], > + editorConfig: { > + url: "/api2/extjs" + me.base_url, > + }, > + listeners: { > + itemdblclick: me.run_editor, > + selectionchange: set_button_status, > + }, > + }); i know its mostly copy&pasted, but i'd still rather see a more declarative approach to this, even if it just defining the functions inline here. > + > + me.callParent(); > + me.on('activate', me.rstore.startUpdate); > + me.on('destroy', me.rstore.stopUpdate); > + me.on('deactivate', me.rstore.stopUpdate); > + }, > +}); > diff --git a/www/manager6/node/Config.js b/www/manager6/node/Config.js index 68f80391..9dbe8d0c 100644 > --- a/www/manager6/node/Config.js > +++ b/www/manager6/node/Config.js > @@ -276,6 +276,13 @@ Ext.define('PVE.node.Config', { > base_url: '/nodes/' + nodename + '/firewall/options', > fwtype: 'node', > itemId: 'firewall-options', > + }, > + { > + xtype: 'pveFail2banOptions', > + iconCls: 'fa fa-legal', > + title: gettext('Fail2ban'), > + base_url: '/nodes/' + nodename + '/firewall/fail2ban', > + itemId: 'fail2ban-options', > }); > } > >