From nobody Sun Jun 28 18:40: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 4gpJBf1WKDz6jkcW for ; Sun, 28 Jun 2026 18:40: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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gpJBd2zlQz3YBq for ; Sun, 28 Jun 2026 18:40:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782672041; 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=g8SBiTlaCAPsuFePCrgg8Om45SJTHzeC3XkqTN6hsdc=; b=opWBdn7jz5CsSCS+663pLDGqwHNUf+flmKfpeF27d8g92mxnrBnLqaAxHBnDDUhe6qMhuX Uda/iXUMxVp2BSJVaRT5ra1mbW9vuO7/KgYohLD0ltsVoFBnA4iLePZuCQWgoUtdOUNiA9 vy98y6EqjnJ7+vAF9hh8ULFkNft98N58z31mM/+w1aFAhZ+Odsv7QNQdVV6vgj5bLxkNWe 4qONdb9teUfF0SVpp46Ju87LccEQuu1hISkC6HRflb4ba/3iFbQdK5bH8rcTTJC6LoGOJf PilI2h2Do0653G2gWHdCcHyTv1hLFpk87s4m30vkLoy99nk6z00UjKrY5gTp5g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782672041; a=rsa-sha256; cv=none; b=RBm6coAQpC8Z8PnvGHsXmeiPVpXgGDN0z2RnQHLkdlP4CYCxU/0V3C3JA8H+rMrd/h7ZS8 hGQ/OBQVtPCfhkcTIeX1PIBoKh6J8jshgr5yTzn4UvLd1++IkZ0CoDq92rwXewQL5HbTc/ kkohpqmqD7bRCRzd3RM0XmEfaJF+RwnLvgfyFIBnMJvOV1TpgEyQiDUWarWZeDr5x3nBox cCMIev2n8NJGXD7O6f3Y5m4VYJwieqFYf45k+hNXnlPU58E7EPv1m8nhP+5mnfZpR5rA6W G3dIJ/XGQYZgoIkYEkSTFObaBJeQTAXQrtSYDyGou+OMGoFUWMgnerp/JhWhpA== 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=1782672041; 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=g8SBiTlaCAPsuFePCrgg8Om45SJTHzeC3XkqTN6hsdc=; b=wkrOGWqUOrhftIgMZmy40aLwDH1jJ5TdfmsvAsS3RtX90pbBDiSkQpGVDNWWw+t8C2UlLB vTTL0l5l3GpIk5T/0Wk9HjT/lIIZ3MjQsSCZDAVSOmro/CWi3G86CdwisNwCEnkPL53cRM efmpDVX82C3gh6E+uZsT9nLj/jwgvaZ7Crv+q1K9022Z6l+BEDxLMM62Lls2f0AsnKRB/p pUHJ+697pg4+fL1gawJx/tpLUMnCs2yscjuRtO+Vj/zuq3d+E0rhvliGgitG5yoLQQjpIn MWTY3o0ZWkwijUjYSAyXuIBVlP5CzAjjTUYj1KP9c+0JBQ03dQBz6j3D8Mq3SA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gpJBd1phlz73G for ; Sun, 28 Jun 2026 18:40:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1cb9a by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 28 Jun 2026 18:40:41 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 04b8103810c7 - stable/15 - nuageinit: implement resolv_conf support 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: 04b8103810c7c48041a8e958cb507be568ddda27 Auto-Submitted: auto-generated Date: Sun, 28 Jun 2026 18:40:41 +0000 Message-Id: <6a416aa9.1cb9a.2a457a02@gitrepo.freebsd.org> The branch stable/15 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=04b8103810c7c48041a8e958cb507be568ddda27 commit 04b8103810c7c48041a8e958cb507be568ddda27 Author: Baptiste Daroussin AuthorDate: 2026-06-05 10:06:02 +0000 Commit: Baptiste Daroussin CommitDate: 2026-06-28 18:32:27 +0000 nuageinit: implement resolv_conf support Add support for the 'resolv_conf' cloud-config key which writes directly to /etc/resolv.conf. (cherry picked from commit 4662263c246fd9c31cf0f03089845140114445bc) --- libexec/nuageinit/nuage.lua | 32 ++++++++++++++++++++++++++++++++ libexec/nuageinit/nuageinit | 6 ++++++ libexec/nuageinit/nuageinit.7 | 17 +++++++++++++++++ libexec/nuageinit/tests/nuageinit.sh | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+) diff --git a/libexec/nuageinit/nuage.lua b/libexec/nuageinit/nuage.lua index 34cf8c9fc090..7fde2d936f1b 100644 --- a/libexec/nuageinit/nuage.lua +++ b/libexec/nuageinit/nuage.lua @@ -837,6 +837,37 @@ local function add_fstab_entry(root, device, mount_point, fstype, options, dump_ return true end +local function write_resolv_conf(root, config) + local path = root .. "/etc/resolv.conf" + local f = io.open(path, "w") + if not f then + warnmsg("unable to open " .. path .. " for writing") + return + end + if config.domain then + f:write("domain " .. config.domain .. "\n") + end + if config.searchdomains then + f:write("search " .. table.concat(config.searchdomains, " ") .. "\n") + end + if config.sortlist then + f:write("sortlist " .. table.concat(config.sortlist, " ") .. "\n") + end + if config.options then + local opts = {} + for k, v in pairs(config.options) do + table.insert(opts, k .. ":" .. v) + end + f:write("options " .. table.concat(opts, " ") .. "\n") + end + if config.nameservers then + for _, ns in ipairs(config.nameservers) do + f:write("nameserver " .. ns .. "\n") + end + end + f:close() +end + local function remove_fstab_entry(root, mount_point) local fstab_path = root .. "/etc/fstab" local f = io.open(fstab_path, "r") @@ -891,6 +922,7 @@ local n = { addfile = addfile, add_fstab_entry = add_fstab_entry, remove_fstab_entry = remove_fstab_entry, + write_resolv_conf = write_resolv_conf, } return n diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit index f56d1207cf01..8fef3bb662d1 100755 --- a/libexec/nuageinit/nuageinit +++ b/libexec/nuageinit/nuageinit @@ -531,6 +531,11 @@ local function disable_root(obj) end end +local function resolv_conf(obj) + if obj.resolv_conf == nil then return end + nuage.write_resolv_conf(root, obj.resolv_conf) +end + local function mounts(obj) if obj.mounts == nil then return end for _, m in ipairs(obj.mounts) do @@ -870,6 +875,7 @@ elseif line == "#cloud-config" then ssh_deletekeys, ssh_keys, network_config, + resolv_conf, disable_root, ssh_pwauth, runcmd, diff --git a/libexec/nuageinit/nuageinit.7 b/libexec/nuageinit/nuageinit.7 index c2981669acb7..8ef9d8b284ea 100644 --- a/libexec/nuageinit/nuageinit.7 +++ b/libexec/nuageinit/nuageinit.7 @@ -195,6 +195,23 @@ The pass number for .Xr fsck 8 , defaults to 0. .El +.It Ic resolv_conf +An object configuring the content of +.Pa /etc/resolv.conf . +.Pp +The following keys are recognized: +.Bl -tag -width "nameservers" +.It nameservers +A list of IP addresses for DNS name servers. +.It searchdomains +A list of search domains. +.It domain +A single domain name. +.It sortlist +A list of IP/netmask sortlist entries. +.It options +A dictionary of resolver options. +.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 11d34fcd98ea..0f758bcac1cd 100644 --- a/libexec/nuageinit/tests/nuageinit.sh +++ b/libexec/nuageinit/tests/nuageinit.sh @@ -35,6 +35,7 @@ atf_test_case config2_userdata_disable_root atf_test_case config2_userdata_bootcmd atf_test_case config2_userdata_manage_etc_hosts atf_test_case config2_userdata_mounts +atf_test_case config2_userdata_resolv_conf atf_test_case config2_userdata_fqdn_and_hostname atf_test_case config2_userdata_write_files @@ -1140,6 +1141,36 @@ EOF true } +config2_userdata_resolv_conf_head() +{ + atf_set "require.user" root +} +config2_userdata_resolv_conf_body() +{ + mkdir -p media/nuageinit + setup_test_adduser + printf "{}" > media/nuageinit/meta_data.json + cat > media/nuageinit/user_data <