Skip to content

Commit ab08d3f

Browse files
authored
Merge branch 'develop' into dlpx/pr/prakashsurya/72edc04a-cee4-4103-94c5-49bc2694c167
2 parents 5344501 + d4776fb commit ab08d3f

10 files changed

Lines changed: 178 additions & 31 deletions

File tree

default-package-config.sh

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Copyright 2018, 2020 Delphix
3+
# Copyright 2018, 2025 Delphix
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -160,6 +160,44 @@ function kernel_build() {
160160
#
161161
logmust fakeroot debian/rules printenv "${debian_rules_args[@]}"
162162

163+
#
164+
# Configure signing keys/certs before build
165+
#
166+
# CONFIG_MODULE_SIG_KEY is set to /var/tmp/sbkeys/signing_key.pem in
167+
# resources/delphix_kernel_annotations
168+
#
169+
FLAVOUR=$platform
170+
OBJ=debian/build/build-$FLAVOUR
171+
CERTS=$OBJ/certs
172+
173+
# ensure the objdir + certs dir exist
174+
mkdir -p "$CERTS"
175+
download_keys
176+
177+
# provide the key the packaging expects INSIDE the objdir
178+
# (symlink or copy)
179+
logmust ln -sf "${SB_KEYS_DIR}/signing_key.pem" "$CERTS/signing_key.pem"
180+
logmust chmod 600 "$CERTS/signing_key.pem"
181+
182+
# create the DER .x509 that sign-file needs from .crt)
183+
logmust openssl x509 -in "${SB_KEYS_DIR}/db.crt" -outform DER -out "$CERTS/signing_key.x509"
184+
185+
# sanity checks
186+
logmust test -s "$CERTS/signing_key.pem" || {
187+
echo "missing signing_key.pem"
188+
exit 1
189+
}
190+
logmust test -s "$CERTS/signing_key.x509" || {
191+
echo "missing signing_key.x509"
192+
exit 1
193+
}
194+
logmust openssl pkey -in "$CERTS/signing_key.pem" -noout >/dev/null || {
195+
echo "key unreadable"
196+
exit 1
197+
}
198+
SBSIGN_KEY="${SBSIGN_KEY:-$SB_KEYS_DIR/db.key}"
199+
SBSIGN_CERT="${SBSIGN_CERT:-$SB_KEYS_DIR/db.crt}"
200+
163201
#
164202
# The default value of the tool argument for mk-build-deps
165203
# is the following:
@@ -203,6 +241,23 @@ function kernel_build() {
203241
# one of the .debs produced
204242
#
205243
logmust test -f "artifacts/linux-image-${kernel_version}_"*.deb
244+
245+
#
246+
# After the build, unpackage linux-image package and sign vmlinuz
247+
#
248+
linux_deb=$(find artifacts -type f -name "linux-image-${kernel_version}*.deb" | head -n1)
249+
temp_dir=$(mktemp -d -p "/var/tmp/")
250+
logmust fakeroot dpkg-deb -R $linux_deb "$temp_dir"
251+
252+
bz="$temp_dir/boot/vmlinuz-${kernel_version}"
253+
logmust sbsign --key $SBSIGN_KEY --cert $SBSIGN_CERT --output "$bz.signed" "$bz"
254+
logmust mv "$bz.signed" "$bz"
255+
logmust sbverify --list "$bz"
256+
257+
# Repack the .deb"
258+
update_md5sums "$temp_dir"
259+
repack_deb $linux_deb $temp_dir
260+
delete_keys
206261
}
207262

208263
#

lib/common.sh

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,3 +1414,87 @@ function set_secret_build_args() {
14141414
_SECRET_BUILD_ARGS+=("-DSECRET_DB_AWS_REGION=$SECRET_DB_AWS_REGION")
14151415
fi
14161416
}
1417+
1418+
#
1419+
# Secure boot variables and functions
1420+
#
1421+
# S3 bucket containing keys and certs
1422+
# ./db subdirectory contains the db key and various certs:
1423+
# .der is for signing modules like ZFS and connstat
1424+
# .crt is for signing vmlinuz
1425+
# signing_key.pem is the format expected by kernel build for signing its modules
1426+
#
1427+
# ./pub contains the auth files, secure boot enrollment certs.
1428+
#
1429+
S3_KEYS_URL="s3://secure-boot-keys-prod/release"
1430+
#
1431+
# The kernel build expects the signing_key.pem in this directory, i.e.
1432+
# CONFIG_MODULE_SIG_KEY is set to /var/tmp/sbkeys/signing_key.pem in
1433+
# resources/delphix_kernel_annotations
1434+
#
1435+
SB_KEYS_DIR="/var/tmp/sbkeys"
1436+
SBSIGN_KEY="$SB_KEYS_DIR/db.key"
1437+
SBSIGN_DER="$SB_KEYS_DIR/db.der"
1438+
1439+
function download_keys() {
1440+
logmust mkdir -p $SB_KEYS_DIR
1441+
logmust aws s3 cp --recursive "$S3_KEYS_URL/db/" $SB_KEYS_DIR
1442+
}
1443+
1444+
function delete_keys() {
1445+
logmust rm -r $SB_KEYS_DIR
1446+
}
1447+
1448+
# Update DEBIAN/md5sum for package directory after
1449+
# some files were updated, i.e. secure-boot signed.
1450+
#
1451+
function update_md5sums() {
1452+
pkg_dir=$1
1453+
echo_bold "Updating md5sums for $pkg_dir"
1454+
1455+
(
1456+
cd "$pkg_dir" || exit
1457+
: >DEBIAN/md5sums
1458+
# print paths relative to root of package
1459+
while IFS= read -r -d '' f; do
1460+
rel="${f#./}"
1461+
md5sum "$rel" >>DEBIAN/md5sums
1462+
done < <(find . -type f ! -path './DEBIAN/*' ! -path './etc/depmod*' -print0)
1463+
)
1464+
}
1465+
1466+
function repack_deb() {
1467+
deb_name=$1
1468+
deb_dir=$2
1469+
temp_deb=$(mktemp /tmp/deb.XXXXXX)
1470+
1471+
logmust fakeroot dpkg-deb -b "$deb_dir" "$temp_deb"
1472+
logmust mv "$temp_deb" "$deb_name"
1473+
}
1474+
1475+
#
1476+
# Sign .ko files in the module list
1477+
#
1478+
function sign_modules() {
1479+
deb_pkgs="$1"
1480+
echo_bold "Signing $deb_pkgs"
1481+
download_keys
1482+
1483+
while IFS= read -r pkg; do
1484+
echo_bold "Processing $pkg"
1485+
temp_dir=$(mktemp -d -p "/var/tmp/")
1486+
logmust fakeroot dpkg-deb -R "$pkg" "$temp_dir"
1487+
1488+
# Find and sign all .ko files in package
1489+
find "$temp_dir" -type f -name "*.ko" -print0 |
1490+
while IFS= read -r -d '' kernel_mod; do
1491+
logmust kmodsign sha256 "$SBSIGN_KEY" "$SBSIGN_DER" "$kernel_mod" "$kernel_mod.signed"
1492+
logmust mv "$kernel_mod.signed" "$kernel_mod"
1493+
logmust modinfo -F signer "$kernel_mod"
1494+
done
1495+
# Repack the .deb"
1496+
update_md5sums "$temp_dir"
1497+
repack_deb "$pkg" "$temp_dir"
1498+
done <<<"$deb_pkgs"
1499+
delete_keys
1500+
}

packages/connstat/config.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Copyright 2018, 2020 Delphix
3+
# Copyright 2018, 2025 Delphix
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -50,4 +50,8 @@ function build() {
5050

5151
logmust cd "$WORKDIR/repo"
5252
logmust mv ./*deb "$WORKDIR/artifacts/"
53+
54+
# Sign the generated modules
55+
connstat_pkgs=$(find "$WORKDIR/artifacts" -type f -name "connstat-module-*.deb" ! -name "*-dbg*")
56+
sign_modules "$connstat_pkgs"
5357
}

packages/delphix-platform/config.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Copyright 2018, 2020 Delphix
3+
# Copyright 2018, 2026 Delphix
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -18,11 +18,14 @@
1818

1919
DEFAULT_PACKAGE_GIT_URL="https://github.com/delphix/delphix-platform.git"
2020

21+
function prepare() {
22+
logmust cd "$WORKDIR/repo"
23+
logmust sudo -E make build-deps
24+
}
25+
2126
function build() {
2227
logmust cd "$WORKDIR/repo"
23-
logmust ansible-playbook bootstrap/playbook.yml
24-
logmust ./scripts/docker-run.sh make packages \
25-
VERSION="1.0.0-$PACKAGE_REVISION"
28+
logmust sudo -E make packages VERSION="1.0.0-$PACKAGE_REVISION"
2629
logmust sudo chown -R "$USER:" artifacts
27-
logmust mv artifacts/*deb "$WORKDIR/artifacts/"
30+
logmust sudo mv artifacts/*deb "$WORKDIR/artifacts/"
2831
}

packages/grub2/config.sh

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,18 @@
1717
# shellcheck disable=SC2034
1818

1919
DEFAULT_PACKAGE_GIT_URL="https://github.com/delphix/grub2"
20+
SKIP_COPYRIGHTS_CHECK=true
2021

21-
UPSTREAM_GIT_URL=https://git.launchpad.net/ubuntu/+source/grub2
22-
UPSTREAM_GIT_BRANCH="applied/ubuntu/${UBUNTU_DISTRIBUTION}-updates"
22+
URI="s3://release-de-images/internal-artifacts/2025.3.0.1/1.0.53/input-artifacts/combined-packages/packages/grub2"
2323

24-
SKIP_COPYRIGHTS_CHECK=true
24+
function fetch() {
25+
logmust cd "$WORKDIR/artifacts"
2526

26-
#
27-
# Install build dependencies for the package.
28-
#
29-
function prepare() {
30-
logmust install_build_deps_from_control_file
27+
logmust aws s3 sync "$URI" .
28+
logmust sha256sum -c SHA256SUMS
3129
}
3230

33-
#
34-
# Build the package.
35-
#
3631
function build() {
37-
logmust dpkg_buildpackage_default
38-
}
39-
40-
#
41-
# Hook to fetch upstream package changes and merge into our tree.
42-
#
43-
function update_upstream() {
44-
logmust update_upstream_from_git
32+
return
33+
# Nothing to do, all the logic is done in fetch().
4534
}

packages/virtualization/config.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,14 @@ function prepare() {
2727
logmust install_pkgs "${_RET_LIST[@]}"
2828

2929
logmust install_pkgs \
30+
openjdk-17-jdk-headless \
3031
"$DEPDIR"/crypt-blowfish/*.deb \
3132
"$DEPDIR"/host-jdks/*.deb
3233
}
3334

3435
function build() {
3536
export JAVA_HOME
36-
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
37+
JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64/"
3738

3839
export LANG
3940
LANG=en_US.UTF-8

packages/windows-connector/config.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@
1919
DEFAULT_PACKAGE_GIT_URL="https://github.com/delphix/dlpx-app-gate.git"
2020
SKIP_COPYRIGHTS_CHECK=true
2121

22+
function prepare() {
23+
logmust install_pkgs \
24+
openjdk-17-jdk-headless
25+
}
26+
2227
function build() {
2328
CONNECTOR_DIR="${WORKDIR}/repo/appliance/server/connector"
2429
INSTALLER_DIR="${WORKDIR}/repo/appliance/host/windows"

packages/zfs/config.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Copyright 2019, 2020 Delphix
3+
# Copyright 2019, 2025 Delphix
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -174,6 +174,10 @@ function build() {
174174
done
175175
logmust cd "$WORKDIR"
176176
logmust mv "all-packages/"*.deb "artifacts/"
177+
178+
# Sign ZFS modules in all packages
179+
zfs_pkgs=$(find "$WORKDIR/artifacts" -type f -name "zfs-modules-*.deb" ! -name "*-dbg*")
180+
sign_modules "$zfs_pkgs"
177181
}
178182

179183
function update_upstream() {

resources/delphix_kernel_annotations

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# FORMAT: 4
33
# ARCH: amd64
44
# FLAVOUR: amd64-aws amd64-azure amd64-generic amd64-gcp amd64-oracle
5+
#
6+
CONFIG_MODULE_SIG_KEY policy<{'amd64': '"/var/tmp/sbkeys/signing_key.pem"'}>
7+
CONFIG_MODULE_SIG_FORCE policy<{'amd64': 'y', 'arm64': 'n'}>
58

69
#
710
# Disable various "net" modules which we don't use.
@@ -151,7 +154,6 @@ CONFIG_CDROM policy<{'amd64': 'n', 'arm64': '
151154
CONFIG_CEPH_LIB policy<{'amd64': 'n', 'arm64': 'n'}>
152155
CONFIG_CRAMFS policy<{'amd64': 'n', 'arm64': 'n'}>
153156
CONFIG_CYCLADES policy<{'amd64': 'n', 'arm64': 'n'}>
154-
CONFIG_DRM policy<{'amd64': 'n', 'arm64': 'n'}>
155157
CONFIG_ENIC policy<{'amd64': 'n', 'arm64': 'n'}>
156158
CONFIG_FM10K policy<{'amd64': 'n', 'arm64': 'n'}>
157159
CONFIG_FORCEDETH policy<{'amd64': 'n', 'arm64': 'n'}>

setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22
#
3-
# Copyright 2018, 2020 Delphix
3+
# Copyright 2018, 2025 Delphix
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -80,7 +80,7 @@ function configure_apt_sources() {
8080
deb ${primary_url} ${UBUNTU_DISTRIBUTION}-backports main restricted universe multiverse
8181
deb-src ${primary_url} ${UBUNTU_DISTRIBUTION}-backports main restricted universe multiverse
8282
83-
deb ${secondary_url} ${UBUNTU_DISTRIBUTION} main multiverse universe
83+
deb ${secondary_url} ${UBUNTU_DISTRIBUTION} main multiverse universe stable
8484
EOF" || die "/etc/apt/sources.list could not be updated"
8585

8686
logmust sudo apt-key add "$TOP/resources/delphix-secondary-mirror.key"

0 commit comments

Comments
 (0)