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`

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 committed Jan 6, 2025
1 parent 45afb4d commit 4a48ae9
Show file tree
Hide file tree
Showing 2 changed files with 8 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: "Fix issue where `socket_path` permissions are not correctly set to `755` when umask is `0027`"
type: bugfix
scope: Core
5 changes: 5 additions & 0 deletions kong/cmd/utils/prefix_handler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,11 @@ local function prepare_prefix(kong_config, nginx_custom_template_path, skip_writ
if not ok then
return nil, err
end

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

-- create directories in prefix
Expand Down

0 comments on commit 4a48ae9

Please sign in to comment.