-
Notifications
You must be signed in to change notification settings - Fork 170
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
Fix sudo usage in cmd-* #3984
Fix sudo usage in cmd-* #3984
Conversation
Hi @mtalexan. Thanks for your PR. I'm waiting for a coreos member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Encountered this when running the cosa container with:
I still need access to the Apparently the So to retain access to the |
Just checking in here after the holidays. It looks like Jenkins crashed or went down while it was supposed to be building, and never completed. |
/retest |
@mtalexan: The following test failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Not sure I understand the problem with running
|
I get it trying to query/prompt for a password (or other authorization), which results in a PAM error every time. The same PAM error regardless of whether I'm running as root or not.
I know there's been an open issue on the Fedora public base images since the F39 release for a PAM (mis-)configuration that breaks password prompting for I also believe most distros are setup to not have |
Sudo is being used directly all over the place, which doesn't work when the user is already root. Add a SUDO and SUDO_W_ENV variable that evaluates to the equivalent sudo command, but is blanked when running as root. Also add a sudo and sudo_w_env alias that map to a fake-root function that just runs the command passed without any sudo call, so any attempted use of sudo by python scripts triggered from the cmd-* scripts won't actually use sudo when running as root.
ec52094
to
e215345
Compare
/retest |
@mtalexan: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
I don't understand why you'd get different results? can you run the
|
Weird, it didn't auto-pull an up to date version of the With
EDIT: removed the 2 lines where I tab-tabbed to auto-complete the name of |
Minor correction, it looks like the I've tried looking into the generic issue before, but didn't get very far. It's related to something that's configured in the PAM modules provided by the Fedora public images (used as a base image for the coreos-assembler images here). From Issue reports on various projects[1][2] it seems like it's probably related to the |
are you running Ubuntu/Debian with AppArmor enabled? |
I saw that, and I am running on an Ubuntu host with AppArmor enabled. However, I'm getting the problem even when not running
```
[~]$ podman run --pull=always --rm --user=root --security-opt=apparmor=unconfined -it --entrypoint=/bin/bash quay.io/coreos-assembler/coreos-assembler:latest
Trying to pull quay.io/coreos-assembler/coreos-assembler:latest...
Getting image source signatures
Copying blob 451ef5bd8681 skipped: already exists
Copying blob a52c777f25d4 skipped: already exists
Copying blob 7f0754b77be7 skipped: already exists
Copying blob 8445f41b77c1 skipped: already exists
Copying blob 2a912ca08877 skipped: already exists
Copying blob b3ff8a0be438 skipped: already exists
Copying blob 4ef37b2c3006 skipped: already exists
Copying blob 52cabd2a22c2 skipped: already exists
Copying blob 83ce49b350c8 skipped: already exists
Copying blob 9dc0860eff5d skipped: already exists
Copying blob cff0cb9d7f6d skipped: already exists
Copying blob 0a6149cfd0f4 skipped: already exists
Copying blob 147aec9af54d skipped: already exists
Copying blob 62499f028be8 skipped: already exists
Copying blob a6c00ebc15d5 skipped: already exists
Copying blob f2f45b7c196b skipped: already exists
Copying blob f0c2e5b6d369 skipped: already exists
Copying blob dfe32983ad5a skipped: already exists
Copying config 9dc80c6b03 done |
Writing manifest to image destination
[root@a8e24a157095 srv]# sudo cat /etc/shadow | wc -l
sudo: PAM account management error: Authentication service cannot retrieve authentication info
sudo: a password is required
0
[root@a8e24a157095 srv]# exit
exit
```
That said, I just double checked by turning off AppArmor entirely, and it turns out it somehow does solve the issue. So the AppArmor on the host is somehow limiting what files can be accessed fully within the completely isolated container, even when AppArmor is explicitly disabled for the container. ( ¯_(ツ)_/¯ ). I guess this PR can be closed as unnecessary then.
|
Sudo is being used directly all over the place, which doesn't work if the user is already root (something the
has_privileges
function checks for and supports). Add aSUDO
andSUDO_W_ENV
variable that evaluates to the equivalentsudo
command when not root, but is blank when running as root.Also add a
sudo
(overlapping) andsudo_w_env
alias that map to afake-root
function defined to just run the arguments passed without any actual sudo call. This makes sure any other tools called from the cmd-* shell scripts (like python scripts) won't call real sudo with their hardcoded commands when running as root.