-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fedora: Unpack from ISO #121
Conversation
d39e192
to
a5d94ed
Compare
// when the release version is equal or less than 40. | ||
relNum, err := strconv.Atoi(s.definition.Image.Release) | ||
if err == nil && relNum <= 40 { | ||
baseURL := fmt.Sprintf("%s/packages/Fedora-Container-Base", s.definition.Source.URL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tend to prefer the more performant variant:
baseURL := fmt.Sprintf("%s/packages/Fedora-Container-Base", s.definition.Source.URL) | |
baseURL := s.definition.Source.URL + "/packages/Fedora-Container-Base" |
But I understand that might not be relevant for this code base that is probably filled with fmt.Sprintf
...
|
||
gpg_keys_official="file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-%[2]s-primary" | ||
|
||
if [ -n "${GPG_KEYS}" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we know Fedora publishes package signing keys, would it make sense to require GPG keys to be provided?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is for the initial packages we mount on /mnt/cdrom/Packages
, and as far as I understand they are not signed which is the reason there is no GPG keys for them. Packages that are downloaded later from the Fedora repositories are checked with GPG keys that are provided within the ISO file.
Here is a snippet what I have tried doing:
# Iterate over all subdirectories in /mnt/cdrom/Packages
for dir in /mnt/cdrom/Packages/*/; do
if [[ -d "$dir" ]]; then
echo "Checking RPMs in: $dir"
rpm --checksig "$dir"*.rpm || true
rpm --query --queryformat '%{NAME}-%{VERSION}-%{RELEASE} -> %{SIGPGP:pgpsig}\n' --package "$dir"*.rpm || true
fi
done
Snippet of the entire output:
+ [[ -d /mnt/cdrom/Packages/j/ ]]
+ echo 'Checking RPMs in: /mnt/cdrom/Packages/j/'
Checking RPMs in: /mnt/cdrom/Packages/j/
+ rpm --checksig /mnt/cdrom/Packages/j/jansson-2.13.1-10.fc41.x86_64.rpm /mnt/cdrom/Packages/j/jbigkit-libs-2.1-30.fc41.i686.rpm /mnt/cdrom/Packages/j/jbigkit-libs-2.1-30.fc41.x86_64.rpm /mnt/cdrom/Packages/j/jemalloc-5.3.0-7.fc41.x86_64.rpm /mnt/cdrom/Packages/j/jomolhari-fonts-0.003-42.fc41.noarch.rpm /mnt/cdrom/Packages/j/jq-1.7.1-8.fc41.x86_64.rpm /mnt/cdrom/Packages/j/json-c-0.17-4.fc41.x86_64.rpm /mnt/cdrom/Packages/j/json-c-devel-0.17-4.fc41.x86_64.rpm /mnt/cdrom/Packages/j/json-glib-1.10.0-1.fc41.i686.rpm /mnt/cdrom/Packages/j/json-glib-1.10.0-1.fc41.x86_64.rpm
/mnt/cdrom/Packages/j/jansson-2.13.1-10.fc41.x86_64.rpm: digests SIGNATURES NOT OK
/mnt/cdrom/Packages/j/jbigkit-libs-2.1-30.fc41.i686.rpm: digests SIGNATURES NOT OK
/mnt/cdrom/Packages/j/jbigkit-libs-2.1-30.fc41.x86_64.rpm: digests SIGNATURES NOT OK
/mnt/cdrom/Packages/j/jemalloc-5.3.0-7.fc41.x86_64.rpm: digests SIGNATURES NOT OK
/mnt/cdrom/Packages/j/jomolhari-fonts-0.003-42.fc41.noarch.rpm: digests SIGNATURES NOT OK
/mnt/cdrom/Packages/j/jq-1.7.1-8.fc41.x86_64.rpm: digests SIGNATURES NOT OK
/mnt/cdrom/Packages/j/json-c-0.17-4.fc41.x86_64.rpm: digests SIGNATURES NOT OK
/mnt/cdrom/Packages/j/json-c-devel-0.17-4.fc41.x86_64.rpm: digests SIGNATURES NOT OK
/mnt/cdrom/Packages/j/json-glib-1.10.0-1.fc41.i686.rpm: digests SIGNATURES NOT OK
/mnt/cdrom/Packages/j/json-glib-1.10.0-1.fc41.x86_64.rpm: digests SIGNATURES NOT OK
+ true
+ echo 'Checking smth in: /mnt/cdrom/Packages/j/'
+ rpm --query --queryformat '%{NAME}-%{VERSION}-%{RELEASE} -> %{SIGPGP:pgpsig}\n' --package /mnt/cdrom/Packages/j/jansson-2.13.1-10.fc41.x86_64.rpm /mnt/cdrom/Packages/j/jbigkit-libs-2.1-30.fc41.i686.rpm /mnt/cdrom/Packages/j/jbigkit-libs-2.1-30.fc41.x86_64.rpm /mnt/cdrom/Packages/j/jemalloc-5.3.0-7.fc41.x86_64.rpm /mnt/cdrom/Packages/j/jomolhari-fonts-0.003-42.fc41.noarch.rpm /mnt/cdrom/Packages/j/jq-1.7.1-8.fc41.x86_64.rpm /mnt/cdrom/Packages/j/json-c-0.17-4.fc41.x86_64.rpm /mnt/cdrom/Packages/j/json-c-devel-0.17-4.fc41.x86_64.rpm /mnt/cdrom/Packages/j/json-glib-1.10.0-1.fc41.i686.rpm /mnt/cdrom/Packages/j/json-glib-1.10.0-1.fc41.x86_64.rpm
warning: /mnt/cdrom/Packages/j/jansson-2.13.1-10.fc41.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID e99d6ad1: NOKEY
jansson-2.13.1-10.fc41 -> (none)
jbigkit-libs-2.1-30.fc41 -> (none)
jbigkit-libs-2.1-30.fc41 -> (none)
jemalloc-5.3.0-7.fc41 -> (none)
jomolhari-fonts-0.003-42.fc41 -> (none)
jq-1.7.1-8.fc41 -> (none)
json-c-0.17-4.fc41 -> (none)
json-c-devel-0.17-4.fc41 -> (none)
json-glib-1.10.0-1.fc41 -> (none)
json-glib-1.10.0-1.fc41 -> (none)
If anyone has more understanding in this, I recommend myself for some help :)
a5d94ed
to
eb0fed3
Compare
Adds Fedora 41 release. Requires: - [ ] canonical/lxd-imagebuilder#121 Passing build: https://github.com/MusicDin/lxd-ci/actions/runs/12930858195
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MusicDin just to confirm this is verifying the checksum of the downloaded iso against a separately stored value?
// getDownloadURL fetches JSON representation of current releases and | ||
// extracts the download URL matching the given release, variant, arch, | ||
// and filetype (.tar.xz, .iso, etc.). | ||
func (s *fedora) getDownloadURL(release string, variant string, arch string, fileType string) (url string, checksum string, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MusicDin when does this ever return a checksum to be verified?
sources/fedora-http.go
Outdated
if err != nil { | ||
return fmt.Errorf("Failed to unpack %q: %w", filepath.Join(fpath, fname), err) | ||
// Verify checksum. | ||
if checksum != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why wouldnt a checksum be returned? This feels like it could introduce accidental issues in case the checksum is ever not returned we would not verify it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not quite clear how we are verifying the downloaded iso file.
Which is critical because as far as I can see, we then go onto trust the GPG keys inside it.
Signed-off-by: Din Music <[email protected]>
Signed-off-by: Din Music <[email protected]>
Signed-off-by: Din Music <[email protected]>
cd5ad8a
to
564cf83
Compare
Signed-off-by: Din Music <[email protected]>
564cf83
to
79767f8
Compare
Fixed, now the checksum is required in order to proceed with unpacking ISO. Passing build: https://github.com/MusicDin/lxd-ci/actions/runs/13237766213/job/36946163432 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks
Adds support to unpack Fedora ISO image, and some small cosmetic fixes.