-
Notifications
You must be signed in to change notification settings - Fork 492
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
NAS-131233 / 25.04 / Update to test for FIPS 3.0.9 (#14629)
- Loading branch information
Showing
3 changed files
with
32 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import pytest | ||
|
||
from middlewared.test.integration.utils import call, ssh | ||
from auto_config import ha | ||
|
||
retry = 5 | ||
fips_version = "3.0.9" | ||
|
||
|
||
# Sometimes this test fails because the testing environment has broken failover (randomly. Fun transient error. Reports a failed heartbeat). | ||
@pytest.mark.flaky(reruns=retry, reruns_delay=5) | ||
@pytest.mark.skipif(not ha, reason='Test only valid for HA') | ||
def test_fips_version(): | ||
# The reason we have a set of commands in a payload is because of some annoying FIPS technicalities. | ||
# Basically, when FIPS is enabled, we can't use SSH because the SSH key used by root isn't using a FIPS provided algorithm. (this might need to be investigated further) | ||
# To allow testing, we write our FIPS information to a file during this phase, and then go disable FIPS to get SSH back all in one joint command. | ||
payload = """midclt call --job system.security.update '{"enable_fips": true}' && openssl list -providers > /root/osslproviders && midclt call system.reboot.info >> /root/osslproviders && midclt call --job system.security.update '{"enable_fips": false}'""" | ||
|
||
ssh(payload, complete_response=True, timeout=300) | ||
|
||
# Check that things are what we expect when FIPS was enabled | ||
enabled_info = ssh("cat /root/osslproviders") | ||
assert fips_version in enabled_info | ||
assert "FIPS configuration was changed." in enabled_info | ||
|
||
# Check that we no longer have FIPS enabled | ||
assert fips_version not in ssh("openssl list -providers") | ||
assert call("system.reboot.info")["reboot_required_reasons"] == [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters