WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit 6fd0c8a

Browse files
committed
add ubuntu 24.04 fips example
Signed-off-by: Mauro Morales <[email protected]>
1 parent 33370cb commit 6fd0c8a

File tree

6 files changed

+94
-0
lines changed

6 files changed

+94
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FROM quay.io/kairos/kairos-init:v0.5.8 AS kairos-init
2+
3+
FROM ubuntu:24.04
4+
ARG VERSION=v0.0.1
5+
6+
RUN --mount=type=bind,from=kairos-init,src=/kairos-init,dst=/kairos-init \
7+
/kairos-init -l debug -s install --version "${VERSION}"
8+
# Remove default kernel that Kairos-init installs
9+
RUN apt-get remove -y linux-base linux-image-generic-hwe-24.04 && apt-get autoremove -y
10+
## THIS comes from the Ubuntu documentation: https://canonical-ubuntu-pro-client.readthedocs-hosted.com/en/latest/tutorials/create_a_fips_docker_image.html
11+
## I've just added "linux-image-fips" in the package list
12+
## If you want to use secureboot with fips, you need to install the shim-signed package
13+
## from the Ubuntu PRO repos as its signed with adifferent key
14+
RUN --mount=type=secret,id=pro-attach-config \
15+
apt-get update \
16+
&& apt-get install --no-install-recommends -y ubuntu-advantage-tools ca-certificates \
17+
&& pro attach --attach-config /run/secrets/pro-attach-config \
18+
&& apt-get upgrade -y \
19+
&& apt-get install -y strongswan openssh-client openssh-server linux-image-fips shim-signed \
20+
&& pro detach --assume-yes
21+
22+
# Copy the custom dracut modules.fips that includes 2 missing modules
23+
COPY modules.fips /tmp/modules.fips
24+
RUN kernel=$(ls /lib/modules | head -n1) && mv /tmp/modules.fips /lib/modules/${kernel}/modules.fips
25+
26+
RUN --mount=type=bind,from=kairos-init,src=/kairos-init,dst=/kairos-init \
27+
/kairos-init -l debug -s init --version "${VERSION}"
28+
29+
# Symlink kernel HMAC
30+
RUN kernel=$(ls /boot/vmlinuz-* | head -n1) && ln -sf ."${kernel#/boot/}".hmac /boot/.vmlinuz.hmac
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Kairos Ubuntu jammy fips
2+
3+
- Edit `pro-attach-config.yaml` with your token
4+
- run `bash build.sh`
5+
- start the ISO with qemu `bash run.sh`
6+
7+
The system is not enabling FIPS by default in kernel space.
8+
9+
To Install with `fips` you need a cloud-config file similar to this one adding `fips=1` to the boot options:
10+
11+
```yaml
12+
#cloud-config
13+
14+
install:
15+
# ...
16+
# Set grub options
17+
grub_options:
18+
# additional Kernel option cmdline to apply
19+
extra_cmdline: "fips=1"
20+
```
21+
22+
Notes:
23+
- The modules.fips file is needed as Ubuntu has an older version of dracut which is missing 2 modules in the initramfs.
24+
- The LiveCD is not running in fips mode, you can enable it by appending `fips=1` to the kernel command line in the boot menu.
25+
26+
## Verify FIPS is enabled
27+
28+
After install, you can verify that fips is enabled by running:
29+
30+
```bash
31+
kairos@localhost:~$ cat /proc/sys/crypto/fips_enabled
32+
1
33+
kairos@localhost:~$ uname -r
34+
5.15.0-140-fips
35+
```
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
# Build the container image
6+
docker build --secret id=pro-attach-config,src=pro-attach-config.yaml -t ubuntu-24.04-fips .
7+
8+
# Build ISO from that container
9+
docker run --rm -ti \
10+
-v "$PWD"/build:/tmp/auroraboot \
11+
-v /var/run/docker.sock:/var/run/docker.sock \
12+
quay.io/kairos/auroraboot:v0.5.0 \
13+
--set container_image=docker://ubuntu-24.04-fips \
14+
--set "disable_http_server=true" \
15+
--set "disable_netboot=true" \
16+
--set "state_dir=/tmp/auroraboot"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ecc ecdh sha1 sha224 sha256 sha384 sha512 sha3-224 sha3-256 sha3-384 sha3-512 crc32c crct10dif ghash cipher_null des3_ede aes cfb ecb cbc ctr xts gcm ccm authenc hmac cmac ofb cts deflate lzo zlib ansi_cprng aead cryptomgr tcrypt crypto_user
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
token: <YOUR_TOKEN>
2+
enable_services:
3+
- fips-updates
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
qemu-img create -f qcow2 disk.img 40g
2+
3+
qemu-system-x86_64 -m 8096 -smp cores=2 -nographic -cpu host -enable-kvm \
4+
-serial mon:stdio -rtc base=utc,clock=rt \
5+
-chardev socket,path=qga.sock,server,nowait,id=qga0 \
6+
-device virtio-serial \
7+
-device virtserialport,chardev=qga0,name=org.qemu.guest_agent.0 \
8+
-drive if=virtio,media=disk,file=disk.img \
9+
-drive if=ide,media=cdrom,file=build/kairos.iso

0 commit comments

Comments
 (0)