diff options
author | netblue30 <netblue30@yahoo.com> | 2015-10-18 07:39:49 -0400 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2015-10-18 07:39:49 -0400 |
commit | 08e97e627a3271959a60ae9be20d9a8a4c42f9aa (patch) | |
tree | f1da8440396d117db8742b877b512a641748a40d /src | |
parent | Merge pull request #85 from dzamlo/dzamlo-patch-1 (diff) | |
download | firejail-08e97e627a3271959a60ae9be20d9a8a4c42f9aa.tar.gz firejail-08e97e627a3271959a60ae9be20d9a8a4c42f9aa.tar.zst firejail-08e97e627a3271959a60ae9be20d9a8a4c42f9aa.zip |
--hostname
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/firejail.h | 3 | ||||
-rw-r--r-- | src/firejail/main.c | 11 | ||||
-rw-r--r-- | src/firejail/usage.c | 3 | ||||
-rw-r--r-- | src/man/firejail.txt | 12 |
4 files changed, 24 insertions, 5 deletions
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 { | |||
89 | char *overlay_dir; | 89 | char *overlay_dir; |
90 | 90 | ||
91 | // networking | 91 | // networking |
92 | char *hostname; | 92 | char *name; // sandbox name |
93 | char *hostname; // host name | ||
93 | uint32_t defaultgw; // default gateway | 94 | uint32_t defaultgw; // default gateway |
94 | Bridge bridge0; | 95 | Bridge bridge0; |
95 | Bridge bridge1; | 96 | 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) { | |||
783 | // hostname, etc | 783 | // hostname, etc |
784 | //************************************* | 784 | //************************************* |
785 | else if (strncmp(argv[i], "--name=", 7) == 0) { | 785 | else if (strncmp(argv[i], "--name=", 7) == 0) { |
786 | cfg.hostname = argv[i] + 7; | 786 | cfg.name = argv[i] + 7; |
787 | if (strlen(cfg.hostname) == 0) { | 787 | if (strlen(cfg.name) == 0) { |
788 | fprintf(stderr, "Error: please provide a name for sandbox\n"); | 788 | fprintf(stderr, "Error: please provide a name for sandbox\n"); |
789 | return 1; | 789 | return 1; |
790 | } | 790 | } |
791 | } | 791 | } |
792 | else if (strncmp(argv[i], "--hostname=", 11) == 0) { | ||
793 | cfg.hostname = argv[i] + 11; | ||
794 | if (strlen(cfg.hostname) == 0) { | ||
795 | fprintf(stderr, "Error: please provide a hostname for sandbox\n"); | ||
796 | return 1; | ||
797 | } | ||
798 | } | ||
792 | else if (strcmp(argv[i], "--nogroups") == 0) | 799 | else if (strcmp(argv[i], "--nogroups") == 0) |
793 | arg_nogroups = 1; | 800 | arg_nogroups = 1; |
794 | else if (strcmp(argv[i], "--noroot") == 0) { | 801 | 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) { | |||
84 | printf("\t--env=name=value - set environment variable in the new sandbox\n"); | 84 | printf("\t--env=name=value - set environment variable in the new sandbox\n"); |
85 | 85 | ||
86 | printf("\t--help, -? - this help screen.\n\n"); | 86 | printf("\t--help, -? - this help screen.\n\n"); |
87 | printf("\t--hostname=name - set sandbox hostname.\n\n"); | ||
87 | 88 | ||
88 | printf("\t--interface=name - move interface in a new network namespace. Up to\n"); | 89 | printf("\t--interface=name - move interface in a new network namespace. Up to\n"); |
89 | printf("\t\tfour --interface options can be sepcified.\n\n"); | 90 | printf("\t\tfour --interface options can be sepcified.\n\n"); |
@@ -101,7 +102,7 @@ void usage(void) { | |||
101 | printf("\t--list - list all sandboxes.\n\n"); | 102 | printf("\t--list - list all sandboxes.\n\n"); |
102 | printf("\t--mac=xx:xx:xx:xx:xx:xx - set interface MAC address.\n\n"); | 103 | printf("\t--mac=xx:xx:xx:xx:xx:xx - set interface MAC address.\n\n"); |
103 | printf("\t--mtu=number - set interface MTU.\n\n"); | 104 | printf("\t--mtu=number - set interface MTU.\n\n"); |
104 | printf("\t--name=name - set sandbox hostname.\n\n"); | 105 | printf("\t--name=name - set sandbox name.\n\n"); |
105 | printf("\t--net=bridgename - enable network namespaces and connect to this bridge\n"); | 106 | printf("\t--net=bridgename - enable network namespaces and connect to this bridge\n"); |
106 | printf("\t\tdevice. Unless specified with option --ip and --defaultgw, an\n"); | 107 | printf("\t\tdevice. Unless specified with option --ip and --defaultgw, an\n"); |
107 | printf("\t\tIP address and a default gateway will be assigned automatically\n"); | 108 | 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 | |||
@@ -331,6 +331,16 @@ Print options end exit. | |||
331 | 331 | ||
332 | 332 | ||
333 | .TP | 333 | .TP |
334 | \fB\-\-hostname=name | ||
335 | Set sandbox hostname. | ||
336 | .br | ||
337 | |||
338 | .br | ||
339 | Example: | ||
340 | .br | ||
341 | $ firejail \-\-hostname=officepc firefox | ||
342 | |||
343 | .TP | ||
334 | \fB\-\-interface=interface | 344 | \fB\-\-interface=interface |
335 | Move interface in a new network namespace. Up to four --interface options can be sepcified. | 345 | Move interface in a new network namespace. Up to four --interface options can be sepcified. |
336 | .br | 346 | .br |
@@ -454,7 +464,7 @@ $ firejail \-\-net=eth0 \-\-mtu=1492 | |||
454 | 464 | ||
455 | .TP | 465 | .TP |
456 | \fB\-\-name=name | 466 | \fB\-\-name=name |
457 | Set sandbox hostname. Several options, such as \-\-join and \-\-shutdown, can use | 467 | Set sandbox name. Several options, such as \-\-join and \-\-shutdown, can use |
458 | this name to identify a sandbox. | 468 | this name to identify a sandbox. |
459 | .br | 469 | .br |
460 | 470 | ||