Skip to content
This repository has been archived by the owner on Nov 20, 2023. It is now read-only.

Commit

Permalink
feat: add support for image signing
Browse files Browse the repository at this point in the history
  • Loading branch information
gerblesh committed Jul 21, 2023
1 parent de8c36e commit d2c9823
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ ARG RECIPE=./recipe.yml
# for manual overrides and editing by the machine's admin AFTER installation!
# See issue #28 (https://github.com/ublue-os/startingpoint/issues/28).
COPY usr /usr
# Copy public key
COPY ./cosign.pub /usr/etc/pki/containers/cosign.pub
# Copy base signing config
COPY ./usr/etc/containers /usr/etc/

# Copy the recipe that we're building.
COPY ${RECIPE} /usr/share/ublue-os/recipe.yml
Expand Down
5 changes: 5 additions & 0 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ YAFTI_ENABLED="$(get_yaml_string '.firstboot.yafti')"
# Welcome.
echo "Building custom Fedora ${FEDORA_VERSION} from image: \"${BASE_IMAGE}\"."

# Setup container signing
echo "Setup container signing in policy.json and cosign.yaml"
sed -i "s ghcr.io/ublue-os $IMAGE_REGISTRY g" /usr/etc/containers/policy.json
sed -i "s ghcr.io/ublue-os $IMAGE_REGISTRY g" /usr/etc/containers/registries.d/cosign.yaml

# Add custom repos.
get_yaml_array repos '.rpm.repos[]'
if [[ ${#repos[@]} -gt 0 ]]; then
Expand Down
74 changes: 74 additions & 0 deletions usr/etc/containers/policy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"default": [
{
"type": "reject"
}
],
"transports": {
"docker": {
"registry.access.redhat.com": [
{
"type": "signedBy",
"keyType": "GPGKeys",
"keyPath": "/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release"
}
],
"registry.redhat.io": [
{
"type": "signedBy",
"keyType": "GPGKeys",
"keyPath": "/etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release"
}
],
"ghcr.io/ublue-os": [
{
"type": "sigstoreSigned",
"keyPath": "/usr/etc/pki/containers/cosign.pub",
"signedIdentity": {
"type": "matchRepository"
}
}
],
"": [
{
"type": "insecureAcceptAnything"
}
]
},
"docker-daemon": {
"": [
{
"type": "insecureAcceptAnything"
}
]
},
"atomic": {
"": [
{
"type": "insecureAcceptAnything"
}
]
},
"dir": {
"": [
{
"type": "insecureAcceptAnything"
}
]
},
"oci": {
"": [
{
"type": "insecureAcceptAnything"
}
]
},
"tarball": {
"": [
{
"type": "insecureAcceptAnything"
}
]
}
}
}
3 changes: 3 additions & 0 deletions usr/etc/containers/registries.d/cosign.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docker:
ghcr.io/ublue-os:
use-sigstore-attachments: true

0 comments on commit d2c9823

Please sign in to comment.