" mount options=(rw,move) /s[^y]*{,/**},\n"
" mount options=(rw,move) /sy[^s]*{,/**},\n"
" mount options=(rw,move) /sys?*{,/**},\n"
+"\n";
+
+static const char AA_PROFILE_BASE_NO_NESTING[] =
"\n"
" # generated by: lxc-generate-aa-rules.py container-rules.base\n"
" deny /proc/sys/[^kn]*{,/**} wklx,\n"
must_append_sized(&profile, &size, AA_PROFILE_BASE,
STRARRAYLEN(AA_PROFILE_BASE));
+ if (!conf->lsm_aa_allow_nesting)
+ must_append_sized(&profile, &size, AA_PROFILE_BASE_NO_NESTING,
+ STRARRAYLEN(AA_PROFILE_BASE_NO_NESTING));
+
append_all_remount_rules(&profile, &size);
if (ops->aa_supports_unix)
if (ops->aa_can_stack && !ops->aa_is_stacked) {
char *namespace, *temp;
- must_append_sized(&profile, &size, AA_PROFILE_STACKING_BASE,
- STRARRAYLEN(AA_PROFILE_STACKING_BASE));
+
+ if (!conf->lsm_aa_allow_nesting)
+ must_append_sized(&profile, &size, AA_PROFILE_STACKING_BASE,
+ STRARRAYLEN(AA_PROFILE_STACKING_BASE));
namespace = apparmor_namespace(conf->name, lxcpath);
temp = must_concat(NULL, " change_profile -> \":", namespace, ":*\",\n"
must_append_sized(&profile, &size, temp, strlen(temp));
free(temp);
- } else {
+ } else if (!conf->lsm_aa_allow_nesting) {
must_append_sized(&profile, &size, AA_PROFILE_NO_STACKING,
STRARRAYLEN(AA_PROFILE_NO_STACKING));
}