mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #1518] ControlSocket failed behaviour with ssh #1014
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#1014
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 @xundeenergie on GitHub (Sep 2, 2017).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1518
Hi there!
I want to git push my repo to github.com, and i have ssh in firejail with standard-profile.
git hangs in case of hanging ssh.
ssh has a ControlMaster for multiplexed ssh-connections. And i have more than one github-repo which i update in a script one after another. So a Control-Socket is a good way, to reuse the connection.
With firejail, the first connection starts the ControlSocket, and the ssh-session for the ControlSocket (the Master) stays in foreground, so the first ssh-process stays in foreground and github cannot come to an end, because it waits for a finnished ssh-process.
If i start in another terminal another git push, it will finnish as expected.
I also can start a "ssh git@github.com" in a second terminal first, then my script with severals git push-comands will finnish.
My ~/.ssh/config contains:
But i don't know, if there is an option to send the master-connection to background.
Without firejail, the multiplexed connections will run without problems, the master connection goes to background.
@chiraag-nataraj commented on GitHub (Aug 23, 2018):
@xundeenergie Is this still an issue?
@SkewedZeppelin commented on GitHub (Aug 23, 2018):
@chiraag-nataraj I think I encountered this a while ago, but ended up disabling the feature for other reasons.
@chiraag-nataraj commented on GitHub (Aug 23, 2018):
Hmm okay. Lemme try this in my VM and report back.
@chiraag-nataraj commented on GitHub (Aug 23, 2018):
I did a different test for various reasons:
sudo ln -s /usr/local/bin/firejail /usr/local/bin/sshsshfs user@hostname /path/to/mountpointsshis being run through firejail withfirejail --list(it is)ssh user@hostnameto test if the connection is reusedIt seems like the connection is re-used, and
sshis backgrounded by thesshfsprocess. I don't know if this is completely equivalent to the scenario listed here though?@chiraag-nataraj commented on GitHub (Aug 24, 2018):
So I followed the same process with
gitand had no issues. I linked/usr/local/bin/ssh -> /usr/local/bin/firejailand rangit pushnormally and didn't run into any issues. I'm going to close this for now, but @xundeenergie, please feel free to re-open if you still have this issue.@mtth-bfft commented on GitHub (Sep 30, 2019):
@chiraag-nataraj Issue is 100% reproducible, and could be renamed "Firejail makes ssh with control sockets hard to use (and breaks Ansible)". For example, see the time it takes to get a prompt back, corresponding to the control process timeout:
From what I was able to understand, the problem is actually "by design": when SSH uses control sockets and the first connection is closed, the ssh client forks in the background to keep the TCP connection and a unix socket alive. This prevents firejail from detecting that the sandbox can be thrashed (there's still a process in it), and hangs until the control socket expires and the background process dies, which can take forever depending on SSH's config and whether the control sockets are used, prolonging the master process' life.
The problem is, you might get around the problem with individual sandboxed SSH sessions by letting them die in a terminal slowly (still, poor UX), but Ansible completely fails due to these timeouts, which forces Ansible users to disable ssh sandboxing (which is a bad thing). For example:
I see two possible types of "fixes" here:
ssh.profile, and ideally find a way to detect when SSH is started by Ansible to display that message, or disable the sandbox altogether 😢@jose1711 commented on GitHub (Jun 17, 2020):
This problem was driving me nuts thus I decided to disable
firejailfor Ansible'ssshcompletely:ansible.cfg:Another option (w/o disabling
firejail) is to turn offControlPersistoption:But for me it had some negative side-effects.
@itoffshore commented on GitHub (Oct 31, 2021):
To help people running
ansiblesearching the web for this error:the first fix above works if you are running
firejail- except do not quote the path:@marek22k commented on GitHub (Jan 10, 2023):
Reported in ansible, but closed: https://github.com/ansible/ansible/issues/79702