mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #5120] Unable to use tcpdump with -Z 'username' #2886
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#2886
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 @BogdanAriton on GitHub (Apr 26, 2022).
Original GitHub issue: https://github.com/netblue30/firejail/issues/5120
Description
I'm trying to use tcpdump with firejail.
The original command we were using was: .-s 0 -C 512 -W 1 -Z 'tcpdump'. -e -i int0 (where 'tcpdump' is a local user)
When running this with firejail I'm getting: tcpdump: Couldn't find user 'tcpdump'.
This makes sense as /etc/passwd wouldn't be present in the sandbox.
Steps to Reproduce
This happens on a centos 7.9.
This is how my tcpdump profile looks like:
The command is:
/usr/local/bin/firejail /usr/bin/tcpdump -s 0 -C 512 -W 1 -Z 'tcpdump' -e -i int0
Expected behavior
Is there some setting that I couldn't find that would be able to update the and empty /etc/passwd with just the needed user for tcpdump? (and this would happen only for tcpdump)
Actual behavior
Mentioned in the description.
Additional context
I'm adding the non-quite print out:
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)Log
Output of
LC_ALL=C firejail /path/to/programOutput of
LC_ALL=C firejail --debug /path/to/program@rusty-snake commented on GitHub (Apr 26, 2022):
Can you try with
allusers(IDK if this applies to /etc/passwd as well but it is my first idea).@BogdanAriton commented on GitHub (Apr 26, 2022):
Not sure what you mean
@rusty-snake commented on GitHub (Apr 26, 2022):
Run
firejail --allusers ...or addallusersto tcpdump.profile.@BogdanAriton commented on GitHub (Apr 26, 2022):
It seems to be the same issue (I've tried both):
I think there might be a problem because tcpdump is set as: 103:
tcpdump:x:103:103:TCPDump User:/:@rusty-snake commented on GitHub (Apr 26, 2022):
Then try it with
--noprofile(and if this does not help withnoprofile.profile) first.@kmk3 commented on GitHub (Apr 27, 2022):
@BogdanAriton commented on Apr 26:
What is the output of the following commands:
@BogdanAriton commented on GitHub (Apr 27, 2022):
Unfortunately I'm in a special case where I don't have getent on the box and I can't run most of them.
But I did run the --noprofile and it took on the tcpdump user - I can see that tcpdump managed to drop privilages to tcpdump:
Using --noprofile will ignore the current tcpdump.profile.
Perhaps there are some thing that I could do to improve the profile?
And also thank you both so much for the help thus far!
@rusty-snake commented on GitHub (Apr 27, 2022):
--noprofileworks this is good (and meansallusersis not needed)seccomp.32IDK why you even want to just it, but you can not use it if tcpdump should switch users.
@BogdanAriton commented on GitHub (Apr 27, 2022):
I commented out the seccomp.32 line - but I've removed
--noprofileand added backallusers- which brings me back to the same issue. (I don't think I fully understand how this works.)@rusty-snake commented on GitHub (Apr 27, 2022):
Remove
seccomp.32andmemory-deny-write-execute(allusersis not needed).@BogdanAriton commented on GitHub (Apr 27, 2022):
OK, I just did. (tcpdump: Couldn't find user 'tcpdump')
By the way, tcpdump can also take as parameter a filename for the content of the dump, I've also tried to
whitelistthe original location of that file (original in the sense of, before trying to jail tcpdump):whitelist /home/runtime/tcpdumpI test this by temporarily removing the user parameter and for some reason tcp dump comes back with:
tcpdump: /home/runtime/tcpdump/tcpdump.dump: No such file or directoryI could open up a different thread for this problem if needed.
@rusty-snake commented on GitHub (Apr 27, 2022):
/home/not-you/...visible/accessible, you needallusers.So removing
seccomp.32andmdweisn't enough? Can you then just comment line until it works to find the problem.@BogdanAriton commented on GitHub (Apr 27, 2022):
/homeis not equal to~in this case, it's just a dir, and by default the user running the process has access. The user that runs the process has it's home defaulted to/.So basically whitelisting
/homeit's like whitelisting/somedirin this case.This is how the tcpdump.profile looks now (I'll try to remove things one by one to see where the problem resides):
@rusty-snake commented on GitHub (Apr 27, 2022):
Don't know how firejail behaves if
~ == /.Whitelisting a top level dir make no sense and
/homemight still be special.@BogdanAriton commented on GitHub (Apr 27, 2022):
I found out my mistake:
/home/runtime was actually a symbolic link to /data/runtime
Once I've whitelisted /data/runtime everything worked! (Note here that I'm not passing in the -Z username)
The username issue still exists.
@rusty-snake commented on GitHub (Jun 8, 2022):
I'm closing here due to inactivity, please fell free to request to reopen if you still have this issue.