invalid signature when validating ASN.1 encoded signature
i've replaced the keys in my repository because i thought something broke and would be a possible solution, then realized nothing was actually broken but it was already too late and have changed them
the images build fine, but when trying to do
rpm-ostree upgrade
or rebase
to the unverified image, i get error: Creating importer: Failed to invoke skopeo proxy method OpenImage: remote error: cryptographic signature verification failed: invalid signature when validating ASN.1 encoded signature
(repo link)Solution:Jump to solution
I'll copy my answer:
For anyone who encounters this, those are the steps to solve the issue:
Copy new
cosign.pub
from your repo to /etc/pki/containers/$your_image_name.pub
...13 Replies
You have 2 choices here. You can either
1. rebase to your image as an unsigned ref (
ostree-unverified-image:docker://image.registry/name
), reboot, and then rebase back to a signed ref (ostree-image-signed:docker://image.registry/name
)
2. you can take your public key and put it somewhere in /etc/
- Update /etc/containers/policy.json
to point to the new public key path
- Run rpm-ostree upgrade
and reboot
- Revert policy.json changes so it will use the public key that's part of your image
We do have an open issue to try to come up with a mechanism for easily moving over to a new set of keys, but haven't gotten around to thatGitHub
feat: Add ability to sign with at least 2 keys · Issue #195 · blue-...
We should add a way for our users to be able to sign their image with at least 2 different keys to allow migrating from one key to another. This would be useful for instances where a key leaked and...
Shit, sorry I didn't fully read your screenshot
I've not seen that before
Are you able to pull that image at all with podman?
Also a link to your repo would be helpful
GitHub
GitHub - sneexy-boi/bluebuild-custom
Contribute to sneexy-boi/bluebuild-custom development by creating an account on GitHub.
podman seems to be pulling in the image successfully
I think I found the bug, I'm working on a fix
OH wait, the bug I found isn't related to this
Could you post your
/etc/containers/policy.json
?I'm really unsure what's happening here. @fiftydinar @Gerblesh have any idea?
It looks like the same error when I screwed up
How'd you fix it?
The same way that Ublue solved the issue
Solution
I'll copy my answer:
For anyone who encounters this, those are the steps to solve the issue:
Copy new
cosign.pub
from your repo to /etc/pki/containers/$your_image_name.pub
sudo cp your-cosign.pub /etc/pki/containers/$your_image_name.pub
Modify /etc/containers/policy.json
, locate your image registry link, in keyPath
edit location to be from /usr/etc
to /etc
"keyPath": "/etc/pki/containers/$your_image_name.pub"
Run rpm-ostree upgrade
& reboot
Copy new policy.json
sudo cp /usr/etc/containers/policy.json /etc/containers/policy.json
Profit
You can verify if new cosign & policy.json is used here. If they're not listed, then you're good. This command tracks changed files in /etc compared to /usr/etc
sudo ostree admin config-diff
yep, this works