building: collect .hmac files for linux shared libraries #8288
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implement collection of
.hmac
files that may accompany shared library.so
files on some linux systems (Red Hat Enterprise Linux, Fedora Linux). As per #8287, these HMACs are used in crypto library validation/self-check that is enforced when RHEL system is running in FIPS-enabled mode:https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/security_hardening/assembly_installing-a-rhel-8-system-with-fips-mode-enabled_security-hardening
Closes #8273.
When running in FIPS-mode,
hashlib.md5()
cannot be used - therefore, switch the binary cache hashes from md5 to sha1. This allows to run PyInstaller with--strip
option on FIPS-enabled RHEL system.A shared library with HMAC should not be modified in any way (as this invalidates the HMAC), so exempt such shared libraries from processing in
process_collected_binaries
(strip and/or upx, although upx is currently disabled on linux).At the same time, refactor
process_collected_binaries
to remove call to itself when both strip and upx are used; instead, both utilities are called one after another (i.e., without separately caching the intermediate result). The main goal here is to simplify the processing flow to make it easier to eventually introduce support for code-signing on Windows.