-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
openssl: add use_validated_fips
option
#24709
base: master
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
recipes/openssl/3.x.x/conanfile.py
Outdated
if not self.options.no_fips: | ||
provdir = os.path.join(self.source_folder, "providers") | ||
if self._is_fips_enabled: | ||
provdir = self._fips_provider_dir |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected 👍🏼
Just a minor thing, does it help to add a self.output.info()
to print the provdir
path ?
It will make it easier to confirm that the certified fips module has been copied from 3.0.9 directory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point @kulkarniamit, I'll see what I can do...
Actually, ideally, I was trying to add some testing logic in the test_package
code to be able to properly verify the version of the fips
module... For example, that version == 3.0.9
when use_validated_fips == True
or version == tested_package_version
otherwwise, but both programmatically or simply using the openssl list -providers
command require a properly fipsinstall
ed module before loading it to check the version...
Do you know of any ways to check the version of the fips
module without it needing to be fully installed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you mentioned, printing buildinfo related information for fips provider requires loading the provider. Loading FIPS provider requires having a configuration file with module-mac
to enable self tests of the module.
If we don't prefer checking the integration with openssl
command, we are left with two options:
- Use
strings
command (or any other equivalent) and search for presence of version number in module. Need to ensure we've a consistent command or python string search thats platform independent# Linux $ strings <path_to_fips_module> | grep -i -A1 buildinfo buildinfo 3.0.9
- Print the fips module source and destination directory information
Though its extra work, running openssl fipsinstall
to generate fipsmodule.cnf
and loading the provider programmatically in test_package.c
would be the ideal future-proof platform-independent approach to printing version information.
This looks really good @gegles ! Thanks for this. Some comments from me: I would probably keep, in the recipe, a list of "fips validated" versions (as per the OpenSSL documentation), and have a logic such that if This might look something like:
I would probably add some additional checks in the
This may look like:
Note that I've seen in the PR that this is done:
however I would err in the side of caution - bear in mind that if externally a user does What I would suggest is just rely on the validation - assume that if users pass these, it's a contradiction. And to avoid building the fips-module when it is being provided by an earlier version, I would do in the configure args method:
The above are all very rough - but gives an idea. I also agree with @Nekto89 - we should re-add 3.0.9 to the list of maintained versions. Perhaps if we do this, we may choose to keep the list in the recipe constrained to just As for the installation, the openssl documentation does specify that the self-tests should be run - personally, if a |
Thanks for the review and all the feedback @jcar87! I agree with almost everything and will see what I can do. I had already just re-added I am seriously questioning whether it would make any sense for anybody to use anything but the latest validated version (i.e. Thanks! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@jcar87, with 274288c, I've now incorporate most of your suggestions/feedback. I've manually tested the various error conditions:
I will see what I can do for the self validation testing... |
This comment has been minimized.
This comment has been minimized.
ad2d616
to
34f51c3
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
0680534
to
3800327
Compare
@jcar87 take a look at my latest changes... I've now added a I got caught by a linter issue (re using Anyway let me know what you think and if I am the right track... Cheers. G. |
This comment has been minimized.
This comment has been minimized.
According to OpenSSL maintainers: openssl/openssl#25048 (comment)
I ran a few commands to verify that OpenSSL 3.0.7 binary can work with 3.0.9 FIPS provider
@gegles @jcar87 Any particular reason why we're limiting lower versions of OpenSSL 3.0.x (x < 9) to not work with 3.0.8 or 3.0.9 FIPS provider? |
none really! we didn't have that context. |
This comment has been minimized.
This comment has been minimized.
516d20d
to
2c5302b
Compare
This comment has been minimized.
This comment has been minimized.
2c5302b
to
f751f84
Compare
This comment has been minimized.
This comment has been minimized.
Conan v1 pipeline ❌Failure in build 14 (
Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability. Conan v2 pipeline ❌
The v2 pipeline failed. Please, review the errors and note this is required for pull requests to be merged. In case this recipe is still not ported to Conan 2.x, please, ping Failure in build 14 (
Note: To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability. |
@gegles : Great update! Thank you for this! 🙏 I see that for this updated recipe to work, the changes from conan-io/conan#16132 are required. I also see that the there is an official conan release which has the necessary update : https://github.com/conan-io/conan/releases/tag/2.4.0 . However : I cannot find a conan1 release with this change. So my question : could the above recipe update work with conan1 as well? Which conan1 version have to be used? |
@szigetics, I may be wrong, but my understanding is that this feature would only work with Conan v2 and especially with the conan-io/conan#16132 changeset as you pointed out. |
Summary
Changes to recipe: openss/*
Motivation
The end goal here is for the openssl package to be able to build and provide the validated FIPS module from another version of itself. This takes advantage of this recent change in conan.
This recipe change is following @jcar87's suggestion here.
Details
use_validated_fips
boolean option.False
by defaultuse_validated_fips
isTrue
then there is no need to build the current version of the FIPS module so setno_fips = True
use_validated_fips
isTrue
then add a hidden dependency to the latest FIPS validated version ofopenssl
, i.e.openssl/3.0.9
not no_fips
oruse_validated_fips
is true, we copy the appropriatefips
library into the final pakcage folder.I did try to also add a programatic check in the
test_package
(following thedigest_legacy.c
example, but, for the FIPS provider to load properly at all (in order to test the version), it requires thefipsmodule.cnf
to be properly generated via theopenssl fipsinstall
command ... All this seems maybe more complexity than desired...FWIW,
I've tested this as part of our software depending on this which does the proper
fipsinstall
command:As you can see, the default provider is
3.2.2
(from the latest version of this package I used as a dependency in my project whereas the FIPS provider is3.0.9
as per the result of usinguse_validated_fips
option.