Skip to content

Add RHCOS4 product#5775

Merged
redhatrises merged 4 commits intoComplianceAsCode:masterfrom
JAORMX:rhcos4
Jun 3, 2020
Merged

Add RHCOS4 product#5775
redhatrises merged 4 commits intoComplianceAsCode:masterfrom
JAORMX:rhcos4

Conversation

@JAORMX
Copy link
Copy Markdown
Contributor

@JAORMX JAORMX commented May 20, 2020

No description provided.

@JAORMX
Copy link
Copy Markdown
Contributor Author

JAORMX commented May 20, 2020

need to fix the cce's

@JAORMX
Copy link
Copy Markdown
Contributor Author

JAORMX commented May 20, 2020

/ok-to-test

@openshift-ci-robot openshift-ci-robot added the ok-to-test Used by openshift-ci bot. label May 20, 2020
@redhatrises
Copy link
Copy Markdown
Contributor

Totally agree with this PR. One thought I have is that "CoreOS is RHEL" so why make it a separate product from RHEL since it implements everything as RHEL anyway.

@evgenyz
Copy link
Copy Markdown
Member

evgenyz commented May 28, 2020

Totally agree with this PR. One thought I have is that "CoreOS is RHEL" so why make it a separate product from RHEL since it implements everything as RHEL anyway.

Sorry, but that is not true, RHCOS ≠ RHEL. For example, RHCOS follows https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ and RHEL does not. As the result, despite the fact that both OSes use the same GRUB2 bootloader, configuration is different. All rules that use 'grub2_bootloader_argument' template are not applicable to RHCOS. See #5285.

@JAORMX
Copy link
Copy Markdown
Contributor Author

JAORMX commented May 28, 2020

haven't gotten a chance to get this working. I'll get back to it next week.

@redhatrises
Copy link
Copy Markdown
Contributor

Totally agree with this PR. One thought I have is that "CoreOS is RHEL" so why make it a separate product from RHEL since it implements everything as RHEL anyway.

Sorry, but that is not true, RHCOS ≠ RHEL. For example, RHCOS follows https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ and RHEL does not. As the result, despite the fact that both OSes use the same GRUB2 bootloader, configuration is different. All rules that use 'grub2_bootloader_argument' template are not applicable to RHCOS. See #5285.

@evgenyz thanks. Preaching to the choir. While the technical people here understand that, this is Red Hat's (whether we agree or not) current statement.

@yuumasato
Copy link
Copy Markdown
Member

yuumasato commented May 28, 2020

Sorry, but that is not true, RHCOS ≠ RHEL. For example, RHCOS follows https://www.freedesktop.org/wiki/Specifications/BootLoaderSpec/ and RHEL does not. As the result, despite the fact that both OSes use the same GRUB2 bootloader, configuration is different.

Although RHEL8 doesn't follow BLS to the letter, the way to configure it is the same.
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/considerations_in_adopting_rhel_8/index#booting-process_kernel

https://access.redhat.com/solutions/3799961

@evgenyz
Copy link
Copy Markdown
Member

evgenyz commented Jun 1, 2020

Although RHEL8 doesn't follow BLS to the letter, the way to configure it is the same.

Exactly because they don't follow it to the letter the configuration is different. For example BLS does not contain a word about variables in configuration files, thus getting kernel arguments for BLS-compatible configuration is as easy as reading options line in /boot/loader/entries/*.conf. In RHEL and Fedora this line could contain something like $kernelopts, which you have to hunt down somewhere else (and truly BLS-compatible boot loader will load garbage as kernel arguments for this entry).

So, no, not compatible. If not to the letter, then not at all.

@yuumasato I'm sorry, I accidentally edited your comment instead of quoting. And I don't have a email with its contents, so I can't restore it :( Found it.

@JAORMX
Copy link
Copy Markdown
Contributor Author

JAORMX commented Jun 1, 2020

/retest

Comment thread rhcos4/cpe/rhcos4-cpe-dictionary.xml Outdated
@yuumasato
Copy link
Copy Markdown
Member

