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

Made the rule sshd_rekey_limit parametrized. #5772

Merged
merged 5 commits into from
May 22, 2020

Conversation

matejak
Copy link
Member

@matejak matejak commented May 19, 2020

Introduce the rekey_limit_size and rekey_limit_time XCCDF values to make the rule more flexible.

There is one problem: The rule uses two XCCDF values, and I think that this is not supported at least for Bash remediations. The remediation code is a wild jungle, is anybody here who knows what buttons to push to make it work? The solution is probably to edit https://github.com/ComplianceAsCode/content/blob/master/ssg/build_remediations.py#L671, but I don't want to mash another hack into a nested-nested-nested if block.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1813066

@matejak matejak added OVAL OVAL update. Related to the systems assessments. Bash Bash remediation update. labels May 19, 2020
@matejak matejak added this to the 0.1.51 milestone May 19, 2020
Introduce the rekey_limit_size and rekey_limit_time XCCDF values
to make the rule more flexible.
Copy link
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.

The remediation code is a wild jungle, is anybody here who knows what buttons to push to make it work? The solution is probably to edit https://github.com/ComplianceAsCode/content/blob/master/ssg/build_remediations.py#L671, but I don't want to mash another hack into a nested-nested-nested if block.

You are on the spot.
I remember looking at this code ages ago and wondering why does the fixparts are 2 stepped.
Never got to change it and see how the code works. And without proper tests in place, I'd be reluctant to change it.

What happens is that the parser does not recognize two function names one after the other.
A workaround is to add a new line between the populate calls. (Worked for me locally)

@matejak
Copy link
Member Author

matejak commented May 22, 2020

Thanks a lot @yuumasato, your answer was exactly what I dreamt of. I have introduced macros that make sure that there are blank lines.

@matejak matejak marked this pull request as ready for review May 22, 2020 09:52
@matejak
Copy link
Member Author

matejak commented May 22, 2020

test this please

@mildas
Copy link
Contributor

mildas commented May 22, 2020

Changes identified:
Rule sshd_rekey_limit:
 Ansible remediation newly added.
 Templatization usage changed.
 OVAL check is newly added.
 Bash remediation is newly added.
 Templatazation usage changed.
Profile ospp on rhel8:
 Rule added to ospp profile.
Profile cui on rhel8:
 CUI profile extends changed OSPP profile.
Profile stig on rhel8:
 STIG profile extends changed OSPP profile.
Profile rhelh-stig on rhel8:
 RHELH-STIG profile extends changed STIG profile.
Profile rhelh-vpp on rhel8:
 RHELH-VPP profile extends changed OSPP profile.
Profile ospp-mls on rhel8:
 OSPP-MLS profile extends changed OSPP profile.
Profile ospp on tests:
 Rule added to ospp profile.
Profile stig on tests:
 Rule added to stig profile.
 New key in profile.
Macro ansible_instantiate_variables:
 In Ansible remediation for sshd_rekey_limit.
Macro bash_instantiate_variables:
 In Bash remediation for sshd_rekey_limit.

Recommended tests to execute:
 build_product tests
 test_suite.py profile --libvirt qemu:///system test-suite-vm --datastream build/ssg-tests-ds.xml ospp
 test_suite.py profile --libvirt qemu:///system test-suite-vm --datastream build/ssg-tests-ds.xml stig
 build_product rhel8
 test_suite.py profile --libvirt qemu:///system test-suite-vm --datastream build/ssg-rhel8-ds.xml ospp
 test_suite.py profile --libvirt qemu:///system test-suite-vm --datastream build/ssg-rhel8-ds.xml stig
 test_suite.py profile --libvirt qemu:///system test-suite-vm --datastream build/ssg-rhel8-ds.xml rhelh-vpp
 test_suite.py profile --libvirt qemu:///system test-suite-vm --datastream build/ssg-rhel8-ds.xml ospp-mls
 test_suite.py profile --libvirt qemu:///system test-suite-vm --datastream build/ssg-rhel8-ds.xml cui
 test_suite.py profile --libvirt qemu:///system test-suite-vm --datastream build/ssg-rhel8-ds.xml rhelh-stig
 build_product ol8
 test_suite.py rule --libvirt qemu:///system test-suite-vm --remediate ansible --datastream build/ssg-ol8-ds.xml sshd_rekey_limit
 test_suite.py rule --libvirt qemu:///system test-suite-vm --remediate bash --datastream build/ssg-ol8-ds.xml sshd_rekey_limit

@yuumasato yuumasato self-assigned this May 22, 2020
@yuumasato yuumasato merged commit b9c1a00 into ComplianceAsCode:master May 22, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bash Bash remediation update. OVAL OVAL update. Related to the systems assessments.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants