Closed ChrisJBurns closed 1 year ago
It seems the problem you are having is because you are renaming the public key from melange.rsa.pub
to .SIGN.RSA.melange.rsa.pub
This should work ⬇️
FROM alpine
COPY files/hello-c/melange.rsa.pub /etc/apk/keys/melange.rsa.pub
RUN echo "@personal http://host.docker.internal:9999/hello-c/packages" | tee -a /etc/apk/repositories
This issue has nothing to do with melange, it happens in across alpine.
Though for SSL or others the filename of the key doesn't matter only the content is important, here for some reason the name is also important.
For example, if you rename one of the pre-existing keys in apline:
cd /etc/apk/keys/
mv alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub a.rsa.pub
mv alpine-devel@lists.alpinelinux.org-5243ef4b.rsa.pub b.rsa.pub
mv alpine-devel@lists.alpinelinux.org-5261cecb.rsa.pub c.rsa.pub
...
...
and try to apk update
or add a package from alpine repo it gives the same UNTRUSTED signature
error.
# apk add wget
WARNING: opening from cache https://dl-cdn.alpinelinux.org/alpine/v3.18/main: UNTRUSTED signature
WARNING: opening from cache https://dl-cdn.alpinelinux.org/alpine/v3.18/community: UNTRUSTED signature
ERROR: unable to select packages:
wget (no such package):
required by: world[wget]
Interesting. I renamed the key because it was originally melange.rsa.pub
and I saw a bit on the Alpine spec about it needing to be a certain name. However, I have just altered the Dockerfile
so that the melange key file name doesn't change and can confirm things work as expected and I get no UNTRUSTED signature errors.
What makes it more weird is that changed the key file name because I had errors before, although at this point I'll have to factor it down to the fact that I've made quite a few changes and tweaks in several places that maybe clouding the waters. Either way, I've got something to work and I can close this issue!
Thanks @debasishbsws
Added a comment in https://github.com/chainguard-dev/melange/issues/591 but didn't get a response so assumed a new issue was required.
Context
I am building a simple file server in Go that is able to act as a APK repository when I can access inside a Docker container. I am creating an
apk
with Melange (successfully), I am then running the Docker container and can install theapk
(pointing to the local Go program running on my host) - however I can only install it when I provide--allow-untrusted
.Steps
I am able to build an
apk
fine with Melange using the following:I am creating an image with the local
packages
folder that contains theapk
added to theapk
repositories:However when I run the Docker image, and perform a
apk update
I get the following error.I also get the same error when I try installing the
hello
package viaapk add hello@personal
.I can verify that the key has been added to
/etc/apk/keys
:I'm not entirely sure why it is complaining about an untrusted signature as I trust that Melange is indeed signing the apk and the public key exists in the
/etc/apk/keys
directory.