Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flux exec --jobid doesn't work for job owner in system instance #6548

Open
garlick opened this issue Jan 10, 2025 · 1 comment
Open

flux exec --jobid doesn't work for job owner in system instance #6548

garlick opened this issue Jan 10, 2025 · 1 comment

Comments

@garlick
Copy link
Member

garlick commented Jan 10, 2025

Problem: intuitively you'd expect flux exec --jobid ID to work in the system instance when the invoking user is the same as the job owner of ID, but it does not.

The reason is noted in the code:

/* The embedded subprocess server restricts access based on FLUX_ROLE_OWNER,
 * but this shell cannot trust message credentials if they are passing through
 * a Flux instance running as a different user (e.g. the "flux" user in a
 * system instance).  If that user were compromised, they could run arbitrary
 * commands as any user that currently has a job running.  Therefore, this
 * additional check ensures that we only trust an instance running as the same
 * user.
 *
 * For good measure, check that the shell userid matches the credential
 * userid. After the above check, this could only fail in test where the
 * owner can be mocked.
 */

The method used to check if the instance is to be trusted is

    /* Determine if this shell is running as the instance owner, without
     * trusting the instance owner to tell us.  Since the parent of a guest
     * shell is flux-imp(1), kill(2) of the parent pid should fail for guests.
     */
    pid_t ppid = getppid (); // 0 =  parent is in a different pid namespace
    if (ppid > 0 && kill (getppid (), 0) == 0)
        rexec->parent_is_trusted = true;

Discussion began in

@garlick
Copy link
Member Author

garlick commented Jan 10, 2025

@grondo mentioned munge as an idea for enhancing message credentials in this case.

I wonder if we could amend the subprocess protocol to allow a signing method from flux-security to be used on the exec requests?

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

No branches or pull requests

1 participant