diff options
author | netblue30 <netblue30@protonmail.com> | 2021-05-18 13:49:02 -0400 |
---|---|---|
committer | netblue30 <netblue30@protonmail.com> | 2021-05-18 13:49:02 -0400 |
commit | b79e4416fe642976111a2d610a19c3e4696bb2e2 (patch) | |
tree | c038806bb80d57314a248dbc6df92b91d32a3a59 /src/jailcheck/apparmor.c | |
parent | readme, etc (diff) | |
download | firejail-b79e4416fe642976111a2d610a19c3e4696bb2e2.tar.gz firejail-b79e4416fe642976111a2d610a19c3e4696bb2e2.tar.zst firejail-b79e4416fe642976111a2d610a19c3e4696bb2e2.zip |
jailtest -> jailcheck (#4268)
Diffstat (limited to 'src/jailcheck/apparmor.c')
-rw-r--r-- | src/jailcheck/apparmor.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/jailcheck/apparmor.c b/src/jailcheck/apparmor.c new file mode 100644 index 000000000..64f278046 --- /dev/null +++ b/src/jailcheck/apparmor.c | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2014-2021 Firejail Authors | ||
3 | * | ||
4 | * This file is part of firejail project | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | #include "jailcheck.h" | ||
21 | |||
22 | #ifdef HAVE_APPARMOR | ||
23 | #include <sys/apparmor.h> | ||
24 | |||
25 | void apparmor_test(pid_t pid) { | ||
26 | char *label = NULL; | ||
27 | char *mode = NULL; | ||
28 | int rv = aa_gettaskcon(pid, &label, &mode); | ||
29 | if (rv == -1 || mode == NULL) | ||
30 | printf(" Warning: AppArmor not enabled\n"); | ||
31 | } | ||
32 | |||
33 | |||
34 | #else | ||
35 | void apparmor_test(pid_t pid) { | ||
36 | (void) pid; | ||
37 | return; | ||
38 | } | ||
39 | #endif | ||
40 | |||