From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gate001.proxmox.com (gate001.proxmox.com [IPv6:2a0f:8001:1:32::40]) by lore.proxmox.com (Postfix) with ESMTPS id 298DE1FF0E0 for ; Thu, 09 Jul 2026 15:50:53 +0200 (CEST) Received: from gate001.proxmox.com (localhost.localdomain [127.0.0.1]) by gate001.proxmox.com (Proxmox) with ESMTP id 27246214F1; Thu, 09 Jul 2026 15:50:37 +0200 (CEST) From: Elias Huhsovitz To: pve-user@lists.proxmox.com Subject: [PATCH access-control] fix #7144: auth: ldap: force utf-8 encoding for bind credentials Date: Thu, 9 Jul 2026 15:50:23 +0200 Message-ID: <20260709135023.159039-1-e.huhsovitz@proxmox.com> X-Mailer: git-send-email 2.47.3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1783605022263 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.000 Adjusted score from AWL reputation of From: address DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment (newer systems) SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: QZ4OFPQDNDV665V67GYP3GJTP2BBAYD4 X-Message-ID-Hash: QZ4OFPQDNDV665V67GYP3GJTP2BBAYD4 X-MailFrom: e.huhsovitz@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Elias Huhsovitz X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE user list List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: When saving the LDAP/AD bind password to /etc/pve/priv/realm/.pw, the file was written using the default byte encoding. This caused passwords containing non-ASCII characters (e.g., '£' or '§') to be truncated to their lowest byte, resulting in authentication failures during subsequent sync operations. Pass the 'force_utf8' flag to file_set_contents to ensure the password is encoded as UTF-8 before being written to disk. Signed-off-by: Elias Huhsovitz --- src/PVE/Auth/LDAP.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PVE/Auth/LDAP.pm b/src/PVE/Auth/LDAP.pm index 6a73ee8..21ee047 100755 --- a/src/PVE/Auth/LDAP.pm +++ b/src/PVE/Auth/LDAP.pm @@ -438,7 +438,7 @@ sub ldap_set_credentials { my $cred_file = ldap_cred_file_name($realmid); mkdir $ldap_pw_dir; - PVE::Tools::file_set_contents($cred_file, $password); + PVE::Tools::file_set_contents($cred_file, $password, 0600, 1); return $cred_file; } -- 2.47.3