Message ID | 20250430141746.44261-1-adolf.belka@ipfire.org |
---|---|
State | Superseded |
Headers |
Return-Path: <development+bounces-273-patchwork=ipfire.org@lists.ipfire.org> Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4ZnfR849J6z3x3j for <patchwork@web04.haj.ipfire.org>; Wed, 30 Apr 2025 14:17:56 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature ECDSA (secp384r1)) (Client CN "mail02.haj.ipfire.org", Issuer "E5" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4ZnfR80fZtz39H for <patchwork@ipfire.org>; Wed, 30 Apr 2025 14:17:56 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4ZnfR771jZz339m for <patchwork@ipfire.org>; Wed, 30 Apr 2025 14:17:55 +0000 (UTC) X-Original-To: development@lists.ipfire.org Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4ZnfR46snLz30NY for <development@lists.ipfire.org>; Wed, 30 Apr 2025 14:17:52 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4ZnfR33VH3z8Y; Wed, 30 Apr 2025 14:17:51 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1746022671; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=QoTumWhgBjkUbd1GF7/XigRWWdl4Pnz/JfI8J2y7pmI=; b=9Yzp88bahNoO6FPOD0lOEYpj6/jh2pVDaF1GK0JB7kb6C1OuPA9pWjCwA5WyZv78e+iWe/ Dg7QdtN3vx12joDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1746022671; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=QoTumWhgBjkUbd1GF7/XigRWWdl4Pnz/JfI8J2y7pmI=; b=K7ESPPpR7+vkqZIgObnNfCG6jjR83Ku0s4PxGLpQ9rOmy+x0Cul8R7h3d6yNqeBM0F9N2i 5uB8G1RjcIM+r+an4tp4w/yAFOouUYdjpmpyhTdc79fzw1IuQonrDqiwvY7FrV1Norjve1 tzyBCxuxYEe29zMyvgrMRil9DSSgP/h/YurrIa7bQQ4+VIjFwTgtyGOyrLHDSV/ts4RCD+ iksedoqVxuNlLxgRhXoXcmdt5iwO+DHXsMWnyE3tC6q5JPtLOnylSyBH+eTYFirDD0ZzN/ RnB+oSrXhfJ8edSAJwEtatzyXYKFi3zDuN3k/C+ofl/idXTNHvkpZZ61cOd6dw== From: Adolf Belka <adolf.belka@ipfire.org> To: development@lists.ipfire.org Cc: Adolf Belka <adolf.belka@ipfire.org> Subject: [PATCH] core194: Fix cert name and change other check to ! -z Date: Wed, 30 Apr 2025 16:17:46 +0200 Message-ID: <20250430141746.44261-1-adolf.belka@ipfire.org> Precedence: list List-Id: <development.lists.ipfire.org> List-Subscribe: <https://lists.ipfire.org/>, <mailto:development+subscribe@lists.ipfire.org?subject=subscribe> List-Unsubscribe: <https://lists.ipfire.org/>, <mailto:development+unsubscribe@lists.ipfire.org?subject=unsubscribe> List-Post: <mailto:development@lists.ipfire.org> List-Help: <mailto:development+help@lists.ipfire.org?subject=help> Sender: <development@lists.ipfire.org> Mail-Followup-To: <development@lists.ipfire.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit |
Series |
core194: Fix cert name and change other check to ! -z
|
|
Commit Message
Adolf Belka
April 30, 2025, 2:17 p.m. UTC
- Error in hostcert extension - -z gives true if not zero and we need true if it is zero so had to add not command. - I thought I had tested the original patch of this change but obviously not because there was missing whitespace and filenames not quoted plus the fixes I have added in this patch. - I definitely tested this out this time by copying it from the update.sh and applying it to my vm system. Tested-by: Adolf Belka <adolf.belka@ipfire.org> Signed-off-by: Adolf Belka <adolf.belka@ipfire.org> --- config/rootfiles/core/194/update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Can I ask what you are testing here with the "! -z"? Typically you would use "-n" rather than "! -z", but both are tests for strings and not files - https://tldp.org/LDP/abs/html/comparison-ops.html. "! -s" would test for a zero length file and if the file exists at all. Nick On 30/04/2025 15:17, Adolf Belka wrote: > - Error in hostcert extension > - -z gives true if not zero and we need true if it is zero so had to add not command. > - I thought I had tested the original patch of this change but obviously not because > there was missing whitespace and filenames not quoted plus the fixes I have added > in this patch. > - I definitely tested this out this time by copying it from the update.sh and applying > it to my vm system. > > Tested-by: Adolf Belka<adolf.belka@ipfire.org> > Signed-off-by: Adolf Belka<adolf.belka@ipfire.org> > --- > config/rootfiles/core/194/update.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/config/rootfiles/core/194/update.sh b/config/rootfiles/core/194/update.sh > index b758c7bf6..8fbf22750 100644 > --- a/config/rootfiles/core/194/update.sh > +++ b/config/rootfiles/core/194/update.sh > @@ -104,7 +104,7 @@ ldconfig > /usr/local/bin/filesystem-cleanup > > # Increment ipsec serial file if x509 certificates present and no content in index.txt > -if [ -e "/var/ipfire/certs/hostcert.pm" ] && [ -z "/var/ipfire/certs/index.txt" ]; then > +if [ -e "/var/ipfire/certs/hostcert.pem" ] && [ ! -z "/var/ipfire/certs/index.txt" ]; then > sed -i "s/01/02/" /var/ipfire/certs/serial > fi >
Hi Nick, On 30/04/2025 16:53, Nick Howitt wrote: > Can I ask what you are testing here with the "! -z"? Typically you would use "-n" rather than "! -z", but both are tests for strings and not files - https://tldp.org/LDP/abs/html/comparison-ops.html. "! -s" would test for a zero length file and if the file exists at all. Thanks for the input. You are absolutely correct. I tested my script but only with index.txt empty. I just tried it with something in index.txt and it still detected it as empty because, as you point out -s is for the file test while -z is for the string test. So in my case it is checking if the string "/var/ipfire/certs/index.txt" is not empty, which of course it will never be empty. Duuuh. I just tried it with -z replaced by -s and that properly detects if the file is empty or not. Hi Michael, Could you please change the ! -z to ! -s in my last patch or should I send out a v2 patch? Regards, Adolf. > > Nick > > On 30/04/2025 15:17, Adolf Belka wrote: >> - Error in hostcert extension >> - -z gives true if not zero and we need true if it is zero so had to add not command. >> - I thought I had tested the original patch of this change but obviously not because >> there was missing whitespace and filenames not quoted plus the fixes I have added >> in this patch. >> - I definitely tested this out this time by copying it from the update.sh and applying >> it to my vm system. >> >> Tested-by: Adolf Belka<adolf.belka@ipfire.org> >> Signed-off-by: Adolf Belka<adolf.belka@ipfire.org> >> --- >> config/rootfiles/core/194/update.sh | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/config/rootfiles/core/194/update.sh b/config/rootfiles/core/194/update.sh >> index b758c7bf6..8fbf22750 100644 >> --- a/config/rootfiles/core/194/update.sh >> +++ b/config/rootfiles/core/194/update.sh >> @@ -104,7 +104,7 @@ ldconfig >> /usr/local/bin/filesystem-cleanup >> >> # Increment ipsec serial file if x509 certificates present and no content in index.txt >> -if [ -e "/var/ipfire/certs/hostcert.pm" ] && [ -z "/var/ipfire/certs/index.txt" ]; then >> +if [ -e "/var/ipfire/certs/hostcert.pem" ] && [ ! -z "/var/ipfire/certs/index.txt" ]; then >> sed -i "s/01/02/" /var/ipfire/certs/serial >> fi >> >
diff --git a/config/rootfiles/core/194/update.sh b/config/rootfiles/core/194/update.sh index b758c7bf6..8fbf22750 100644 --- a/config/rootfiles/core/194/update.sh +++ b/config/rootfiles/core/194/update.sh @@ -104,7 +104,7 @@ ldconfig /usr/local/bin/filesystem-cleanup # Increment ipsec serial file if x509 certificates present and no content in index.txt -if [ -e "/var/ipfire/certs/hostcert.pm" ] && [ -z "/var/ipfire/certs/index.txt" ]; then +if [ -e "/var/ipfire/certs/hostcert.pem" ] && [ ! -z "/var/ipfire/certs/index.txt" ]; then sed -i "s/01/02/" /var/ipfire/certs/serial fi