-
Notifications
You must be signed in to change notification settings - Fork 5
filesystem kernel modules al2 #28
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
Open
Shubhanshi-2123
wants to merge
1
commit into
v2.0.0
Choose a base branch
from
filesystem_kernel_modules_al2
base: v2.0.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| --- | ||
| - name: Amazon Linux 2 | Disable kernal module | ||
| include_tasks: filesystem_kernel_modules_al2 | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| --- | ||
| # Configure Filesystem Kernel Modules (CIS 1.1.1.1 - 1.1.1.8) | ||
| # Combined single playbook to disable all unused filesystem kernel modules | ||
|
|
||
| - name: "Disable unused filesystem kernel modules" | ||
| block: | ||
|
|
||
| # --------------------------------------------------------- | ||
| # Step 1: Create/update modprobe configuration (blockinfile) | ||
| # --------------------------------------------------------- | ||
| - name: "Block and blacklist filesystem modules in /etc/modprobe.d/cis.conf" | ||
| ansible.builtin.blockinfile: | ||
| path: /etc/modprobe.d/cis.conf | ||
| create: yes | ||
| block: | | ||
| install {{ item.name }} /bin/true | ||
| blacklist {{ item.name }} | ||
| marker: "# {mark} {{ item.name }} module disable" | ||
| loop: | ||
| - { name: "cramfs", desc: "1.1.1.1 Ensure cramfs kernel module is not available" } | ||
| - { name: "freevxfs", desc: "1.1.1.2 Ensure freevxfs kernel module is not available" } | ||
| - { name: "hfs", desc: "1.1.1.3 Ensure hfs kernel module is not available" } | ||
| - { name: "hfsplus", desc: "1.1.1.4 Ensure hfsplus kernel module is not available" } | ||
| - { name: "jffs2", desc: "1.1.1.5 Ensure jffs2 kernel module is not available" } | ||
| - { name: "usb-storage", desc: "1.1.1.8 Ensure usb-storage kernel module is not available" } | ||
| loop_control: | ||
| label: "{{ item.desc }}" | ||
| notify: Rebuild module dependencies | ||
|
|
||
| # --------------------------------------------------------- | ||
| # Step 2: Unload modules if they’re currently loaded | ||
| # --------------------------------------------------------- | ||
| - name: "Unload filesystem modules if loaded" | ||
| become: true | ||
| ansible.builtin.command: "modprobe -r {{ item.name }}" | ||
| register: unload_result | ||
| failed_when: false | ||
| changed_when: unload_result.rc == 0 | ||
| loop: | ||
| - { name: "cramfs" } | ||
| - { name: "freevxfs" } | ||
| - { name: "hfs" } | ||
| - { name: "hfsplus" } | ||
| - { name: "jffs2" } | ||
| - { name: "usb-storage" } | ||
| loop_control: | ||
| label: "Unload {{ item.name }} module if loaded" | ||
|
|
||
| when: ansible_os_family == "RedHat" | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,18 @@ | ||
| --- | ||
| - name: Include CIS Stage Specific vars | ||
| include_vars: cis-{{ cis_Stage }}.yaml | ||
|
|
||
| - name: Debian realted Specification | ||
| include_tasks: configure_Debian.yaml | ||
| - name: Ubuntu related Specification | ||
|
Contributor
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. Why Debian tasks change requires |
||
| include_tasks: ubuntu.yaml | ||
| when: | ||
| ansible_os_family == 'Debian' | ||
|
|
||
| - name: Centos realted Specification | ||
| include_tasks: configure_RedHat.yaml | ||
| - name: CentOS related Specification | ||
| include_tasks: centos.yaml | ||
| when: | ||
| ansible_os_family == 'RedHat' and ansible_distribution != 'Amazon' | ||
|
|
||
| - name: Amazon Linux 2 related Specification | ||
| include_tasks: amazon_linux.yaml | ||
| when: | ||
| ansible_os_family == 'RedHat' | ||
| ansible_distribution == 'Amazon' | ||
|
|
||
| # - name: Special purpose services | ||
| # include_tasks: services.yaml | ||
|
|
@@ -35,3 +37,4 @@ | |
|
|
||
| # - name: Ensure dccp and sctp is disabled | ||
| # include_tasks: network_protocol_and_unusedFilesystem.yaml | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Ensure this will not impact Debian tasks