From nobody Sat Oct 4 12:43:50 2025 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 4cf4w64WzSz6BXF2; Sat, 04 Oct 2025 12:43:50 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4cf4w63d3Pz3lYX; Sat, 04 Oct 2025 12:43:50 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759581830; 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=Dqp7pQPPWx4TqLNZlOicndZmXZ6V7SDrVj4TXPwuVGA=; b=w4MAJAV9txMQb1KISDinB5bHhBBNE2Ioz3TuSeZ7Hn9KaKY7DBNQgJP1EHYx8hFOao2sWb M6yscLRpTIfnrFnMiFa8/EVvsuZbl9ABpQOHPFshwlxjXfSqnv/8TPRz/kCcPXKtMqjj0o SwWKdw/Xrwjs4kw2CG6vjgrm4u8S0WNxHYtp5m+/oWYkqxQ20KWBjHC7kphGKKGsoMiy5s jD04SFc7+kAvs0w1MR6nn8XbjPGhnC/zoxv/8aC2IRsayAtnU3HCyUaKXi36Qd8rMFmso8 08Py72YiCj11+QXkgrcGfFDr/2pVV/yV97CeWXAo8WNr2FsQBnXwV5rAlpgZtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1759581830; 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=Dqp7pQPPWx4TqLNZlOicndZmXZ6V7SDrVj4TXPwuVGA=; b=ZqHIWFokPOmEjpKD3qYahrSmV91LZiJ3Zx3wJbTfaSVteqxQ/Qy58IPNA9RY/2ZFqasHIM EMNxlV4X3y9phO2lEqFeE1SHijLRxZyiiLqkqufXhHAKsBHVkt7uY4OGBXH5vIJ0DH2liK 0Thgq3+URNpZ7tUQbWGrSvSuCzMwxhwE9vPUj38i2eNkU/povXu2E6HpN5tY2688niiFup 9UA8k8AOoUWRnLUaZjAk4O3crJHRcOkFPMxOCKbRsfWVotyGOfk8JniMdR/jg5vUZVg/qg wil9CGgnqpgzd9jfj14joybGCehf/EDpOygzxUCzztduv37KHkc6xhngCDV7zw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1759581830; a=rsa-sha256; cv=none; b=nq3lFvq0OR7cYTmGdmru8IduT5LM+6tB2X6MT6mch/DFv7WbBVM1OFpCzIDWS79t2/fAow eljw9+RZXkNTwsc+t1o4FrMuJfD39bJ6Q55U559A+XYUIimBhN4JypA33F9CqP0LIuthTe ddMcv3HJ68EdgtP6nEMFw+0BOCaPNOFLTYcU6zcg7xAj7qVc6bkgFgVIGro3gzPxe9ROQZ qXblXaQjknSl/HEA1hb4B8hf7IjSzSJKy9CllgTssQNfs6uNQK0c9flgUpYObPNw2Ac7DL BhpSETWy+/Ku39Bj4SV21hO2tadDoT20R6OyOjLC9VAC4ggg/KouX7ylyAYqXw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4cf4w63433zjMs; Sat, 04 Oct 2025 12:43:50 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 594ChoLg005779; Sat, 4 Oct 2025 12:43:50 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 594ChoT7005776; Sat, 4 Oct 2025 12:43:50 GMT (envelope-from git) Date: Sat, 4 Oct 2025 12:43:50 GMT Message-Id: <202510041243.594ChoT7005776@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 02dfca245808 - main - release: Complete NO_ROOTification of Vagrant builds 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 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 02dfca2458081587d8224c5ebf8bde99fa360f94 Auto-Submitted: auto-generated The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=02dfca2458081587d8224c5ebf8bde99fa360f94 commit 02dfca2458081587d8224c5ebf8bde99fa360f94 Author: Mark Johnston AuthorDate: 2025-09-19 21:01:52 +0000 Commit: Mark Johnston CommitDate: 2025-10-04 12:43:14 +0000 release: Complete NO_ROOTification of Vagrant builds - Don't clean pkg files, they won't be recorded in the manifest anyway. - Use pw's new metalog mode to create the vagrant user. Note that we do not need to manually create the home directory, pw will do it, so just remove that. - Write metalog entries for the vagrant user's ssh key dir and authorized keys file Note, this depends on an updated pw being installed on the host. Reviewed by: emaste MFC after: 1 day Sponsored by: Klara, Inc. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D52631 --- release/tools/vagrant.conf | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/release/tools/vagrant.conf b/release/tools/vagrant.conf index 7ab0e1238693..5b0f38b740a6 100644 --- a/release/tools/vagrant.conf +++ b/release/tools/vagrant.conf @@ -14,14 +14,16 @@ export VM_EXTRA_PACKAGES="${VM_EXTRA_PACKAGES} shells/bash \ export VM_RC_LIST="firstboot_freebsd_update firstboot_pkgs growfs" vagrant_common () { - # The firstboot_pkgs rc.d script will download the repository - # catalogue and install or update pkg when the instance first - # launches, so these files would just be replaced anyway; removing - # them from the image allows it to boot faster. - env ASSUME_ALWAYS_YES=yes pkg -c ${DESTDIR} clean -y -a - env ASSUME_ALWAYS_YES=yes pkg -c ${DESTDIR} delete -f -y pkg - rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports - rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports-kmods + if [ -z "${NO_ROOT}" ]; then + # The firstboot_pkgs rc.d script will download the repository + # catalogue and install or update pkg when the instance first + # launches, so these files would just be replaced anyway; + # removing them from the image allows it to boot faster. + pkg -c ${DESTDIR} clean -y -a + pkg -c ${DESTDIR} delete -f -y pkg + rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports + rm -r ${DESTDIR}/var/db/pkg/repos/FreeBSD-ports-kmods + fi # Vagrant instances use DHCP to get their network configuration. echo 'ifconfig_DEFAULT="SYNCDHCP"' >> ${DESTDIR}/etc/rc.conf @@ -40,8 +42,7 @@ vagrant_common () { # Create the vagrant user with a password of vagrant /usr/sbin/pw -R ${DESTDIR} \ groupadd vagrant -g 1001 - chroot ${DESTDIR} mkdir -p /home/vagrant - /usr/sbin/pw -R ${DESTDIR} \ + /usr/sbin/pw -R ${DESTDIR} -M ${DESTDIR}/METALOG \ useradd vagrant \ -m -M 0755 -w yes -n vagrant -u 1001 -g 1001 -G 0 \ -c 'Vagrant User' -d '/home/vagrant' -s '/bin/csh' @@ -58,11 +59,11 @@ vagrant_common () { echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > ${DESTDIR}/home/vagrant/.ssh/authorized_keys echo "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN1YdxBpNlzxDqfJyw/QKow1F+wvG9hXGoqiysfJOn5Y vagrant insecure public key" >> ${DESTDIR}/home/vagrant/.ssh/authorized_keys chmod 600 ${DESTDIR}/home/vagrant/.ssh/authorized_keys - metalog_add_data ./home/vagrant/.ssh/authorized_keys 0600 chmod 700 ${DESTDIR}/home/vagrant/.ssh chown -R 1001 ${DESTDIR}/home/vagrant/.ssh - echo "./home/vagrant/.ssh type=dir uid=1001 gid=1001 mode=0700" >> METALOG + echo "./home/vagrant/.ssh type=dir uid=1001 gid=1001 mode=0700" >> ${DESTDIR}/METALOG + echo "./home/vagrant/.ssh/authorized_keys type=file uid=1001 gid=1001 mode=0600" >> ${DESTDIR}/METALOG # Reboot quickly, Don't wait at the panic screen echo 'debug.trace_on_panic=1' >> ${DESTDIR}/etc/sysctl.conf