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

(PUP-10627) Add default file permissions 640 for last_run_summary.yaml #8433

Merged
merged 1 commit into from
Nov 4, 2020
Merged
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
22 changes: 16 additions & 6 deletions acceptance/tests/agent/last_run_summary_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,24 @@
end
end

step "Check if the 'last_run_summary.yaml' report file created has '0644' permissions" do
step "Check if the 'last_run_summary.yaml' report file created has '0640' permissions" do
if agent['platform'] =~ /windows/
on(agent, "icacls #{File.join(publicdir, 'last_run_summary.yaml')}") do |result|
# Linux 'Owner' premissions class equivalent
assert_match('Administrator:(R,W', result.stdout)
# Linux 'Group' permissions class equivalent
assert_match('None:(R)', result.stdout)
# Linux 'Public' permissions class equivalent
assert_match('Everyone:(R)', result.stdout)
assert_match('Everyone:(Rc,S,RA)', result.stdout)
# According to icacls docs:
# Rc = Read control
# S = Synchronize
# RA = Read attributes
# More at https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/icacls
end
else
on(agent, "ls -al #{publicdir}") do |result|
assert_match(/rw-r--r--.+last_run_summary\.yaml$/, result.stdout)
assert_match(/rw-r-----.+last_run_summary\.yaml$/, result.stdout)
end
end
end
Expand All @@ -86,19 +91,24 @@
end
end

step "Check if the 'last_run_summary.yaml' report file was created in the new location and still has '0644' permissions" do
step "Check if the 'last_run_summary.yaml' report file was created in the new location and still has '0640' permissions" do
if agent['platform'] =~ /windows/
on(agent, "icacls #{File.join(custom_publicdir, 'last_run_summary.yaml')}") do |result|
# Linux 'Owner' premissions class equivalent
assert_match('Administrator:(R,W', result.stdout)
# Linux 'Group' permissions class equivalent
assert_match('None:(R)', result.stdout)
# Linux 'Public' permissions class equivalent
assert_match('Everyone:(R)', result.stdout)
assert_match('Everyone:(Rc,S,RA)', result.stdout)
# According to icacls docs:
# Rc = Read control
# S = Synchronize
# RA = Read attributes
# More at https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/icacls
end
else
on(agent, "ls -al #{custom_publicdir}") do |result|
assert_match(/rw-r--r--.+last_run_summary\.yaml$/, result.stdout)
assert_match(/rw-r-----.+last_run_summary\.yaml$/, result.stdout)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1809,7 +1809,7 @@ def self.initialize_default_settings!(settings)
:lastrunfile => {
:default => "$publicdir/last_run_summary.yaml",
:type => :file,
:mode => "0644",
:mode => "0640",
:desc => "Where puppet agent stores the last run report summary in yaml format."
},
:lastrunreport => {
Expand Down