mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #1616] Firejail breaks the ssh-agent launch semantics #1083
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#1083
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @lhernanz on GitHub (Oct 25, 2017).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1616
Hi,
the most common way of launching ssh-agent is by using:
That works because ssh-agent prints the environment information before getting into background. Unfortunately, when using the firejail profile this is not the case and the process just blocks as it never gets into background. This breaks some of the most common shell launch scripts and some programs like ssh-ident.
If you try to solve this by putting firejail in the background, the problem is that you miss the information that is sent to the terminal before getting into the background. You can try to fix this by using the
--outputoption in firejail, but you still need to use an sleep to get the output in the file. A hack on top of a hack.Wouldn't be possible for firejail to detect that the controlled process has got into the background so that it could imitate the same behavior? Is there any other way to simulate this?
I think that firejail is a great addition to ssh-agent. It would be a pity not to be able to use it.
Thanks
Regards
@Adrianzo commented on GitHub (Nov 3, 2017):
I'm having the same trouble. Played around a little bit with the profile but got only pain and no gains 😝
@Adrianzo commented on GitHub (Dec 14, 2017):
any news on this?
@laomaiweng commented on GitHub (May 9, 2019):
I have a workaround for this issue. Basically if an agent is not already running, I do the following in my
~/.bashrc:The idea is that I don't let the agent decide the path to its socket, this way I don't need it to tell me where it is.
As for the PID,
$!is actually the PID of the parent Firejail process, which will die when the shell exits. This is not really an issue as the PID is only ever used to signal the agent, which usually doesn't happen. However, to provide the actualssh-agentPID to other shells, I just spawn a background subshell that waits for the agent to be up and running, gets its PID, and substitutes it in the environment file:This is a bit convoluted, but mostly unnecessary anyways. I have it just for the sake of completeness. :)
The problem remains that the agent isn't available right after the command runs and is put in the background. However, for interactive use, that's not really an issue.
@chiraag-nataraj commented on GitHub (May 29, 2019):
I'm going to mark this with "workaround" and close this for now. @lhernanz, please feel free to re-open if you have more questions or if the workaround does not work for you.