Exactly because they don't follow it to the letter the configuration is different. For example BLS does not contain a word about variables in configuration files, thus getting kernel arguments for BLS-compatible configuration is as easy as reading options line in /boot/loader/entries/*.conf. In RHEL and Fedora this line could contain something like $kernelopts, which you have to hunt down somewhere else (and truly BLS-compatible boot loader will load garbage as kernel arguments for this entry).

So, no, not compatible. If not to the letter, then not at all.

@evgenyz Very well put.

These particularities can make it hard to maintain good content for both OSes if treated as a single product. It is probably best to keep RHEL and RHCOS two separate products.

Copy link
Copy Markdown
Member

@yuumasato yuumasato left a comment

Choose a reason for hiding this comment

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

I haven't checked applicability of the rules, but overall looks good to me.

Comment thread ssg/constants.py Outdated
@JAORMX
Copy link
Copy Markdown
Contributor Author

JAORMX commented Jun 3, 2020

/test all

Copy link
Copy Markdown
Collaborator

@jhrozek jhrozek left a comment

Choose a reason for hiding this comment

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

I'll continue the review later today

Red Hat Enterprise Linux CoreOS</description>
</metadata>
<criteria>
<extend_definition comment="RHEL8 OS installed" definition_ref="installed_OS_is_rhel8" />
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Instead of extending the RHEL-8 test, should we remove the following from the RHEL-8 oval check:

  <ind:textfilecontent54_test check="all" comment="redhat-release-coreos is version 8" id="test_rhel8_coreos" version="1">
    <ind:object object_ref="obj_rhel8_coreos" />
    <ind:state state_ref="state_rhel8_coreos" />
  </ind:textfilecontent54_test>
  <ind:textfilecontent54_object id="obj_rhel8_coreos" version="1">
    <ind:filepath>/etc/os-release</ind:filepath>
    <ind:pattern operation="pattern match">^PRETTY_NAME=&quot;Red Hat Enterprise Linux CoreOS \d+\.(\d)\d+\.[\d\.\-]+ \([\w\s]+\)&quot;$</ind:pattern>
    <ind:instance operation="greater than or equal" datatype="int">1</ind:instance>
  </ind:textfilecontent54_object>
  <ind:textfilecontent54_state id="state_rhel8_coreos" version="1">
    <ind:subexpression operation="pattern match">8</ind:subexpression>
  </ind:textfilecontent54_state>

and move it to this file instead? Or are there some other cases where we want to treat RHCOS as RHEL?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not necessarily, but currently the "RHEL" check contains an RHCOS check, we need to change that but I think it should be done in a subsequent PR.

<check system="http://oval.mitre.org/XMLSchema/oval-definitions-5" href="filename">installed_env_has_chrony_package</check>
</cpe-item>
<cpe-item name="cpe:/a:gdm">
<title xml:lang="en-us">Package gdm is installed</title>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I literally have zero idea what this file is for, but several of the items in this file will never be present on a RHCOS host, at least not in the OCP context (gdm, nss-pam-ldapd, yum, ...)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@yuumasato @ggbecker any idea what's up with this file? I merely copied it from the ocp product.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

in ComplianceAsCode we use to limit applicability of certain checks using the platform: keyword within rule.yml files:

Check this excerpt from the developer_guide.adoc:

platform: Defines applicability of a rule. For example, if a rule is not applicable to containers, 
this should be set to machine, which means it will be evaluated only if the targeted scan 
environment is either bare-metal or virtual machine. Also, it can restrict applicability on higher 
software layers. By setting to shadow-utils, the rule will have its applicability restricted to only 
environments which have shadow-utils package installed. The available options can be found 
in the file <product>/cpe/<product>-cpe-dictionary.xml (e.g.: rhel8/cpe/rhel8-cpe-dictionary.xml).
 In order to support a new value, an OVAL check (of inventory class) must be created under 
