chef / cookstyle

A linting tool that helps you to write better Chef Infra cookbooks and InSpec profiles by detecting and automatically correcting style, syntax, and logic mistakes in your code.
Apache License 2.0
109 stars 54 forks source link

Chef/Modernize/CronDFileOrTemplate matches on /etc/cron.deny #946

Closed tas50 closed 5 months ago

tas50 commented 2 years ago

/etc/cron.deny is matching with the Chef/Modernize/CronDFileOrTemplate cop. Example:

file '/etc/cron.deny' do
  action :delete
end
draksha22 commented 2 years ago

hey @tas50 can you please elaborate your issue.

ddamw commented 2 years ago

cron.deny and cron.allow are special files that can be placed in /etc/cron.d that allow or deny access to crontab. Their contents are completely different from regular cron.d files and as such can not be serviced by the cron_d resource.

Source: https://docs.oracle.com/cd/E19253-01/817-0403/sysrescron-23/index.html

I noticed that @tas50 is not even processing the file in /etc/cron.d, but in /etc instead, which should not trigger the warning at all imho. I noticed something similar with cron.daily, but will report that in a new issue.

dafyddcrosby commented 5 months ago

Confirmed bug fixed with #959, but didn't have a regression test, so made one with #972