Skip to content

Commit

Permalink
cookstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Metzger committed Jan 17, 2025
1 parent 32708ce commit de1014a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ end

begin
RuboCop::RakeTask.new(:lint) do |task|
task.options += %w[--display-cop-names --no-color --parallel]
task.options += %w(--display-cop-names --no-color --parallel)
end
rescue LoadError
puts 'rubocop is not available. Install the rubocop gem to run the lint tests.'
Expand Down
15 changes: 8 additions & 7 deletions controls/SV-230251.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,32 +40,33 @@
else
# Define the required algorithms
required_algorithms = input('openssh_server_required_algorithms')

# TODO: make a simple resource for this based off 'login_defs' or 'yum' as a model

# Parse the configuration file to get the value of "CRYPTO_POLICY"
crypto_policy = parse_config_file('/etc/crypto-policies/back-ends/opensshserver.config')['CRYPTO_POLICY']

# Parse the CRYPTO_POLICY string into a hash of configuration options
config_options = crypto_policy.scan(/-o(\w+)=([\w\-,@]+.)/).to_h

# Split each configuration option's values into an array
config_options.transform_values! { |v| v.split(',') }

# Define the path to the crypto policy file
crypto_policy_file = '/etc/crypto-policies/back-ends/opensshserver.config'

# Test that the crypto policy file is configured with the required algorithms
describe "The crypto policy file #{crypto_policy_file}" do
it 'is configured with the required algorithms' do
expect(crypto_policy).not_to be_nil, "The crypto policy file #{crypto_policy_file} \ndoes not contain the required algorithms\n\n\t#{required_algorithms}."
end
end

# Test that the MACS option in the crypto policy file contains the required algorithms in the correct order
describe 'The MACs option in the crypto policy file' do
it 'contains the required algorithms in the correct order' do
expect(config_options['MACS']).to eq(required_algorithms), "The MACS option in the crypto policy file does not contain the required algorithms in the *exact order*:\n\n\texpected: #{required_algorithms}\n\tgot:#{config_options['MACS']}"
end
end
end
end
4 changes: 2 additions & 2 deletions controls/SV-230475.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@
!virtualization.system.eql?('docker')
}

audit_tools = %w[/usr/sbin/auditctl
audit_tools = %w(/usr/sbin/auditctl
/usr/sbin/auditd
/usr/sbin/ausearch
/usr/sbin/aureport
/usr/sbin/autrace
/usr/sbin/rsyslogd
/usr/sbin/augenrules]
/usr/sbin/augenrules)

if package('aide').installed?
audit_tools.each do |tool|
Expand Down

0 comments on commit de1014a

Please sign in to comment.