mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #5721] ssh: errors accessing shell file from /usr/share when using fish and mosh #3073
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#3073
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 @skrat on GitHub (Mar 8, 2023).
Original GitHub issue: https://github.com/netblue30/firejail/issues/5721
Description
I'm using mosh , it's running ssh and doing UDP mumbo jumbo, that's beyond this report. I'm also using fish shell (set in /etc/passwd). Now mosh is running ssh to do its thing. This is where firejail is invoked to run ssh. Somehow it needs to run user's shell in that process, but suddenly the files that need to be loaded from /usr/share/fish are not accessible because of some firejail rules. This results in fish spewing errors locally. I'm not sure what to do about it, what to whitelist, etc.
Related:
https://github.com/mobile-shell/mosh/issues/1262
Steps to Reproduce
Steps to reproduce the behavior
~/.config/fish/config.fishsuch as calls tofish_add_pathor just add somealias ll=ls -lmoshto a remote server (needs to havemoshinstalled and UDP ports accessible, see https://github.com/mobile-shell/mosh#how-it-works)Expected behavior
It would just connect, not complaining about unknown functions called in
~/.config/fish/config.fishActual behavior
Spews errors because functions are not loaded from
/usr/share/fishBehavior without a profile
What changed calling
LC_ALL=C firejail --noprofile /path/to/programin a terminal?Additional context
...
Environment
Checklist
/usr/bin/vlc) "fixes" it).https://github.com/netblue30/firejail/issues/1139)browser-allow-drm yes/browser-disable-u2f noinfirejail.configto allow DRM/U2F in browsers.--profile=PROFILENAMEto set the right profile. (Only relevant for AppImages)@kmk3 commented on GitHub (Mar 8, 2023):
Basic debugging information is missing; please follow the bug report template:
@skrat commented on GitHub (Mar 8, 2023):
@kmk3 updated description according to template, left out the last part (logs) as I don't find it relevant
@kmk3 commented on GitHub (Mar 8, 2023):
@skrat on Mar 8:
@skrat on Mar 8:
What are the errors?
Do they happen when invoking just ssh with firejail?
Example:
@skrat on Mar 8:
What is the output with
LC_ALL=en_US.UTF-8?@skrat commented on GitHub (Mar 8, 2023):
@kmk3
The errors are about missing functions (
aliasandfish_add_path) which are defined in files under/usr/share/fish.No it does not happen when using
ssh(firejailed) directly. So yes, this is probably a mosh thing (there is no profile yet).Yes it works as expected when I invoke
moshwithfirejail --noprofile.@kmk3 commented on GitHub (Mar 8, 2023):
ssh.profile has whitelist-usr-share-common.inc, so the following workaround
might fix the errors:
~/.config/firejail/ssh.local:
Though I think that ideally this would be fixed in mosh (why does it source
local auto-completion files when connecting to a server?) or maybe in a new
mosh.profile.
@ghost commented on GitHub (Mar 8, 2023):
The ssh profile includes
whitelist-usr-share-common.inc:0c00616634/etc/profile-m-z/ssh.profile (L23)But that included file doesn't whitelist /usr/share/fish, so you'll need at least that. What happens when you add
whitelist /usr/share/fishto ssh.local? You might have to create that file, either in ~/.config/firejail or /etc/firejail.Also, due to mosh not having a separate firejail profile there might be additional things going awry (include logic or otherwise) that we can't see wihout logs. I can understand that you don't find those relevant, but at least double-check everything on your side if the above doesn't fix things.
@skrat commented on GitHub (Mar 8, 2023):
Those are not just auto-completion functions, they are fairly core functions that are typically called from user's
config.fishsuch asalias. But this is getting weird, it doesn't make sense to whitelist user's shell specific/usr/shareresources in (not yet existing)mosh.profile? How about all the other shells?@skrat commented on GitHub (Mar 8, 2023):
Here's what's happening https://asciinema.org/a/4AitlLYB2xuA9qsYdNHoABBbI
@ghost commented on GitHub (Mar 8, 2023):
FWIW, I actually did create firejail profiles for
mosh,mosh-clientandmosh-servera long time ago when I was using mosh myself. If there's interest I could recover/dust those of and add them to the project. But that will take some time because I would at least have to re-test everything involved. That being said, basically they are simple redirects for ssh.profile. Not hard to create them yourself.@skrat commented on GitHub (Mar 8, 2023):
I think we need to find what exactly is running user's shell (fish in this case) and under what conditions. It seems it's not ssh, then it must be mosh, but why is it getting ssh.profile restrictions? When I
whitelist /usr/share/fishin.config/firejail/ssh.local, the errors go away.@kmk3 commented on GitHub (Mar 8, 2023):
@skrat on Mar 8:
But why would it (re-)source them locally? Does it re-spawn the user shell?
Presumably these files would already have been sourced by the current shell
locally and the remote shell would be sourcing things on the remote host.
This seems to be a quirk of mosh, so such whitelisting (including any other
shells) would be a workaround for it in mosh.profile.
But ideally we would first understand why it tries to do the sourcing.
It could also be added to whitelist-usr-share-common.inc, but it seems
unnecessary if only a single program would use it.
@kmk3 commented on GitHub (Mar 8, 2023):
@skrat on Mar 8:
/usr/local/bin usually takes precedence over /usr/bin in
$PATHand/usr/local/bin/ssh points to firejail, so
ssh->/usr/local/bin/ssh->firejail /usr/bin/ssh(seefirecfg(1)).@ghost commented on GitHub (Mar 8, 2023):
Here are my mosh profiles:
@ghost commented on GitHub (Mar 8, 2023):
I actually don't see anything that 'weird' here. The ssh profile that's being called simply doesn't whitelist /usr/share/fish. A local override can fix that without doing anything else IMO. But let's wait and see what happens when @skrat uses these referenced mosh profiles.
@skrat commented on GitHub (Mar 8, 2023):
Nothing happens with those profile, same error. There's still no explanation why locally spawned user shell is getting ssh.profile restrictions.
@eminence commented on GitHub (Mar 8, 2023):
I know nothing about fish or about firejail, but when you mosh into a remote server, the
mosh-serverprocess is initially launched by the sshd, and thenmosh-serverwill to the usual fork/daemonize dance and then spawn the user's default shell as a subprocess@ghost commented on GitHub (Mar 8, 2023):
@skrat
Good.
Seems to contradict the above. If
whitelist /usr/share/fishfixed the errors, it will/should do the same, whether you've placed that option in ssh.local or in mosh.profile.But there is an explanation:
(1) According to your opening post you've set your user to use fish shell in /etc/passwd.
(2) You're using firejail (probably also firecfg for desktop intehration).
(2) See https://github.com/netblue30/firejail/issues/5721#issuecomment-1460805718.
Please, I'm not intending to dispute what you're seeing, nor am I trying to be snug here. Based on what you've showed in this thread it all seems pretty straightforward. And fixable.