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

add cron permissions hardening #150

Merged
merged 2 commits into from
Feb 22, 2021
Merged
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
20 changes: 20 additions & 0 deletions controls/os_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,23 @@
end
end
end

control 'os-13' do
impact 1.0
title 'Protect cron directories and files'
desc 'The cron directories and files should belong to root.'

cron_files = ['/etc/crontab', '/etc/cron.hourly', '/etc/cron.daily', '/etc/cron.weekly', '/etc/cron.monthly', '/etc/cron.d']

cron_files.each do |cron_file|
next unless file(cron_file).exist?

describe file(cron_file) do
it { should be_owned_by 'root' }
it { should_not be_writable.by('group') }
it { should_not be_writable.by('other') }
it { should_not be_readable.by('group') }
it { should_not be_readable.by('other') }
end
end
end