From nobody Sun Jun 28 18:40:44 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 4gpJBj1f4Qz6jknm for ; Sun, 28 Jun 2026 18:40:45 +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 4gpJBh4Wd8z3YCL for ; Sun, 28 Jun 2026 18:40:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1782672044; 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=S+ugGMOwipq+P5HqE4gIliDvCJuwgtonhUeUU7lz9Ls=; b=VAiWhZCHc4NndnmoM+2z+/9LKhsIcuYtCLMJoyHHgkhE595Kfx6cob3BhYj/6loSvTwIce ooI+ZOPaiKTuM35k7HsyPv4NTPcM+AvXLW3yp4DnKAjekoUXRJai+MHNbpopOodcngTtiP dRkXVXusumJNp1317COypbJqwft4dMmmcbxVUimrCHU32X7a+z6xGIIrntbALKlt912kTj Y4PuOuc9qnR2RLpyzs2MnJv9vRe4dXckTxWNIFDvVr0uEOa5REJCAE4o7td3MCD4kqR/aC Edn+1Xw7AlxN5kZoCzGZdJ9243UP1QM/6MhPKzZR3iOjxuuHMdPmak9Cqha3Tg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1782672044; a=rsa-sha256; cv=none; b=vEmOEBBJGvNRzn9Cc86+IvSrw6Qq+2fNZcsruW0/m7s9R26IVDs64L0z5RHG4JnRq16sQv cLd3XpcTCkM3iNYHibPK0AKAvfSHNZBzsmu/nyYSBifq9ZOQ1gkF/ye/5wLZg0zHbey3hA 4S3aRZMA5O3SXKbQnZrLZY2zEc0ahR+bIKeAgczeYQC8QGzS5Q5DEevtDDPIK2WuEFT3uY 2mSQoazKX8ou63fkfhDyukIILWwMULPfmBqpMz2JasEFgm/V845PaJ20vzz9tzccOQxE1F fw/HxTgn4GGTOu+Wq2YmLXX7NVUxcFAwWNu2ychTliz/fkZQA+iWqxeNYFb7FA== 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=1782672044; 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=S+ugGMOwipq+P5HqE4gIliDvCJuwgtonhUeUU7lz9Ls=; b=E8lrmrZNC40OVf4xhgLnA6+gOsy1s0PatuHbKQZas177+1l0jSQevj8g8AOEuyhIouDK/+ UtJoI8dWhD5Xh6Yi80MIpbcLbMFnMkcGAXwS7yewfAaS/YCG6C6Ugoj+vnSujFquffhhXu XQbkq9yMdBNCX+nokVO8YR+1q68zPT36aGa5vZjScLhiv81+/LyXP7oVh2mecAVLC4OK1+ I4KkAD4hRRy8CoanxaBGophtSUb15ctRxf38rCgLQ6g9sslHTKIeZLyXwhic4fbYDkDDAc LaJNSSubJKaGrKpArfHvpmbI4h/WTx6CEVHlEpdvYiZzPC/BCJT81OWOnS46FQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gpJBh3Zccz6Yx for ; Sun, 28 Jun 2026 18:40:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 1a5db by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sun, 28 Jun 2026 18:40:44 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Baptiste Daroussin Subject: git: 9835838d76d5 - stable/15 - nuageinit: implement ntp 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: 9835838d76d5cf1338400a86747a8404606fde87 Auto-Submitted: auto-generated Date: Sun, 28 Jun 2026 18:40:44 +0000 Message-Id: <6a416aac.1a5db.492907c8@gitrepo.freebsd.org> The branch stable/15 has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=9835838d76d5cf1338400a86747a8404606fde87 commit 9835838d76d5cf1338400a86747a8404606fde87 Author: Baptiste Daroussin AuthorDate: 2026-06-05 20:25:29 +0000 Commit: Baptiste Daroussin CommitDate: 2026-06-28 18:32:28 +0000 nuageinit: implement ntp support Add support for the 'ntp' cloud-config key which configures NTP by writing /etc/ntp.conf with server and pool entries. (cherry picked from commit 6d27d52ccd35d1980e99bc2fc4dae602334d28af) --- libexec/nuageinit/nuageinit | 37 ++++++++++++++++++++++++++++++++++++ libexec/nuageinit/nuageinit.7 | 21 ++++++++++++++++++++ libexec/nuageinit/tests/nuageinit.sh | 28 +++++++++++++++++++++++++++ 3 files changed, 86 insertions(+) diff --git a/libexec/nuageinit/nuageinit b/libexec/nuageinit/nuageinit index 8e2658f2cd13..19681b54810f 100755 --- a/libexec/nuageinit/nuageinit +++ b/libexec/nuageinit/nuageinit @@ -532,6 +532,42 @@ local function ssh_authkey_fingerprints(obj) end end +local function ntp(obj) + if obj.ntp == nil then return end + if type(obj.ntp) == "table" and obj.ntp.enabled == false then + return + end + local servers = {} + if type(obj.ntp) == "table" then + if obj.ntp[1] then + servers = obj.ntp + else + for _, s in ipairs(obj.ntp.servers or {}) do + table.insert(servers, "server " .. s .. " iburst") + end + for _, p in ipairs(obj.ntp.pools or {}) do + table.insert(servers, "pool " .. p .. " iburst") + end + end + elseif type(obj.ntp) == "string" then + table.insert(servers, "server " .. obj.ntp .. " iburst") + end + if #servers == 0 then return end + local path = root .. "/etc/ntp.conf" + local f = io.open(path, "w") + if not f then + warnmsg("unable to open " .. path .. " for writing") + return + end + for _, line in ipairs(servers) do + f:write(line .. "\n") + end + f:write("leapfile /var/db/ntpd.leap-seconds.list\n") + f:write("restrict default limited kod nomodify notrap nopeer noquery\n") + f:write("restrict source limited kod nomodify notrap noquery\n") + f:close() +end + local function ssh_deletekeys(obj) if obj.ssh_deletekeys == nil then return end if obj.ssh_deletekeys then @@ -931,6 +967,7 @@ elseif line == "#cloud-config" then } local post_network_calls = { + ntp, packages, users, chpasswd, diff --git a/libexec/nuageinit/nuageinit.7 b/libexec/nuageinit/nuageinit.7 index 200eb2524fe6..ae8e9446bde5 100644 --- a/libexec/nuageinit/nuageinit.7 +++ b/libexec/nuageinit/nuageinit.7 @@ -237,6 +237,27 @@ Boolean which determines whether fingerprints of SSH host keys should be logged to the console. Defaults to .Ar false . +.It Ic ntp +An object configuring the NTP daemon by writing +.Pa /etc/ntp.conf . +.Pp +The following keys are recognized: +.Bl -tag -width "enabled" +.It servers +A list of NTP server addresses. +.It pools +A list of NTP pool addresses. +.It enabled +Boolean, defaults to +.Ar true . +Set to +.Ar false +to skip NTP configuration. +.El +.Pp +Alternatively, +.Ic ntp +can be a list of server addresses (legacy format). .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 44c681e18046..63366f79486a 100644 --- a/libexec/nuageinit/tests/nuageinit.sh +++ b/libexec/nuageinit/tests/nuageinit.sh @@ -38,6 +38,7 @@ atf_test_case config2_userdata_mounts 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_fqdn_and_hostname atf_test_case config2_userdata_write_files @@ -1218,6 +1219,32 @@ EOF true } +config2_userdata_ntp_head() +{ + atf_set "require.user" root +} +config2_userdata_ntp_body() +{ + mkdir -p media/nuageinit + setup_test_adduser + printf "{}" > media/nuageinit/meta_data.json + cat > media/nuageinit/user_data <