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
[IPU 8->9] Detect RPMs with RSA/SHA1 signatures #854
Conversation
Thank you for contributing to the Leapp project!Please note that every PR needs to comply with the Leapp Guidelines and must pass all tests in order to be mergable.
Please open ticket in case you experience technical problem with the CI. (RH internal only) Note: In case there are problems with tests not being triggered automatically on new PR/commit or pending for a long time, please consider rerunning the CI by commenting leapp-ci build (might require several comments). If the problem persists, contact leapp-infra. |
ba196a4
to
4359365
Compare
...upgrade/el8toel9/actors/checkdeprecatedrpmsignature/libraries/checkdeprecatedrpmsignature.py
Outdated
Show resolved
Hide resolved
...upgrade/el8toel9/actors/checkdeprecatedrpmsignature/libraries/checkdeprecatedrpmsignature.py
Outdated
Show resolved
Hide resolved
|
@abadger thanks!! applied. |
0f8a653
to
ce0ef5c
Compare
|
The code looks good! I added some minor grammatical suggestions. Other than those, I wonder if we should include something that tells the user to set the crypto policy back to default after the upgrade? (Or tells them the pros and cons of leaving it on legacy vs setting it back to default). If we don't encourage them to set it back after the upgrade, they probably will leave it on legacy which will circumvent one of rhel9's security enhancements. |
ce0ef5c
to
bee8125
Compare
|
@abadger I would like to add a link to a RH article that gives people more information about the impacts. But at least some summary we should add in the code as well. Of course, FIPS systems could not use anything like that, as they become non-FIPS when they do it. Their only solution could be to replace/remove the packages prior the upgrade. But let's keep that as good enough for the first release and improvement could be delivered with the next one. Also I checked that we have to do additional stuff in the container really as I was afraid. It means, we will restrict the possible values just to |
88aebf7
to
ce808b7
Compare
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.
No smart remarks, just some nits.
Just please run make lint_fix
...ade/el8toel9/actors/targetuserspacecryptopolicies/libraries/targetuserspacecryptopolicies.py
Outdated
Show resolved
Hide resolved
...upgrade/el8toel9/actors/checkdeprecatedrpmsignature/libraries/checkdeprecatedrpmsignature.py
Outdated
Show resolved
Hide resolved
2d3fd66
to
5adc9b5
Compare
Ahh. Ignore my comment. I read |
5adc9b5
to
2d2ed03
Compare
|
If you want to test scenario with (from rhel 9 SHA1.pmod) |
fd0fc00
to
2725cb2
Compare
|
The current implementation covers issue with already installed rpms. I've tested scenarios when we try to install rpms that are signed with RSA/SHA1 signatures - and when not bad rpms are present on the system, so
Under current circumstances, I think this is good enough solution. UPDATE: however, on the upgraded system, if user runs e.g. |
52544b7
to
bf1c4f7
Compare
...upgrade/el8toel9/actors/checkdeprecatedrpmsignature/libraries/checkdeprecatedrpmsignature.py
Outdated
Show resolved
Hide resolved
...upgrade/el8toel9/actors/checkdeprecatedrpmsignature/libraries/checkdeprecatedrpmsignature.py
Outdated
Show resolved
Hide resolved
...upgrade/el8toel9/actors/checkdeprecatedrpmsignature/libraries/checkdeprecatedrpmsignature.py
Outdated
Show resolved
Hide resolved
repos/system_upgrade/el8toel9/actors/checkdeprecatedrpmsignature/actor.py
Outdated
Show resolved
Hide resolved
...upgrade/el8toel9/actors/checkdeprecatedrpmsignature/libraries/checkdeprecatedrpmsignature.py
Show resolved
Hide resolved
...e/el8toel9/actors/checkdeprecatedrpmsignature/tests/unit_test_checkdeprecatedrpmsignature.py
Show resolved
Hide resolved
repos/system_upgrade/el8toel9/actors/targetuserspacecryptopolicies/actor.py
Outdated
Show resolved
Hide resolved
repos/system_upgrade/el8toel9/actors/targetuserspacecryptopolicies/actor.py
Show resolved
Hide resolved
repos/system_upgrade/el8toel9/actors/targetuserspacecryptopolicies/actor.py
Show resolved
Hide resolved
...ade/el8toel9/actors/targetuserspacecryptopolicies/libraries/targetuserspacecryptopolicies.py
Outdated
Show resolved
Hide resolved
...upgrade/el8toel9/actors/checkdeprecatedrpmsignature/libraries/checkdeprecatedrpmsignature.py
Outdated
Show resolved
Hide resolved
...upgrade/el8toel9/actors/checkdeprecatedrpmsignature/libraries/checkdeprecatedrpmsignature.py
Outdated
Show resolved
Hide resolved
...upgrade/el8toel9/actors/checkdeprecatedrpmsignature/libraries/checkdeprecatedrpmsignature.py
Outdated
Show resolved
Hide resolved
...upgrade/el8toel9/actors/checkdeprecatedrpmsignature/libraries/checkdeprecatedrpmsignature.py
Outdated
Show resolved
Hide resolved
...upgrade/el8toel9/actors/checkdeprecatedrpmsignature/libraries/checkdeprecatedrpmsignature.py
Outdated
Show resolved
Hide resolved
9bccd72
to
5caa1fc
Compare
5caa1fc
to
77a3e5a
Compare
tl;dr;
* get the currennt crypto policies
* inhibit upgrade when rpms with RSA/SHA1 signature are installed
and used crypto policies will not allow it on the upgrade system
* the only allowed crypto policy in such a case is LEGACY or
DEFAULT:SHA1
* set the crypto policy in the target userspace container if
it is not DEFAULT
The SHA-1 hash algorithm is considered as unsafe and it is not longer
allowed to be used on RHEL 9 system using default crypto policies.
One of side effects is problem with installed packages with RSA/SHA1
signatures, as these packages could cause fail of the in-place upgrade
because such packages cannot be read, nor removed by dnf/rpm so the
tests of the transaction already fails in case we want to remove
(include replace) such packages. Additionally, even when we do not
touch such packages during the IPU, the final system will be still
malfunction as rpm will not be able to handle it by default.
Exception are packages signed by RSA/SHA1 keys that are not imported
in the system, so such signatures are not checked and are ignored
like in the case no signature is present at all.
To prevent unwanted situations regarding the installed packages
(packages that will be installed during the upgrade will be handled
in separate commit):
* inhibit the upgrade when an RSA/SHA1 rpm is installed and
current crypto policy is not LEGACY or DEFAULT:SHA1
* NOTE: SHA1 subpolicy have to be created by user manually on the
the system (and correctly!!) to make it working,
so rather do not suggest it in remediation instructions
* just report presence of such packages with HIGH risk so users
are informed about the changed policy on RHEL 9
The current crypto policy is obtained from
/etc/crypto-policies/state/current
In case the policy is not "DEFAULT", set the crypto policy inside
the targetuserspace container. However, in case of custom policies
it can be broken (policies have to be copied/installed into the
container as well).
This is currently expected limitation. It is expected to improve it
in future.
Co-authored-by: Toshio Kuratomi <a.badger@gmail.com>
Co-authored-by: Michal Reznik (mreznik) <mreznik@redhat.com>
Co-authored-by: Alexander Sosedkin <monk@unboiled.info>
77a3e5a
to
67f0aa6
Compare
tl;dr;
and used crypto policies will not allow it on the upgrade system
DEFAULT:SHA1
it is not DEFAULT
The SHA-1 hash algorithm is considered as unsafe and it is not longer
allowed to be used on RHEL 9 system using default crypto policies.
One of side effects is problem with installed packages with RSA/SHA1
signatures, as these packages could cause fail of the in-place upgrade
because such packages cannot be read, nor removed by dnf/rpm so the
tests of the transaction already fails in case we want to remove
(include replace) such packages. Additionally, even when we do not
touch such packages during the IPU, the final system will be still
malfunction as rpm will not be able to handle it by default.
Exception are packages signed by RSA/SHA1 keys that are not imported
in the system, so such signatures are not checked and are ignored
like in the case no signature is present at all.
To prevent unwanted situations regarding the installed packages
(packages that will be installed during the upgrade will be handled
in separate commit):
current crypto policy is not LEGACY or DEFAULT:SHA1 (e.g.
DEFAULT:SHA1).
the system (and correctly!!) to make it working,
so rather do not suggest it in remediation instructions
are informed about the changed policy on RHEL 9
The current crypto policy is obtained from:
In case the policy is not
DEFAULT, set the crypto policy insidethe targetuserspace container. However, in case of custom policies
it can be broken (policies have to be copied/installed into the
container as well).
This is currently expected limitation. It is expected to improve it
in future.