From nobody Tue Apr 11 13:50:03 2023 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 4PwnK81dXkz44tnL; Tue, 11 Apr 2023 13:50:04 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PwnK80jYKz3nrB; Tue, 11 Apr 2023 13:50:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681221004; 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=yROilVlGb58/JTnOWn0FB2vFkOM3No+cTBZRl8ytPog=; b=knMZWEh/vw9f9R2ujxkr2FZfHQDxRFBGjI1/NNufdg/9GOPyeMKWl+eZEoQn5t/n6Bt3gJ kVO90/89wCIJjC8yh7PieTqE0eNYYhiUjOksrHZx9p+Abi9ZN1mv9xmAfUYrMJeg8NsInW 9hM9FRNBfT3C8o1yPqr7x2AC7ZC5VUEQjtZ+s8eDLpkUe9OcTly2WeVdF0n7KNqD/jQNTe 2KfFSrd+EoBHwTT9DC+0vPM6vdVou92kyX6bcUD06MP4fgnBaP6gTdVmO3QHaxajYlgdOE sEWSaqrsSiuedWV1muv4KGlGQrbrcxR/T+O+wsnSFBErLLdytCH7lYQlIyuktQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1681221004; 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=yROilVlGb58/JTnOWn0FB2vFkOM3No+cTBZRl8ytPog=; b=M/xCZavdFDwAH05yn5ahP4PLNfwENU2kTuVc3A+QCxKcUgO+cgUKc9+7sfYtSt6f90N+IF 22QBJtZsAqXggNYPJOSzNOsxMH9qCIlkJgb+a1tOX+GiTD/Vvjl2NnIWWTFibBejB6oidq CyEEADlAFOfqD/QBX8ipfnWD8vMNqex13YLVrNWGFhoB0/4QZEXXk6vzRy26CeKh57oim1 5/LJi73/lL6LrrUQ6uLmLEskWND6rQwtvBYWs9vVuh9lBb98h8A/FsoFFSYWtNt1oXrF62 3HlkHDgjqldk7zmwN0AjCie7Ev19cMReBtKw4u3/CKabdQfzHb7h3i0zPZJriw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1681221004; a=rsa-sha256; cv=none; b=aqnfEtpT5S2HX/L6MzrXPT4byX70mBMdyTWv4YRbOL/YmeoUNoM1Aw5VS3bQLI4+Yptb+B NjEgh8oUj1FA5QpCA4FJcS3rRxJdXJo5pgn3XV8QgUDV1l30HhXiKZCZ6Lu4MJ01oZS9/A pSkxDklCYffD5r7f7+ouqwQ8A/lBSinNqmtDP8+SQgC5GyHxuk2dDH35Y+FUCSrJ4xA4En yCv+jMApxn4VBina0qHHy9VgAODS9up3lbJ3uCRUsP07qzeF3HdO+kYpXW3ZzNLPDVypG5 OZpSbbpmL74RuUjqcfWxAfEA/E/KnfgRg2ypk559h6XAB6M0MpkOmE+FvV4Idg== 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 4PwnK76tzYzKhN; Tue, 11 Apr 2023 13:50:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33BDo3FP050846; Tue, 11 Apr 2023 13:50:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33BDo3Vp050844; Tue, 11 Apr 2023 13:50:03 GMT (envelope-from git) Date: Tue, 11 Apr 2023 13:50:03 GMT Message-Id: <202304111350.33BDo3Vp050844@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: f8bbe032b286 - stable/13 - release/oci: add Oracle Cloud image builder 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: f8bbe032b286fa261e93b2b2516ba97d5b4a07a7 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=f8bbe032b286fa261e93b2b2516ba97d5b4a07a7 commit f8bbe032b286fa261e93b2b2516ba97d5b4a07a7 Author: Dave Cottlehuber AuthorDate: 2022-11-27 11:12:02 +0000 Commit: Ed Maste CommitDate: 2023-04-11 13:40:53 +0000 release/oci: add Oracle Cloud image builder Provides an OCI (Oracle Cloud Infrastructure) release target for Oracle's KVM-based VM implementation. Tested using 13.1-RELEASE, primarily on Ampere CPU on A1.Flex VM shapes, but also works on amd64 shapes. - supports cloud-init and custom scripts - provides a freebsd@ sudo-enabled user - root user disabled over ssh & console Reviewed by: emaste Sponsored by: The FreeBSD Foundation Sponsored by: SkunkWerks, GmbH Technical assistance from: Oracle Differential Revision: https://reviews.freebsd.org/D34746 (cherry picked from commit 0af49f00b3096a5809f992d87b416cc0f70435ea) --- release/Makefile.vm | 4 ++ release/release.conf.sample | 2 +- release/tools/oci.conf | 94 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 1 deletion(-) diff --git a/release/Makefile.vm b/release/Makefile.vm index 64a3dc31b90a..5ce0ffafd69c 100644 --- a/release/Makefile.vm +++ b/release/Makefile.vm @@ -19,6 +19,7 @@ RAW_DESC= Unformatted raw disk image CLOUDWARE?= BASIC-CI \ EC2 \ GCE \ + OCI \ VAGRANT-VIRTUALBOX \ VAGRANT-VMWARE AZURE_FORMAT= vhdf @@ -33,6 +34,9 @@ EC2_DISK= ${OSRELEASE}.${EC2_FORMAT} GCE_FORMAT= raw GCE_DESC= Google Compute Engine image GCE_DISK= disk.${GCE_FORMAT} +OCI_FORMAT= qcow2 +OCI_DESC= Oracle Cloud Infrastructure image +OCI_DISK= ${OSRELEASE}.${OCI_FORMAT} OPENSTACK_FORMAT=qcow2 OPENSTACK_DESC= OpenStack platform image OPENSTACK_DISK= ${OSRELEASE}.${OPENSTACK_FORMAT} diff --git a/release/release.conf.sample b/release/release.conf.sample index f9cebf82491b..e4e37909c34e 100644 --- a/release/release.conf.sample +++ b/release/release.conf.sample @@ -113,4 +113,4 @@ PORTBRANCH="main" ## If WITH_CLOUDWARE is set to a non-empty value, this is a list of providers ## to create disk images. -#CLOUDWARE="EC2 GCE VAGRANT-VIRTUALBOX VAGRANT-VMWARE" +#CLOUDWARE="EC2 GCE OCI VAGRANT-VIRTUALBOX VAGRANT-VMWARE" diff --git a/release/tools/oci.conf b/release/tools/oci.conf new file mode 100644 index 000000000000..7260cd24defd --- /dev/null +++ b/release/tools/oci.conf @@ -0,0 +1,94 @@ +#!/bin/sh +# Set to a list of packages to install. +export VM_EXTRA_PACKAGES=" + comms/py-pyserial + converters/base64 + devel/oci-cli + devel/py-babel + devel/py-iso8601 + devel/py-pbr + devel/py-six + ftp/curl + lang/python + lang/python3 + net/cloud-init + net/py-eventlet + net/py-netaddr + net/py-netifaces + net/py-oauth + net/rsync + panicmail + security/ca_root_nss + security/sudo + sysutils/firstboot-freebsd-update + sysutils/firstboot-pkgs + sysutils/panicmail + textproc/jq + " + +# Should be enough for base image, image can be resized in needed +export VMSIZE=5g + +# Set to a list of third-party software to enable in rc.conf(5). +export VM_RC_LIST=" + cloudinit + firstboot_pkgs + firstboot_freebsd_update + growfs + ntpd + ntpd_sync_on_start + sshd + zfs" + +vm_extra_pre_umount() { + cat <<-'EOF' >> ${DESTDIR}/etc/rc.conf + dumpdev=AUTO + sendmail_enable=NONE +EOF + + cat <<-'EOF' >> ${DESTDIR}/boot/loader.conf + autoboot_delay="5" + beastie_disable="YES" + boot_serial="YES" + loader_logo="none" + cryptodev_load="YES" + opensolaris_load="YES" + xz_load="YES" + zfs_load="YES" +EOF + + cat <<-'EOF' >> ${DESTDIR}/etc/ssh/sshd_config + # S11 Configure the SSH service to prevent password-based login + PermitRootLogin prohibit-password + PasswordAuthentication no + KbdInteractiveAuthentication no + PermitEmptyPasswords no + UseDNS no +EOF + + # S14 Root user login must be disabled on serial-over-ssh console + pw -R ${DESTDIR} usermod root -w no + # OCI requirements override the default FreeBSD cloud-init settings + cat <<-'EOF' >> ${DESTDIR}/usr/local/etc/cloud/cloud.cfg.d/98_oci.cfg + disable_root: true + system_info: + distro: freebsd + default_user: + name: freebsd + lock_passwd: True + gecos: "OCI Default User" + groups: [wheel] + sudo: ["ALL=(ALL) NOPASSWD:ALL"] + shell: /bin/sh + network: + renderers: ['freebsd'] +EOF + + # Use Oracle Cloud Infrastructure NTP server + sed -i '' -E -e 's/^pool.*iburst/server 169.254.169.254 iburst/' \ + ${DESTDIR}/etc/ntp.conf + + touch ${DESTDIR}/firstboot + + return 0 +}