shared/checks/oval/ and referenced in the dictionary file.
``

@JAORMX JAORMX force-pushed the rhcos4 branch 2 times, most recently from 86a0de8 to 174a949 Compare June 3, 2020 12:04
Comment thread ssg/constants.py
@@ -516,6 +522,7 @@
'example': 'Example Linux Content',
'ol': 'Oracle Linux',
'ocp': 'Red Hat OpenShift Container Platform',
'rhcos': 'Red Hat Enterprise Linux CoreOS',
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

When this line is like this:
'rhcos': 'Red Hat Enterprise Linux CoreOS release',

The build process includes OVALs included by affected_platform, like auditd_data_retention_flush.

What happens is that in is_applicable_for_product() https://github.com/ComplianceAsCode/content/blob/master/ssg/utils.py#L123, it tries to reconstruct the full name of the product, which in rhcos4/product.yml is defined with trailing release.

Now I wonder how much the word release is actually really part of the name.
Should the product full_name in rhcos4/product.yml be Red Hat Enterprise Linux CoreOS 4?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

let's give it a try

@JAORMX JAORMX force-pushed the rhcos4 branch 3 times, most recently from e12215c to b040079 Compare June 3, 2020 12:48
@JAORMX JAORMX changed the title WIP: Add RHCOS4 product Add RHCOS4 product Jun 3, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Used by openshift-ci bot. label Jun 3, 2020
JAORMX and others added 3 commits June 3, 2020 17:22
Co-Authored-By: Gabriel Becker <ggasparb@redhat.com>
Co-Authored-By: Watson Yuuma Sato <wsato@redhat.com>
This adds the rhel7, rhel8, and rhcos4 datastreams to the image, so they
can be used.
Comment thread rhcos4/CMakeLists.txt Outdated
@mildas
Copy link
Copy Markdown
Contributor

mildas commented Jun 3, 2020

Changes identified:
Rule checks:
 The rule doesn't occur in any profile nor product.
 OVAL check is newly added.
Profile coreos-ncp on rhcos4:
 Newly added profile.
Profile e8 on rhcos4:
 Newly added profile.
Profile moderate on rhcos4:
 Newly added profile.
Others:
 Python abstract syntax tree change found in ssg/constants.py.

Recommended tests to execute:
 build_product rhcos4
 tests/test_suite.py profile --libvirt qemu:///system test-suite-vm --datastream build/ssg-rhcos4-ds.xml coreos-ncp
 tests/test_suite.py profile --libvirt qemu:///system test-suite-vm --datastream build/ssg-rhcos4-ds.xml e8
 tests/test_suite.py profile --libvirt qemu:///system test-suite-vm --datastream build/ssg-rhcos4-ds.xml moderate
 (cd build && cmake ../ && ctest -j4)

@JAORMX
Copy link
Copy Markdown
Contributor Author

JAORMX commented Jun 3, 2020

/retest

unrelated CI issue

@JAORMX
Copy link
Copy Markdown
Contributor Author

JAORMX commented Jun 3, 2020

/test all

CI issues...

@JAORMX
Copy link
Copy Markdown
Contributor Author

JAORMX commented Jun 3, 2020

/retest

@JAORMX
Copy link
Copy Markdown
Contributor Author

JAORMX commented Jun 3, 2020

@redhatrises could you check this out?

@redhatrises
Copy link
Copy Markdown
Contributor

Looks like there are subsequent follow on PRs, so merging this to support the follow-on fixes and work.

@redhatrises redhatrises merged commit c328b8e into ComplianceAsCode:master Jun 3, 2020
@redhatrises redhatrises added this to the 0.1.51 milestone Jun 3, 2020
@redhatrises redhatrises added the enhancement General enhancements to the project. label Jun 3, 2020
@yuumasato yuumasato added the Highlight This PR/Issue should make it to the featured changelog. label Jun 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement General enhancements to the project. Highlight This PR/Issue should make it to the featured changelog. ok-to-test Used by openshift-ci bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants