mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #2698] firejailed ssh tunnel not authenticated #1700
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#1700
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 @rieje on GitHub (May 16, 2019).
Original GitHub issue: https://github.com/netblue30/firejail/issues/2698
I use Syncthing and want to access the remote GUI via ssh tunneling. I have the following shell function:
It works if I don't firejail it (i.e.
/usr/bin/ssh); but doesn't work when jailed (i.e./usr/local/binssh). It won't authenticate the ssh session (I just see the randomart image until it times out). Canceling it (Ctrl+c) will launch Firefox but the remote web GUI is not connected, obviously.I did do some trial and error with
/etc/firejail/ssh.profilebut have no success. Is this just a simple whitelist of some setting or is it not worth the effort to jail (which is unfortunate)?@ghost commented on GitHub (May 16, 2019):
@rieje Have you tried to debug authentication issues using ssh's -v option? Showing debug log(s) here would be more informative to see what's actually happening. You can use something like:
$ firejail --debug /usr/bin/ssh -v -fNT -L 9999:localhost:8384 -o "ControlMaster auto" -o "ControlPath /tmp/syncthing-%u@%n.socket" pi | tee debug.log 2>&1@rusty-snake commented on GitHub (May 16, 2019):
firejail sh -c "sleep 1m &"didn't go in background. Not sure how firejail handel stdin/out and fg/bg.@rieje commented on GitHub (May 17, 2019):
@glitsj16 Here's the output. Actually, it doesn't timeout, so i did
ctrl+c. Also, there's stout to terminal not shown on debug.log if that's relevant:So seems like problem with socket.
@ghost commented on GitHub (May 17, 2019):
Deprecated option can be safely removed from /home/gcheng/.ssh/config
Try using a socket path that's guaranteed to be accessible with firejail, e.g. ~/.ssh/syncthing-%u@%n.socket.
@rieje commented on GitHub (May 17, 2019):
Same issue, unfortunately.
@ghost commented on GitHub (May 17, 2019):
@rieje I use SSH tunneling (for other purposes than syncthing) with firejail succesfully and reliably, so it is possible. Just keep experimenting with it. Personally I always disable sockets by using
ControlPath noneand use firejail --shutdown=foo to kill the SSH session (with a fallback using pkill). Here's an example of how your shell function could look like:@rieje commented on GitHub (May 19, 2019):
Hmm, just tried and still the same problem/output, bizarre.
@ghost commented on GitHub (May 20, 2019):
@rieje What OS and firejail version are you seeing this on? The current ssh.profile contains
noblacklist /tmp/ssh-*, so using a ControlPath like /tmp/ssh-syncthing-%u@%n.socket should work. Leaving aside the shell function for now, can you report output of the below commands:@rieje commented on GitHub (May 22, 2019):
I am on Arch Linux and firejail is on version 0.9.58.2-1.
First command (with ssh verbose option) output. I see the host key fingerprint and that's it until I kill the process with
Ctrl+c.Second command (with ssh verbose option) output. Same thing--I see host key fingerprint and that's it until I kill the process.
Without firejail,
/usr/bin/ssh -fMNT -L 9999:localhost:8384 piis same thing, but after killing withCtrl+c,pidof sshshows process still exists.@ghost commented on GitHub (May 25, 2019):
@rieje Looks like the firejail tunnel is working. Have you tried using a systemd user unit yet to control the tunnel? Something like the below can be placed under ~/.config/systemd/user as sshtunnel.service:
From your shell function I infer you don't want to have the tunnel running all the time, so you don't have to enable the service. Alternatively you could look into sshtunnel, which is in the AUR. Once you have the file set up, you can do the following:
After testing the remote Syncthing GUI like that you could integrate those commands into your shell function.
@rieje commented on GitHub (May 25, 2019):
Just tried it and it works. Any particular reason for
RemainAfterExit=yesout of curiosity? Want to keep it as simple as possible.Works great, much appreciated. Still don't know why the original function isn't running, but this seems simpler anyway. Feel free to close this issue if you want.
@ghost commented on GitHub (May 25, 2019):
@rieje Happy to see you've got it working now. My guess the original shell function hangs because the first ssh command isn't backgrounded. SSH is backgrounded, but not the shell command itself. If you would like to test, just for the fun of it, try putting a
&afterpiand add asleep 2(or something appropriate to wait untill the tunnel is running) before starting firefox.About the
RemainAfterExit=yes. That's totally my own preference, I forgot to mention that. I seem to be conditioned to the green/red colored output of systemd status commands to spot errors at a glance. You can safely take that out. I'll close the issue, but feel free to re-open if something turns up during daily use of the tunnel.