From nobody Sun Jun 28 18:40:45 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gpJBk2Wp8z6jkcq for ; Sun, 28 Jun 2026 18:40:46 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gpJBj5bRsz3YSb for ; Sun, 28 Jun 2026 18:40:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782672045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RlnbqVy90T3RiVsg7UqnaO+rzaBrMGoJSvKmQOjaf1g=; b=IgdcDwmVeogvTUdaY4WAKM7RasWwRP5/TfEbq9j49SiGSe75YTFGzrRkWX0OUqPzCfaxNU Uo+jbKneBw2ocsTMeSqm7LyYVbmxCf0TFVfeIA/NJeWFTEFw2a3bjlK7G7F+rn8e+B/Rsr 1tlFpSZEQIlZjhUuK2EgyAi2iAqFQYXqOz8KRN+3I5TM7/AtKZ7v1FVgv+tAx/SLvU7kto PolSoD+vZnkiHivZAWpGDSgAuf2lJP4oBk85ZPiT3tfONRtjxomNRAsM8nOC7YpqcwnQKM 0UW55cS3CHA1Echm7YRE/i9NaT6vU5cvU5Zp8r76urtsOe/TjmraOUhDgHasbQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782672045; a=rsa-sha256; cv=none; b=uN4dJu4feOhwyK9UWURQqTkKFA51HSOQQcjivZPpCrzTNbYGZMqJCyeKlWaQ0Dje5xHdu+ jO1KC5jG6W/ajkQR+wwOdtBIx7Auxp4tjajN/LWY7bAYhpKT8csrqqqApAQoQ8DppQPbcF p8E9IBzft7su6OXsxM+xhErCijs4URIbL1ZG7zlD1TiBtOh5d1h1eveSPOHUUCucScrxnA OvsHXhEGyUF7PzeGNJoVDNUVRXxWhKPbCl8vdnjbZbd5zW0XwC0m7PasAKwcIaXqlBxgs8 9WmsuWCwBiQ/caLv96t/xA9l0mQTCs5JtK8/VNQoKElLYM7eDc31/JxlCpz0MA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782672045; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=RlnbqVy90T3RiVsg7UqnaO+rzaBrMGoJSvKmQOjaf1g=; b=eB5SD6Wu0kgEyeXE3jov96/owxA3xGg7Cpiutr9S4EmeXXdpdlLp9tLFr4a74IO5Gn1FX2 K7iuOHdncUPoMlJ/oQSKg+JpLekhFUnAzQkk+O/7TgLDuAZBdLwG3wsZtZ4wfdSlCszFsu 0dsnHJ8eYPxgKyzpl2H9Wc8V+fpMtY9DFUbq3CikKfOO/DFxj4HrRm0oZuXYk/HTEpgSi4 hFecl2ln+T1db+2c34FjN6ZCFQOKvUzgzTiNlxymcMdyJrUPUtRCLqBb+BNvUxpMto5de9 BHV/4Gw9CfizNR5RnruvaLJNihd0SpLwCbjq2uZlvBUQnMmmPYpLZYh0aOP5Rw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gpJBj4Mm8z70L for ; Sun, 28 Jun 2026 18:40:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1a5df by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 28 Jun 2026 18:40:45 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: f0fa0c599330 - stable/15 - nuageinit: implement ca_certs support List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bapt X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: f0fa0c599330cd01ebe8ef18c07846ad29bbf04f Auto-Submitted: auto-generated Date: Sun, 28 Jun 2026 18:40:45 +0000 Message-Id: <6a416aad.1a5df.1286387d@gitrepo.freebsd.org> The branch stable/15 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=f0fa0c599330cd01ebe8ef18c07846ad29bbf04f commit f0fa0c599330cd01ebe8ef18c07846ad29bbf04f Author: Baptiste Daroussin AuthorDate: 2026-06-05 20:27:07 +0000 Commit: Baptiste Daroussin CommitDate: 2026-06-28 18:32:28 +0000 nuageinit: implement ca_certs support Add support for the 'ca_certs' cloud-config key which manages CA certificates by writing them to /etc/ssl/certs/ and running certctl rehash. (cherry picked from commit b56f029add4825b21b2957f19ccfbb219a3f96cb) --- libexec/nuageinit/nuageinit | 20 ++++++++++++++++++++ libexec/nuageinit/nuageinit.7 | 17 +++++++++++++++++ libexec/nuageinit/tests/nuageinit.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 67 insertions(+) diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit index 19681b54810f..f5a018a00793 100755 --- a/libexec/nuageinit/nuageinit +++ b/libexec/nuageinit/nuageinit @@ -568,6 +568,25 @@ local function ntp(obj) f:close() end +local function ca_certs(obj) + if obj.ca_certs == nil then return end + local trusted = obj.ca_certs.trusted + if trusted == nil or #trusted == 0 then return end + local certdir = root .. "/etc/ssl/certs" + nuage.mkdir_p(certdir) + for i, cert in ipairs(trusted) do + local certpath = certdir .. "/nuageinit-" .. i .. ".pem" + local f = io.open(certpath, "w") + if f then + f:write(cert .. "\n") + f:close() + else + warnmsg("unable to write " .. certpath) + end + end + os.execute("certctl rehash 2>/dev/null") +end + local function ssh_deletekeys(obj) if obj.ssh_deletekeys == nil then return end if obj.ssh_deletekeys then @@ -947,6 +966,7 @@ if line == nil then -- YAML user-data elseif line == "#cloud-config" then local pre_network_calls = { + ca_certs, mounts, bootcmd, sethostname, diff --git a/libexec/nuageinit/nuageinit.7 b/libexec/nuageinit/nuageinit.7 index ae8e9446bde5..fcccf1bef4f0 100644 --- a/libexec/nuageinit/nuageinit.7 +++ b/libexec/nuageinit/nuageinit.7 @@ -258,6 +258,23 @@ to skip NTP configuration. Alternatively, .Ic ntp can be a list of server addresses (legacy format). +.It Ic ca_certs +An object managing CA certificates. +.Pp +The following keys are recognized: +.Bl -tag -width "remove_defaults" +.It trusted +A list of PEM-encoded CA certificates to add to the system trust store. +Certificates are written to +.Pa /etc/ssl/certs/ +and +.Xr certctl 8 +rehash is executed. +.It remove_defaults +Boolean, if +.Ar true , +remove the default CA certificates. +.El .It Ic timezone Sets the system timezone based on the value provided. .Pp diff --git a/libexec/nuageinit/tests/nuageinit.sh b/libexec/nuageinit/tests/nuageinit.sh index 63366f79486a..8f746599f14f 100644 --- a/libexec/nuageinit/tests/nuageinit.sh +++ b/libexec/nuageinit/tests/nuageinit.sh @@ -39,6 +39,7 @@ atf_test_case config2_userdata_resolv_conf atf_test_case config2_userdata_keyboard atf_test_case config2_userdata_ssh_authkey_fingerprints atf_test_case config2_userdata_ntp +atf_test_case config2_userdata_ca_certs atf_test_case config2_userdata_fqdn_and_hostname atf_test_case config2_userdata_write_files @@ -1245,6 +1246,34 @@ EOF true } +config2_userdata_ca_certs_head() +{ + atf_set "require.user" root +} +config2_userdata_ca_certs_body() +{ + mkdir -p media/nuageinit + setup_test_adduser + printf "{}" > media/nuageinit/meta_data.json + cat > media/nuageinit/user_data <<'EOF' +#cloud-config +ca_certs: + trusted: + - | + -----BEGIN CERTIFICATE----- + dGVzdGNlcnQx + -----END CERTIFICATE----- + - | + -----BEGIN CERTIFICATE----- + dGVzdGNlcnQy + -----END CERTIFICATE----- +EOF + atf_check -o empty /usr/libexec/nuageinit "${PWD}"/media/nuageinit config-2 + atf_check -o match:"dGVzdGNlcnQx" cat etc/ssl/certs/nuageinit-1.pem + atf_check -o match:"dGVzdGNlcnQy" cat etc/ssl/certs/nuageinit-2.pem + true +} + config2_userdata_fqdn_and_hostname_body() { mkdir -p media/nuageinit @@ -1299,6 +1328,7 @@ atf_init_test_cases() atf_add_test_case config2_userdata_keyboard atf_add_test_case config2_userdata_ssh_authkey_fingerprints atf_add_test_case config2_userdata_ntp + atf_add_test_case config2_userdata_ca_certs atf_add_test_case config2_userdata_fqdn_and_hostname atf_add_test_case config2_userdata_write_files }