diff options
Diffstat (limited to 'src/firejail/sandbox.c')
-rw-r--r-- | src/firejail/sandbox.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/firejail/sandbox.c b/src/firejail/sandbox.c index 0fd81979f..1502a0312 100644 --- a/src/firejail/sandbox.c +++ b/src/firejail/sandbox.c | |||
@@ -39,6 +39,9 @@ | |||
39 | # define PR_SET_NO_NEW_PRIVS 38 | 39 | # define PR_SET_NO_NEW_PRIVS 38 |
40 | #endif | 40 | #endif |
41 | 41 | ||
42 | #ifdef HAVE_APPARMOR | ||
43 | #include <sys/apparmor.h> | ||
44 | #endif | ||
42 | 45 | ||
43 | 46 | ||
44 | static int monitored_pid = 0; | 47 | static int monitored_pid = 0; |
@@ -392,6 +395,7 @@ int sandbox(void* sandbox_arg) { | |||
392 | if (arg_debug && child_pid == 1) | 395 | if (arg_debug && child_pid == 1) |
393 | printf("PID namespace installed\n"); | 396 | printf("PID namespace installed\n"); |
394 | 397 | ||
398 | |||
395 | //**************************** | 399 | //**************************** |
396 | // set hostname | 400 | // set hostname |
397 | //**************************** | 401 | //**************************** |
@@ -503,7 +507,6 @@ int sandbox(void* sandbox_arg) { | |||
503 | else | 507 | else |
504 | fs_basic_fs(); | 508 | fs_basic_fs(); |
505 | 509 | ||
506 | |||
507 | //**************************** | 510 | //**************************** |
508 | // set hostname in /etc/hostname | 511 | // set hostname in /etc/hostname |
509 | //**************************** | 512 | //**************************** |
@@ -798,8 +801,13 @@ int sandbox(void* sandbox_arg) { | |||
798 | pid_t app_pid = fork(); | 801 | pid_t app_pid = fork(); |
799 | if (app_pid == -1) | 802 | if (app_pid == -1) |
800 | errExit("fork"); | 803 | errExit("fork"); |
801 | 804 | ||
802 | if (app_pid == 0) { | 805 | if (app_pid == 0) { |
806 | #ifdef HAVE_APPARMOR | ||
807 | errno = 0; | ||
808 | if (aa_change_onexec("firejail-default")) | ||
809 | fprintf(stderr, "Warning: apparmor profile not loaded, errno %d\n", errno); | ||
810 | #endif | ||
803 | prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); // kill the child in case the parent died | 811 | prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0); // kill the child in case the parent died |
804 | start_application(); // start app | 812 | start_application(); // start app |
805 | } | 813 | } |