mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #645] "netfilter" enabled by default #450
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#450
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 (Jul 24, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/645
Since I have my own custom rules for iptables, I decided to edit each profile in /etc/firejail and remove the "netfilter" entries for each one of them. Then I stumped upon "nolocal" which is where the rules are stored.
So instead of removing every "netfilter" line from the profiles, would simply making the "nolocal" file blank suffice to make the applications follow my global iptables rules?
@netblue30 commented on GitHub (Jul 24, 2016):
When a new network namespace is created, it doesn't automatically inherit netfilter configuration from the main network namespace. Instead, netfilter in the new namespace has an empty configuration - all traffic allowed.
This is what I can do:
When starting the sandbox as a user, most profiles will set a netfilter configuration hardcoded in the program. I can add an entry in /etc/firejail/firejail.config and allow you to overwrite this default configuration with one you specify, something like:
Will this work for you?
@ghost commented on GitHub (Jul 24, 2016):
Wouldn't that be a redundancy? Because the system is already using a system-wide configuration at /etc/iptables/iptables.rules, regardless if the program is ran via firejail or not [1]. The same would happen if the user runs ufw or similar programs.
I think a configuration like "netfilter-handling=none" in /etc/firejail/firejail.conf that would override any "netfilter" entry on the profiles would be more appropriate, making the program unable to do anything firewall related (dealing only with the sandbox part).
But to be honest, I think the perfect solution would be asking (via CLI, upon installing firejail) if the user wants firejail to handle iptables. Something like this:
[1] https://raw.githubusercontent.com/amarildojr/Firewall/master/rules
@netblue30 commented on GitHub (Jul 24, 2016):
No, the kernel doesn't care about system wide configuration rules. Every time it creates a network namespace, the filter is empty. So, when you create the namespace, you need to tell the kernel everytihing: IP addresses, default gateway and netfilter configuration.
@ghost commented on GitHub (Jul 24, 2016):
So it would be OK to use "default-netfilter" and point it to "/etc/iptables.iptables.rules"?
Or is it simpler to edit the "nolocal.net" file and set it as an exact copy of my iptables.rules?
Whichever is easier for both of us, please let me know :)
@netblue30 commented on GitHub (Jul 24, 2016):
Yes, you'll be able to use "default-netfilter" and point it to "/etc/iptables/iptables.rules", and it will be global over the system. As soon as firejail starts, it will load it. I'll have the fix in the next few days, it is very easy, and I think it could be useful to some other people.
@ghost commented on GitHub (Jul 24, 2016):
Thank you! :D
@ghost commented on GitHub (Jul 24, 2016):
BTW, what will happen to "nolocal.net"? It can simply stay there?
@netblue30 commented on GitHub (Jul 25, 2016):
People still can use it: "firejail --net=eth0 --netfilter=/etc/firejail/nolocal.net firefox" and you get a browser without access on the local network. If somebody breaks into the browser, there will be no connectivity on the local network.
@netblue30 commented on GitHub (Jul 28, 2016):
All set in git, you can try it.
@ghost commented on GitHub (Jul 29, 2016):
Thanks, but it didn't work for me.
This is the "off.rules" I'll be referencing on firejail.conf:
Firejail.conf:
It seems that firejail can't override what is already being managed by iptables.service, which loads my "out.conf" (see my Firewall repo).
@netblue30 commented on GitHub (Jul 29, 2016):
How do you start the sandbox? Are you using --net command?
@ghost commented on GitHub (Aug 10, 2016):
Sorry for the late reply.
I had forgotten about that switch. It works :)
Thank you a lot for listening the community and implementing features so quickly. Not a lot of developers do that.
Cheers!
@netblue30 commented on GitHub (Aug 10, 2016):
No problem, let me know if you need anything else, at this point new features are easy to add.