Skip to main content

A tool for verification of software downloads using checksums and PGP.

Project description

icetrust

PyPI Test package Extra tests on main branch only codecov GitHub PyPI - Downloads

What is this?

A tool for verification of software downloads using checksums and/or PGP.

This tool is intended to make verification of downloads easier. Development of this project was prompted by the recent supply chain attack against codecov.io.

Requirements

Python 3 is required and you can find all required modules in the requirements.txt file. Only tested on Python 3.9 but should work on other 3.x releases.

You also must have GnuPG installed.

Installation

Check if GnuPG is installed:

gpg --version

Install this project via PIP:

pip install icetrust
icetrust --version

Alternatively, you can download and run manually:

git clone https://github.com/nightwatchcybersecurity/icetrust.git
cd icetrust
pip install -r requirements.txt
python -m icetrust.cli

How to use

There are two main modes that this tool can be used in:

  1. For project owners: "canary" mode can be used to download and verify project files on a regular basis to detect supply chain attacks.
  2. For end users: this tool can be used for verification of already downloaded files against checksums or PGP.

If you are using a PGP key ID, this utility will attempt to connect to a PGP server. If you use a keyfile, the verification will be done entirely off-line. This utility will not modify or use your PGP keyrings, instead a temporary directory is created for this purpose. While this is less efficient and somewhat less secure, it is easier for a lot of users since it avoids the complexity of managing PGP keys.

NOTE: if you are comfortable with using GnuPG and native OS command line tools for verification, please use those instead. This tool is only intended for users who are not yet comfortable with that approach.

Canary Mode

See CANARY.md for help.

Live demos can be viewed here:

Verification modes

This tool offers the following verification modes to verify downloaded files:

  1. compare_files - compares a downloaded file against another copy obtained from another source/location, using checksums.
  2. checksum - verifies a downloaded file against a hardcoded checksum value.
  3. checksumfile - verifies a downloaded file against checksum values in a separate file. The file follows the format used by SHASUM.
  4. pgp - verifies a downloaded file against a detached PGP signature in a separate file. This uses PGP keys provided via a file or a key ID/server name.
  5. pgpchecksumfile - verifies a downloaded file against checksum values in a separate file. That file is first verified via a detached PGP signature using PGP keys provided via a file or a key ID/server name.

To view more details on the verification process, use the "--verbose" option.

compare_files

First download the software to be verified and its second copy:

curl -O https://www1.example.com/software1.zip
curl -O https://www2.example.com/software2.zip

Compare the files (SHA-256 is used behind the scenes):

icetrust compare_files software1.zip software2.zip

checksum

First download the software to be verified:

curl -O https://www.example.com/software.zip

Verify using the checksum value (unless specified, SHA-256 is used):

icetrust checksum software.zip foobarchecksumvaluefoobar

checksumfile

First download the software to be verified and its checksum file:

curl -O https://www1.example.com/software.zip
curl -O https://www2.example.com/software.CHECKSUMS.txt

Verify using the checksum file (unless specified, SHA-256 is used):

icetrust checksumfile software.zip software.CHECKSUMS.txt

pgp

First download the software to be verified and its signature file:

curl -O https://www.example.com/software.zip
curl -O https://www.example.com/software.zip.sig

Verify using a key ID:

icetrust pgp software.zip software.zip.sig --keyid 12345 --keyserver pgp.example.com

If you want to use a keyfile, you must download it or provide it, then verify:

curl -O https://keys.example.com/project_keys.txt
icetrust pgp software.zip software.zip.sig --keyfile project_keys.txt

pgpchecksumfile

First download the software to be verified, its checksum and signatures:

curl -O https://www.example.com/software.zip
curl -O https://www.example.com/software.CHECKSUMS.txt
curl -O https://www.example.com/software.CHECKSUMS.txt.sig

Verify using a key ID (unless specified, SHA-256 is used):

icetrust pgpchecksumfile software.zip software.CHECKSUMS.txt software.CHECKSUMS.txt.sig --keyid 12345 --keyserver pgp.example.com

If you want to use a keyfile, you must download it or provide it, then verify:

curl -O https://keys.example.com/project_keys.txt
icetrust pgpchecksumfile software.zip software.CHECKSUMS.txt software.CHECKSUMS.txt.sig --keyfile project_keys.txt

Sample output and automation

Display installed version:

user@localhost:~/$ icetrust --version
icetrust, version 0.1.0

Example of successful verification

File verified

Example of failed verification

ERROR: File cannot be verified!

Successful verification will return 0. Any errors or failed verification will result in a non-zero return.

Development Information

Reporting bugs and feature requests

Please use the GitHub issue tracker to report issues or suggest features: https://github.com/nightwatchcybersecurity/icetrust

You can also send emai to research /at/ nightwatchcybersecurity [dot] com

Wishlist

  • Add more unit tests

About the name

The name "Ice Trust" is a play on words "Ice Crust" or "Ледяная Кора", which is a magical spell for mental protection (from the book "Last Watch" / "Последний Дозор" by Sergei Lukyanenko)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

icetrust-0.1.6.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

icetrust-0.1.6-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file icetrust-0.1.6.tar.gz.

File metadata

  • Download URL: icetrust-0.1.6.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

File hashes

Hashes for icetrust-0.1.6.tar.gz
Algorithm Hash digest
SHA256 e3c214aa5da595ea8b91981a51033a76625d3fb13dd9c7b1dac673cec36cb234
MD5 592e97f5d8d71ea8fc366b7d2702b90b
BLAKE2b-256 5b9d0e09add4b223f4ec570afe8bf02e9656be71be445785782b24656348736e

See more details on using hashes here.

File details

Details for the file icetrust-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: icetrust-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.9.0

File hashes

Hashes for icetrust-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 ce05cef3d952fbb4b421a4830e77837602558b71787b82087a86b738703d3fef
MD5 ee379817d97834f5e17b03fb561b62bf
BLAKE2b-256 cfe9d9cf0ebf7540f207d667cb4daef317b82d665fd3e2f00195d18a6c8047e1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page