Skip to content

Commit

Permalink
account for fips=1 installs with a unique VM tag
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Jaburek <[email protected]>
  • Loading branch information
comps committed Feb 3, 2025
1 parent b322cfa commit 4351160
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 10 deletions.
3 changes: 2 additions & 1 deletion hardening/anaconda/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
g = virt.Guest()

_, variant, profile = util.get_test_name().rsplit('/', 2)
with_fips = os.environ.get('WITH_FIPS') == '1'

# use kickstart from content, not ours
ks_file = util.get_kickstart(profile)
Expand All @@ -34,7 +35,7 @@

g.install(
kickstart=ks,
kernel_args=['fips=1'] if os.environ.get('WITH_FIPS') == '1' else None,
kernel_args=['fips=1'] if with_fips else None,
)

with g.booted():
Expand Down
18 changes: 14 additions & 4 deletions hardening/ansible/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,29 @@
virt.Host.setup()

_, variant, profile = util.get_test_name().rsplit('/', 2)
with_fips = os.environ.get('WITH_FIPS') == '1'

if variant == 'with-gui':
g = virt.Guest('gui_with_oscap')
guest_tag = 'gui_with_oscap'
elif variant == 'uefi':
g = virt.Guest('uefi_with_oscap')
guest_tag = 'uefi_with_oscap'
else:
g = virt.Guest('minimal_with_oscap')
guest_tag = 'minimal_with_oscap'

if with_fips:
guest_tag += '_fips'

g = virt.Guest(guest_tag)

if not g.can_be_snapshotted():
ks = virt.Kickstart(partitions=partitions.partitions)
if variant == 'with-gui':
ks.packages.append('@Server with GUI')
g.install(kickstart=ks, secure_boot=(variant == 'uefi'))
g.install(
kickstart=ks,
secure_boot=(variant == 'uefi'),
kernel_args=['fips=1'] if with_fips else None,
)
g.prepare_for_snapshot()

# the VM guest ssh code doesn't use $HOME/.known_hosts, so Ansible blocks
Expand Down
3 changes: 2 additions & 1 deletion hardening/kickstart/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
g = virt.Guest()

_, variant, profile = util.get_test_name().rsplit('/', 2)
with_fips = os.environ.get('WITH_FIPS') == '1'

oscap.unselect_rules(util.get_datastream(), 'remediation-ds.xml', remediation.excludes())

Expand All @@ -32,7 +33,7 @@
g.install(
kickstart=ks, rpmpack=rpmpack,
secure_boot=(variant == 'uefi'),
kernel_args=['fips=1'] if os.environ.get('WITH_FIPS') == '1' else None,
kernel_args=['fips=1'] if with_fips else None,
)

with g.booted():
Expand Down
16 changes: 12 additions & 4 deletions hardening/oscap/test.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
#!/usr/bin/python3

import os

from lib import util, results, virt, oscap
from conf import remediation, partitions


virt.Host.setup()

_, variant, profile = util.get_test_name().rsplit('/', 2)
with_fips = os.environ.get('WITH_FIPS') == '1'

if variant == 'with-gui':
g = virt.Guest('gui_with_oscap')
guest_tag = 'gui_with_oscap'
elif variant == 'uefi':
g = virt.Guest('uefi_with_oscap')
guest_tag = 'uefi_with_oscap'
else:
g = virt.Guest('minimal_with_oscap')
guest_tag = 'minimal_with_oscap'

if with_fips:
guest_tag += '_fips'

g = virt.Guest(guest_tag)

if not g.can_be_snapshotted():
ks = virt.Kickstart(partitions=partitions.partitions)
Expand All @@ -22,7 +30,7 @@
g.install(
kickstart=ks,
secure_boot=(variant == 'uefi'),
kernel_args=['fips=1'] if os.environ.get('WITH_FIPS') == '1' else None,
kernel_args=['fips=1'] if with_fips else None,
)
g.prepare_for_snapshot()

Expand Down

0 comments on commit 4351160

Please sign in to comment.