Skip to content
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

feat: warn/confirm with user if enabling fips downgrades the kernel #2890

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

catmsred
Copy link
Collaborator

@catmsred catmsred commented Dec 12, 2023

This change adds a new message prompting the user to confirm if enabling fips downgrades the kernel.

Why is this needed?

There have been reports of people enabling FIPS (not realizing it will downgrade their kernel), and having their hardware fail as it needed the new kernel. This change adds an additional warning/prompt if a FIPS enablement is determined to downgrade the kernel.

Jira card: SC-1534

Test Steps

On a pro (but not FIPS) VM, enable FIPS and you should see the new messages.

Checklist

  • I have updated or added any unit tests accordingly
  • I have updated or added any integration tests accordingly
  • Changes here need to be documented, and this was done in: [N/A]

Does this PR require extra reviews?

  • Yes
  • No

Copy link

github-actions bot commented Dec 12, 2023

🌎 This PR changes translatable messages. 🌏

Please select which scenarios apply. For further explanation, please read our policy on message changes.

  • New messages are being added.
    • We will ask translators to take a look and add translations if they have time, but it will not block this PR.
  • Existing messages are being changed.
    • ⚠️ Please add a comment with justification of why messages are being altered.
    • If the changes are trivial (e.g. a typo fix), then translations must be preserved.
    • If the changes are substantial, then we will ask translators to take a look and update translations if they have time, but it will not block this PR.
  • Existing messages are being deleted.
    • No special action needed.

Copy link

Jira: This PR is not related to a Jira item. (The PR title does not include a SC-#### reference)

GitHub Issues: No GitHub issues are fixed by this PR. (No commits have Fixes: #### references)

Launchpad Bugs: No Launchpad bugs are fixed by this PR. (No commits have LP: #### references)

Documentation: The changes in this PR do not require documentation changes.

👍 this comment to confirm that this is correct.

@catmsred catmsred force-pushed the feature/fips_downgrade_warn branch 5 times, most recently from 6fa3681 to 4ff8838 Compare December 13, 2023 17:06
uaclient/entitlements/fips.py Outdated Show resolved Hide resolved
uaclient/entitlements/fips.py Outdated Show resolved Hide resolved
uaclient/entitlements/fips.py Outdated Show resolved Hide resolved
@catmsred catmsred force-pushed the feature/fips_downgrade_warn branch 2 times, most recently from cdfc0fb to 33e8ae7 Compare January 10, 2024 14:09
@orndorffgrant orndorffgrant changed the base branch from main to next-v32 January 11, 2024 18:56
@catmsred catmsred force-pushed the feature/fips_downgrade_warn branch 7 times, most recently from 28d6489 to e70b077 Compare January 24, 2024 20:53
@catmsred
Copy link
Collaborator Author

Integration test failures are just proxy tests which I don't think have anything to do with this code

@@ -195,8 +247,14 @@ def install_packages(

for pkg in desired_packages:
try:
super().install_packages(
package_list=[pkg], cleanup_on_failure=False, verbose=False
apt.run_apt_install_command(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double checking, why are we changing this ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every time super().install_packages is called, the kernel downgrade warning is sent. In my testing, we generally saw it three times. Grant suggested that this call should properly be run_apt_install_command instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ohh fair enough, that makes total sense. Thanks for the context here

uaclient/entitlements/fips.py Outdated Show resolved Hide resolved
"""
Updating <fips-name> package lists
Installing <fips-name> packages
Updating standard Ubuntu package lists
This will downgrade the kernel from .+ to .+\.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this test supposed to pass on all releases specified in this Scenario Outline ? I have tested the bionic aws.pro and the test didn't work

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this failing for you? It worked for all the iterations I ran of it and is currently passing in CI -- the aws.pro bionic failure is only for an unrelated proxy test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's weird. I am getting the following error on bionic:

      Assertion Failed: Expected to match regexp:                                                                                                                                                                  
        Updating FIPS package lists                                                                                                                                                                                
        Installing FIPS packages                                                                                                                                                                                   
        This will downgrade the kernel from .+ to .+\.                                                                                                                                                             
        Warning: Downgrading the kernel may cause hardware failures.  Please ensure the                                                                                                                            
                 hardware is compatible with the new kernel version before proceeding.                                                                                                                             
                                                                                                                                                                                                                   
        Updating standard Ubuntu package lists(\n.*)?                                                                                                                                                              
        FIPS enabled                                                                                                                                                                                               
        A reboot is required to complete install                                                                                                                                                                   
      But got:                                                                                                                                                                                                     
        One moment, checking your subscription first                                                                                                                                                               
        Disabling incompatible service: Livepatch                                                                                                                                                                  
        Updating FIPS package lists                                                                                                                                                                                
        Installing FIPS packages                                                                                                                                                                                   
        Updating standard Ubuntu package lists                                                                                                                                                                     
        FIPS enabled                                                                                                                                                                                               
        A reboot is required to complete install.  

But I haven't checked the other releases yet

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for the check! I have since fixed the downgrade conditional -- let me know if you're still seeing unexpected failures?

@catmsred catmsred force-pushed the feature/fips_downgrade_warn branch 3 times, most recently from 255894a to 3708517 Compare January 30, 2024 16:06
Copy link
Member

@renanrodrigo renanrodrigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
All CI failures caused by flaky network connections, and not affected by this PR at all.

Copy link
Contributor

@lucasmoura lucasmoura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@catmsred I can confirm the tests are now passing for me. Just one more addition to this PR and I will approve it

@@ -154,6 +155,56 @@ def conditional_packages(self):

return FIPS_CONDITIONAL_PACKAGES.get(series, [])

def prompt_if_kernel_downgrade(
Copy link
Contributor

@lucasmoura lucasmoura Jan 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we just need some unittests for this method now

Copy link
Contributor

@lucasmoura lucasmoura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the work on this issue @catmsred. I have just one tiny nit here, but let me know if I am missing something

entitlement,
):
"""Test kernel downgrades block install if user denies prompt"""
m_prompt_for_confirmation = util.prompt_for_confirmation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I am missing something. Why do we need this line here ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not! Good catch, that was left over from my experiments for the best way to handle this mock. I will clean it up and then we should be good to merge.

This change adds a new message prompting the user to confirm if enabling
fips downgrades the kernel.
@orndorffgrant
Copy link
Collaborator

CI fails are flakes + two approvals = merging
Thank you @catmsred!

@orndorffgrant orndorffgrant merged commit 39991a1 into next-v32 Feb 1, 2024
23 of 25 checks passed
@orndorffgrant orndorffgrant deleted the feature/fips_downgrade_warn branch February 1, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants