Skip to content
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

Optionally use PGP to validate tarballs #374

Open
elric1 opened this issue Feb 23, 2022 · 3 comments
Open

Optionally use PGP to validate tarballs #374

elric1 opened this issue Feb 23, 2022 · 3 comments

Comments

@elric1
Copy link
Collaborator

elric1 commented Feb 23, 2022

No description provided.

@elric1
Copy link
Collaborator Author

elric1 commented Feb 23, 2022

This must work whilst still streaming the download, decompression, and tar xf -.

@elric1
Copy link
Collaborator Author

elric1 commented Feb 23, 2022

The way to do this properly is approximately:

    curl -o expected-sum $SHA256_URL
    use_pgp_to_validate expected-sum
    curl $iTB_URL | ( tee /dev/stderr | openssl sha256 > the-sum ) 2>&1 | lz4 -d | tar xvpf -
    if ! cmp the-sum expected-sum; then
        echo sigs don\'t match 1>&2
        exit 1
    fi

This still decompresses and unpacks the tarball during the download, thus maximising perfomance, but it also computes the sha256 at the same time so even that step won't slow things down. And it preserves the nice quality of the pipeline that it doesn't require additional disk for the intermediate object.

@elric1
Copy link
Collaborator Author

elric1 commented Feb 23, 2022

It might be better to use fd 3 rather than stderr, too, as we might lose error messages. Something more like:

    curl ... | ( tee /dev/fd/3 | openssl sha256 > the-sum ) 3>&1 | lz4 -d | tar xvpf -

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant