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

New rule for SLE 15 unnecessary_firewalld_services_ports_disabled #10090

Conversation

rumch-se
Copy link
Contributor

Description:

  • New rule for SLE 15 which covers CIS requirement 3.5.1.6 Ensure unnecessary services and ports are not accepted

Rationale:

  • At the moment CIS profile for SLE 15 does not include this requirement. The control cannot be automated, and should be addressed manually.

@rumch-se rumch-se requested a review from a team as a code owner January 19, 2023 13:02
@openshift-ci openshift-ci bot added the needs-ok-to-test Used by openshift-ci bot. label Jan 19, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jan 19, 2023

Hi @rumch-se. Thanks for your PR.

I'm waiting for a ComplianceAsCode member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@github-actions
Copy link

Start a new ephemeral environment with changes proposed in this pull request:

sle15 (from CTF) Environment (using Fedora as testing environment)
Open in Gitpod

Fedora Testing Environment
Open in Gitpod

Oracle Linux 8 Environment
Open in Gitpod

CCE code correction
@Mab879 Mab879 added the SLES SUSE Linux Enterprise Server product related. label Jan 25, 2023
@Mab879 Mab879 self-assigned this Jan 25, 2023
@Mab879 Mab879 added the New Rule Issues or pull requests related to new Rules. label Jan 25, 2023
@Mab879 Mab879 added this to the 0.1.67 milestone Jan 25, 2023
Copy link
Member

@Mab879 Mab879 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 the PR. I have do a few suggestions.


rationale: |-
To reduce the attack surface of a system, all services and ports should be blocked unless
required
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
required
required.

description: |-
Services and ports can be accepted or explicitly rejected or dropped by a zone.
For every zone, you can set a default behavior that handles incoming traffic that is not
further specified. Such behavior is defined by setting the target of the zone. There are three
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
further specified. Such behavior is defined by setting the target of the zone. There are three
further specified. Such behavior is defined by setting the target of the zone. There are three:

For every zone, you can set a default behavior that handles incoming traffic that is not
further specified. Such behavior is defined by setting the target of the zone. There are three
options - default, ACCEPT, REJECT, and DROP.
- <tt>ACCEPT</tt> - you accept all incoming packets except those disabled by a specific rule.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- <tt>ACCEPT</tt> - you accept all incoming packets except those disabled by a specific rule.
- <tt>ACCEPT</tt> - accept all incoming packets except those disabled by a specific rule.

further specified. Such behavior is defined by setting the target of the zone. There are three
options - default, ACCEPT, REJECT, and DROP.
- <tt>ACCEPT</tt> - you accept all incoming packets except those disabled by a specific rule.
- <tt>REJECT</tt> - you disable all incoming packets except those that you have allowed in
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- <tt>REJECT</tt> - you disable all incoming packets except those that you have allowed in
- <tt>REJECT</tt> - disables all incoming packets except those that have been allowed in by

- <tt>ACCEPT</tt> - you accept all incoming packets except those disabled by a specific rule.
- <tt>REJECT</tt> - you disable all incoming packets except those that you have allowed in
specific rules and the source machine is informed about the rejection.
- <tt>DROP</tt> - you disable all incoming packets except those that you have allowed in
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- <tt>DROP</tt> - you disable all incoming packets except those that you have allowed in
- <tt>DROP</tt> - disables all incoming packets except those that been have allowed in by

references:
cis@sle15: 3.5.1.6

ocil_clause: 'Your system accepts all incoming packets for unnecessary services and ports'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ocil_clause: 'Your system accepts all incoming packets for unnecessary services and ports'
ocil_clause: 'the system accepts all incoming packets for unnecessary services and ports'

following command:
<pre>$ sudo firewall-cmd --get-active-zones | awk '!/:/ {print $1}' | while read ZN; do
firewall-cmd --list-all --zone=$ZN; done</pre>
If your have to remove an unnecessary service run the following command:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
If your have to remove an unnecessary service run the following command:
To remove an unnecessary service, run the following command:

firewall-cmd --list-all --zone=$ZN; done</pre>
If your have to remove an unnecessary service run the following command:
<pre>$ sudo firewall-cmd --remove-service=<service></pre>
If you have to remove an unnecessary port run the following command:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
If you have to remove an unnecessary port run the following command:
To remove an unnecessary port, run the following command:


prodtype: sle15

title: 'Ensure unnecessary services and ports are not accepted'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
title: 'Ensure unnecessary services and ports are not accepted'
title: 'Ensure Unnecessary Services and Ports Are Not Accepted'


description: |-
Services and ports can be accepted or explicitly rejected or dropped by a zone.
For every zone, you can set a default behavior that handles incoming traffic that is not
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
For every zone, you can set a default behavior that handles incoming traffic that is not
For every zone, a default behavior can be set that handles incoming traffic that is not

@rumch-se
Copy link
Contributor Author

Hello @Mab879
Thank you for your feedback.
I have corrected the rule.
Have a nice day
Rumen

@codeclimate
Copy link

codeclimate bot commented Jan 27, 2023

Code Climate has analyzed commit bff329e and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 49.5% (-0.2% change).

View more on Code Climate.

Copy link
Member

@Mab879 Mab879 left a comment

Choose a reason for hiding this comment

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

Sorry, Just one last minor change.

references:
cis@sle15: 3.5.1.6

ocil_clause: 'The system accepts all incoming packets for unnecessary services and ports'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ocil_clause: 'The system accepts all incoming packets for unnecessary services and ports'
ocil_clause: 'the system accepts incoming packets for unnecessary services and ports'

@rumch-se
Copy link
Contributor Author

rumch-se commented Feb 6, 2023

Hello @Mab879
I have done the requested change.
Have a nice day
Rumen

Copy link
Member

@Mab879 Mab879 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 the PR. Waving the CodeClimate coverage test as there are no Python changes in this PR.

@Mab879
Copy link
Member

Mab879 commented Feb 6, 2023

Failures in Automatus is expected due to prodtype.

@Mab879 Mab879 merged commit 582d2fb into ComplianceAsCode:master Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ok-to-test Used by openshift-ci bot. New Rule Issues or pull requests related to new Rules. SLES SUSE Linux Enterprise Server product related.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants