aboutsummaryrefslogtreecommitdiffstats
path: root/src/jailcheck/apparmor.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/jailcheck/apparmor.c')
-rw-r--r--src/jailcheck/apparmor.c40
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
25void 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
35void apparmor_test(pid_t pid) {
36 (void) pid;
37 return;
38}
39#endif
40