Skip to content

Commit

Permalink
fix(core): set correct permissions for socket path when umask is set …
Browse files Browse the repository at this point in the history
…to `0027` (#14084)

When umask is configured to `0027`, the newly created `kong_config.socket_path` directory inherits permissions `750`,
which restricts access for worker processes. This commit ensures that the `socket_path` directory is explicitly set
to permissions `755` using `chmod 755`, thereby preventing permission-related errors and allowing proper access for
all necessary processes.

Fix: [FTI-6298](https://konghq.atlassian.net/browse/FTI-6298)
Signed-off-by: tzssangglass <[email protected]>
  • Loading branch information
tzssangglass authored Jan 9, 2025
1 parent b7f5ed2 commit f4d9c7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelog/unreleased/kong/fix-socket-path-permissions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
message: "Fixed an issue where `socket_path` permissions were not correctly set to `755` when the umask setting did not give enough permission"
type: bugfix
scope: Core
6 changes: 6 additions & 0 deletions kong/cmd/utils/prefix_handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,12 @@ local function prepare_prefix(kong_config, nginx_custom_template_path, skip_writ
if not ok then
return nil, err
end

local ok, _, _, stderr = pl_utils.executeex("chmod 755 " .. kong_config.socket_path)
if not ok then
return nil, "can not set correct permissions for socket path: " .. kong_config.socket_path
.. " (" .. stderr .. ")"
end
end

-- create directories in prefix
Expand Down

1 comment on commit f4d9c7f

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

Bazel Build

Docker image available kong/kong:f4d9c7fe0edeb5fef91b6817febea9ffca73a8ac
Artifacts available https://github.com/Kong/kong/actions/runs/12687323181

Please sign in to comment.