From 08e97e627a3271959a60ae9be20d9a8a4c42f9aa Mon Sep 17 00:00:00 2001 From: netblue30 Date: Sun, 18 Oct 2015 07:39:49 -0400 Subject: --hostname --- README | 7 ++++++- RELNOTES | 2 ++ src/firejail/firejail.h | 3 ++- src/firejail/main.c | 11 +++++++++-- src/firejail/usage.c | 3 ++- src/man/firejail.txt | 12 +++++++++++- 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/README b/README index c3690df7f..5956a6b89 100644 --- a/README +++ b/README @@ -18,6 +18,8 @@ License: GPL v2 Firejail Authors: netblue30 (netblue30@yahoo.com) +Loïc Damien (https://github.com/dzamlo) + - small fixes Matthew Gyurgyik (https://github.com/pyther) - rpm spec and several fixes greigdp (https://github.com/greigdp) @@ -36,7 +38,10 @@ sarneaud (https://github.com/sarneaud) - various enhancements and bug fixes Patrick Toomey (http://sourceforge.net/u/ptoomey/profile/) - user namespace implementation -Reiner Herrmann - a number of build patches, man page fixes, Debian integration +Reiner Herrmann + - a number of build patches + - man page fixes + - Debian and Ubuntu integration sshirokov (http://sourceforge.net/u/yshirokov/profile/) - Patch to output "Reading profile" to stderr instead of stdout G4JC (http://sourceforge.net/u/gaming4jc/profile/) diff --git a/RELNOTES b/RELNOTES index 4ca531138..d70deb21a 100644 --- a/RELNOTES +++ b/RELNOTES @@ -3,6 +3,8 @@ firejail (0.9.31) baseline; urgency=low * added --mtu option * added --private-bin option * added --nosound option + * added --hostname option + * added --quiet option * added seccomp errno support * added FBReader default profile * added Spotify default profile diff --git a/src/firejail/firejail.h b/src/firejail/firejail.h index 8260886a4..6a88d7e17 100644 --- a/src/firejail/firejail.h +++ b/src/firejail/firejail.h @@ -89,7 +89,8 @@ typedef struct config_t { char *overlay_dir; // networking - char *hostname; + char *name; // sandbox name + char *hostname; // host name uint32_t defaultgw; // default gateway Bridge bridge0; Bridge bridge1; diff --git a/src/firejail/main.c b/src/firejail/main.c index 3d3d43878..3d6d4cfb3 100644 --- a/src/firejail/main.c +++ b/src/firejail/main.c @@ -783,12 +783,19 @@ int main(int argc, char **argv) { // hostname, etc //************************************* else if (strncmp(argv[i], "--name=", 7) == 0) { - cfg.hostname = argv[i] + 7; - if (strlen(cfg.hostname) == 0) { + cfg.name = argv[i] + 7; + if (strlen(cfg.name) == 0) { fprintf(stderr, "Error: please provide a name for sandbox\n"); return 1; } } + else if (strncmp(argv[i], "--hostname=", 11) == 0) { + cfg.hostname = argv[i] + 11; + if (strlen(cfg.hostname) == 0) { + fprintf(stderr, "Error: please provide a hostname for sandbox\n"); + return 1; + } + } else if (strcmp(argv[i], "--nogroups") == 0) arg_nogroups = 1; else if (strcmp(argv[i], "--noroot") == 0) { diff --git a/src/firejail/usage.c b/src/firejail/usage.c index 8eda8208c..43e21433e 100644 --- a/src/firejail/usage.c +++ b/src/firejail/usage.c @@ -84,6 +84,7 @@ void usage(void) { printf("\t--env=name=value - set environment variable in the new sandbox\n"); printf("\t--help, -? - this help screen.\n\n"); + printf("\t--hostname=name - set sandbox hostname.\n\n"); printf("\t--interface=name - move interface in a new network namespace. Up to\n"); printf("\t\tfour --interface options can be sepcified.\n\n"); @@ -101,7 +102,7 @@ void usage(void) { printf("\t--list - list all sandboxes.\n\n"); printf("\t--mac=xx:xx:xx:xx:xx:xx - set interface MAC address.\n\n"); printf("\t--mtu=number - set interface MTU.\n\n"); - printf("\t--name=name - set sandbox hostname.\n\n"); + printf("\t--name=name - set sandbox name.\n\n"); printf("\t--net=bridgename - enable network namespaces and connect to this bridge\n"); printf("\t\tdevice. Unless specified with option --ip and --defaultgw, an\n"); printf("\t\tIP address and a default gateway will be assigned automatically\n"); diff --git a/src/man/firejail.txt b/src/man/firejail.txt index ae9d07bb8..e311c66b0 100644 --- a/src/man/firejail.txt +++ b/src/man/firejail.txt @@ -330,6 +330,16 @@ $ firejail \-\-env=LD_LIBRARY_PATH=/opt/test/lib Print options end exit. +.TP +\fB\-\-hostname=name +Set sandbox hostname. +.br + +.br +Example: +.br +$ firejail \-\-hostname=officepc firefox + .TP \fB\-\-interface=interface Move interface in a new network namespace. Up to four --interface options can be sepcified. @@ -454,7 +464,7 @@ $ firejail \-\-net=eth0 \-\-mtu=1492 .TP \fB\-\-name=name -Set sandbox hostname. Several options, such as \-\-join and \-\-shutdown, can use +Set sandbox name. Several options, such as \-\-join and \-\-shutdown, can use this name to identify a sandbox. .br -- cgit v1.2.3-70-g09d2