From nobody Mon Sep 07 04:20:41 2026 X-Original-To: dev-commits-src-branches@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 4hdYlZ4jxnz6rLXp for ; Mon, 07 Sep 2026 04:20:42 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hdYlY5KRYz3SB0 for ; Mon, 07 Sep 2026 04:20:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1788754841; 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=gzKFkUiTwQ1XC+I8wlSywZhffkcY3Ny2dZJgFGO7ig0=; b=exjF9TCp5doj9kMbtCDP4LL3yHfqin67/5QEbTg3zrgTx/hFC7oVdGj1pe3LYQ8G98DTIW zwN4fJWxlRbBxkulNIaUQecUJyDNzIHWzPaj1sSc6zk5vKPIq9DEmzbXsnNwTd0qnjMwZU 0NHjLuZogEF7kInCkYzx8hZCdCjxpYgemCfhWN7duipUU3R4UU3Fu0zcAb44Ff+ENenSP/ cIPqL394sJwjkpNMqa72VPFFvPyHpeSrObFrtEj1iipUp2QOtxC9E8uaGC9gVEiwodf+Bq juIhUcTcMfvQxByc5ULmFyvCT/e/FrjlNcYIPKO881Bhd65X0CkGqYrJPH1/TQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1788754841; a=rsa-sha256; cv=none; b=HaQgKrz+x/tn/KMqyxuAXXTvtPbMvGeFlT2CmDA/Xm5SgZonAPoeRBwjajptcaVXltBEy5 UYaPuj3CLGGWUnVOhM+GZkX3pToAWJg2qFhJMBME/wUryCGvW5nIeco+55G6HzqvQ0DEiN aQlXxYW+/epTBWVIZyUd6xAPqBW0sTkTaZWMEHiDJyd5eEsPgfF+IrSqefbpvyQRKFfrxJ ofs/FN1aQuSzsTRnBlu2IjPRB5BjYdk5WqiWLMzwDxRBgeUo+id8+LNVa93LsbLpAxLGT3 ANYNWhp0OI9yvvV4quAG2Db6sUFvA7X0yZAPo6qaJ7onJddRp1flGx7PzfcvxQ== 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=1788754841; 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=gzKFkUiTwQ1XC+I8wlSywZhffkcY3Ny2dZJgFGO7ig0=; b=gC+fAbyblI8wW8TNqyVRHBUE8VDUD/HJg0aTL8T2OwzQW3k64YfrP53f+DJFILVldLRub2 QdTDnjLolpEeFqPsajKu1i2CyX/AN3S6RY9A3MLiP/14bVjqf9U589vIxmGOk/nHyUWD/p zOeib3v1SON/74/O3BU03mEjhe+0lD3Zy6Fl0grjaD9RvcKQevOl9A1wYuy1y+gMq9AZhx rgp2kGdFNfJUy4etLPuGe6FfnWXRTiX+VkNzA1d09i/7wqQzUwKkzcx7ccxo1Hn6o/pNDf zMcu7PvTxTkBXF0C6kRqWRf8D3y0KrzHoRL/HWNt+RYsTMsp1Uv6oMESwqURIA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hdYlY3kN7z12Jr for ; Mon, 07 Sep 2026 04:20:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 195ea by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 07 Sep 2026 04:20:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: a1fd5f9f87d3 - stable/15 - nuageinit: support allow_public_ssh_keys List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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: a1fd5f9f87d3c131991933125462d6750f911179 Auto-Submitted: auto-generated Date: Mon, 07 Sep 2026 04:20:41 +0000 Message-Id: <6a9e3b99.195ea.2827b688@gitrepo.freebsd.org> The branch stable/15 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=a1fd5f9f87d3c131991933125462d6750f911179 commit a1fd5f9f87d3c131991933125462d6750f911179 Author: Baptiste Daroussin AuthorDate: 2026-08-11 10:00:56 +0000 Commit: Baptiste Daroussin CommitDate: 2026-09-07 04:19:01 +0000 nuageinit: support allow_public_ssh_keys Skip importing datasource public keys when set to false. (cherry picked from commit 8f378c83c6b8b052433834ca0b53677459dc0e85) --- libexec/nuageinit/nuageinit | 6 ++++-- libexec/nuageinit/nuageinit.7 | 10 +++++++++ libexec/nuageinit/tests/nuageinit.sh | 41 ++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit index 536739c8a0bf..31daff5c71b9 100755 --- a/libexec/nuageinit/nuageinit +++ b/libexec/nuageinit/nuageinit @@ -18,7 +18,8 @@ local citype = arg[2] local function default_user(obj, metadata) local ssh_authorized_keys = {} - if type(metadata.public_keys) == "table" then + if (not obj or obj.allow_public_ssh_keys ~= false) and + type(metadata.public_keys) == "table" then for _, k in pairs(metadata.public_keys) do table.insert(ssh_authorized_keys, k) end @@ -604,7 +605,8 @@ local function disable_root(obj, metadata) opts = opts:gsub("%$DISABLE_USER", "root") end local keys = {} - if type(metadata.public_keys) == "table" then + if obj.allow_public_ssh_keys ~= false and + type(metadata.public_keys) == "table" then for _, k in pairs(metadata.public_keys) do table.insert(keys, k) end diff --git a/libexec/nuageinit/nuageinit.7 b/libexec/nuageinit/nuageinit.7 index 4f1a492473af..63a36608f1ed 100644 --- a/libexec/nuageinit/nuageinit.7 +++ b/libexec/nuageinit/nuageinit.7 @@ -323,6 +323,16 @@ being the actual content of the files in Append each entry of the array to .Nm default user which will be created. +.It Ic allow_public_ssh_keys +Boolean which determines if the public SSH keys from the datasource +metadata are imported to the default user and root. +If set to +.Ar false , +only the keys specified in +.Ic ssh_authorized_keys +are used. +Defaults to +.Ar true . .It Ic ssh_pwauth boolean which determines the value of the .Qq Ic PasswordAuthentication diff --git a/libexec/nuageinit/tests/nuageinit.sh b/libexec/nuageinit/tests/nuageinit.sh index 4803ddf941ab..bfc7e9f13c88 100644 --- a/libexec/nuageinit/tests/nuageinit.sh +++ b/libexec/nuageinit/tests/nuageinit.sh @@ -385,6 +385,46 @@ EOF atf_check -o inline:"ssh-ed25519 my_key_id tdb@host\n" cat home/freebsd/.ssh/authorized_keys } +config2_pubkeys_allow_public_ssh_keys_head() +{ + atf_set "require.user" root +} +config2_pubkeys_allow_public_ssh_keys_body() +{ + here=$(pwd) + export NUAGE_FAKE_ROOTDIR=$(pwd) + if [ $(id -u) -ne 0 ]; then + atf_skip "root required" + fi + mkdir -p media/nuageinit + cat > media/nuageinit/meta_data.json << EOF +{ + "uuid": "uuid_for_this_instance", + "public_keys": { + "tdb": "ssh-ed25519 my_key_id tdb@host" + } +} +EOF + cat > media/nuageinit/user_data << EOF +#cloud-config +allow_public_ssh_keys: false +EOF + mkdir -p etc + mkdir -p root + cat > etc/master.passwd << EOF +root:*:0:0::0:0:Charlie &:/root:/bin/csh +sys:*:1:0::0:0:Sys:/home/sys:/bin/csh +EOF + pwd_mkdb -d etc ${here}/etc/master.passwd + cat > etc/group << EOF +wheel:*:0:root +users:*:1: +EOF + atf_check /usr/libexec/nuageinit ${here}/media/nuageinit config-2 + # no public key should be imported + atf_check -s exit:1 test -e home/freebsd/.ssh/authorized_keys +} + config2_network_body() { mkdir -p media/nuageinit @@ -1509,6 +1549,7 @@ atf_init_test_cases() atf_add_test_case config2_pubkeys atf_add_test_case config2_pubkeys_user_data atf_add_test_case config2_pubkeys_meta_data + atf_add_test_case config2_pubkeys_allow_public_ssh_keys atf_add_test_case config2_network atf_add_test_case config2_network_static_v4 atf_add_test_case config2_network_dns