-
Notifications
You must be signed in to change notification settings - Fork 23
Adds Ubuntu Jammy & Rocky 9 CIS benchmark hardening playbooks #685
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
d040e09
Adds Ubuntu Jammy CIS benchmark hardening playbooks
jovial df6a357
Use fork of role to support inject_facts_as_vars=False
jovial cdb4849
Add support for Rocky 9 CIS hardening
jovial b5d984c
Whitespace fix
jovial 986874b
Whitespace fix
jovial 8f8ff8c
Matt's code review
jovial ed87968
Add rhel9 auditd configuration
jovial d46c360
Move auditd config to new location
jovial b54bfd2
...
jovial 4e4cf55
Update cis
jovial 08206c6
Apply suggestions from code review
jovial 86a9f6f
Apply suggestions from code review
jovial 4d6ad57
Apply suggestions from code review
jovial 864ec3a
Rename section
jovial c4279ff
Fix indentation
jovial c2be0e5
Apply suggestions from code review
jovial 65742ba
Remove instructions to enable inject_facts_as_vars
jovial 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,3 +18,4 @@ the various features provided. | |
wazuh | ||
vault | ||
magnum-capi | ||
security | ||
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,49 @@ | ||
================== | ||
Security Hardening | ||
================== | ||
|
||
CIS Benchmark Hardening | ||
----------------------- | ||
|
||
The roles from the `Ansible-Lockdown <https://github.com/ansible-lockdown>`_ | ||
project are used to harden hosts in accordance with the CIS benchmark criteria. | ||
It won't get your benchmark score to 100%, but should provide a significant | ||
improvement over an unhardened system. The following operating systems are | ||
jovial marked this conversation as resolved.
Show resolved
Hide resolved
|
||
supported: | ||
|
||
- Rocky 8, RHEL 8, CentOS Stream 8 | ||
- Ubuntu 22.04 | ||
jovial marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
jovial marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Configuration | ||
-------------- | ||
|
||
Some overrides to the role defaults are provided in | ||
``$KAYOBE_CONFIG_PATH/inventory/group_vars/overcloud/cis``. These may not be | ||
suitable for all deployments and so some fine tuning may be required. For | ||
instance, you may want different rules on a network node compared to a | ||
controller. It is best to consult the upstream role documentation for details | ||
about what each variable does. The documentation can be found here: | ||
|
||
- `Rocky 8, RHEL 8, CentOS Stream 8 <https://github.com/ansible-lockdown/RHEL8-CIS/tree/1.3.0>`__ | ||
- `Ubuntu 22.04 <https://github.com/ansible-lockdown/UBUNTU22-CIS>`__ | ||
jovial marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
jovial marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Running the playbooks | ||
--------------------- | ||
|
||
As there is potential for unintended side effects when applying the hardening | ||
playbooks, the playbooks are not currently enabled by default. It is recommended | ||
that they are first applied to a representative staging environment to determine | ||
whether or not workloads or API requests are affected by any configuration changes. | ||
|
||
The upstream roles do not currently support using | ||
`INJECT_FACTS_AS_VARS=False <https://docs.ansible.com/ansible/latest/reference_appendices/config.html#inject-facts-as-vars>` | ||
so you must enable this feature to be able to run the playbooks. This an be done on | ||
an adhoc basis using the environment variable. An example of how of to do that is | ||
shown below: | ||
markgoddard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
.. code-block:: console | ||
|
||
kayobe playbook run $KAYOBE_CONFIG_PATH/ansible/cis.yml | ||
jovial marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
jovial marked this conversation as resolved.
Show resolved
Hide resolved
|
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
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,4 +1,6 @@ | ||
--- | ||
############################################################################## | ||
# RHEL 8 / Centos Stream 8 CIS Hardening Configuration | ||
|
||
# NOTE: kayobe configures NTP. Do not clobber configuration. | ||
rhel8cis_time_synchronization: skip | ||
|
@@ -22,3 +24,108 @@ rhel8cis_crypto_policy: FIPS | |
# from being displayed. | ||
rhel8cis_rule_1_8_1_1: false | ||
rhel8cis_rule_1_8_1_4: false | ||
|
||
############################################################################## | ||
# Rocky 9 CIS Hardening Configuration | ||
|
||
# Allow IP forwarding | ||
rhel9cis_is_router: true | ||
|
||
# Skip configuration of chrony | ||
rhel9cis_rule_2_1_1: false | ||
rhel9cis_rule_2_1_2: false | ||
|
||
# Skip configuration of the firewall | ||
rhel9cis_firewall: None | ||
rhel9cis_rule_3_4_1_2: false | ||
|
||
# Don't configure selinux | ||
rhel9cis_selinux_disable: true | ||
|
||
# NOTE: FUTURE breaks wazuh agent repo metadata download | ||
rhel9cis_crypto_policy: FIPS | ||
|
||
# Skip package updates | ||
rhel9cis_rule_1_9: false | ||
|
||
# Disable requirement for password when using sudo | ||
rhel9cis_rule_5_3_4: false | ||
|
||
jovial marked this conversation as resolved.
Show resolved
Hide resolved
|
||
############################################################################## | ||
# Ubuntu Jammy CIS Hardening Configuration | ||
|
||
# Ubuntu 22 CIS configuration | ||
# Disable changing routing rules | ||
ubtu22cis_is_router: true | ||
|
||
# Set Chrony as the time sync tool | ||
ubtu22cis_time_sync_tool: "chrony" | ||
|
||
# Disable CIS from configuring the firewall | ||
ubtu22cis_firewall_package: "none" | ||
|
||
# Stop CIS from installing Network Manager | ||
ubtu22cis_install_network_manager: false | ||
|
||
# Set syslog service to journald | ||
ubtu22cis_syslog_service: journald | ||
|
||
# Squashfs is compiled into the kernel | ||
ubtu22cis_rule_1_1_1_2: false | ||
|
||
# This updates the system. Let's do this explicitly. | ||
ubtu22cis_rule_1_9: false | ||
|
||
# Do not change Chrony Time servers | ||
ubtu22cis_rule_2_1_2_1: false | ||
|
||
# Disable CIS from touching sudoers | ||
ubtu22cis_rule_5_3_4: false | ||
|
||
# Add stack and kolla to allowed ssh users | ||
ubtu22cis_sshd: | ||
log_level: "INFO" | ||
max_auth_tries: 4 | ||
ciphers: "[email protected],[email protected],[email protected],aes256-ctr,aes192-ctr,aes128-ctr" | ||
macs: "[email protected],[email protected],hmac-sha2-512,hmac-sha2-256" | ||
kex_algorithms: "curve25519-sha256,[email protected],diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,ecdh-sha2-nistp521,ecdh-sha2-nistp384,ecdh-sha2-nistp256,diffie-hellman-group-exchange-sha256" | ||
client_alive_interval: 300 | ||
client_alive_count_max: 3 | ||
login_grace_time: 60 | ||
max_sessions: 10 | ||
allow_users: "kolla stack ubuntu" | ||
allow_groups: "kolla stack ubuntu" | ||
# This variable, if specified, configures a list of USER name patterns, separated by spaces, to prevent SSH access | ||
# for users whose user name matches one of the patterns. This is done | ||
# by setting the value of `DenyUsers` option in `/etc/ssh/sshd_config` file. | ||
# If an USER@HOST format will be used, the specified user will be restricted only on that particular host. | ||
# The allow/deny directives process order: DenyUsers, AllowUsers, DenyGroups, AllowGroups. | ||
# For more info, see https://linux.die.net/man/5/sshd_config | ||
deny_users: "" | ||
# This variable, if specified, configures a list of GROUP name patterns, separated by spaces, to prevent SSH access | ||
# for users whose primary group or supplementary group list matches one of the patterns. This is done | ||
# by setting the value of `DenyGroups` option in `/etc/ssh/sshd_config` file. | ||
# The allow/deny directives process order: DenyUsers, AllowUsers, DenyGroups, AllowGroups. | ||
# For more info, see https://linux.die.net/man/5/sshd_config | ||
deny_groups: "" | ||
|
||
# Do not change /var/lib/docker permissions | ||
ubtu22cis_no_group_adjust: false | ||
ubtu22cis_no_owner_adjust: false | ||
|
||
# Enable collecting auditd logs | ||
update_audit_template: true | ||
|
||
# Configure log rotation to prevent audit logs from filling the disk | ||
ubtu22cis_auditd: | ||
action_mail_acct: root | ||
space_left_action: syslog | ||
admin_space_left_action: halt | ||
max_log_file_action: rotate | ||
|
||
# Disable grub bootloader password. Requires overriding | ||
# ubtu22cis_bootloader_password_hash | ||
ubtu22cis_rule_1_4_1: false | ||
ubtu22cis_rule_1_4_3: false | ||
|
||
############################################################################## |
5 changes: 5 additions & 0 deletions
5
releasenotes/notes/adds-cis-hardening-for-ubuntu-jammy-d9bf23a34c08f5be.yaml
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,5 @@ | ||
--- | ||
features: | ||
- | | ||
Adds support for Ubuntu Jammy to the CIS benchmark hardening playbook: | ||
jovial marked this conversation as resolved.
Show resolved
Hide resolved
|
||
``cis.yml``. This playbook will need to be manually applied. |
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.
Uh oh!
There was an error while loading. Please reload this page.