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

Ensure permissions on /etc/crontab are configured #405

Merged
merged 5 commits into from
Mar 11, 2021
Merged

Ensure permissions on /etc/crontab are configured #405

merged 5 commits into from
Mar 11, 2021

Conversation

joubbi
Copy link
Contributor

@joubbi joubbi commented Feb 19, 2021

See #375

I'm not sure how to do the baseline change.
I looked at the baseline code and decided to leave it to someone else.
I got unsure about how to define the test since the file/directory (/etc/crontab, /etc/cron.daily...) doesn't have to exist.
The permissions should be correct only if the file/directory exists.

Signed-off-by: Farid Joubbi <farid@joubbi.se>
Signed-off-by: Farid Joubbi <farid@joubbi.se>
@rndmh3ro rndmh3ro self-assigned this Feb 22, 2021
Copy link
Member

@rndmh3ro rndmh3ro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, two things should be adressed.

After having tests, we can merge this.

roles/os_hardening/tasks/cron.yml Outdated Show resolved Hide resolved
roles/os_hardening/tasks/cron.yml Outdated Show resolved Hide resolved
@rndmh3ro
Copy link
Member

related test: dev-sec/linux-baseline#150

Signed-off-by: Farid Joubbi <farid@joubbi.se>
@schurzi
Copy link
Contributor

schurzi commented Mar 10, 2021

@joubbi are you able to complete this in the comming days, or should I take over?

…le/dir.

Signed-off-by: Farid Joubbi <farid@joubbi.se>
@joubbi
Copy link
Contributor Author

joubbi commented Mar 11, 2021

I changed it to a list that is looped instead. The code is prettier and very compact. Unfortunately the output is not as nice.

@schurzi schurzi linked an issue Mar 11, 2021 that may be closed by this pull request
@schurzi schurzi changed the title Ensure permissions on /etc/crontab are configured #375 Ensure permissions on /etc/crontab are configured Mar 11, 2021
Signed-off-by: Martin Schurz <Martin.Schurz@t-systems.com>
@schurzi schurzi merged commit 0b94553 into dev-sec:master Mar 11, 2021
@schurzi
Copy link
Contributor

schurzi commented Mar 11, 2021

THank you @joubbi for this nice addition!

@schurzi schurzi added the minor label Mar 11, 2021
divialth pushed a commit to divialth/ansible-collection-hardening that referenced this pull request Aug 3, 2022
Ensure permissions on cron files and directories are configured
@yabinma
Copy link

yabinma commented Dec 2, 2023

Sorry, a question please, I did find the cron.yml included in the PR. But why the cron hardening tasks are not called in my test?
It is a Ubuntu 20.04 system.
While installed the role, 'ansible-galaxy install dev-sec.os-hardening' and ran the playbook, in the report, there are no cron tasks log found(auditd and limits tasks included, there are the logs for both). Thanks for any comment.

@schurzi
Copy link
Contributor

schurzi commented Dec 3, 2023

@maxatcn please don't use old PRs to ask questions or report bugs. This is not manageable for us.

As to your issue. There should at least be a task named Import tasks for cron that will appear in your logs, and this task determines, if the cron hardening is included. If it is skipped the usual reason is you set some tags in your playbook.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure permissions on /etc/crontab are configured
4 participants