From 6738c6f477a8a4644649fcf56f918cfbac956e54 Mon Sep 17 00:00:00 2001 From: Jose Luis Duran Date: Thu, 23 Nov 2023 14:43:19 -0300 Subject: [PATCH] FreeBSD 14.0-RELEASE (#27) * FreeBSD 14.0-RELEASE --- .github/workflows/packer.yml | 6 +++--- README.md | 13 ++++++++----- http/installerconfig | 11 ++++++++++- scripts/hardening.sh | 6 +++++- scripts/vmtools.sh | 14 +++++++------- variables.pkr.hcl | 2 +- variables.pkrvars.hcl.sample | 2 +- 7 files changed, 35 insertions(+), 19 deletions(-) diff --git a/.github/workflows/packer.yml b/.github/workflows/packer.yml index fd8cd1a..0f3cc3c 100644 --- a/.github/workflows/packer.yml +++ b/.github/workflows/packer.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Packer uses: hashicorp/setup-packer@main @@ -33,7 +33,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize Packer run: packer init . @@ -52,7 +52,7 @@ jobs: steps: - name: Checkout Repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Initialize Packer run: packer init . diff --git a/README.md b/README.md index ce7eee9..5585706 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ +> [!WARNING] +> FreeBSD 14.0-RELEASE is currently failing to build on VirtualBox. + packer-FreeBSD ============== @@ -30,7 +33,7 @@ To create a box: $ packer init . -3. Build the box: +3. Build the box (`virtualbox-iso.freebsd` or `qemu.freebsd`): $ packer build -only=virtualbox-iso.freebsd . @@ -38,7 +41,7 @@ To create a box: [Handling `.iso` and `.box` files](#handling-iso-and-box-files) for more information. - $ vagrant box add builds/FreeBSD-13.2-RELEASE-amd64.box --name FreeBSD-13.2-RELEASE-amd64 + $ vagrant box add builds/FreeBSD-14.0-RELEASE-amd64.box --name FreeBSD-14.0-RELEASE-amd64 Sample `Vagrantbox` file ------------------------ @@ -59,7 +62,7 @@ ansible_raw_arguments = [] Vagrant.configure(2) do |config| servers.each do |server| config.vm.define server[:name] do |box| - box.vm.box = 'FreeBSD-13.2-RELEASE-amd64' + box.vm.box = 'FreeBSD-14.0-RELEASE-amd64' box.vm.hostname = server[:name] box.vm.provider 'virtualbox' do |v| v.default_nic_type = 'virtio' @@ -113,7 +116,7 @@ guest_os_type = "FreeBSD_64" memory = 1024 mirror = "https://download.freebsd.org" rc_conf_file = "" -revision = "13.2" +revision = "14.0" ``` The following variables can be set: @@ -125,7 +128,7 @@ The following variables can be set: - `memory` is the amount of RAM in megabytes assigned. _Default:_ `1024` -- `revision` is the FreeBSD revision number. _Default:_ `13.2` +- `revision` is the FreeBSD revision number. _Default:_ `14.0` - `branch` used in conjunction with `build_date`, `git_commit` and `directory`. _Default:_ `RELEASE` diff --git a/http/installerconfig b/http/installerconfig index 16f60e3..fe8adf9 100644 --- a/http/installerconfig +++ b/http/installerconfig @@ -8,6 +8,11 @@ if [ -e /dev/vtbd0 ]; then GEOM=vtbd0 # VirtIO (QEMU) fi +if [ -z $GEOM ]; then + echo "ERROR: No disks found." >&2 + exit 1 +fi + if [ "$FILESYSTEM" = 'ufs' ]; then PARTITIONS="$GEOM" else @@ -26,17 +31,21 @@ if [ "$RC_CONF_FILE" = 'local' ]; then touch /tmp/rc-local SSHD_RC_CONF_FILE=/etc/rc.conf.local SENDMAIL_RC_CONF_FILE=/etc/rc.conf.local + SYSCTL_CONF_FILE=/etc/sysctl.conf.local elif [ "$RC_CONF_FILE" = 'vendor' ]; then touch /tmp/rc-vendor SSHD_RC_CONF_FILE=/etc/defaults/vendor.conf SENDMAIL_RC_CONF_FILE=/etc/defaults/vendor.conf + SYSCTL_CONF_FILE=/etc/sysctl.conf elif [ "$RC_CONF_FILE" = 'name' ]; then touch /tmp/rc-name SSHD_RC_CONF_FILE=/etc/rc.conf.d/sshd SENDMAIL_RC_CONF_FILE=/etc/rc.conf.d/sendmail + SYSCTL_CONF_FILE=/etc/sysctl.conf.d/reboot.conf # XXX else SSHD_RC_CONF_FILE=/etc/rc.conf SENDMAIL_RC_CONF_FILE=/etc/rc.conf + SYSCTL_CONF_FILE=/etc/sysctl.conf fi # Disable X11 @@ -66,7 +75,7 @@ echo 'vagrant' | pw usermod root -h 0 echo 'debug.trace_on_panic=1' echo 'debug.debugger_on_panic=0' echo 'kern.panic_reboot_wait_time=0' -} >> /etc/sysctl.conf +} >> "$SYSCTL_CONF_FILE" # The console is not interactive, so we might as well boot quickly sysrc -f /boot/loader.conf autoboot_delay=-1 diff --git a/scripts/hardening.sh b/scripts/hardening.sh index 58b873c..913d9bd 100755 --- a/scripts/hardening.sh +++ b/scripts/hardening.sh @@ -8,6 +8,7 @@ if [ -e /tmp/rc-local ]; then NETOPTIONS_RC_CONF_FILE=/etc/rc.conf.local ROUTING_RC_CONF_FILE=/etc/rc.conf.local SSHD_RC_CONF_FILE=/etc/rc.conf.local + SYSCTL_CONF_FILE=/etc/sysctl.conf.local SYSLOGD_RC_CONF_FILE=/etc/rc.conf.local elif [ -e /tmp/rc-vendor ]; then BLACKLISTD_RC_CONF_FILE=/etc/defaults/vendor.conf @@ -16,6 +17,7 @@ elif [ -e /tmp/rc-vendor ]; then NETOPTIONS_RC_CONF_FILE=/etc/defaults/vendor.conf ROUTING_RC_CONF_FILE=/etc/defaults/vendor.conf SSHD_RC_CONF_FILE=/etc/defaults/vendor.conf + SYSCTL_CONF_FILE=/etc/sysctl.conf SYSLOGD_RC_CONF_FILE=/etc/defaults/vendor.conf elif [ -e /tmp/rc-name ]; then BLACKLISTD_RC_CONF_FILE=/etc/rc.conf.d/blacklistd @@ -24,6 +26,7 @@ elif [ -e /tmp/rc-name ]; then NETOPTIONS_RC_CONF_FILE=/etc/rc.conf.d/netoptions ROUTING_RC_CONF_FILE=/etc/rc.conf.d/routing SSHD_RC_CONF_FILE=/etc/rc.conf.d/sshd + SYSCTL_CONF_FILE=/etc/sysctl.conf.d/hardening.conf # XXX SYSLOGD_RC_CONF_FILE=/etc/rc.conf.d/syslogd else BLACKLISTD_RC_CONF_FILE=/etc/rc.conf @@ -32,6 +35,7 @@ else NETOPTIONS_RC_CONF_FILE=/etc/rc.conf ROUTING_RC_CONF_FILE=/etc/rc.conf SSHD_RC_CONF_FILE=/etc/rc.conf + SYSCTL_CONF_FILE=/etc/sysctl.conf SYSLOGD_RC_CONF_FILE=/etc/rc.conf fi @@ -96,7 +100,7 @@ sysrc -f "$CLEARTMP_RC_CONF_FILE" clear_tmp_enable=YES sysrc -f "$SYSLOGD_RC_CONF_FILE" syslogd_flags=-ss # Change sysctl default values -cat > /etc/sysctl.conf <<- EOF +cat > "$SYSCTL_CONF_FILE" <<- EOF debug.debugger_on_panic=0 debug.trace_on_panic=1 hw.kbd.keymap_restrict_change=4 diff --git a/scripts/vmtools.sh b/scripts/vmtools.sh index 9e1c622..92fb4d7 100755 --- a/scripts/vmtools.sh +++ b/scripts/vmtools.sh @@ -27,16 +27,16 @@ fi case "$PACKER_BUILDER_TYPE" in virtualbox-iso|virtualbox-ovf) - pkg install -qy virtualbox-ose-additions-nox11 + # pkg install -qy virtualbox-ose-additions-nox11 - sysrc -f "$DBUS_RC_CONF_FILE" dbus_enable=YES - sysrc -f "$VBOXGUEST_RC_CONF_FILE" vboxguest_enable=YES - sysrc -f "$VBOXSERVICE_RC_CONF_FILE" vboxservice_enable=YES + # sysrc -f "$DBUS_RC_CONF_FILE" dbus_enable=YES + # sysrc -f "$VBOXGUEST_RC_CONF_FILE" vboxguest_enable=YES + # sysrc -f "$VBOXSERVICE_RC_CONF_FILE" vboxservice_enable=YES cat >> /boot/loader.conf <<- END - #VIRTUALBOX-BEGIN - vboxdrv_load="YES" - #VIRTUALBOX-END + # VIRTUALBOX-BEGIN + #vboxdrv_load="YES" + # VIRTUALBOX-END END ;; diff --git a/variables.pkr.hcl b/variables.pkr.hcl index 900476b..4ab4bf4 100644 --- a/variables.pkr.hcl +++ b/variables.pkr.hcl @@ -65,5 +65,5 @@ variable "rc_conf_file" { variable "revision" { type = string - default = "13.2" + default = "14.0" } diff --git a/variables.pkrvars.hcl.sample b/variables.pkrvars.hcl.sample index affc56d..ec2e94b 100644 --- a/variables.pkrvars.hcl.sample +++ b/variables.pkrvars.hcl.sample @@ -11,4 +11,4 @@ guest_os_type = "FreeBSD_64" memory = 1024 mirror = "https://download.freebsd.org" rc_conf_file = "" -revision = "13.2" +revision = "14.0"