freebsd: upgrade to freebsd

Upgrade to FreeBSD 14 as bin packages for FreeBSD 12 are no longer
available.

Also pre-install github server key, and pre-install rust.

Change-Id: Ifd46cbe30ef732755af0753d317dea02ef849800
diff --git a/freebsd.sh b/freebsd.sh
index a4616e8..d1280ef 100644
--- a/freebsd.sh
+++ b/freebsd.sh
@@ -4,7 +4,7 @@
     curl \
     git \
     gnupg \
-    openjdk17 \
+    openjdk21 \
     python3 \
     unzip \
     cmake \
@@ -17,10 +17,21 @@
     gmake \
     perl5 \
     bash \
-    py39-pip
+    rust \
+    py311-pip
 
 mount -t fdescfs fdesc /dev/fd
 mount -t procfs proc /proc
 
 echo 'fdesc             /dev/fd fdescfs rw      0       0' >> /etc/fstab
 echo 'proc              /proc   procfs  rw      0       0' >> /etc/fstab
+
+mkdir -p /etc/ssh/ssh_config.d/
+echo "Host *\n\tStrictHostKeyChecking accept-new" > /etc/ssh/ssh_config.d/accept_only_new_keys.conf
+
+# clear out previous known host pub keys
+rm -f /etc/ssh/known_hosts
+
+# Download ssh host keys
+# - github.com
+ssh-keyscan -H github.com >> /etc/ssh/known_hosts
diff --git a/packer_freebsd.json b/packer_freebsd.json
index f80ee07..bee206c 100644
--- a/packer_freebsd.json
+++ b/packer_freebsd.json
@@ -8,16 +8,15 @@
   "builders": [
     {
       "type": "amazon-ebs",
-      "name": "freebsd-12.3-mbedtls",
+      "name": "freebsd-14.3-mbedtls",
       "vpc_id":  "{{user `vpc_id`}}",
       "subnet_id": "{{user `subnet_id`}}",
       "region": "{{user `vpc_region`}}",
       "source_ami_filter": {
         "filters": {
-          "image-id": "ami-0ce4290dab6773fdd",
-          "product-code": "ejmg4fgac56dgb0xac6m4fpis"
+          "image-id": "ami-0533685f87f5b6c96"
         },
-        "owners": ["aws-marketplace"],
+        "owners": ["782442783595"],
         "most_recent": true,
         "include_deprecated": true
       },
@@ -25,11 +24,11 @@
       "ssh_username": "{{user `ssh_username`}}",
       "ssh_timeout": "10m",
       "ami_name": "jenkins-freebsd-amd64-{{isotime \"2006-01-02-1504\"}}",
-      "ami_regions": ["eu-west-1"],
+      "ami_regions": ["eu-central-1"],
       "launch_block_device_mappings": [
         {
           "device_name": "/dev/sda1",
-          "volume_type": "gp2",
+          "volume_type": "gp3",
           "volume_size": "30",
           "delete_on_termination": true
         }