Skip to content

Check Omaha sha1 hash if available and Verify checksum after download, with retry#47

Merged
pothos merged 4 commits intotrunkfrom
kai/sha1
Jan 5, 2024
Merged

Check Omaha sha1 hash if available and Verify checksum after download, with retry#47
pothos merged 4 commits intotrunkfrom
kai/sha1

Conversation

@pothos
Copy link
Copy Markdown
Member

@pothos pothos commented Jan 3, 2024

  • Check Omaha sha1 hash if available
    Old Nebraska servers were missing the newly introduced sha256 attribute and might only serve paylads with the regular sha1 attribute set. The generic payload is also just using the regular sha1 attribute because at that time a different extension was used which holds the sha256 checksum for the generic payload.
    Support the regular Omaha sha1 hash for use with old Nebraska servers. This makes it also easy to test with the generic payload.

  • Verify checksum after download, with retry

    The self.verify_checksum(...) call's return value wasn't checked in the
    package download call. Even if we do it there we should rather move it
    into the retry loop and make it explicit whether we expect certain
    checksums or not.
    Check the checksum after the download, and also retry when it
    mismatches.

How to use

Fixes #31

I think this is the last piece to start using it in Flatcar.

Testing done

RUST_LOG=debug target/release/download_sysext -p ~/kinvolk/scripts/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-au-key/files/official-v2.pub.pem -m oem-azure.gz -o /var/tmp/outdir/ -u https://update.release.flatcar-linux.net/amd64-usr/3815.0.0/oem-azure.gz -v
RUST_LOG=debug target/release/download_sysext -p ~/kinvolk/scripts/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-au-key/files/official-v2.pub.pem -m oem-azure.gz -o /var/tmp/outdir/ -i /var/tmp/beta-response -v
RUST_LOG=debug target/release/download_sysext -p ~/kinvolk/scripts/sdk_container/src/third_party/coreos-overlay/coreos-base/coreos-au-key/files/official-v2.pub.pem -m flatcar_production_update.gz -o /var/tmp/outdir/ -i /var/tmp/beta-response -v

@pothos pothos requested a review from dongsupark January 3, 2024 14:42
@pothos pothos changed the title Check Omaha sha1 hash if available Check Omaha sha1 hash if available and Verify checksum after download, with retry Jan 3, 2024
@pothos pothos force-pushed the kai/sha1 branch 2 times, most recently from ff6ad75 to 3fc1a8d Compare January 3, 2024 14:56
Copy link
Copy Markdown
Member

@dongsupark dongsupark left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good in general.

pothos added 2 commits January 5, 2024 14:46
Old Nebraska servers were missing the newly introduced sha256 attribute
and might only serve paylads with the regular sha1 attribute set. The
generic payload is also just using the regular sha1 attribute because
at that time a different extension was used which holds the sha256
checksum for the generic payload.
Support the regular Omaha sha1 hash for use with old Nebraska servers.
This makes it also easy to test with the generic payload.
The self.verify_checksum(...) call's return value wasn't checked in the
package download call. Even if we do it there we should rather move it
into the retry loop and make it explicit whether we expect certain
checksums or not.
Check the checksum after the download, and also retry when it
mismatches.
@pothos
Copy link
Copy Markdown
Member Author

pothos commented Jan 5, 2024

I've fixed all warnings and added running clippy in the CI, otherwise it's too easy to forget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

wire up omaha::Hash<T> with DynDigest

2 participants