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

WIP: make sure no legacy or weak ciphers are enabled #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
cis_compliance['sbp_kernel_is_not_tainted'] = true
cis_compliance['sbp_kernel_only_allows_signed_modules'] = true
cis_compliance['sbp_mrepos_are_not_older_than_6_weeks'] = true
cis_compliance['sbp_ensure_cbc_not_enabled_openssh'] = true

# CIS templates
cis_compliance['xccdf_org']['cisecurity'].tap do |cisecurity|
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
maintainer_email '[email protected]'
license 'Apache-2.0'
description 'Installs/Configures cis-hardening'
version '0.1.0'
version '0.2.0'
chef_version '>= 16.0'
42 changes: 33 additions & 9 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,39 @@
action :create
end

# # xccdf_org.cisecurity.benchmarks_rule_1.10_Ensure_system-wide_crypto_policy_is_not_legacy
# bash 'crypto-policies' do
# code <<-EOH
# sed -i 's/^LEGACY/DEFAULT/' /etc/crypto-policies/config
# EOH
# only_if { cisecurity['benchmarks_rule_Ensure_system-wide_crypto_policy_is_not_legacy'] }
# only_if { node['platform_version'].to_i >= 8 }
# action :run
# end
# xccdf_org.cisecurity.benchmarks_rule_1.10_Ensure_system-wide_crypto_policy_is_not_legacy
bash 'crypto-policies' do
code <<-EOH
sed -i 's/^LEGACY/DEFAULT/' /etc/crypto-policies/config
EOH
only_if { cisecurity['benchmarks_rule_Ensure_system-wide_crypto_policy_is_not_legacy'] }
only_if { node['platform_version'].to_i >= 8 }
action :run
end

# Ensure no CBC ciphers are used by OpenSSH server
file '/etc/crypto-policies/policies/modules/DISABLE-CBC.pmod' do
content <<~EOU
cipher@ssh = -AES-128-CBC -AES-256-CBC
EOU
owner 'root'
group 'root'
mode '0750'
action :create
only_if { node['cis_compliance']['sbp_ensure_cbc_not_enabled_openssh'] }
only_if { node['platform_version'].to_i >= 8 }
end
file '/etc/crypto-policies/config' do
content <<~EOU
DEFAULT:DISABLE-CBC
EOU
owner 'root'
group 'root'
mode '0750'
action :create
only_if { node['cis_compliance']['sbp_ensure_cbc_not_enabled_openssh'] }
only_if { node['platform_version'].to_i >= 8 }
end

# xccdf_org.cisecurity.benchmarks_rule_2.3.2_Ensure_telnet_client_is_not_installed
package 'telnet' do
Expand Down