From nobody Sat Jun 6 06:14:14 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 4gXSgc1Kdgz6g55L for ; Sat, 06 Jun 2026 06:14:20 +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 4gXSgc03vjz3T8f for ; Sat, 06 Jun 2026 06:14:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780726460; 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=DhORaTDwO4Pp3pZnTk/rHklvcSlzlLQtBLetGEO1U9hgeAqN0NfYIEJ3ngKWBIl5AyAt/1 XBoO7ov2rzwStBEoXnVtU29aBGJ5om4AlMADXhjKgQQX2g2KGMkO2bPtk3K8inS35O5qGz ZAgBVMeVVYTTiKjZ8KOZ1MnR0Rp5ebfZF3vN89q3pte1+CG++DLdfLokQpmRFZblHTnhG4 l/5NsRnL72teg5KJ1e+ev3Tj/moZNaoo6iCuoC6ygkGkynq3BldcqqhhZxgXqOs/K03jkh BZqVaEkF8kmJr5Cx5L2Krr6PGl1tYIvGHM+Mr/4YPusby8+hC7jBIJtrWb/UFA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780726460; a=rsa-sha256; cv=none; b=MtDN7ns8CV7pDVHyCzjIqO+5EfGPptlhMcXAPnODLxMiFKoQnel0mSbNYnNm16XHjl7x7h ftMF87iPN71DufNfb6132fuxX7MHiqDs3WKOBLxUzCYKDJMX3MfILfXlBTZHuYCfsuV2zp Ozlql9tu9xZHJaSsG0HodfMkUrXBV3Woj+yNfElf6D0lX2KcIcZbdU4/+D7q03EhuuprsU +OlkdvCjXPj9Kvi67ah00vdj9qIiK9IrUFtCrObdbitDBRTf6cKT0iiR6QgN/zC9WRf/P8 ZJnkJqMlQ0LFLWZ9ANGIL6mbHxPxaHg2kbydC3G8ZATOQFD2Z4v7Es0NDikjkA== 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=1780726460; 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=VMr38xXMTGxAawetDCGX5BBcPFDJk8XggQSBa77UKq/pD3xFkYvasnPb1WBADXdd6sfLnB rU6F9oiFFGeTmJdz4fb3t2OaBVhWg2yHnsiFgULv0wyarko32yy3SfmhSXQpT0hgbnJb61 goe+abaatilrQWac2B33c3T6BUlSZl4kcSTOkhB9ZDxkKFdMNYcMgX7490ff7VG1ySzR9S k5RYyxz06sOoK/uNZZ0LwEWa2B90ep7o4uffV6Ex7cGCiMpXvM/iPvQ1VFSGDvwegiszfN ZkItLqRrd8hQGd3n7BiSoblF7o2e8DegmKTq+EvbFPxoBLaYnmYHaKp0arR58w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gXSgb69Mpz13jP for ; Sat, 06 Jun 2026 06:14:19 +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 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/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 <