#591 Support sha512 checksums
Closed: Fixed by lsedlar. Opened by ralph.

sha1 is bust. We're using sha256 now.

The code currently limits you to only using md5, sha1, or sha256.

We should probably enable support for sha512 now before sha256 becomes too weak someday.

From a look at the code we need to:

  • Easy: change the config check to just allow sha512.
  • Harder: from grepping around, it seems like "sha256" is hardcoded in a number of places. Those need to be modified to take their value from the config.

There are multiple places where checksums are computed:

  • for createrepo_c: current options are sha or sha256. At least createrepo_c is fine with sha512 as well, so this should be allowed.
  • for live media, isos and images we compute checksums that go into metadata and the CHECKSUM files in compose dir: this supports any checksum provided by hashlib and is not restricted by config (but the documentation needs to be updated though to mention this explicitly)
  • .treeinfo files contain checksums of some files, and this is currently hardcoded to sha256. The value contains the checksum type, so it should be possible to change these, but care needs to be taken to not break consumers. (example).
  • when extra files are copied to the compose (not used for fedora), we create a file with checksums for them. Right now it uses a sha256 checksum, but it's written in a way to support multiple checksums, and probably should reuse the config for live media.

As for the .treeinfo Pungi is using productmd which does not seem to support multiple checksums (the format looks like it could support it, but the code can not write it). Before changing that we need to find out what reads the value and whether it could break.

On the subject of bad checksums, the sigkeys and signing_key_id settings should probably enforce a longer key length (see https://evil32.com/).

The key ids are passed to koji to get paths to signed copies of the files, so Koji itself first needs to support longer keys. Currently the ID is just put into a path as is.

Checking again the .treeinfo file does not support multiple checksums for a single file and it can't without big changes.The INI format uses file path as key, and these can not be duplicated. The best we can do is to just switch it, which could break consumers.

The checksums in treeinfo are now switched to whatever createrepo_checksum is configured to.

Metadata Update from @lsedlar:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

Metadata Update from @lsedlar:
- Issue set to the milestone: 4.1.39

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/pungi/pungi/issues/591

Please continue any further discussion there.

Metadata