-
Notifications
You must be signed in to change notification settings - Fork 220
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
tty device used inside toolbox gets odd permissions on host causing pinentry/gpg-agent to not work #568
Comments
Thanks for narrowing it down to those working and broken versions. I wonder if this might be solved by using I don't think Toolbox itself does anything funky with the TTY devices, but it does bind mount the entire |
No problem :) - It's worth noting those were just two data points. I don't know exactly when the issue was introduced.
Can you recreate locally? I'm assuming pretty much anyone running latest toolbox/podman should see a weird owner when running
Right, I suspect it was a change in |
Adding
That seems to be a step in the right direction in terms of matching the TTY device's ownership to that on the host, but I don't know if it solves your problem. I don't know if you figured it out already, but the strange ownership that you are seeing is related to the use of |
Right, but what we need is for the owner of the tty device on the host to be the user who started Before changing the ownership whenever I |
Yes, I understand. Right now I can think of a (crude?) way to fix this. |
I'm not sure if this can be done inside the container or if it needs to be done as part of container setup (i.e. |
If you have a new Otherwise, the |
Just wanted to bump this up as it is unfortunately still a problem as of toolbox version 0.0.99.2 (fedora silverblue 34). The If it does help, the ssh credentials dialog works normally. I tried unsetting both GPG_TTY and DISPLAY, but to no avail. |
Poked around a little bit more and found something interesting. I setup an empty git repo to test the issu. I found that this sequence of commands makes signing work inside the toolbox: [user@fedora:repo]$ git commit -S -m 'Test' # you can cancel this
[user@fedora:repo]$ toolbox enter
[user@toolbox:repo]$ git commit -S -m 'Test' # this will sign However this sequence will break signing both for the host and the toolbox: [user@fedora:repo]$ toolbox enter
[user@toolbox:repo]$ git commit -S -m 'Test' # this will fail
[user@toolbox:repo]$ exit
[user@fedora:repo]$ git commit -S -m 'Test' # this will fail Moreover, on my system the These findings make me think that this issue also involves |
what are the permissions in Is the container running with |
The container is running with
|
that seems correct. If I understand correctly though, you would like it to be owned by your ID? I've opened a PR for Podman to allow passing down more options like uid= and gid=: containers/podman#12124 so you'll be abe to do something like |
Maybe starting the container directly with the correct permissions will fix the error. Right now even with chowning after host$ gpgconf --kill gpg-agent # Make sure the agent is not running
host$ toolbox enter
toolbox$ sudo chown user:tty /dev/pts/0
toolbox$ git commit ... # doesn't work
toolbox$ exit
host$ git commit ... # still doesn't work This leads me to believe that this isn't simply a permission issue because, as I said in my previous comment, if the agent is started on the host then it correctly prompts for password. OP says that this was not a problem with |
I don't think it is correct though, could you give a try to the patch I've proposed for Podman? |
allow to pass down more options that are supported by the kernel. Discussion here: containers/toolbox#568 Signed-off-by: Giuseppe Scrivano <[email protected]>
Did some testing using podman main at commit 0686f0bb. Using I also tried passing |
Revisiting this one after a long time ...
Oh, I am sorry. I am an idiot. :) You wanted the owner of the (nested pseudo) terminal device on the host to be the user who started Sorry about that. Note that entering a container (ie., I think that one consequence of using: (which is commit 494007b6cadc5fe3 or #581) ... is that it separates the devices in The nested pseudo-terminal device inside the container gets created as The other consequence of that change is that the nested pseudo-terminal device inside the container gets created as @dustymabe Does this set-up help your
Except, with a separate Note that #1016 is about changing the ownership of the nested pseudo-terminal device inside the container to |
You can check if your container was created with:
... by looking at |
I spent some time debugging It seems to me that the That doesn't work at the moment because commit 494007b6cadc5fe3 or #581 mounted a separate Back when @dustymabe originally filed this issue, the containers didn't have their own Now, the host can't even see the device, so there's no ownership to be corrected. |
I filed containers/crun#1158 for some clarifications and advice. |
Sorry to intrude, but this seems related to a problem I'm having running distrobox/containerbox nested inside an LXC container, see:
|
I don't have much to contribute here, but i wanted to offer a decent workaround for anyone who, like myself, just wants to sign git commits within a
and having to run Since signing works as long as the |
@heyakyra, I'm not sure that's a sufficient workaround for the problem I experience. My gpg agent is always run from outside of When I am on my local system (i.e. |
I have no idea why this workaround works, but if you run this a few times in quick succession from within the toolbox (never works if just ran once): systemctl --user restart gpg-agent.socket Then for some reason the popup window in GNOME will start working, and I can put in my password for my GPG key I use to sign my git commits. $ rpm -q toolbox podman
toolbox-0.0.99.4-1.fc38.x86_64
podman-4.5.1-1.fc38.x86_64 |
Describe the bug
My setup includes running gpg-agent on my host and doing development (git commit, etc) inside my toolbox container. When I git-commit I sign the commits, which means the process talks to the agent that then runs a pinentry program to ask the user for the passphrase.
When running in the terminal I prefer for the passphrase to be asked to me in the terminal window and not in a popup. So I'll
unset DISPLAY
to force it to use the terminal window. This stopped working sometime in the past few months. I finally tracked down some more information on why.When running inside toolbox the permissions on my tty device are as expected:
However outside of toolbox (from the perspective of the host) the
permissions look odd:
I would expect the owner of the tty to be the user who launched the toolbox container (
1001
). If I change the ownership to the expected UID then my pinentry program appropriately asks for the passphrase on the same terminal window (inside toolbox) where I am runninggit commit
.I'm running Fedora 33 with:
Indeed if I go back to an old machine I haven't updated in a while I can see that the permissions are what I would expect them to be. This out of date machine has:
Steps how to reproduce the behaviour
ls -l $(tty)
. Should show up asroot
since you are inside a user namespace.The text was updated successfully, but these errors were encountered: