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

bug: ASDF fails to load in some sudo/su contexts #1775

Open
mcandre opened this issue Aug 26, 2024 · 2 comments
Open

bug: ASDF fails to load in some sudo/su contexts #1775

mcandre opened this issue Aug 26, 2024 · 2 comments
Labels

Comments

@mcandre
Copy link

mcandre commented Aug 26, 2024

Describe the Bug

Hi,

While provisioning Ruby environments upon enterprise Jenkins agents, I noticed a hidden assumption within ASDF that causes the ASDF bash load process to fail.

Note two workarounds:

  • Jenkins pipelines probably still work, due to connecting directly to the Jenkins SSH account using known credentials, as opposed to sudo/su. But that breaks SSH troubleshooting from individual engineer accounts.
  • The user can override a default bash shell to target sh, then run sudo/su, then explicitly cd to the Jenkins home directory, and finally launch bash to load ASDF. But that's tedious.

Steps to Reproduce

  1. chmod 0700 ~ in your normal Unix account.
  2. Create a Jenkins Unix account.
  3. Install ASDF in the Jenkins account.
  4. Use sudo or su to change context to the Jenkins account.

Expected Behaviour

ASDF is available and working.

Actual Behaviour

The ASDF source line in the Jenkins account's .bashrc file terminates too early, citing cd permission errors.

The asdf command fails to register. asdf version reports that no such command is found.

Environment

Redacted

asdf plugins affected (if relevant)

No response

@mcandre mcandre added the bug label Aug 26, 2024
@skull-squadron
Copy link

Asdf isn't the problem. The problem is a failure to start a clean login shell as the target user, and so the environment is inherited and wrong.

/usr/bin/env sudo -iu jenkins -- ...

@mcandre
Copy link
Author

mcandre commented Sep 1, 2024

I suspect asdf is triggering a dirty login shell as a consequence of asdf's assumptions about the authorization to cd into arbitrary /home/* directories, which is not true in all environments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants
@mcandre @skull-squadron and others