From nobody Sun Jun 28 18:40:17 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 4gpJB9720Dz6jkPf for ; Sun, 28 Jun 2026 18:40:17 +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 4gpJB95RH8z3XMY for ; Sun, 28 Jun 2026 18:40:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782672017; 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=Dls9Uguaga6kAxbxm8viXBCNLofbkWckYvGE8BABq9U=; b=xhYP9cifLTLvGBZbjGDziVBFH1PWSjr2QGG1Oac38wvlf1kiAMmYVPELX6VJ8hHKH9jKb6 G5pUIfx5/EhGtfxMLFGoADI/o9EuvOiBHdDobH46120heeMvfjXYFJUViyBWPYDqhjlSLJ e8KBjgYuaxEkVdH1kj7iPA4GDwPT78EHoEokZ2V2xkSFkbC9pGaLh2PK3tYxXvuqjTmMvC Og4h6cMv3hRTaAosjlA80llTnYRfacpoJVSlZHnWauXCzbdL6o3WyThLxMojAj4B+Ni5X9 2bzTn/iDpj8qYJGLi6FcWBxKOn3gKHfNcKGgdTDCsxyf0RH0fcn4QNIrD2c6mA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782672017; a=rsa-sha256; cv=none; b=Ll5ByO+m2osCPR8cvNctJoAW51mWMdrnsj0xCQevk6zAl7XTU6xiCUBZP7Vn0OR/zbRN6T /xN1x7yTa3Y3cVx0XuukO+93/7lvkNowZ36RqHw9EqiOZy3bydG9gTHpd67m7mRybAeBu1 CYNX8o2HAH+mS/B7qqpDR3sGz2494cvBcfEm6b+98RV+JoG5Szbhh3ajwpRXDq2Jf8vwNl NhfzD7UhNRDy8sao3uM7Z7VUB8tpmN7FK5FD4LNopLUsTmtWILjxJbeFlVt6d4dHbaxAla rfNzbRT8ixYNXVPpQpLn731DzTdeQZxBgNxyNgjPhStlVPjKND2VdayNHwtfmg== 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=1782672017; 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=Dls9Uguaga6kAxbxm8viXBCNLofbkWckYvGE8BABq9U=; b=IVHyU44zgw0jG2U6IJpvNr5Way6mVRVb4fNmFJOw+YBKxZ+LCH6MBrRmDILM9cAzIWisYL neCvZgnA4eLhqRR6J6loPcze9khbqTulqM/67+wkphUlCOWmwsYuuxHpOK1fRyLEfjHbBg rDEtceKmLyD7DZfyKI4sFEBiJ497EFkAE7efDm6NtiqNEkMcyvvPIRCuMXBAvGgf5SKXKB JgT+p59GSve31YotvrkeymG92VPpfVweCeTbVYNKATJcoj/7rYy4IjSTiXu1l3Qx1XuiAO fbW99b+RnbLxRGyBhx2PWoRmAq3AgoVpOJZsiklkOeCVzjr228d3x3GXvR6toQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gpJB93HK0z734 for ; Sun, 28 Jun 2026 18:40:17 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1c328 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 28 Jun 2026 18:40:17 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 43184397e6c4 - stable/15 - nuageinit: add update_sshd_config tests 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: 43184397e6c4e157280605b9742767ea9bf28ec4 Auto-Submitted: auto-generated Date: Sun, 28 Jun 2026 18:40:17 +0000 Message-Id: <6a416a91.1c328.35e0b898@gitrepo.freebsd.org> The branch stable/15 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=43184397e6c4e157280605b9742767ea9bf28ec4 commit 43184397e6c4e157280605b9742767ea9bf28ec4 Author: Baptiste Daroussin AuthorDate: 2026-05-10 15:54:48 +0000 Commit: Baptiste Daroussin CommitDate: 2026-06-28 18:32:23 +0000 nuageinit: add update_sshd_config tests (cherry picked from commit 8b03193289e87fd243acc50c5128c80459792667) --- libexec/nuageinit/tests/Makefile | 1 + libexec/nuageinit/tests/nuage.sh | 8 +++ libexec/nuageinit/tests/update_sshd_config.lua | 73 ++++++++++++++++++++++++++ 3 files changed, 82 insertions(+) diff --git a/libexec/nuageinit/tests/Makefile b/libexec/nuageinit/tests/Makefile index 4c99f8e31ce3..fc7765268660 100644 --- a/libexec/nuageinit/tests/Makefile +++ b/libexec/nuageinit/tests/Makefile @@ -21,5 +21,6 @@ ${PACKAGE}FILES+= addfile.lua ${PACKAGE}FILES+= decode_base64.lua ${PACKAGE}FILES+= addsudo.lua ${PACKAGE}FILES+= adddoas.lua +${PACKAGE}FILES+= update_sshd_config.lua .include diff --git a/libexec/nuageinit/tests/nuage.sh b/libexec/nuageinit/tests/nuage.sh index 01c4612eb8ec..348a8d93ba09 100644 --- a/libexec/nuageinit/tests/nuage.sh +++ b/libexec/nuageinit/tests/nuage.sh @@ -17,6 +17,7 @@ atf_test_case addfile atf_test_case decode_base64 atf_test_case addsudo atf_test_case adddoas +atf_test_case update_sshd_config settimezone_body() { @@ -109,6 +110,12 @@ adddoas_body() atf_check /usr/libexec/flua $(atf_get_srcdir)/adddoas.lua } +update_sshd_config_body() +{ + mkdir -p etc/ssh + atf_check /usr/libexec/flua $(atf_get_srcdir)/update_sshd_config.lua +} + atf_init_test_cases() { atf_add_test_case sethostname @@ -120,4 +127,5 @@ atf_init_test_cases() atf_add_test_case decode_base64 atf_add_test_case addsudo atf_add_test_case adddoas + atf_add_test_case update_sshd_config } diff --git a/libexec/nuageinit/tests/update_sshd_config.lua b/libexec/nuageinit/tests/update_sshd_config.lua new file mode 100644 index 000000000000..ac56c29986ac --- /dev/null +++ b/libexec/nuageinit/tests/update_sshd_config.lua @@ -0,0 +1,73 @@ +#!/usr/libexec/flua +--- +-- SPDX-License-Identifier: BSD-2-Clause +-- +-- Copyright (c) 2026 Baptiste Daroussin + +local n = require("nuage") + +local root = os.getenv("NUAGE_FAKE_ROOTDIR") +if not root then + root = "" +end + +local sshd_config = root .. "/etc/ssh/sshd_config" + +local function setup(content) + local dir = root .. "/etc/ssh" + n.mkdir_p(dir) + local f = assert(io.open(sshd_config, "w")) + f:write(content) + f:close() +end + +local function read_config() + local f = assert(io.open(sshd_config, "r")) + local content = f:read("*a") + f:close() + return content +end + +-- Key not found: appended +setup("SomeOtherKey yes\n") +n.update_sshd_config("PasswordAuthentication", "yes") +if read_config() ~= "SomeOtherKey yes\nPasswordAuthentication yes\n" then + n.err("Key not found: should be appended") +end + +-- Key with same value: no change +setup("PasswordAuthentication yes\n") +n.update_sshd_config("PasswordAuthentication", "yes") +if read_config() ~= "PasswordAuthentication yes\n" then + n.err("Same value: should not change") +end + +-- Key with different value: changed +setup("PasswordAuthentication no\n") +n.update_sshd_config("PasswordAuthentication", "yes") +if read_config() ~= "PasswordAuthentication yes\n" then + n.err("Different value: should change") +end + +-- Key with comment +setup("PasswordAuthentication no # keep this\n") +n.update_sshd_config("PasswordAuthentication", "yes") +if read_config() ~= "PasswordAuthentication yes\n" then + n.err("Comment stripped: '" .. read_config() .. "'") +end + +-- Case insensitive key matching +setup("passwordauthentication no\n") +n.update_sshd_config("PasswordAuthentication", "yes") +if read_config() ~= "PasswordAuthentication yes\n" then + n.err("Case insensitive matching failed") +end + +-- Extra spaces +setup(" PasswordAuthentication no \n") +n.update_sshd_config("PasswordAuthentication", "yes") +if read_config() ~= "PasswordAuthentication yes\n" then + n.err("Extra spaces handling failed: '" .. read_config() .. "'") +end + +os.exit(0)