[GH-ISSUE #1085] option to expose only whitelisted ip:port:protocol into the sandbox #739

Closed
opened 2026-05-05 06:33:09 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @ibukanov on GitHub (Jan 31, 2017).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1085

To restrict the sandbox networking it is nice to allow for the sandbox to reach only single ip:port:protocol outside the sandbox. My use case is to expose http proxy running on my laptop into the sandbox so the only connection to the outside world is through this proxy.

Currently it is possible with --netns and custom iptable rules, but that requires root.

Originally created by @ibukanov on GitHub (Jan 31, 2017). Original GitHub issue: https://github.com/netblue30/firejail/issues/1085 To restrict the sandbox networking it is nice to allow for the sandbox to reach only single ip:port:protocol outside the sandbox. My use case is to expose http proxy running on my laptop into the sandbox so the only connection to the outside world is through this proxy. Currently it is possible with --netns and custom iptable rules, but that requires root.
gitea-mirror 2026-05-05 06:33:09 -06:00
Author
Owner

@netblue30 commented on GitHub (Feb 1, 2017):

I would try a setup similar to this one: https://firejail.wordpress.com/documentation-2/basic-usage/#routed

  1. Create a bridge and set an IP address:
$ sudo brctl addbr br0
$ sudo ifconfig br0 10.10.20.1/24
  1. Make sure the bridge traffic is not routed on the network outside:
$ sudo echo "0" > /proc/sys/net/ipv4/ip_forward
  1. Start a http proxy on 10.10.20.1

  2. You also need a DNS proxy on 10.10.20.1. If you are running on Ubuntu, you already have one - it is probably listening only on 127.0.0.1, so you'll have to reconfigure it.

  3. Start the sandbox:

$ firejail --net=br0 firefox
<!-- gh-comment-id:276652305 --> @netblue30 commented on GitHub (Feb 1, 2017): I would try a setup similar to this one: https://firejail.wordpress.com/documentation-2/basic-usage/#routed 1. Create a bridge and set an IP address: ````` $ sudo brctl addbr br0 $ sudo ifconfig br0 10.10.20.1/24 ````` 2. Make sure the bridge traffic is not routed on the network outside: ````` $ sudo echo "0" > /proc/sys/net/ipv4/ip_forward ````` 3. Start a http proxy on 10.10.20.1 4. You also need a DNS proxy on 10.10.20.1. If you are running on Ubuntu, you already have one - it is probably listening only on 127.0.0.1, so you'll have to reconfigure it. 5. Start the sandbox: ````` $ firejail --net=br0 firefox `````
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/firejail#739
No description provided.