-
Notifications
You must be signed in to change notification settings - Fork 761
Create rule group_server_with_gui_removed #14204
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| # platform = multi_platform_rhel | ||
| # strategy = configure | ||
| # complexity = low | ||
| # disruption = low | ||
| # reboot = false | ||
|
|
||
| # Note: This is important to update dependencies to allow the removal of the Server | ||
| # with GUI group with minimal impact to the system functionality. | ||
| - name: "{{{ rule_title }}} - Install Minimal Install group" | ||
| ansible.builtin.command: | ||
| cmd: dnf groupinstall -y 'Minimal Install' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this going to work in "check mode"? Will it be OK? Would some tasks which would check actual presence / absence of a group make sense? |
||
| when: not ansible_check_mode | ||
|
|
||
| - name: "{{{ rule_title }}} - Remove Server with GUI group" | ||
| ansible.builtin.command: | ||
| cmd: dnf groupremove -y 'Server with GUI' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add empty lines between tasks. |
||
| when: not ansible_check_mode | ||
|
|
||
| - name: "{{{ rule_title }}} - Install Server group" | ||
| ansible.builtin.command: | ||
| cmd: dnf groupinstall -y 'Server' | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't like this solution. It conflicts with our approach to install and remove all packages at the very beginning of the Ansible Playbook. Now, with this change, many packages are installed or removed somewhere in the middle of the Playbook. That not only makes the task longer, but probably causes the fails of the /hardening/host-os/ansible tests in Testing farm CI jobs. Please invent a different solution. |
||
| when: not ansible_check_mode | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # platform = multi_platform_rhel | ||
|
|
||
| # Note: This is important to update dependencies to allow the removal of the Server | ||
| # with GUI group with minimal impact to the system functionality. | ||
| dnf groupinstall -y "Minimal Install" | ||
|
|
||
| # Remove the Server with GUI group | ||
| dnf groupremove -y "Server with GUI" | ||
| dnf groupinstall -y "Server" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| documentation_complete: true | ||
|
|
||
| title: 'Remove the Server with GUI Package Group' | ||
|
|
||
| description: |- | ||
| By removing the <tt>Server with GUI</tt> package group, the system no longer has a graphical user interface (GUI) installed. | ||
| If a GUI is not installed then the system cannot boot into graphical user mode. | ||
| This prevents the system from being accidentally or maliciously booted into a <tt>graphical.target</tt> mode. | ||
| To do so, run the following command: | ||
| <pre>dnf groupremove -y "Server with GUI"</pre> | ||
|
|
||
| rationale: |- | ||
| Unnecessary service packages must not be installed to decrease the attack surface of the system. | ||
| If a Graphical User Interface (GUI) is not required, it should be removed to reduce the | ||
| attack surface of the system. | ||
|
|
||
| severity: medium | ||
|
|
||
| identifiers: | ||
| cce@rhel10: CCE-87443-8 | ||
|
|
||
| ocil_clause: The Server with GUI package group has not been removed | ||
|
|
||
| ocil: |- | ||
| Run the following command to verify the Installed Environment Group is not | ||
| Server with GUI: | ||
| # dnf grouplist | sed -n '/Installed Environment Groups:/,/Installed Groups:/p' | ||
| The output should not contain the Server with GUI group. | ||
|
|
||
| fixtext: |- | ||
| Run the following commands to remove the Server with GUI package group: | ||
| # dnf groupinstall -y "Minimal Install" | ||
| Note: This is important to update dependencies to allow the removal of the Server | ||
| with GUI group with minimal impact to the system functionality. | ||
| # dnf groupremove -y "Server with GUI" | ||
| # dnf groupinstall -y "Server" | ||
| # reboot | ||
|
|
||
| warnings: | ||
| - general: |- | ||
| This rule doesn't come with an OVAL check, as it is not possible to check if the Server with GUI group is installed using the OVAL rpm objects. Therefore, this rule contains only an SCE check. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| #!/usr/bin/env bash | ||
| # platform = multi_platform_rhel | ||
| # check-import = stdout | ||
|
|
||
| if dnf grouplist | sed -n '/Installed Environment Groups:/,/Installed Groups:/p' | grep -q "Server with GUI"; then | ||
| echo "Server with GUI group is installed" | ||
| exit $XCCDF_RESULT_FAIL | ||
| fi | ||
|
|
||
| exit $XCCDF_RESULT_PASS |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| #!/bin/bash | ||
|
|
||
| dnf groupinstall -y "Server with GUI" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Note: This is important to update dependencies to allow the removal of the Server | ||
| # with GUI group with minimal impact to the system functionality. | ||
| dnf groupinstall -y "Minimal Install" | ||
|
|
||
| # Remove the Server with GUI group | ||
| dnf groupremove -y "Server with GUI" | ||
| dnf groupinstall -y "Server" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -431,7 +431,6 @@ CCE-87438-8 | |
| CCE-87440-4 | ||
| CCE-87441-2 | ||
| CCE-87442-0 | ||
| CCE-87443-8 | ||
| CCE-87446-1 | ||
| CCE-87450-3 | ||
| CCE-87453-7 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the whole rule would fit better into the linux_os/guide/services/xwindows/disabling_xwindows group.