tickets #116638
openchecksum fails for downloaded ISO
0%
Description
This issue has popped up every now and again, and also been the topic of a factory list thread, just this week.
The issue seems to be that mirrorcache issues redirects for certain (hardcoded) symlinks. I'm copying the most recent thread contribution by Andrei Borzenkov:
On 15.09.2022 20:34, Per Jessen wrote:
> Per Jessen wrote:
>
>> Andrei Borzenkov wrote:
>>
>>> I am still unsure because the first redirection comes to the local
>>> file (not to a mirror), and I do not know whether this redirection is
>>> performed by mirrorbrain/MirrorCache or web server on download.o.o
>>> itself. But it does not really matter because the final name on
>>> mirrors will still include version.
>>
>> I've already checked the apache config pontifex, I'll do it again.
>
> I have gone over the download.o.o apache config and I see nothing that
> does any redirection or rewriting based on symlinks. I can only
> conclude it is being done by mirrorbrain/mirrorcache.
For MirrorCache it apparently was added relatively recently:
commit 90e6bf65e20c49a96a974b1a504a2dcea750675f
Author: Andrii Nikitin <46994839+andrii-suse@users.noreply.github.com>
Date: Thu Dec 9 07:09:53 2021 +0100
Special handling unversioned media symlinks (#235)
* Remove outdated variable MIRRORCACHE_COUNTRY_RESCAN_TIMEOUT
* Improve test 04-remote-link
* Try to use redirect for unversioned media symlinks
* Track symlink with hashes for unversioned media files if in the
same folder
* Do not calcuclate hashes for symlinks
I won't claim to understand what MirrorCache tries to do it for, but it
only does it for two files - -Media and -Current:
+sub _detect_ln {
+ my ($dir, $file) = @_;
+ return undef unless $file && $file =~
m/.*(Media|Current)\.iso(\.sha256)?/;
+
Tests added in the same commit expect that sha256 files are links
+echo now change the symlink and make sure redirect changes
+(
+ cd $ap9/dt/folder1
+ ln -sf file2.1-Media.iso file-Media.iso
+ ln -sf file2.1-Media.iso.sha256 file-Media.iso.sha256
+)
+$mc/backstage/job -e folder_sync -a '["/folder1"]'
+$mc/backstage/shoot
+$mc/curl -I /download/folder1/file-Media.iso | grep -C 10 302 |
grep /download/folder1/file2.1-Media.iso
+$mc/curl -I /download/folder1/file-Media.iso.sha256 | grep -C 10 302 |
grep /download/folder1/file2.1-Media.iso.sha256
+$mc/curl -L /download/folder1/file-Media.iso.sha256 | grep -q
"2019dd7afaf5759c68cec4d0e7553227657f01c69da168489116a1c48e40270e "
Updated by pjessen about 2 years ago
- Category set to Core services and virtual infrastructure
- Assignee set to andriinikitin
- Private changed from Yes to No
Updated by andriinikitin about 2 years ago
- Status changed from New to Feedback
Following scenarios were considered:
A. a user or script downloads openSUSE-Tumbleweed-DVD-x86_64-Current.iso and wants to check checksum of the file later at some point.
B. a script downloads openSUSE-Tumbleweed-DVD-x86_64-Current.iso and openSUSE-Tumbleweed-DVD-x86_64-Current.iso.sha256 .
C. a Download tool pauses download and then resumes.
Assuming that new .iso and .sha256 can be published any moment - consistent results are more likely to happen and troubleshooting will be easier when requests are get redirected to the particular version instead of delivering content under -Current
label.
So MirrorCache has implemented behavior like that , e.g.:
# curl -I https://mirrorcache.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-DVD-x86_64-Current.iso.sha256
HTTP/2 302
location: /tumbleweed/iso/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20220914-Media.iso.sha256
Now (I must admit) that I didn't consider Apache on download.o.o would serve small files (i.e. .sha256 ) even before requesting MirrorCache, so current behavior of download.o.o is not as consistent as was planned.
I guess making an exception for .sha256 files in Apache config will solve the problem?
Or what logic can ensure consistent behavior in scenarios above?
Updated by arvidjaar about 2 years ago
andriinikitin wrote:
A. a user or script downloads openSUSE-Tumbleweed-DVD-x86_64-Current.iso and wants to check checksum of the file later at some point.
...... requests are get redirected to the particular version instead of delivering content under
-Current
label.
Both
whet https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Current.iso
and
curl -LO https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Current.iso
store downloaded file under the original filename, even though they follow redirects for the file content. So in this case filename in the .iso.sha256 will be wrong.
bor@bor-Latitude-E5450:~/tmp/d.o.o$ LANG=C wget https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Current.iso.sha256
--2022-09-16 07:20:54-- https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Current.iso.sha256
Resolving download.opensuse.org (download.opensuse.org)... 2001:67c:2178:8::13, 195.135.221.134
Connecting to download.opensuse.org (download.opensuse.org)|2001:67c:2178:8::13|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Snapshot20220914-Media.iso.sha256 [following]
--2022-09-16 07:20:55-- https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Snapshot20220914-Media.iso.sha256
Reusing existing connection to [download.opensuse.org]:443.
HTTP request sent, awaiting response... 200 OK
Length: 124 [application/x-download]
Saving to: 'openSUSE-Tumbleweed-NET-x86_64-Current.iso.sha256'
openSUSE-Tumbleweed-NET 100%[==============================>] 124 --.-KB/s in 0s
2022-09-16 07:20:55 (92.5 MB/s) - 'openSUSE-Tumbleweed-NET-x86_64-Current.iso.sha256' saved [124/124]
bor@bor-Latitude-E5450:~/tmp/d.o.o$ cat openSUSE-Tumbleweed-NET-x86_64-Current.iso.sha256
35d5c061ebcd390d2296b4bb2db9ad74e805c9b91df57d9255d4890572785905 openSUSE-Tumbleweed-NET-x86_64-Snapshot20220914-Media.iso
bor@bor-Latitude-E5450:~/tmp/d.o.o$
ISO will be stored as openSUSE-Tumbleweed-NET-x86_64-Current.iso while checksum file has openSUSE-Tumbleweed-NET-x86_64-Snapshot20220914-Media.iso as file name.
This is chicken and egg problem - to store under the correct name you have know the correct name already at which point you just can download the correct name directly.
This will work correctly with current browsers which store downloaded file under the final redirected name. But not with scripts.
Now (I must admit) that I didn't consider Apache on download.o.o would serve small files (i.e. .sha256 ) even before requesting MirrorCache,
No, it is not the reason here. -Current.iso.sha256 is links for Tumbleweed, but for Leap 15.4 -Current.iso.sha256 and unversioned -Media.iso.sha256 are plain files and so are not redirected.
Updated by robin_listas about 2 years ago
I understand that the reason Apache on download.o.o serves the small .sha256 files, instead of the mirrors, is security. A rogue mirror could alter both the iso and the checksum.
Updated by andriinikitin over 1 year ago
While I don't understand what proper solution should be - wget with flag --content-disposition do save file under correct name:
wget --content-disposition https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Current.iso
--2023-06-22 09:28:35-- https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Current.iso
Resolving download.opensuse.org (download.opensuse.org)... 2001:67c:2178:8::13, 195.135.221.134
Connecting to download.opensuse.org (download.opensuse.org)|2001:67c:2178:8::13|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Snapshot20230620-Media.iso [following]
--2023-06-22 09:28:35-- https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Snapshot20230620-Media.iso
Reusing existing connection to [download.opensuse.org]:443.
HTTP request sent, awaiting response... 302 Found
Location: https://ftp.uni-erlangen.de/opensuse/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Snapshot20230620-Media.iso [following]
--2023-06-22 09:28:35-- https://ftp.uni-erlangen.de/opensuse/tumbleweed/iso/openSUSE-Tumbleweed-NET-x86_64-Snapshot20230620-Media.iso
Resolving ftp.uni-erlangen.de (ftp.uni-erlangen.de)... 2001:638:a000:1021:21::1, 131.188.12.211
Connecting to ftp.uni-erlangen.de (ftp.uni-erlangen.de)|2001:638:a000:1021:21::1|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 233832448 (223M) [application/x-iso9660-image]
Saving to: ‘openSUSE-Tumbleweed-NET-x86_64-Snapshot20230620-Media.iso’
openSUSE-Tumbleweed-NET-x86_64-Snapshot20230620-Media.iso 100%[===================================================================================================================================================================>] 223.00M 105MB/s in 2.1s
2023-06-22 09:28:37 (105 MB/s) - ‘openSUSE-Tumbleweed-NET-x86_64-Snapshot20230620-Media.iso’ saved [233832448/233832448]
and even better aria2c will use metalink file for parallel download from several mirrors and can verify checksum from metalink file, so no need for sha256 (thus no chance for inconsistency between Current.iso and Current.iso.sha256):
> aria2c https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-DVD-x86_64-Current.iso
06/22 09:57:19 [NOTICE] Downloading 1 item(s)
06/22 09:57:19 [NOTICE] CUID#7 - Redirecting to https://download.opensuse.org/tumbleweed/iso/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20230620-Media.iso
06/22 09:57:19 [NOTICE] Download complete: /home/an/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20230620-Media.iso.meta4
*** Download Progress Summary as of Thu Jun 22 09:58:27 2023 ***
================================================================================================================================================================================================================================================================================
[#fd7b42 4.3GiB/4.3GiB(99%) CN:1 DL:1.8MiB ETA:4s]
FILE: /home/an/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20230620-Media.iso
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
[#fd7b42 4.3GiB/4.3GiB(99%) CN:1 DL:94KiB ETA:1m25s]
06/22 09:58:28 [NOTICE] Download complete: /home/an/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20230620-Media.iso
Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
8244dd|OK | 1.8MiB/s|/home/an/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20230620-Media.iso.meta4
fd7b42|OK | 64MiB/s|/home/an/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20230620-Media.iso
Status Legend:
(OK):download completed.
> aria2c --check-integrity openSUSE-Tumbleweed-DVD-x86_64-Snapshot20230620-Media.iso.meta4
06/22 10:17:33 [NOTICE] Downloading 1 item(s)
[#e0e525 0B/4.3GiB(0%) CN:0 DL:0B] [Checksum:#e0e525 4.2GiB/4.3GiB(97%)]
06/22 10:17:45 [NOTICE] Verification finished successfully. file=/home/an/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20230620-Media.iso
06/22 10:17:45 [NOTICE] Download complete: /home/an/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20230620-Media.iso
Download Results:
gid |stat|avg speed |path/URI
======+====+===========+=======================================================
e0e525|OK | 0B/s|/home/an/openSUSE-Tumbleweed-DVD-x86_64-Snapshot20230620-Media.iso
Status Legend:
(OK):download completed.