From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 0FD091FF16F for ; Tue, 27 May 2025 15:58:26 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id BD78416653; Tue, 27 May 2025 15:58:35 +0200 (CEST) From: Stefan Hanreich To: pve-devel@lists.proxmox.com Date: Tue, 27 May 2025 15:57:59 +0200 Message-Id: <20250527135800.190084-4-s.hanreich@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250527135800.190084-1-s.hanreich@proxmox.com> References: <20250527135800.190084-1-s.hanreich@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.214 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_LAZY_DOMAIN_SECURITY 1 Sending domain does not have any anti-forgery methods RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RDNS_NONE 0.793 Delivered to internal network by a host with no rDNS SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_NONE 0.001 SPF: sender does not publish an SPF Record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox-firewall.rs] Subject: [pve-devel] [PATCH proxmox-firewall v2 3/3] proxmox-firewall: add localnet subcommand 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: , Reply-To: Proxmox VE development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" pve-firewall provided the localnet subcommand to query the currently used IPs in the management ipset. Reimplement this command in proxmox-firewall to enable easier debugging. Signed-off-by: Stefan Hanreich --- proxmox-firewall/src/bin/proxmox-firewall.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/proxmox-firewall/src/bin/proxmox-firewall.rs b/proxmox-firewall/src/bin/proxmox-firewall.rs index f7e9516..d9409b2 100644 --- a/proxmox-firewall/src/bin/proxmox-firewall.rs +++ b/proxmox-firewall/src/bin/proxmox-firewall.rs @@ -10,6 +10,7 @@ use proxmox_firewall::firewall::Firewall; use proxmox_log as log; use proxmox_log::{LevelFilter, Logger}; use proxmox_nftables::{client::NftError, NftClient}; +use proxmox_ve_config::firewall::host::Config as HostConfig; const HELP: &str = r#" USAGE: @@ -20,6 +21,7 @@ COMMANDS: skeleton Prints the firewall rule skeleton as accepted by 'nft -f -' compile Compile and print firewall rules as accepted by 'nft -j -f -' start Execute proxmox-firewall service in foreground + localnet Print the contents of the management ipset "#; const RULE_BASE: &str = include_str!("../../resources/proxmox-firewall.nft"); @@ -122,6 +124,7 @@ pub enum Command { Help, Skeleton, Start, + Localnet, } impl std::str::FromStr for Command { @@ -133,6 +136,7 @@ impl std::str::FromStr for Command { "compile" => Command::Compile, "skeleton" => Command::Skeleton, "start" => Command::Start, + "localnet" => Command::Localnet, cmd => { bail!("{cmd} is not a valid command") } @@ -157,6 +161,14 @@ fn run_command(command: Command) -> Result<(), Error> { println!("{}", RULE_BASE); } Command::Start => run_firewall()?, + Command::Localnet => { + let management_ips = HostConfig::management_ips()?; + + println!("Management IPSet:"); + for ip in management_ips { + println!("{ip}"); + } + } }; Ok(()) -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel