Skip to content

Commit

Permalink
Set the right ACLs on system log files in the darwin package
Browse files Browse the repository at this point in the history
  • Loading branch information
swiatekm committed Nov 15, 2023
1 parent cab4c78 commit c159ab8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions settings/otc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ macro(set_otc_settings)
# File paths
set(SOURCE_OTC_BINARY_PATH "${SOURCE_OTC_BINARY_DIR}/${OTC_BINARY}")
set(GH_ARTIFACT_OTC_BINARY_PATH "${GH_ARTIFACTS_DIR}/${GH_OUTPUT_OTC_BIN}")
set(ACL_LOG_FILE_PATHS "/var/log")

##
# Other
Expand Down
9 changes: 9 additions & 0 deletions templates/hooks/common/darwin-functions.in
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,12 @@ create_user_and_group_if_missing()
# Add user to group if the user is not a member
add_user_to_group_if_missing "$group" "$user"
}

set_acl_on_log_paths()
{
local group="$1"
local acl_log_file_paths="$2"
for log_path in "${acl_log_file_paths}"; do
chmod -R +a "group:$group allow read,readattr,readextattr" "$log_path"
done
}
1 change: 1 addition & 0 deletions templates/hooks/productbuild/preflight.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
@common_darwin_functions@

create_user_and_group_if_missing "@SERVICE_USER@" "@SERVICE_GROUP@"
set_acl_on_log_paths "@SERVICE_GROUP@" "@ACL_LOG_FILE_PATHS@"

exit 0

0 comments on commit c159ab8

Please sign in to comment.