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
WIP: Gpg agent support #3446
base: main
Are you sure you want to change the base?
WIP: Gpg agent support #3446
Conversation
Creates a --socket flag that allows access to the host gpg-agent. Related to flatpak#2301
Can one of the admins verify this patch?
|
According to containers/bubblewrap#346 bubblewrap changes are required for the chmod issue. |
flatpak_bwrap_add_args (bwrap, | ||
"--ro-bind", agent_socket, sandbox_agent_socket, | ||
NULL); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general we try to avoid external dependencies as much as possible, and getting the gpg socket directory is pretty easy:
https://github.com/gpg/gnupg/blob/0904b8ef348a52335c378bee6dc90a978885d66f/common/homedir.c#L566
So, i would prefer if we hand roll similar code to find the directory rather than shelling out.
I'm not an expert on GPG, so I have some questions:
|
I'm not an expert either;
To be honest, I'm also not sure if this is the best approach to solve this, but:
I think I'll write a mail to the gpg mailinglist asking for some advice, as long as containers/bubblewrap#346 isn't fixed (or gpgme looses it's requirements) we anyways can't really ship this solution. |
About compatibility, the gpg agent is able to tell when the socket/server is completely different (which is the case when using centos7 on the host and fedora as client) and refuse to function. Small version differences (e.g. patch versions) will produce a warning but from my experience work completely fine. |
I've looked into adding gpg-agent access, but this will require some work still.
This patch mounts the gpg-agent-extra socket (https://jlk.fjfi.cvut.cz/arch/manpages/man/gpg-agent.1 see the --extra-socket option) with has a reduced command set (so arguably more secure), but still allows for encryption & signing as a proof of concept. We may want to add two flags for gpg-agent and gpg-agent-extra (I think being able to do key-management from a flatpak'd app is a valid usecase as well.)
For gpg to work as expected inside the container it is still required to "chmod 700 /run/user/1000/gnupg", which I have failed to do from flatpak so far (doesn't look like bubblewrap has the necessary options?)
I'd like to get some feedback on whether this approach has potential to be accepted, and if yes some guidance with the chmod part above. I would then also add both the gpg-agent and gpg-agent-extra flags (if you agree)
For the usecase: I have an email application that uses gpgme. Currently I'm starting a gpg-agent inside the container, which means the agent has to be unlocked every time I open the application.
By using the system gpg-agent this can be avoided and the agent only needs to be unlocked once.