| Message ID | 20261027063635.1775102-1-vincent.mc.li@gmail.com |
|---|---|
| State | New |
| Headers |
Return-Path: <development+bounces-2928-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 raw public key)
server-digest SHA384
client-signature RSA-PSS (4096 bits) client-digest SHA256)
(Client CN "mail01.haj.ipfire.org", Issuer "YR1" (not verified))
by web04.haj.ipfire.org (Postfix) with ESMTPS id 4jDLPx4nMZz3xWt
for <patchwork@web04.haj.ipfire.org>; Tue, 27 Oct 2026 06:37:09 +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)
(Client CN "mail02.haj.ipfire.org", Issuer "YE2" (not verified))
by mail01.ipfire.org (Postfix) with ESMTPS id 4jDLPw6f5yz6b1
for <patchwork@ipfire.org>; Tue, 27 Oct 2026 06:37:08 +0000 (UTC)
Received: from mail02.haj.ipfire.org (localhost [IPv6:::1])
by mail02.haj.ipfire.org (Postfix) with ESMTP id 4jDLPw5vcZz2yqg
for <patchwork@ipfire.org>; Tue, 27 Oct 2026 06:37:08 +0000 (UTC)
X-Original-To: development@lists.ipfire.org
Received: from mail01.ipfire.org (mail01.haj.ipfire.org
[IPv6:2001:678:b28::25])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)
server-digest SHA384
client-signature RSA-PSS (4096 bits) client-digest SHA256)
(Client CN "mail01.haj.ipfire.org", Issuer "YR1" (not verified))
by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4jDLPp00P7z2xKC
for <development@lists.ipfire.org>; Tue, 27 Oct 2026 06:37:01 +0000 (UTC)
Received: from mail-dl1-x122e.google.com (mail-dl1-x122e.google.com
[IPv6:2607:f8b0:4864:20::122e])
(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
client-signature RSA-PSS (2048 bits) client-digest SHA256)
(Client CN "smtp.gmail.com", Issuer "WR4" (verified OK))
by mail01.ipfire.org (Postfix) with ESMTPS id 4jDLPf3GMVz4Sj
for <development@lists.ipfire.org>; Tue, 27 Oct 2026 06:36:54 +0000 (UTC)
Authentication-Results: mail01.ipfire.org;
dkim=pass header.d=gmail.com header.s=20251104 header.b=S8u5lmbz;
spf=pass (mail01.ipfire.org: domain of vincent.mc.li@gmail.com designates
2607:f8b0:4864:20::122e as permitted sender)
smtp.mailfrom=vincent.mc.li@gmail.com;
dmarc=pass (policy=none) header.from=gmail.com
ARC-Seal: i=1; a=rsa-sha256; d=lists.ipfire.org; s=202003rsa; cv=none;
t=1793083015;
b=sZIf+c/geebGDHxFgvAHiFKrkkpsH4G6aR/T2yOAVZ2pjTHmmx87O40ePBzdRQqdjudWGS
Moia2vnttJPr+UH3VLjPH3Y5baVQ9KiZn7teloXRZQzCB2SkM/P6q1it6xkb4mg8gItgk0
MIf8I+ZWRdgoibX3lVjKmq9gab31180WCxZbGTE6ZzZyDU9gexthHP4V96RqbpNjPCZ2Sn
OJJatClcvvvrrkixHp8DfjqnHmU1vZNgiXEmIdyhB9N67XmSg1hIgOd0gaY8rbrl2FhxTD
3DRPIO4I3Q19Aej+bfoiQ5pzbUX65cPZ/FLQgXZqo8EfwofyMBcjZfPfPpmjQg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed;
d=lists.ipfire.org;
s=202003rsa; t=1793083015;
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:dkim-signature;
bh=j6H4KHs0SJGlqGFrHjEhFQoWDmtTvI2p6nY6CBmzqHw=;
b=u1oube2t490r0aNsA/AGxJk0hjglT2FS73eY6Fg9Fmj4Er0RZT0onkW0kv37FlHLPMG9BM
VeKR+DZbYdHO3cFbGB1r6LUbjb0AAEcOv1mMxVn9to6qpCSlE//aJwuh0ZGqG4QKmDXnBK
hAGbsrBuuFUVjsbL1u7vEbyyEPfB7u2m/PqzUZ4mgKvFtgWpitXSpvubDXl3bhwFAcPjKf
54ZjnTuikHLEHuR+Od5l7avvqRbW/u0St4/Zqil0f+bE1PdHtjL5QW0ptdaSkAWJwYcONw
hTlewA65WbaNPGhj96lEg0qF/ExbtOiKAaM+kmLRdhPjxwIzqkBEcJn3efsmdw==
ARC-Authentication-Results: i=1;
mail01.ipfire.org;
dkim=pass header.d=gmail.com header.s=20251104 header.b=S8u5lmbz;
spf=pass (mail01.ipfire.org: domain of vincent.mc.li@gmail.com designates
2607:f8b0:4864:20::122e as permitted sender)
smtp.mailfrom=vincent.mc.li@gmail.com;
dmarc=pass (policy=none) header.from=gmail.com
Received: by mail-dl1-x122e.google.com with SMTP id
a92af1059eb24-1a3c08d6928so1098761c88.0
for <development@lists.ipfire.org>;
Mon, 26 Oct 2026 23:36:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1793083012; x=1793687812;
darn=lists.ipfire.org;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
bh=j6H4KHs0SJGlqGFrHjEhFQoWDmtTvI2p6nY6CBmzqHw=;
b=S8u5lmbz3LvirSAkqp6M8MIs5jmPtlcUiubxC7mum/fKXNxIYnubImaca40B61M7YW
fjvZVwIkxZYsqJOClshsN4q9R6EXB5ZNrMbFWuWCuLUtrD4CoSBqE6muZfrZZZxKG7i7
8MO/2nRTCRGELKQoP8jIusyVcSTDNcjqbovSYEzNpsfdxh7K8HkzCoiCv1zGKxfrzA94
0sbHYOCRpSbZeDn1iFGC9zB/lu6WOPrLsXWVHwSy6PbWtyDGHRw4fs2WoKuONEv6fbC9
lzaCyzNv+JA19nfDOxKmgQdgsh+DekKqp7Eo5Yfv1U4CJtI0uWfbDchCJzWSzX8Y4EDN
1mpA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793083012; x=1793687812;
h=content-transfer-encoding:mime-version:message-id:date:subject:cc
:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=j6H4KHs0SJGlqGFrHjEhFQoWDmtTvI2p6nY6CBmzqHw=;
b=OoLk4kJYDZiYwUC11emb6UdRiwlqSFrqVzfxcCRn43LahzXTifmUS37jUXIJUdx/vk
kmOvaTcWM/xChHB5Z7uULfO9p+Id5e08kGdYz9kumKlsMhoZn5psDqHBvDu1c1mh+Mqm
yUekwcyT/UcftmncB/eOYcpiTVow1UGtnpwPLG4ILPwB+bPmzi9nMOTsYpg4HSabyER9
1/5Bo902JPybTQ+5bpGSkv+UOnB39oEr+v1l3nwlq2/Puvp5RbPzGjtYJXheXl5s0aBm
n0y7Ns+WomR1hKGtjogNVusxAOrCWNRK0pA4vNQrX84M/TScvQ2rPgCFDgNOEFUxtYfZ
yjIQ==
X-Gm-Message-State: AFq9FYIBvzq8mSMhiElScIGZNuj/mugKEaG2NscLdEwBts+MCHz16K29
gh616x2At4FPUC0wiHjhe7SGw0qnqrewNgRYMLi2zwARgXH+US2deZyFScdPFQ==
X-Gm-Gg: AYBFou1vHh++/6ruQwPyullWD2PEa+FI5H8EpEjFqYhX/BjmRZ0B48+OOZQhvmkSPoT
xmilwXv6abx3+4h+yNEmiMPkYqlG7Nz5Nfmksn+SLQVjciAT4V27nhMuglt8paHPRsH2ZSeNbRn
dJcj/1NPppSNXJsdR9lWHrK4d6vsw0N9yRw7OJfLnVb2g2zGCSrHaHBdTmjukIEg/nmiKt7PLnp
X8wruxNKRb2ME3CJnAEbRIjcEOiD2Gn5aOOT0CT5y5SPB6AKxkYyQG/ObZL4zXpT7nl2yI+dywQ
GQTbc93xnBJWjV9ZAlryyvtAw60HlluUUJdMI6jRIPsSykGJXoAG31drV/FtgJN751PvklNfDvK
mvukJsrB0rclQl286QU4AfA97EzCtJ8JolvoHxGhqDWxLhBf68nkPndYK+WKkQXbGpCEbKQ9yA/
ytdk9ZkhmFqPU3pY+GYVz6lIz5ZnnBjlD7GHbWgkRMoyOCWYtCYmKTY5B9KU9mGVo7Ft709+hKc
KRze/IxDacQYhxtgsLxGJA1tH095Rv7ZvyfQDlq6zZe4Uzy0m4rOPWaFrPD/Ng=
X-Received: by 2002:a05:7022:3b82:b0:149:1b5b:1f25 with SMTP id
a92af1059eb24-1993505e533mr13366302c88.15.1793083011543;
Mon, 26 Oct 2026 23:36:51 -0700 (PDT)
Received: from wg-vpn-sf2.. ([138.197.218.192])
by smtp.gmail.com with ESMTPSA id
5a478bee46e88-36a026e04a0sm12542674eec.1.2026.10.26.23.36.50
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 26 Oct 2026 23:36:50 -0700 (PDT)
From: Vincent Li <vincent.mc.li@gmail.com>
To: development@lists.ipfire.org
Cc: michael.tremer@ipfire.org,
Vincent Li <vincent.mc.li@gmail.com>
Subject: [PATCH] initscripts: apache: Regenerate empty ECDSA certificate files
on start
Date: Tue, 27 Oct 2026 06:36:35 +0000
Message-Id: <20261027063635.1775102-1-vincent.mc.li@gmail.com>
X-Mailer: git-send-email 2.34.1
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
X-Rspamd-Action: no action
X-Spamd-Result: default: False [-6.83 / 11.00];
BAYES_HAM(-3.00)[100.00%];
R_DKIM_ALLOW(-1.60)[gmail.com:s=20251104];
DKIM_REPUTATION(-0.97)[-0.96886792186387];
SPF_REPUTATION_HAM(-0.76)[-0.76156325333488];
DMARC_POLICY_ALLOW(-0.50)[gmail.com,none];
R_MISSING_CHARSET(0.50)[];
R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4864::/56:c];
MIME_GOOD(-0.10)[text/plain];
R_DKIM_ALIGNED(-0.10)[strict];
MX_GOOD(-0.10)[gmail-smtp-in.l.google.com];
DWL_DNSWL_NONE(0.00)[gmail.com:dkim];
FREEMAIL_ENVFROM(0.00)[gmail.com];
RCVD_TLS_LAST(0.00)[];
FREEMAIL_FROM(0.00)[gmail.com];
MIME_TRACE(0.00)[0:+];
ARC_NA(0.00)[];
TO_DN_SOME(0.00)[];
IP_REPUTATION_HAM(0.00)[asn: 15169(-0.29), country: US(-0.01),
ip: 2607:f8b0:4864:20::(-0.80)];
DKIM_TRACE(0.00)[gmail.com:+];
RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::122e:from];
TO_MATCH_ENVRCPT_SOME(0.00)[];
ARC_SIGNED(0.00)[lists.ipfire.org:s=202003rsa:i=1];
RCVD_COUNT_TWO(0.00)[2];
FROM_EQ_ENVFROM(0.00)[];
FREEMAIL_CC(0.00)[ipfire.org,gmail.com];
PREVIOUSLY_DELIVERED(0.00)[development@lists.ipfire.org];
MID_RHS_MATCH_FROM(0.00)[];
RCPT_COUNT_THREE(0.00)[3];
ALIAS_RESOLVED(0.00)[];
ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US];
RCVD_VIA_SMTP_AUTH(0.00)[];
FROM_HAS_DN(0.00)[]
X-Rspamd-Server: mail01.haj.ipfire.org
X-Rspamd-Queue-Id: 4jDLPf3GMVz4Sj
|
| Series |
initscripts: apache: Regenerate empty ECDSA certificate files on start
|
|
Commit Message
Vincent Li
27 Oct 2026, 6:36 a.m. UTC
After completing an ISO installation, Apache was observed once to fail
to start, leaving the web UI inaccessible. Although this is a rare
occurrence, the cause was that generate_certificates() used "test -f",
which only checks that the key/CSR/cert files exist, not that they are
non-empty. If openssl fails to write a file during first boot (e.g.
low entropy) but leaves an empty file behind, later starts consider the
certificate already generated and skip regeneration, leaving Apache
with empty server-ecdsa.key/crt and a broken web UI.
Use "test -s" instead so empty files are regenerated, and log a boot
message via boot_mesg ${FAILURE} if a file is still empty after
openssl runs.
Signed-off-by: Vincent Li <vincent.mc.li@gmail.com>
---
src/initscripts/system/apache | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
Comments
Hello Vincent, Thank you very much for your email. I have a question regarding this change which is why it is required at all? There should never be an empty file and if there is one, I am not sure it is a good idea to quietly replace the certificate. So please let me know what caused this problem. All the best, -Michael > On 27 Oct 2026, at 06:36, Vincent Li <vincent.mc.li@gmail.com> wrote: > > After completing an ISO installation, Apache was observed once to fail > to start, leaving the web UI inaccessible. Although this is a rare > occurrence, the cause was that generate_certificates() used "test -f", > which only checks that the key/CSR/cert files exist, not that they are > non-empty. If openssl fails to write a file during first boot (e.g. > low entropy) but leaves an empty file behind, later starts consider the > certificate already generated and skip regeneration, leaving Apache > with empty server-ecdsa.key/crt and a broken web UI. > > Use "test -s" instead so empty files are regenerated, and log a boot > message via boot_mesg ${FAILURE} if a file is still empty after > openssl runs. > > Signed-off-by: Vincent Li <vincent.mc.li@gmail.com> > --- > src/initscripts/system/apache | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/src/initscripts/system/apache b/src/initscripts/system/apache > index ba7ede670..7eba99b53 100644 > --- a/src/initscripts/system/apache > +++ b/src/initscripts/system/apache > @@ -24,28 +24,38 @@ > > PIDFILE="/var/run/httpd.pid" > > +# Verify a generated file exists and is non-empty; log a boot message if not. > +check_generated() { > + if [ ! -s "$1" ]; then > + boot_mesg "ERROR: $1 is missing or empty!" ${FAILURE} > + fi > +} > + > generate_certificates() { > - if [ ! -f "/etc/httpd/server-ecdsa.key" ]; then > + if [ ! -s "/etc/httpd/server-ecdsa.key" ]; then > boot_mesg "Generating HTTPS ECDSA server key..." > openssl ecparam -genkey -name secp384r1 -noout \ > -out /etc/httpd/server-ecdsa.key &>/dev/null > chmod 600 /etc/httpd/server-ecdsa.key > evaluate_retval > + check_generated /etc/httpd/server-ecdsa.key > fi > > - if [ ! -f "/etc/httpd/server-ecdsa.csr" ]; then > + if [ ! -s "/etc/httpd/server-ecdsa.csr" ]; then > sed "s/HOSTNAME/`hostname -f`/" < /etc/certparams | \ > openssl req -new -key /etc/httpd/server-ecdsa.key \ > -out /etc/httpd/server-ecdsa.csr &>/dev/null > + check_generated /etc/httpd/server-ecdsa.csr > fi > > - if [ ! -f "/etc/httpd/server-ecdsa.crt" ]; then > + if [ ! -s "/etc/httpd/server-ecdsa.crt" ]; then > boot_mesg "Signing ECDSA certificate..." > openssl x509 -req -days 999999 -sha256 \ > -in /etc/httpd/server-ecdsa.csr \ > -signkey /etc/httpd/server-ecdsa.key \ > -out /etc/httpd/server-ecdsa.crt &>/dev/null > evaluate_retval > + check_generated /etc/httpd/server-ecdsa.crt > fi > } > > -- > 2.34.1 > >
diff --git a/src/initscripts/system/apache b/src/initscripts/system/apache index ba7ede670..7eba99b53 100644 --- a/src/initscripts/system/apache +++ b/src/initscripts/system/apache @@ -24,28 +24,38 @@ PIDFILE="/var/run/httpd.pid" +# Verify a generated file exists and is non-empty; log a boot message if not. +check_generated() { + if [ ! -s "$1" ]; then + boot_mesg "ERROR: $1 is missing or empty!" ${FAILURE} + fi +} + generate_certificates() { - if [ ! -f "/etc/httpd/server-ecdsa.key" ]; then + if [ ! -s "/etc/httpd/server-ecdsa.key" ]; then boot_mesg "Generating HTTPS ECDSA server key..." openssl ecparam -genkey -name secp384r1 -noout \ -out /etc/httpd/server-ecdsa.key &>/dev/null chmod 600 /etc/httpd/server-ecdsa.key evaluate_retval + check_generated /etc/httpd/server-ecdsa.key fi - if [ ! -f "/etc/httpd/server-ecdsa.csr" ]; then + if [ ! -s "/etc/httpd/server-ecdsa.csr" ]; then sed "s/HOSTNAME/`hostname -f`/" < /etc/certparams | \ openssl req -new -key /etc/httpd/server-ecdsa.key \ -out /etc/httpd/server-ecdsa.csr &>/dev/null + check_generated /etc/httpd/server-ecdsa.csr fi - if [ ! -f "/etc/httpd/server-ecdsa.crt" ]; then + if [ ! -s "/etc/httpd/server-ecdsa.crt" ]; then boot_mesg "Signing ECDSA certificate..." openssl x509 -req -days 999999 -sha256 \ -in /etc/httpd/server-ecdsa.csr \ -signkey /etc/httpd/server-ecdsa.key \ -out /etc/httpd/server-ecdsa.crt &>/dev/null evaluate_retval + check_generated /etc/httpd/server-ecdsa.crt fi }