mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #422] private-bin doesn't use /usr/local/bin #305
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#305
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 @ghost on GitHub (Apr 9, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/422
And that's a cool thing, except that it doesn't seem to should do this, because
/usr/local/binisn't infs_bin.c's paths array.What I wanted to do is private-bin a program that only resides in my /usr/local/bin and not any of those in the paths array. So that program naturally wasn't found and firejail told me that it's ignoring private-bin for that reason.
So I added /usr/local/bin to the paths array and it worked.
At the same time I noticed something weird. I have another program in both /usr/bin and /usr/local/bin. Before I made any changes to the array, the program from /usr/local/bin was copied to the new bin dir. When I added /usr/local/bin, the version from /usr/bin was copied.
Again;
/usr/local/binin paths, but/usr/local/binversion was used, while debug said/usr/bin. (woot)/usr/local/binappended,/usr/binversion was used, debug says/usr/bin. (correct)/usr/local/binprepended,/usr/local/binversion was used, debug says/usr/local/bin, too. (correct)@ghost commented on GitHub (Apr 9, 2016):
Now I see that you already append paths from the PATH variable, but they are two different paths variables.
@ghost commented on GitHub (Apr 9, 2016):
And now I know why it copies
/usr/binand still uses the/usr/local/binversion./usr/local/binis not modified, except when I add/usr/local/binto the paths variable, then it's the same as/usr/bin.So without modifying the paths variable, there are still both versions (and my $PATH prefers
/usr/local/bin).I hope this makes enough sense. I'll play around with it a little more later.
@netblue30 commented on GitHub (Apr 9, 2016):
I'll look into it, thanks.
@netblue30 commented on GitHub (Apr 12, 2016):
I added /usr/local/bin in the list in the first position. It will take precedence over /usr/bin or /bin.
@ghost commented on GitHub (Apr 12, 2016):
Main problem confirmed fixed.
What about
paths.c:78andfs.c:504,509? Does anything need to be adjusted there, too? Just making sure nothing is forgotten.Now, the fix is static priority. Would it be good to build the paths from $PATH, too? So that user's preferences are honored still. Also considering that $PATH may have a directory in $HOME.
@ghost commented on GitHub (Apr 12, 2016):
There is also /usr/local/sbin and that's why I think it would be good to use $PATH.
@netblue30 commented on GitHub (Apr 12, 2016):
Yes, I added /usr/local/sbin to the list. We cannot allow $PATH in this case, because this will let the user replace system executables with his own version, and take advantage of SUID to attack the system. We can allow only directories owned by root user.
@ghost commented on GitHub (Apr 12, 2016):
My main idea was to use $PATH to get the directory priorities as the user wishes, while ignoring $HOME binaries.
@netblue30 commented on GitHub (Apr 13, 2016):
We know about $HOME, but the user can sneak in files from some other places, and it is difficult to process correctly in a SUID executable. This is why I went for a fixed order, with /usr/local/bin before /usr/bin and /bin.
@ghost commented on GitHub (Apr 13, 2016):
Then how about using $PATH to only get the correct order of known paths (those we already have hardcoded), and not including new, foreign paths?
@netblue30 commented on GitHub (Apr 14, 2016):
Sure, I'll put it in.
@ghost commented on GitHub (Apr 14, 2016):
Awesome.
With /usr/local/bin in I can also contribute suckless.org tools profiles, since those are ideally compiled from source. That's how I found that issue, too.
@netblue30 commented on GitHub (Apr 15, 2016):
Sure, I'll put it in over the weekend.