mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3439] How to block all internet except 127.0.0.1 localhost #2161
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#2161
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 @hiBrett on GitHub (May 28, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3439
Is there any way to block a sandboxed program from all internet access except specifically allow access to 127.0.0.1 localhost?
I'm working on having a node.js server run side by side with a sandboxed program, and I want them to communicate.
The documentation mentions adding a bridge under 4.2 Routed Network Setup, but I don't understand how to make that work for this purpose, or if it would work for this purpose.
Relates to:
@ghost commented on GitHub (May 28, 2020):
Have you tried the
--net=noneoption? Or--protocol=unixif the former crashes the application. If either of those does what you want, you can put the relevant option into a foo.local file, which (1) you will have to create and which (2) uses a slightly different syntax:net noneorprotocol unix.@rusty-snake commented on GitHub (May 28, 2020):
FWIW: #108
There are two ways bridge (
net) or iptables (netfilter).@glitsj16
net=nonehas its ownlointerface, and therefore its own 127.0.0.1. andprotocol unixbreak IPv4/Ipv6 sockets.@rusty-snake commented on GitHub (Sep 1, 2020):
I'm closing here due to inactivity, please fell free to request to reopen if you have more questions.
@jgsch commented on GitHub (Jun 21, 2021):
@rusty-snake
it means, for example, the adress
127.0.0.1:9095does not point to the same thing if I am in a firejail or not? If yes, so I need to use--netfilterto make a bridge between127.0.0.1:9095(host) and127.0.0.1:9095(firejail)?@rusty-snake commented on GitHub (Jun 21, 2021):
If you use
--net=none, yes.Nope.
--netfilteris use iptables. Depending on what you want use--net=tap0/--net=br0or just drop all--net=commands.@jgsch commented on GitHub (Jun 23, 2021):
But if I do that, the process can communicate with the outside.
My goal is the same as OP, I want to remove internet access to a process but it still need to update a redis database so I need to keep access to locahost.
So from what I understand, there is two possibilities:
--netfilterwith an iptable to restrict all network access except for localhost (no need of--netin this case)--net(I'm new with all this networking stuff and it's a little bit hard to assimilate all these new things)
@rusty-snake commented on GitHub (Jun 23, 2021):
right two possibilities:
--netfilterto block everything ecept127.0.0.1(--netfilterrequires--net)--netwith a bridge or tap iface (or--netns)@miloslavnosek commented on GitHub (Dec 1, 2024):
I'm very sorry for commenting on an old issue, however I'm facing this exact problem. I want to run a next.js server on my local machine and completely cut off from the internet, but since it's a server, I need to be able to access it from the localhost.
simply using
--net=nonedoes cut it off from the internet, but it also prevents me from being able to access the server from my browser.I've been researching firejail, but I don't understand these suggestions. Could anyone please provide me with an example?
@rusty-snake commented on GitHub (Dec 2, 2024):
--join-network=could do the trick in your case. Run a second browser instance in the network namespace of your server.@l8l commented on GitHub (Mar 23, 2025):
I also need this feature. Running a local database that I want to query with a program that must otherwise be cut off from the internet. Is there a way to do this already or any progress?
@kmk3 commented on GitHub (Mar 23, 2025):
Re-closing as "not planned" since this is a duplicate of:
@keesj commented on GitHub (Feb 17, 2026):
This appears to be such a basic question for a program called a jail (specially in these days of programs wanting to access the internet) .