Skip to content

Commit

Permalink
Make UEP endpoint.log readable by default
Browse files Browse the repository at this point in the history
There's a distinction between the file permissions, and the descriptor
permissions.  The descriptor, per stdout and stderr needs only to be writable.
But the file, per other tools, needs to be readable.  `chmod` is easy enough to
invoke, but there's no need to for us to do the weird thing here.  So, create
the file with user rw perms.
  • Loading branch information
khk-globus committed Sep 30, 2024
1 parent 1f0f752 commit 480538d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ def cmd_start_endpoint(

log.debug("Convey credentials; redirect stdout, stderr (to '%s')", ep_log)
log_fd_flags = os.O_CREAT | os.O_WRONLY | os.O_APPEND | os.O_SYNC
log_fd = os.open(ep_log, log_fd_flags, mode=0o200)
log_fd = os.open(ep_log, log_fd_flags, mode=0o600)
with os.fdopen(log_fd, "w") as log_f:
if os.dup2(log_f.fileno(), 1) != 1:
raise OSError(f"Unable to redirect stdout to {ep_log}")
Expand Down
1 change: 1 addition & 0 deletions compute_endpoint/tests/unit/test_endpointmanager_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1972,6 +1972,7 @@ def test_redirect_stdstreams_to_user_log(

a, k = next((a, k) for a, k in mock_os.open.call_args_list if a[0] == ep_log)
assert a[1] == exp_flags, "Expect replacement stdout/stderr: append, wronly, sync"
assert k["mode"] == 0o600, "Expect default to writable *and* readable"


@pytest.mark.parametrize("debug", (True, False))
Expand Down

0 comments on commit 480538d

Please sign in to comment.