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 5A790724AC for ; Thu, 1 Jul 2021 14:59:16 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 4E9F52558B for ; Thu, 1 Jul 2021 14:58:46 +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 C9C0E25580 for ; Thu, 1 Jul 2021 14:58:45 +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 A1FE640323 for ; Thu, 1 Jul 2021 14:58:45 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Thu, 1 Jul 2021 14:58:33 +0200 Message-Id: <20210701125833.2773190-2-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210701125833.2773190-1-f.gruenbichler@proxmox.com> References: <20210701125833.2773190-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.556 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH proxmox-backup 2/2] openid: conditionally disable api endpoint X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2021 12:59:16 -0000 since it pulls in lots of additional linked libraries for all binaries compiled as part of proxmox-backup. it can easily be re-enabled with `--cfg openid` added to the RUSTFLAGS env variable. Signed-off-by: Fabian Grünbichler --- Notes: to be reverted as part of splitting client/server/lib crates next week, but this is currently breaking file-restore builds for PVE 7. alternatively, a feature could be employed for the same effect, but since this is just a temporary measure a 'cfg' flag causes less churn/noise. the difference is quite big (ldd $bin | wc -l) usr/sbin/proxmox-backup-manager: 53 vs 28 usr/lib/x86_64-linux-gnu/proxmox-backup/sg-tape-cmd: 41 vs 12 usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-daily-update: 48 vs 23 usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-proxy: 54 vs 29 usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-banner: 6 vs 6 (doesn't use proxmox_backup at all!) usr/lib/x86_64-linux-gnu/proxmox-backup/proxmox-backup-api: 54 vs 29 usr/lib/x86_64-linux-gnu/proxmox-backup/file-restore/proxmox-restore-daemon: 39 vs 10 usr/bin/proxmox-tape: 43 vs 14 usr/bin/pmtx: 40 vs 11 usr/bin/pmt: 40 vs 11 usr/bin/proxmox-file-restore: 43 vs 14 usr/bin/pxar: 40 vs 11 usr/bin/proxmox-backup-client: 43 vs 14 src/api2/access.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/api2/access.rs b/src/api2/access.rs index e5430f62..1cd772d6 100644 --- a/src/api2/access.rs +++ b/src/api2/access.rs @@ -26,6 +26,8 @@ pub mod domain; pub mod role; pub mod tfa; pub mod user; + +#[cfg(openid)] pub mod openid; #[allow(clippy::large_enum_variant)] @@ -415,6 +417,12 @@ pub fn list_permissions( Ok(map) } +#[cfg(openid)] +const OPENID_ROUTER: &Router = &openid::ROUTER; + +#[cfg(not(openid))] +const OPENID_ROUTER: &Router = &Router::new(); + #[sortable] const SUBDIRS: SubdirMap = &sorted!([ ("acl", &acl::ROUTER), @@ -424,7 +432,7 @@ const SUBDIRS: SubdirMap = &sorted!([ &Router::new().get(&API_METHOD_LIST_PERMISSIONS) ), ("ticket", &Router::new().post(&API_METHOD_CREATE_TICKET)), - ("openid", &openid::ROUTER), + ("openid", &OPENID_ROUTER), ("domains", &domain::ROUTER), ("roles", &role::ROUTER), ("users", &user::ROUTER), -- 2.30.2