From nobody Sat Jun 6 06:14:14 2026 X-Original-To: dev-commits-src-main@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 4gXSgW3mbMz6g4p2 for ; Sat, 06 Jun 2026 06:14:15 +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 "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gXSgV6WsLz3T5x for ; Sat, 06 Jun 2026 06:14:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780726454; 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=27KvJblbYv3sUi88xC5thSOslVf8R4O8laEcEa2cf1w=; b=GgW0GoEV4HT4fsDsYARdntVcV7J9fFfdTXLCfH8WTKRTtNJvjCiisQ9WDKWHJTYCDDwfc5 PCeY1ZKaemK/HY3uP1/+RJwuwt8pfk2PJRFR7X0v6Zu59HEeliPcfQCwhp4Rx8fLmjuH/x 1p1zusYWzj89VISaHD29v+27WUprjrtNHOpVLkhR0EJ+a1m3S38QLY8E8LGJf7lN9DmC2a +z3Lk9J1B/XSi0cUy7kMc4v7ddcWZglqotij1mb+juwaOanowiPkUaFDlVwJ/xmYyftcxZ uANNLoUueGYVWCj8ZXyMbQaLmrpSg3fPQPVQvvEgVFXKRHRwAL9H2u8pzsqdGg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780726454; a=rsa-sha256; cv=none; b=jJL2HdHGL/KHc5QDQtSWjNqN/uR2U4vOu+brdL3L8/pXXoyql++dzG5beMi4QJQk2ZDFFK j8gcTLFk0ztusxlcjpHhu5X6oaDGp4AsaqtHVrEfincejDY/zLtoK3ePQRHnznopNs8PCm +90unOZgPQ6AmtJJP/bMhGrhtVpoCPoi2WAWImOGEOat3vnsRjF9HMksxwbNWeWllscXda RMzfRkntyrpo5C0k3bXZdH5j3jtW12UfFNQqgaNjaEc6hmJE3Ru0+HvgGuwgqLN/q/ObbY vglakzi9EB58Io6N+LQIGojN5TN3NbqcKxEDKe/v+rKU72LSWPeG6JRgZAeQPg== 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=1780726454; 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=27KvJblbYv3sUi88xC5thSOslVf8R4O8laEcEa2cf1w=; b=BUuqPEUAoVnWXFQUT0iLFUKL41VqPp2hGv188VoRl2kgl0heQz+d3rvMOextuqVYupLo3a m2OpWGFKte81ezjWsBwMedigIeC85eQMDOwI0rHJnm0Ln0DgLjNsrY9Kewg7Ov3uRTZtmB jCp0oZQsgYt6PmjfyB8t4oQhcB08bTyvSlY7W5yf3eHX03QPnPDp9b6yQ/iF8qpANN0OMh /FuZ3YJrmwO8TcKv+TpMOZuMfSg7hd8mCBEmYuEvOCPJTM3sk1LC+duKsGYe93GjHD5BNy /IJ4RMVj963uTxq5MAOhnwgbk/ql0I3nqaEc5frZ8O+5OSN9ZU0GgzuitZ/a7g== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gXSgV5Ywrz138N for ; Sat, 06 Jun 2026 06:14:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 300e6 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 06 Jun 2026 06:14:14 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Baptiste Daroussin Subject: git: 6d27d52ccd35 - main - nuageinit: implement ntp support List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 6d27d52ccd35d1980e99bc2fc4dae602334d28af Auto-Submitted: auto-generated Date: Sat, 06 Jun 2026 06:14:14 +0000 Message-Id: <6a23bab6.300e6.268fc11e@gitrepo.freebsd.org> The branch main has been updated by bapt: URL: https://cgit.FreeBSD.org/src/commit/?id=6d27d52ccd35d1980e99bc2fc4dae602334d28af commit 6d27d52ccd35d1980e99bc2fc4dae602334d28af Author: Baptiste Daroussin AuthorDate: 2026-06-05 20:25:29 +0000 Commit: Baptiste Daroussin CommitDate: 2026-06-05 20:25:29 +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. --- 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 <