镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Restricting the user that spawns ECF_*_CMD - #469

Open
marcosbento wants to merge 4 commits into
developfrom
task/restrict_owner
Open

marcosbento wants to merge 4 commits into
developfrom
task/restrict_owner

Conversation

@marcosbento

@marcosbento marcosbento commented Sep 29, 2026 •

Copy link
Copy Markdown
Collaborator

Description

As per PR title -- see commit messages for details.

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

🌦️ >> Documentation << 🌦️
https://sites.ecmwf.int/docs/dev-section/ecflow/pull-requests/PR-469

@marcosbento
marcosbento force-pushed the task/restrict_owner branch 2 times, most recently from f4abf9a to 1750d49 Compare September 29, 2026 14:44
@codecov-commenter

codecov-commenter commented Sep 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.47674% with 38 lines in your changes missing coverage. Please review.
✅ Project coverage is 56.94%. Comparing base (e3d738c) to head (6548a7d).

Files with missing lines Patch % Lines
libs/node/test/TestSystem.cpp 80.70% 11 Missing ⚠️
libs/node/src/ecflow/node/System.cpp 75.00% 8 Missing ⚠️
libs/node/src/ecflow/node/Submittable.cpp 82.35% 6 Missing ⚠️
libs/server/test/TestServerEnvironment.cpp 95.83% 5 Missing ⚠️
libs/node/src/ecflow/node/SpawnIdentity.cpp 90.90% 2 Missing ⚠️
libs/node/test/TestSpawnIdentity.cpp 92.30% 2 Missing ⚠️
libs/server/test/TestServer.cpp 89.47% 2 Missing ⚠️
...bs/base/src/ecflow/base/cts/user/EditScriptCmd.cpp 66.66% 1 Missing ⚠️
libs/node/src/ecflow/node/NodeContainer.cpp 85.71% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #469      +/-   ##
===========================================
+ Coverage    56.69%   56.94%   +0.24%     
===========================================
  Files         1265     1272       +7     
  Lines       105999   106660     +661     
  Branches     15403    15443      +40     
===========================================
+ Hits         60101    60733     +632     
- Misses       45898    45927      +29     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@marcosbento marcosbento changed the title Enable restricting the user that runs ECF_*_CMD to the task owner Restricting the user that spawns ECF_*_CMD Sep 30, 2026
Every task and alias records the login name of the user whose
command put it in a state from which a job is spawned: load and
replace on the nodes they add; requeue, run, force to queued and the
submission of an edited script on the nodes they act on. Begin and
automatic requeues leave it unchanged.

The owner is the generated variable ECF_OWNER, which job generation
resolves before any user variable of that name, as for ECF_HOST and
ECF_PASS. It is kept in the checkpoint as the token "owner:<user>",
sent to clients with the task memento, compared by the node
equality, and exposed in Python through get_owner().
Read a JSON server configuration file beside server_environment.cfg,
<host>.<port>.server.cfg when it exists and server.cfg otherwise. Its
only setting, spawn_as_owner, declares that jobs are to run as their
owner; it is off without the file. A file that is not valid JSON, a
setting of the wrong type or an unknown one stops the server from
starting, as does the flag on a server that is not root, since only
root can switch user. The mode is logged at start-up and shown in the
--debug dump.
With spawn_as_owner set, the server resolves the owner of a task to a
system account before forking, and the child switches to it before
executing the command:

- job, kill and status commands run with the account's uid and gid,
  and with HOME, USER, LOGNAME and SHELL taken from it;
- an empty owner, an unknown user or root is refused: nothing runs,
  the refusal is logged and becomes the abort reason of the task;
- a kill or status runs as the user that requested it, or as the
  owner when nothing did.
- server.cfg, under the start-up files: location and precedence, the
  JSON form, the spawn_as_owner setting, the faults that stop the
  server;
- Running jobs as their owner, under Security: the owner, what the
  server does at spawn time, the refusals, what the host needs, and a
  warning against enabling the switch for unauthenticated users;
- links from the ECF_OWNER section and the Kubernetes Cookbook page.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants