aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-04-07 07:32:27 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2016-04-07 07:32:27 -0400
commitee604df6d6963af146244c28deb3a650306fa80c (patch)
tree813bd7c3863751ebc3a3fb76755d47947fb7549b /src
parentMerge pull request #416 from avoidr/minor_profile.c_change (diff)
parentfirejail-profile.txt: add --net <iface> (diff)
downloadfirejail-ee604df6d6963af146244c28deb3a650306fa80c.tar.gz
firejail-ee604df6d6963af146244c28deb3a650306fa80c.tar.zst
firejail-ee604df6d6963af146244c28deb3a650306fa80c.zip
Merge pull request #415 from avoidr/add_net_to_profiles
profile.c: add --net <iface>
Diffstat (limited to 'src')
-rw-r--r--src/firejail/profile.c28
-rw-r--r--src/man/firejail-profile.txt24
2 files changed, 50 insertions, 2 deletions
diff --git a/src/firejail/profile.c b/src/firejail/profile.c
index ec1bd5ee3..22d6beb56 100644
--- a/src/firejail/profile.c
+++ b/src/firejail/profile.c
@@ -232,6 +232,34 @@ int profile_check_line(char *ptr, int lineno, const char *fname) {
232#endif 232#endif
233 return 0; 233 return 0;
234 } 234 }
235 else if (strncmp(ptr, "net ", 4) == 0) {
236#ifdef HAVE_NETWORK
237 if (checkcfg(CFG_NETWORK)) {
238 if (strcmp(ptr + 4, "lo") == 0) {
239 fprintf(stderr, "Error: cannot attach to lo device\n");
240 exit(1);
241 }
242
243 Bridge *br;
244 if (cfg.bridge0.configured == 0)
245 br = &cfg.bridge0;
246 else if (cfg.bridge1.configured == 0)
247 br = &cfg.bridge1;
248 else if (cfg.bridge2.configured == 0)
249 br = &cfg.bridge2;
250 else if (cfg.bridge3.configured == 0)
251 br = &cfg.bridge3;
252 else {
253 fprintf(stderr, "Error: maximum 4 network devices are allowed\n");
254 exit(1);
255 }
256 net_configure_bridge(br, ptr + 4);
257 }
258 else
259 fprintf(stderr, "Warning: networking features are disabled in Firejail configuration file\n");
260#endif
261 return 0;
262 }
235 263
236 if (strncmp(ptr, "protocol ", 9) == 0) { 264 if (strncmp(ptr, "protocol ", 9) == 0) {
237#ifdef HAVE_SECCOMP 265#ifdef HAVE_SECCOMP
diff --git a/src/man/firejail-profile.txt b/src/man/firejail-profile.txt
index b135ee615..ddfae5948 100644
--- a/src/man/firejail-profile.txt
+++ b/src/man/firejail-profile.txt
@@ -296,10 +296,30 @@ If a new network namespace is created, enabled default network filter.
296If a new network namespace is created, enabled the network filter in filename. 296If a new network namespace is created, enabled the network filter in filename.
297 297
298.TP 298.TP
299\fBnet bridge_interface
300Enable a new network namespace and connect it to this bridge interface.
301Unless specified with option \-\-ip and \-\-defaultgw, an IP address and a default gateway will be assigned
302automatically to the sandbox. The IP address is verified using ARP before assignment. The address
303configured as default gateway is the bridge device IP address. Up to four \-\-net
304bridge devices can be defined. Mixing bridge and macvlan devices is allowed.
305
306.TP
307\fBnet ethernet_interface
308Enable a new network namespace and connect it
309to this ethernet interface using the standard Linux macvlan
310driver. Unless specified with option \-\-ip and \-\-defaultgw, an
311IP address and a default gateway will be assigned automatically
312to the sandbox. The IP address is verified using ARP before
313assignment. The address configured as default gateway is the
314default gateway of the host. Up to four \-\-net devices can
315be defined. Mixing bridge and macvlan devices is allowed.
316Note: wlan devices are not supported for this option.
317
318.TP
299\fBnet none 319\fBnet none
300Enable a new, unconnected network namespace. The only interface 320Enable a new, unconnected network namespace. The only interface
301available in the new namespace is a new loopback interface (lo). 321available in the new namespace is a new loopback interface (lo).
302Use this option to deny network access to programs that don't 322Use this option to deny network access to programs that don't
303really need network access. 323really need network access.
304 324
305.TP 325.TP