mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 14:55:10 +00:00
Compare commits
122 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
090ed4185c | ||
|
24256fc73b | ||
|
8047a7e2a5 | ||
|
c2d64e90b9 | ||
|
ddc0a0128a | ||
|
f18750b4ac | ||
|
c5c6a78474 | ||
|
4fad40d5b0 | ||
|
3d46978dee | ||
|
eae16fb03f | ||
|
7183ff3ef1 | ||
|
ba1aba4c00 | ||
|
0b85c03649 | ||
|
4d93ec6489 | ||
|
356740ac4f | ||
|
a3ad1cd62e | ||
|
a03acd0ff1 | ||
|
f9349fe462 | ||
|
540117e4a1 | ||
|
646d73300f | ||
|
472596186f | ||
|
de0762ad2c | ||
|
2597b5bc54 | ||
|
a9624311c0 | ||
|
262fd11359 | ||
|
d240142bb2 | ||
|
d73e244ed7 | ||
|
ebe10fbb90 | ||
|
af9d04d24b | ||
|
39e7c30ae4 | ||
|
d266f7f84c | ||
|
4f0dd10e5e | ||
|
a5f8b065a8 | ||
|
9f9edbeeb2 | ||
|
147c4f4703 | ||
|
dd5edd8f9f | ||
|
56d1b65e7f | ||
|
c919db4042 | ||
|
b6cfad04c0 | ||
|
24bdf3855f | ||
|
a9ef414655 | ||
|
2b97de1b2c | ||
|
a80e3dc432 | ||
|
de739160c1 | ||
|
698c3f313f | ||
|
ca6191d158 | ||
|
d2905d907a | ||
|
da9a4aa20a | ||
|
e7bf292343 | ||
|
099ad8186a | ||
|
aa10832801 | ||
|
504df28245 | ||
|
a072082626 | ||
|
6d3cb1b78d | ||
|
8ec5f81382 | ||
|
1312cf4768 | ||
|
474a12ebe8 | ||
|
8b8fe03f1e | ||
|
57994dfcda | ||
|
18cf5bffde | ||
|
d71b9ade1a | ||
|
e6ed0b6c42 | ||
|
e92a8c8f1b | ||
|
ea681c4638 | ||
|
010b0bd081 | ||
|
6a0f7e813c | ||
|
d9ea198fe4 | ||
|
7ebb259610 | ||
|
e1714b9631 | ||
|
e8c7f0f84f | ||
|
505a3fbc59 | ||
|
b4c7e18f55 | ||
|
66118dc3e0 | ||
|
79044b98e4 | ||
|
ae1c30e337 | ||
|
0ead606d9e | ||
|
20c28f25ce | ||
|
702c282325 | ||
|
822db765c6 | ||
|
e34149546d | ||
|
8668d4a456 | ||
|
704c82c574 | ||
|
bcda237953 | ||
|
8485770cdf | ||
|
cc7f549665 | ||
|
d6441c9da8 | ||
|
18813234b9 | ||
|
b9aaa632fb | ||
|
8cf3ec75fc | ||
|
d4e465a0bb | ||
|
8890dbcedc | ||
|
0e7d009164 | ||
|
215b5de131 | ||
|
59c8d43cec | ||
|
ec19c34795 | ||
|
df1bbdbb20 | ||
|
a5586f45fb | ||
|
9099b7ed41 | ||
|
6bb342380c | ||
|
0e26be21df | ||
|
36886b9c45 | ||
|
b0af2c2217 | ||
|
32c87d09c5 | ||
|
dceba9763a | ||
|
f1c6defb4a | ||
|
ecf8abab98 | ||
|
9b72afe9c3 | ||
|
c6324c2a3e | ||
|
cecb8e2855 | ||
|
4f2f7c60a6 | ||
|
da879c0704 | ||
|
9799fbde99 | ||
|
2b6eada019 | ||
|
bc952a5c85 | ||
|
b27a5b0cab | ||
|
74e074a213 | ||
|
8a21472175 | ||
|
1d3193b55c | ||
|
d0a131b70e | ||
|
78baf655b2 | ||
|
5141132c48 | ||
|
de9d56c29e |
@@ -454,6 +454,7 @@ static int detailed_output(FILE *json) {
|
|||||||
const char *process_statuses[] = {"enforce", "complain", "unconfined", "mixed", "kill"};
|
const char *process_statuses[] = {"enforce", "complain", "unconfined", "mixed", "kill"};
|
||||||
int ret;
|
int ret;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
int need_finish = 0;
|
||||||
|
|
||||||
ret = get_profiles(&profiles, &nprofiles);
|
ret = get_profiles(&profiles, &nprofiles);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
@@ -534,16 +535,20 @@ static int detailed_output(FILE *json) {
|
|||||||
} else {
|
} else {
|
||||||
fprintf(json, "%s\"%s\": [{\"profile\": \"%s\", \"pid\": \"%s\", \"status\": \"%s\"}",
|
fprintf(json, "%s\"%s\": [{\"profile\": \"%s\", \"pid\": \"%s\", \"status\": \"%s\"}",
|
||||||
// first element will be a unique executable
|
// first element will be a unique executable
|
||||||
i == 0 && j == 0 ? "" : "], ",
|
j == 0 && !need_finish ? "" : "], ",
|
||||||
filtered[j].exe, filtered[j].profile, filtered[j].pid, filtered[j].mode);
|
filtered[j].exe, filtered[j].profile, filtered[j].pid, filtered[j].mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
need_finish = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free_processes(filtered, nfiltered);
|
free_processes(filtered, nfiltered);
|
||||||
}
|
}
|
||||||
if (json) {
|
if (json) {
|
||||||
fprintf(json, "%s}}\n", nprocesses > 0 ? "]" : "");
|
if (need_finish > 0) {
|
||||||
|
fprintf(json, "]");
|
||||||
|
}
|
||||||
|
fprintf(json, "}\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
@@ -1 +1 @@
|
|||||||
3.0.4
|
3.0.10
|
||||||
|
@@ -159,6 +159,8 @@ typedef struct
|
|||||||
char *fs_type;
|
char *fs_type;
|
||||||
char *flags;
|
char *flags;
|
||||||
char *src_name;
|
char *src_name;
|
||||||
|
|
||||||
|
char *class;
|
||||||
} aa_log_record;
|
} aa_log_record;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -27,8 +27,9 @@ INCLUDES = $(all_includes)
|
|||||||
# http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
|
# http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
|
||||||
#
|
#
|
||||||
AA_LIB_CURRENT = 9
|
AA_LIB_CURRENT = 9
|
||||||
AA_LIB_REVISION = 2
|
AA_LIB_REVISION = 6
|
||||||
AA_LIB_AGE = 8
|
AA_LIB_AGE = 8
|
||||||
|
EXPECTED_SO_NAME = libapparmor.so.1.8.6
|
||||||
|
|
||||||
SUFFIXES = .pc.in .pc
|
SUFFIXES = .pc.in .pc
|
||||||
|
|
||||||
@@ -77,4 +78,8 @@ tst_kernel_LDFLAGS = -pthread
|
|||||||
check_PROGRAMS = tst_aalogmisc tst_features tst_kernel
|
check_PROGRAMS = tst_aalogmisc tst_features tst_kernel
|
||||||
TESTS = $(check_PROGRAMS)
|
TESTS = $(check_PROGRAMS)
|
||||||
|
|
||||||
|
.PHONY: check-local
|
||||||
|
check-local:
|
||||||
|
test -f ./.libs/$(EXPECTED_SO_NAME) || { echo '*** unexpected .so name/number for libapparmor (expected $(EXPECTED_SO_NAME), the actual filename is shown below) ***' ; ls -l ./.libs/libapparmor.so.*.* ; exit 1; }
|
||||||
|
|
||||||
EXTRA_DIST = grammar.y scanner.l libapparmor.map libapparmor.pc
|
EXTRA_DIST = grammar.y scanner.l libapparmor.map libapparmor.pc
|
||||||
|
@@ -194,6 +194,8 @@ static int features_dir_cb(int dirfd, const char *name, struct stat *st,
|
|||||||
if (features_snprintf(fst, "%s {", name) == -1)
|
if (features_snprintf(fst, "%s {", name) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
/* Handle symlink here. See _aa_dirat_for_each in private.c */
|
||||||
|
|
||||||
if (S_ISREG(st->st_mode)) {
|
if (S_ISREG(st->st_mode)) {
|
||||||
ssize_t len;
|
ssize_t len;
|
||||||
size_t remaining;
|
size_t remaining;
|
||||||
|
@@ -159,7 +159,9 @@ aa_record_event_type lookup_aa_event(unsigned int type)
|
|||||||
%token TOK_KEY_NAMESPACE
|
%token TOK_KEY_NAMESPACE
|
||||||
%token TOK_KEY_ERROR
|
%token TOK_KEY_ERROR
|
||||||
%token TOK_KEY_FSUID
|
%token TOK_KEY_FSUID
|
||||||
|
%token TOK_KEY_FSUID_UPPER
|
||||||
%token TOK_KEY_OUID
|
%token TOK_KEY_OUID
|
||||||
|
%token TOK_KEY_OUID_UPPER
|
||||||
%token TOK_KEY_UID
|
%token TOK_KEY_UID
|
||||||
%token TOK_KEY_AUID
|
%token TOK_KEY_AUID
|
||||||
%token TOK_KEY_SAUID
|
%token TOK_KEY_SAUID
|
||||||
@@ -185,6 +187,7 @@ aa_record_event_type lookup_aa_event(unsigned int type)
|
|||||||
%token TOK_KEY_FSTYPE
|
%token TOK_KEY_FSTYPE
|
||||||
%token TOK_KEY_FLAGS
|
%token TOK_KEY_FLAGS
|
||||||
%token TOK_KEY_SRCNAME
|
%token TOK_KEY_SRCNAME
|
||||||
|
%token TOK_KEY_CLASS
|
||||||
|
|
||||||
%token TOK_SOCKLOGD_KERNEL
|
%token TOK_SOCKLOGD_KERNEL
|
||||||
%token TOK_SYSLOG_KERNEL
|
%token TOK_SYSLOG_KERNEL
|
||||||
@@ -351,6 +354,10 @@ key: TOK_KEY_OPERATION TOK_EQUALS TOK_QUOTED_STRING
|
|||||||
{ ret_record->fsuid = $3;}
|
{ ret_record->fsuid = $3;}
|
||||||
| TOK_KEY_OUID TOK_EQUALS TOK_DIGITS
|
| TOK_KEY_OUID TOK_EQUALS TOK_DIGITS
|
||||||
{ ret_record->ouid = $3;}
|
{ ret_record->ouid = $3;}
|
||||||
|
| TOK_KEY_FSUID_UPPER TOK_EQUALS TOK_QUOTED_STRING
|
||||||
|
{ free($3);} /* Ignore - fsuid username */
|
||||||
|
| TOK_KEY_OUID_UPPER TOK_EQUALS TOK_QUOTED_STRING
|
||||||
|
{ free($3);} /* Ignore - ouid username */
|
||||||
| TOK_KEY_SAUID TOK_EQUALS TOK_DIGITS
|
| TOK_KEY_SAUID TOK_EQUALS TOK_DIGITS
|
||||||
{ /* Ignore - Source audit ID from user AVC messages */ }
|
{ /* Ignore - Source audit ID from user AVC messages */ }
|
||||||
| TOK_KEY_HOSTNAME TOK_EQUALS safe_string
|
| TOK_KEY_HOSTNAME TOK_EQUALS safe_string
|
||||||
@@ -425,6 +432,8 @@ key: TOK_KEY_OPERATION TOK_EQUALS TOK_QUOTED_STRING
|
|||||||
ret_record->event = AA_RECORD_INVALID;
|
ret_record->event = AA_RECORD_INVALID;
|
||||||
ret_record->info = $1;
|
ret_record->info = $1;
|
||||||
}
|
}
|
||||||
|
| TOK_KEY_CLASS TOK_EQUALS TOK_QUOTED_STRING
|
||||||
|
{ ret_record->class = $3; }
|
||||||
;
|
;
|
||||||
|
|
||||||
apparmor_event:
|
apparmor_event:
|
||||||
|
@@ -103,6 +103,8 @@ void free_record(aa_log_record *record)
|
|||||||
free(record->flags);
|
free(record->flags);
|
||||||
if (record->src_name != NULL)
|
if (record->src_name != NULL)
|
||||||
free(record->src_name);
|
free(record->src_name);
|
||||||
|
if (record->class != NULL)
|
||||||
|
free(record->class);
|
||||||
|
|
||||||
free(record);
|
free(record);
|
||||||
}
|
}
|
||||||
|
@@ -45,6 +45,8 @@ struct aa_policy_cache {
|
|||||||
static int clear_cache_cb(int dirfd, const char *path, struct stat *st,
|
static int clear_cache_cb(int dirfd, const char *path, struct stat *st,
|
||||||
void *data unused)
|
void *data unused)
|
||||||
{
|
{
|
||||||
|
/* Handle symlink here. See _aa_dirat_for_each in private.c */
|
||||||
|
|
||||||
if (S_ISREG(st->st_mode)) {
|
if (S_ISREG(st->st_mode)) {
|
||||||
/* remove regular files */
|
/* remove regular files */
|
||||||
return unlinkat(dirfd, path, 0);
|
return unlinkat(dirfd, path, 0);
|
||||||
|
@@ -452,7 +452,8 @@ int _aa_overlaydirat_for_each(int dirfd[], int n, void *data,
|
|||||||
*
|
*
|
||||||
* The cb function is called with the DIR in use and the name of the
|
* The cb function is called with the DIR in use and the name of the
|
||||||
* file in that directory. If the file is to be opened it should
|
* file in that directory. If the file is to be opened it should
|
||||||
* use the openat, fstatat, and related fns.
|
* use the openat, fstatat, and related fns. If the file is a symlink
|
||||||
|
* _aa_dirat_for_each currently tries to traverse it for the caller
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, else -1 and errno is set to the error code
|
* Returns: 0 on success, else -1 and errno is set to the error code
|
||||||
*/
|
*/
|
||||||
@@ -485,14 +486,34 @@ int _aa_dirat_for_each(int dirfd, const char *name, void *data,
|
|||||||
autofree struct dirent *dir = namelist[i];
|
autofree struct dirent *dir = namelist[i];
|
||||||
struct stat my_stat;
|
struct stat my_stat;
|
||||||
|
|
||||||
if (rc)
|
if (fstatat(cb_dirfd, dir->d_name, &my_stat, AT_SYMLINK_NOFOLLOW)) {
|
||||||
continue;
|
|
||||||
|
|
||||||
if (fstatat(cb_dirfd, dir->d_name, &my_stat, 0)) {
|
|
||||||
PDEBUG("stat failed for '%s': %m\n", dir->d_name);
|
PDEBUG("stat failed for '%s': %m\n", dir->d_name);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
/* currently none of the callers handle symlinks, and this
|
||||||
|
* same basic code was applied to each. So for this patch
|
||||||
|
* just drop it here.
|
||||||
|
*
|
||||||
|
* Going forward we need to start handling symlinks as
|
||||||
|
* they have meaning.
|
||||||
|
* In the case of
|
||||||
|
* cache: they act as a place holder for files that have been
|
||||||
|
* combined into a single binary. This enables the
|
||||||
|
* file based cache lookup time find that relation
|
||||||
|
* and dedup, so multiple loads aren't done.
|
||||||
|
* profiles: just a profile in an alternate location, but
|
||||||
|
* should do dedup detection when doing dir reads
|
||||||
|
* so we don't double process.
|
||||||
|
*/
|
||||||
|
if (S_ISLNK(my_stat.st_mode)) {
|
||||||
|
/* just traverse the symlink */
|
||||||
|
if (fstatat(cb_dirfd, dir->d_name, &my_stat, 0)) {
|
||||||
|
PDEBUG("symlink target stat failed for '%s': %m\n", dir->d_name);
|
||||||
|
rc = -1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cb(cb_dirfd, dir->d_name, &my_stat, data)) {
|
if (cb(cb_dirfd, dir->d_name, &my_stat, data)) {
|
||||||
PDEBUG("dir_for_each callback failed for '%s'\n",
|
PDEBUG("dir_for_each callback failed for '%s'\n",
|
||||||
|
@@ -72,7 +72,7 @@ void string_buf_append(unsigned int length, char *text)
|
|||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
ws [ \t\r\n]
|
ws [ \t\r\n\x1d]
|
||||||
|
|
||||||
equals "="
|
equals "="
|
||||||
digit [[:digit:]]
|
digit [[:digit:]]
|
||||||
@@ -121,6 +121,8 @@ key_namespace "namespace"
|
|||||||
key_mask "mask"
|
key_mask "mask"
|
||||||
key_denied_mask "denied_mask"
|
key_denied_mask "denied_mask"
|
||||||
key_requested_mask "requested_mask"
|
key_requested_mask "requested_mask"
|
||||||
|
key_denied "denied"
|
||||||
|
key_requested "requested"
|
||||||
key_attribute "attribute"
|
key_attribute "attribute"
|
||||||
key_task "task"
|
key_task "task"
|
||||||
key_parent "parent"
|
key_parent "parent"
|
||||||
@@ -138,7 +140,9 @@ key_sock_type "sock_type"
|
|||||||
key_protocol "protocol"
|
key_protocol "protocol"
|
||||||
key_error "error"
|
key_error "error"
|
||||||
key_fsuid "fsuid"
|
key_fsuid "fsuid"
|
||||||
|
key_fsuid_upper "FSUID"
|
||||||
key_ouid "ouid"
|
key_ouid "ouid"
|
||||||
|
key_ouid_upper "OUID"
|
||||||
key_uid "uid"
|
key_uid "uid"
|
||||||
key_auid "auid"
|
key_auid "auid"
|
||||||
key_sauid "sauid"
|
key_sauid "sauid"
|
||||||
@@ -161,11 +165,13 @@ key_dest "dest"
|
|||||||
key_path "path"
|
key_path "path"
|
||||||
key_interface "interface"
|
key_interface "interface"
|
||||||
key_member "member"
|
key_member "member"
|
||||||
|
key_method "method"
|
||||||
key_signal "signal"
|
key_signal "signal"
|
||||||
key_peer "peer"
|
key_peer "peer"
|
||||||
key_fstype "fstype"
|
key_fstype "fstype"
|
||||||
key_flags "flags"
|
key_flags "flags"
|
||||||
key_srcname "srcname"
|
key_srcname "srcname"
|
||||||
|
key_class "class"
|
||||||
audit "audit"
|
audit "audit"
|
||||||
|
|
||||||
/* network addrs */
|
/* network addrs */
|
||||||
@@ -307,6 +313,8 @@ yy_flex_debug = 0;
|
|||||||
{key_mask} { return(TOK_KEY_MASK); }
|
{key_mask} { return(TOK_KEY_MASK); }
|
||||||
{key_denied_mask} { return(TOK_KEY_DENIED_MASK); }
|
{key_denied_mask} { return(TOK_KEY_DENIED_MASK); }
|
||||||
{key_requested_mask} { return(TOK_KEY_REQUESTED_MASK); }
|
{key_requested_mask} { return(TOK_KEY_REQUESTED_MASK); }
|
||||||
|
{key_denied} { return(TOK_KEY_DENIED_MASK); }
|
||||||
|
{key_requested} { return(TOK_KEY_REQUESTED_MASK); }
|
||||||
{key_attribute} { BEGIN(sub_id); return(TOK_KEY_ATTRIBUTE); }
|
{key_attribute} { BEGIN(sub_id); return(TOK_KEY_ATTRIBUTE); }
|
||||||
{key_task} { return(TOK_KEY_TASK); }
|
{key_task} { return(TOK_KEY_TASK); }
|
||||||
{key_parent} { return(TOK_KEY_PARENT); }
|
{key_parent} { return(TOK_KEY_PARENT); }
|
||||||
@@ -324,7 +332,9 @@ yy_flex_debug = 0;
|
|||||||
{key_protocol} { return(TOK_KEY_PROTOCOL); }
|
{key_protocol} { return(TOK_KEY_PROTOCOL); }
|
||||||
{key_error} { return(TOK_KEY_ERROR); }
|
{key_error} { return(TOK_KEY_ERROR); }
|
||||||
{key_fsuid} { return(TOK_KEY_FSUID); }
|
{key_fsuid} { return(TOK_KEY_FSUID); }
|
||||||
|
{key_fsuid_upper} { return(TOK_KEY_FSUID_UPPER); }
|
||||||
{key_ouid} { return(TOK_KEY_OUID); }
|
{key_ouid} { return(TOK_KEY_OUID); }
|
||||||
|
{key_ouid_upper} { return(TOK_KEY_OUID_UPPER); }
|
||||||
{key_uid} { return(TOK_KEY_UID); }
|
{key_uid} { return(TOK_KEY_UID); }
|
||||||
{key_auid} { return(TOK_KEY_AUID); }
|
{key_auid} { return(TOK_KEY_AUID); }
|
||||||
{key_sauid} { return(TOK_KEY_SAUID); }
|
{key_sauid} { return(TOK_KEY_SAUID); }
|
||||||
@@ -346,11 +356,13 @@ yy_flex_debug = 0;
|
|||||||
{key_path} { return(TOK_KEY_PATH); }
|
{key_path} { return(TOK_KEY_PATH); }
|
||||||
{key_interface} { return(TOK_KEY_INTERFACE); }
|
{key_interface} { return(TOK_KEY_INTERFACE); }
|
||||||
{key_member} { return(TOK_KEY_MEMBER); }
|
{key_member} { return(TOK_KEY_MEMBER); }
|
||||||
|
{key_method} { return(TOK_KEY_MEMBER); }
|
||||||
{key_signal} { BEGIN(sub_id); return(TOK_KEY_SIGNAL); }
|
{key_signal} { BEGIN(sub_id); return(TOK_KEY_SIGNAL); }
|
||||||
{key_peer} { BEGIN(safe_string); return(TOK_KEY_PEER); }
|
{key_peer} { BEGIN(safe_string); return(TOK_KEY_PEER); }
|
||||||
{key_fstype} { return(TOK_KEY_FSTYPE); }
|
{key_fstype} { return(TOK_KEY_FSTYPE); }
|
||||||
{key_flags} { BEGIN(safe_string); return(TOK_KEY_FLAGS); }
|
{key_flags} { BEGIN(safe_string); return(TOK_KEY_FLAGS); }
|
||||||
{key_srcname} { BEGIN(safe_string); return(TOK_KEY_SRCNAME); }
|
{key_srcname} { BEGIN(safe_string); return(TOK_KEY_SRCNAME); }
|
||||||
|
{key_class} { BEGIN(safe_string); return(TOK_KEY_CLASS); }
|
||||||
|
|
||||||
{socklogd_kernel} { BEGIN(dmesg_timestamp); return(TOK_SOCKLOGD_KERNEL); }
|
{socklogd_kernel} { BEGIN(dmesg_timestamp); return(TOK_SOCKLOGD_KERNEL); }
|
||||||
{syslog_kernel} { BEGIN(dmesg_timestamp); return(TOK_SYSLOG_KERNEL); }
|
{syslog_kernel} { BEGIN(dmesg_timestamp); return(TOK_SYSLOG_KERNEL); }
|
||||||
|
@@ -10,8 +10,7 @@ test_python.py: test_python.py.in $(top_builddir)/config.status
|
|||||||
|
|
||||||
CLEANFILES = test_python.py
|
CLEANFILES = test_python.py
|
||||||
|
|
||||||
# bah, how brittle is this?
|
PYTHON_DIST_BUILD_PATH = '$(builddir)/../build/$$($(PYTHON) buildpath.py)'
|
||||||
PYTHON_DIST_BUILD_PATH = '$(builddir)/../build/$$($(PYTHON) -c "import sysconfig; print(\"lib.%s-%s\" %(sysconfig.get_platform(), sysconfig.get_python_version()))")'
|
|
||||||
|
|
||||||
TESTS = test_python.py
|
TESTS = test_python.py
|
||||||
TESTS_ENVIRONMENT = \
|
TESTS_ENVIRONMENT = \
|
||||||
|
13
libraries/libapparmor/swig/python/test/buildpath.py
Normal file
13
libraries/libapparmor/swig/python/test/buildpath.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
# the build path has changed in setuptools 62.1:
|
||||||
|
# https://github.com/pypa/setuptools/commit/1c23f5e1e4b18b50081cbabb2dea22bf345f5894
|
||||||
|
import sys
|
||||||
|
import sysconfig
|
||||||
|
import setuptools
|
||||||
|
|
||||||
|
|
||||||
|
if tuple(map(int, setuptools.__version__.split("."))) >= (62, 1):
|
||||||
|
identifier = sys.implementation.cache_tag
|
||||||
|
else:
|
||||||
|
identifier = "%d.%d" % sys.version_info[:2]
|
||||||
|
print("lib.%s-%s" % (sysconfig.get_platform(), identifier))
|
@@ -34,6 +34,7 @@ OUTPUT_MAP = {
|
|||||||
'Local port': 'net_local_port',
|
'Local port': 'net_local_port',
|
||||||
'Foreign port': 'net_foreign_port',
|
'Foreign port': 'net_foreign_port',
|
||||||
'Audit subid': 'audit_sub_id',
|
'Audit subid': 'audit_sub_id',
|
||||||
|
'Class': '_class',
|
||||||
}
|
}
|
||||||
|
|
||||||
# FIXME: pull this automatically out of LibAppArmor, but swig
|
# FIXME: pull this automatically out of LibAppArmor, but swig
|
||||||
@@ -108,7 +109,7 @@ class AAPythonBindingsTests(unittest.TestCase):
|
|||||||
'''parse the swig created record and construct a dict from it'''
|
'''parse the swig created record and construct a dict from it'''
|
||||||
|
|
||||||
new_record = dict()
|
new_record = dict()
|
||||||
for key in [x for x in dir(record) if not (x.startswith('_') or x == 'this')]:
|
for key in [x for x in dir(record) if not (x.startswith('__') or x == 'this')]:
|
||||||
value = getattr(record, key)
|
value = getattr(record, key)
|
||||||
if key == "event" and value in EVENT_MAP:
|
if key == "event" and value in EVENT_MAP:
|
||||||
new_record[key] = EVENT_MAP[value]
|
new_record[key] = EVENT_MAP[value]
|
||||||
|
@@ -134,6 +134,8 @@ int print_results(aa_log_record *record)
|
|||||||
print_string("Flags", record->flags);
|
print_string("Flags", record->flags);
|
||||||
print_string("Src name", record->src_name);
|
print_string("Src name", record->src_name);
|
||||||
|
|
||||||
|
print_string("Class", record->class);
|
||||||
|
|
||||||
print_long("Epoch", record->epoch, 0);
|
print_long("Epoch", record->epoch, 0);
|
||||||
print_long("Audit subid", (long) record->audit_sub_id, 0);
|
print_long("Audit subid", (long) record->audit_sub_id, 0);
|
||||||
return(0);
|
return(0);
|
||||||
|
@@ -0,0 +1 @@
|
|||||||
|
type=AVC msg=audit(1661734785.992:270): apparmor="ALLOWED" operation="open" profile="/usr/bin/dolphin" name="/home/otis/.config/kdedefaults/kdeglobals" pid=3483 comm="dolphin" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0FSUID="otis" OUID="root"
|
@@ -0,0 +1,15 @@
|
|||||||
|
START
|
||||||
|
File: 0x1d-uppercase-FSUID-OUID.in
|
||||||
|
Event type: AA_RECORD_ALLOWED
|
||||||
|
Audit ID: 1661734785.992:270
|
||||||
|
Operation: open
|
||||||
|
Mask: r
|
||||||
|
Denied Mask: r
|
||||||
|
fsuid: 1000
|
||||||
|
ouid: 0
|
||||||
|
Profile: /usr/bin/dolphin
|
||||||
|
Name: /home/otis/.config/kdedefaults/kdeglobals
|
||||||
|
Command: dolphin
|
||||||
|
PID: 3483
|
||||||
|
Epoch: 1661734785
|
||||||
|
Audit subid: 270
|
@@ -0,0 +1,4 @@
|
|||||||
|
/usr/bin/dolphin {
|
||||||
|
/home/otis/.config/kdedefaults/kdeglobals r,
|
||||||
|
|
||||||
|
}
|
1
libraries/libapparmor/testsuite/test_multi/file_xm.in
Normal file
1
libraries/libapparmor/testsuite/test_multi/file_xm.in
Normal file
@@ -0,0 +1 @@
|
|||||||
|
type=AVC msg=audit(1676978994.840:1493): apparmor="DENIED" operation="link" profile="cargo" name="/var/tmp/portage/dev-lang/rust-1.67.1/work/rustc-1.67.1-src/build/bootstrap/debug/libbootstrap.rlib" pid=12412 comm="cargo" requested_mask="xm" denied_mask="xm" fsuid=250 ouid=250 target="/var/tmp/portage/dev-lang/rust-1.67.1/work/rustc-1.67.1-src/build/bootstrap/debug/deps/libbootstrap-4542dd99e796257e.rlib"FSUID="portage" OUID="portage"
|
16
libraries/libapparmor/testsuite/test_multi/file_xm.out
Normal file
16
libraries/libapparmor/testsuite/test_multi/file_xm.out
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
START
|
||||||
|
File: file_xm.in
|
||||||
|
Event type: AA_RECORD_DENIED
|
||||||
|
Audit ID: 1676978994.840:1493
|
||||||
|
Operation: link
|
||||||
|
Mask: xm
|
||||||
|
Denied Mask: xm
|
||||||
|
fsuid: 250
|
||||||
|
ouid: 250
|
||||||
|
Profile: cargo
|
||||||
|
Name: /var/tmp/portage/dev-lang/rust-1.67.1/work/rustc-1.67.1-src/build/bootstrap/debug/libbootstrap.rlib
|
||||||
|
Command: cargo
|
||||||
|
Name2: /var/tmp/portage/dev-lang/rust-1.67.1/work/rustc-1.67.1-src/build/bootstrap/debug/deps/libbootstrap-4542dd99e796257e.rlib
|
||||||
|
PID: 12412
|
||||||
|
Epoch: 1676978994
|
||||||
|
Audit subid: 1493
|
@@ -0,0 +1,4 @@
|
|||||||
|
profile cargo {
|
||||||
|
owner /var/tmp/portage/dev-lang/rust-1.67.1/work/rustc-1.67.1-src/build/bootstrap/debug/libbootstrap.rlib m,
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1 @@
|
|||||||
|
Dec 15 17:32:17 kinetic kernel: [4835959.046111] audit: type=1107 audit(1671125537.724:209): pid=7308 uid=0 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_method_call" bus="session" path="/org/freedesktop/DBus" interface="org.freedesktop.DBus" method="Hello" mask="send" label="/tmp/apparmor/tests/regression/apparmor/dbus_message" peer_label="unconfined" exe="/usr/local/bin/dbus-broker" sauid=0 hostname=? addr=? terminal=?'
|
@@ -0,0 +1,15 @@
|
|||||||
|
START
|
||||||
|
File: testcase_dbus_11.in
|
||||||
|
Event type: AA_RECORD_DENIED
|
||||||
|
Audit ID: 1671125537.724:209
|
||||||
|
Operation: dbus_method_call
|
||||||
|
Denied Mask: send
|
||||||
|
Profile: /tmp/apparmor/tests/regression/apparmor/dbus_message
|
||||||
|
Peer profile: unconfined
|
||||||
|
Command: /usr/local/bin/dbus-broker
|
||||||
|
DBus bus: session
|
||||||
|
DBus path: /org/freedesktop/DBus
|
||||||
|
DBus interface: org.freedesktop.DBus
|
||||||
|
DBus member: Hello
|
||||||
|
Epoch: 1671125537
|
||||||
|
Audit subid: 209
|
@@ -0,0 +1,4 @@
|
|||||||
|
/tmp/apparmor/tests/regression/apparmor/dbus_message {
|
||||||
|
dbus send bus=session path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=Hello peer=(label=unconfined),
|
||||||
|
|
||||||
|
}
|
@@ -70,6 +70,8 @@ CFLAGS = -g -pg -fprofile-arcs -ftest-coverage
|
|||||||
endif
|
endif
|
||||||
endif #CFLAGS
|
endif #CFLAGS
|
||||||
|
|
||||||
|
CFLAGS += -flto-partition=none
|
||||||
|
|
||||||
EXTRA_CXXFLAGS = ${CFLAGS} ${CPPFLAGS} ${CXX_WARNINGS} -std=gnu++0x
|
EXTRA_CXXFLAGS = ${CFLAGS} ${CPPFLAGS} ${CXX_WARNINGS} -std=gnu++0x
|
||||||
EXTRA_CFLAGS = ${EXTRA_CXXFLAGS} ${CPP_WARNINGS}
|
EXTRA_CFLAGS = ${EXTRA_CXXFLAGS} ${CPP_WARNINGS}
|
||||||
|
|
||||||
@@ -384,11 +386,11 @@ DISTRO=$(shell if [ -f /etc/slackware-version ] ; then \
|
|||||||
elif [ -f /etc/debian_version ] ; then \
|
elif [ -f /etc/debian_version ] ; then \
|
||||||
echo debian ;\
|
echo debian ;\
|
||||||
elif which rpm > /dev/null ; then \
|
elif which rpm > /dev/null ; then \
|
||||||
if [ "$(rpm --eval '0%{?suse_version}')" != "0" ] ; then \
|
if [ "$$(rpm --eval '0%{?suse_version}')" != "0" ] ; then \
|
||||||
echo suse ;\
|
echo suse ;\
|
||||||
elif [ "$(rpm --eval '%{_host_vendor}')" = redhat ] ; then \
|
elif [ "$$(rpm --eval '%{_host_vendor}')" = redhat ] ; then \
|
||||||
echo rhel4 ;\
|
echo rhel4 ;\
|
||||||
elif [ "$(rpm --eval '0%{?fedora}')" != "0" ] ; then \
|
elif [ "$$(rpm --eval '0%{?fedora}')" != "0" ] ; then \
|
||||||
echo rhel4 ;\
|
echo rhel4 ;\
|
||||||
else \
|
else \
|
||||||
echo unknown ;\
|
echo unknown ;\
|
||||||
@@ -419,6 +421,7 @@ install-indep: indep
|
|||||||
install -m 755 -d ${DESTDIR}/var/lib/apparmor
|
install -m 755 -d ${DESTDIR}/var/lib/apparmor
|
||||||
install -m 755 -d $(APPARMOR_BIN_PREFIX)
|
install -m 755 -d $(APPARMOR_BIN_PREFIX)
|
||||||
install -m 755 rc.apparmor.functions $(APPARMOR_BIN_PREFIX)
|
install -m 755 rc.apparmor.functions $(APPARMOR_BIN_PREFIX)
|
||||||
|
install -m 755 profile-load $(APPARMOR_BIN_PREFIX)
|
||||||
$(MAKE) -C po install NAME=${NAME} DESTDIR=${DESTDIR}
|
$(MAKE) -C po install NAME=${NAME} DESTDIR=${DESTDIR}
|
||||||
$(MAKE) install_manpages DESTDIR=${DESTDIR}
|
$(MAKE) install_manpages DESTDIR=${DESTDIR}
|
||||||
|
|
||||||
|
@@ -111,8 +111,7 @@ unix_rule::unix_rule(unsigned int type_p, bool audit_p, bool denied):
|
|||||||
|
|
||||||
unix_rule::unix_rule(int mode_p, struct cond_entry *conds,
|
unix_rule::unix_rule(int mode_p, struct cond_entry *conds,
|
||||||
struct cond_entry *peer_conds):
|
struct cond_entry *peer_conds):
|
||||||
af_rule("unix"), addr(NULL), peer_addr(NULL),
|
af_rule("unix"), addr(NULL), peer_addr(NULL)
|
||||||
audit(0), deny(0)
|
|
||||||
{
|
{
|
||||||
move_conditionals(conds);
|
move_conditionals(conds);
|
||||||
move_peer_conditionals(peer_conds);
|
move_peer_conditionals(peer_conds);
|
||||||
@@ -136,7 +135,7 @@ ostream &unix_rule::dump_local(ostream &os)
|
|||||||
{
|
{
|
||||||
af_rule::dump_local(os);
|
af_rule::dump_local(os);
|
||||||
if (addr)
|
if (addr)
|
||||||
os << "addr='" << addr << "'";
|
os << " addr='" << addr << "'";
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -144,7 +143,7 @@ ostream &unix_rule::dump_peer(ostream &os)
|
|||||||
{
|
{
|
||||||
af_rule::dump_peer(os);
|
af_rule::dump_peer(os);
|
||||||
if (peer_addr)
|
if (peer_addr)
|
||||||
os << "addr='" << peer_addr << "'";
|
os << " addr='" << peer_addr << "'";
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -36,9 +36,6 @@ class unix_rule: public af_rule {
|
|||||||
public:
|
public:
|
||||||
char *addr;
|
char *addr;
|
||||||
char *peer_addr;
|
char *peer_addr;
|
||||||
int mode;
|
|
||||||
int audit;
|
|
||||||
bool deny;
|
|
||||||
|
|
||||||
unix_rule(unsigned int type_p, bool audit_p, bool denied);
|
unix_rule(unsigned int type_p, bool audit_p, bool denied);
|
||||||
unix_rule(int mode, struct cond_entry *conds,
|
unix_rule(int mode, struct cond_entry *conds,
|
||||||
|
@@ -172,7 +172,7 @@ B<MOUNT FLAGS EXPRESSION> = ( I<MOUNT FLAGS LIST> | I<MOUNT EXPRESSION> )
|
|||||||
|
|
||||||
B<MOUNT FLAGS LIST> = Comma separated list of I<MOUNT FLAGS>.
|
B<MOUNT FLAGS LIST> = Comma separated list of I<MOUNT FLAGS>.
|
||||||
|
|
||||||
B<MOUNT FLAGS> = ( 'ro' | 'rw' | 'nosuid' | 'suid' | 'nodev' | 'dev' | 'noexec' | 'exec' | 'sync' | 'async' | 'remount' | 'mand' | 'nomand' | 'dirsync' | 'noatime' | 'atime' | 'nodiratime' | 'diratime' | 'bind' | 'rbind' | 'move' | 'verbose' | 'silent' | 'loud' | 'acl' | 'noacl' | 'unbindable' | 'runbindable' | 'private' | 'rprivate' | 'slave' | 'rslave' | 'shared' | 'rshared' | 'relatime' | 'norelatime' | 'iversion' | 'noiversion' | 'strictatime' | 'nouser' | 'user' )
|
B<MOUNT FLAGS> = ( 'ro' | 'rw' | 'nosuid' | 'suid' | 'nodev' | 'dev' | 'noexec' | 'exec' | 'sync' | 'async' | 'remount' | 'mand' | 'nomand' | 'dirsync' | 'noatime' | 'atime' | 'nodiratime' | 'diratime' | 'bind' | 'rbind' | 'move' | 'verbose' | 'silent' | 'loud' | 'acl' | 'noacl' | 'unbindable' | 'runbindable' | 'private' | 'rprivate' | 'slave' | 'rslave' | 'shared' | 'rshared' | 'relatime' | 'norelatime' | 'iversion' | 'noiversion' | 'strictatime' | 'nostrictatime' | 'lazytime' | 'nolazytime' | 'nouser' | 'user' | 'symfollow' | 'nosymfollow' )
|
||||||
|
|
||||||
B<MOUNT EXPRESSION> = ( I<ALPHANUMERIC> | I<AARE> ) ...
|
B<MOUNT EXPRESSION> = ( I<ALPHANUMERIC> | I<AARE> ) ...
|
||||||
|
|
||||||
|
@@ -71,6 +71,13 @@ fi
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
|
if [ -x /usr/bin/systemd-detect-virt ] && \
|
||||||
|
systemd-detect-virt --quiet --container && \
|
||||||
|
! is_container_with_internal_policy; then
|
||||||
|
aa_log_daemon_msg "Not starting AppArmor in container"
|
||||||
|
aa_log_end_msg 0
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
apparmor_start
|
apparmor_start
|
||||||
rc=$?
|
rc=$?
|
||||||
;;
|
;;
|
||||||
@@ -79,6 +86,13 @@ case "$1" in
|
|||||||
rc=$?
|
rc=$?
|
||||||
;;
|
;;
|
||||||
restart|reload|force-reload)
|
restart|reload|force-reload)
|
||||||
|
if [ -x /usr/bin/systemd-detect-virt ] && \
|
||||||
|
systemd-detect-virt --quiet --container && \
|
||||||
|
! is_container_with_internal_policy; then
|
||||||
|
aa_log_daemon_msg "Not starting AppArmor in container"
|
||||||
|
aa_log_end_msg 0
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
apparmor_restart
|
apparmor_restart
|
||||||
rc=$?
|
rc=$?
|
||||||
;;
|
;;
|
||||||
|
@@ -19,8 +19,25 @@
|
|||||||
#ifndef __AA_CAPABILITY_H
|
#ifndef __AA_CAPABILITY_H
|
||||||
#define __AA_CAPABILITY_H
|
#define __AA_CAPABILITY_H
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <linux/capability.h>
|
||||||
|
|
||||||
#define NO_BACKMAP_CAP 0xff
|
#define NO_BACKMAP_CAP 0xff
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef CAP_AUDIT_WRITE
|
||||||
|
#define CAP_AUDIT_WRITE 29
|
||||||
|
#endif
|
||||||
|
#ifndef CAP_AUDIT_CONTROL
|
||||||
|
#define CAP_AUDIT_CONTROL 30
|
||||||
|
#endif
|
||||||
|
#ifndef CAP_SETFCAP
|
||||||
|
#define CAP_SETFCAP 31
|
||||||
|
#endif
|
||||||
|
#ifndef CAP_MAC_OVERRIDE
|
||||||
|
#define CAP_MAC_OVERRIDE 32
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef CAP_PERFMON
|
#ifndef CAP_PERFMON
|
||||||
#define CAP_PERFMON 38
|
#define CAP_PERFMON 38
|
||||||
#endif
|
#endif
|
||||||
|
@@ -193,9 +193,8 @@ void CHFA::insert_state(vector<pair<size_t, size_t> > &free_list,
|
|||||||
State *default_state = dfa.nonmatching;
|
State *default_state = dfa.nonmatching;
|
||||||
ssize_t base = 0;
|
ssize_t base = 0;
|
||||||
int resize;
|
int resize;
|
||||||
|
|
||||||
StateTrans &trans = from->trans;
|
StateTrans &trans = from->trans;
|
||||||
ssize_t c = trans.begin()->first.c;
|
ssize_t c;
|
||||||
ssize_t prev = 0;
|
ssize_t prev = 0;
|
||||||
ssize_t x = first_free;
|
ssize_t x = first_free;
|
||||||
|
|
||||||
@@ -204,6 +203,7 @@ void CHFA::insert_state(vector<pair<size_t, size_t> > &free_list,
|
|||||||
if (trans.empty())
|
if (trans.empty())
|
||||||
goto do_insert;
|
goto do_insert;
|
||||||
|
|
||||||
|
c = trans.begin()->first.c;
|
||||||
repeat:
|
repeat:
|
||||||
resize = 0;
|
resize = 0;
|
||||||
/* get the first free entry that won't underflow */
|
/* get the first free entry that won't underflow */
|
||||||
@@ -251,10 +251,18 @@ repeat:
|
|||||||
first_free = next;
|
first_free = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
do_insert:
|
/* these flags will only be set on states that have transitions */
|
||||||
if (c < 0) {
|
if (c < 0) {
|
||||||
base |= MATCH_FLAG_OOB_TRANSITION;
|
base |= MATCH_FLAG_OOB_TRANSITION;
|
||||||
}
|
}
|
||||||
|
do_insert:
|
||||||
|
/* While a state without transitions could have the diff encode
|
||||||
|
* flag set, it would be pointless resulting in just an extra
|
||||||
|
* state transition in the encoding chain, and so it should be
|
||||||
|
* considered an error
|
||||||
|
* TODO: add check that state without transitions isn't being
|
||||||
|
* given a diffencode flag
|
||||||
|
*/
|
||||||
if (from->flags & DiffEncodeFlag)
|
if (from->flags & DiffEncodeFlag)
|
||||||
base |= DiffEncodeBit32;
|
base |= DiffEncodeBit32;
|
||||||
default_base.push_back(make_pair(default_state, base));
|
default_base.push_back(make_pair(default_state, base));
|
||||||
|
@@ -543,9 +543,9 @@ public:
|
|||||||
|
|
||||||
int min_match_len()
|
int min_match_len()
|
||||||
{
|
{
|
||||||
if (contains_oob()) {
|
/* Inverse match does not match any oob char at this time
|
||||||
return 0;
|
* so only count characters
|
||||||
}
|
*/
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
720
parser/mount.cc
720
parser/mount.cc
@@ -98,6 +98,9 @@
|
|||||||
* nomand
|
* nomand
|
||||||
* #define MS_DIRSYNC 128 Directory modifications are synchronous
|
* #define MS_DIRSYNC 128 Directory modifications are synchronous
|
||||||
* dirsync
|
* dirsync
|
||||||
|
* #define MS_NOSYMFOLLOW 256 Do not follow symlinks
|
||||||
|
* symfollow
|
||||||
|
* nosymfollow
|
||||||
* #define MS_NOATIME 1024 Do not update access times
|
* #define MS_NOATIME 1024 Do not update access times
|
||||||
* noatime
|
* noatime
|
||||||
* atime
|
* atime
|
||||||
@@ -139,6 +142,9 @@
|
|||||||
* #define MS_STRICTATIME (1<<24) Always perform atime updates
|
* #define MS_STRICTATIME (1<<24) Always perform atime updates
|
||||||
* strictatime
|
* strictatime
|
||||||
* nostrictatime
|
* nostrictatime
|
||||||
|
* #define MS_LAZYTIME (1<<25) Update the on-disk [acm]times lazily
|
||||||
|
* lazytime
|
||||||
|
* nolazytime
|
||||||
* #define MS_NOSEC (1<<28)
|
* #define MS_NOSEC (1<<28)
|
||||||
* #define MS_BORN (1<<29)
|
* #define MS_BORN (1<<29)
|
||||||
* #define MS_ACTIVE (1<<30)
|
* #define MS_ACTIVE (1<<30)
|
||||||
@@ -246,6 +252,8 @@ static struct mnt_keyword_table mnt_opts_table[] = {
|
|||||||
{"mand", MS_MAND, 0},
|
{"mand", MS_MAND, 0},
|
||||||
{"nomand", 0, MS_MAND},
|
{"nomand", 0, MS_MAND},
|
||||||
{"dirsync", MS_DIRSYNC, 0},
|
{"dirsync", MS_DIRSYNC, 0},
|
||||||
|
{"symfollow", 0, MS_NOSYMFOLLOW},
|
||||||
|
{"nosymfollow", MS_NOSYMFOLLOW, 0},
|
||||||
{"atime", 0, MS_NOATIME},
|
{"atime", 0, MS_NOATIME},
|
||||||
{"noatime", MS_NOATIME, 0},
|
{"noatime", MS_NOATIME, 0},
|
||||||
{"diratime", 0, MS_NODIRATIME},
|
{"diratime", 0, MS_NODIRATIME},
|
||||||
@@ -283,6 +291,9 @@ static struct mnt_keyword_table mnt_opts_table[] = {
|
|||||||
{"iversion", MS_IVERSION, 0},
|
{"iversion", MS_IVERSION, 0},
|
||||||
{"noiversion", 0, MS_IVERSION},
|
{"noiversion", 0, MS_IVERSION},
|
||||||
{"strictatime", MS_STRICTATIME, 0},
|
{"strictatime", MS_STRICTATIME, 0},
|
||||||
|
{"nostrictatime", 0, MS_STRICTATIME},
|
||||||
|
{"lazytime", MS_LAZYTIME, 0},
|
||||||
|
{"nolazytime", 0, MS_LAZYTIME},
|
||||||
{"user", 0, (unsigned int) MS_NOUSER},
|
{"user", 0, (unsigned int) MS_NOUSER},
|
||||||
{"nouser", (unsigned int) MS_NOUSER, 0},
|
{"nouser", (unsigned int) MS_NOUSER, 0},
|
||||||
|
|
||||||
@@ -298,6 +309,22 @@ static struct mnt_keyword_table mnt_conds_table[] = {
|
|||||||
{NULL, 0, 0}
|
{NULL, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ostream &dump_flags(ostream &os,
|
||||||
|
pair <unsigned int, unsigned int> flags)
|
||||||
|
{
|
||||||
|
for (int i = 0; mnt_opts_table[i].keyword; i++) {
|
||||||
|
if ((flags.first & mnt_opts_table[i].set) ||
|
||||||
|
(flags.second & mnt_opts_table[i].clear))
|
||||||
|
os << mnt_opts_table[i].keyword;
|
||||||
|
}
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
ostream &operator<<(ostream &os, pair<unsigned int, unsigned int> flags)
|
||||||
|
{
|
||||||
|
return dump_flags(os, flags);
|
||||||
|
}
|
||||||
|
|
||||||
static int find_mnt_keyword(struct mnt_keyword_table *table, const char *name)
|
static int find_mnt_keyword(struct mnt_keyword_table *table, const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
@@ -320,7 +347,7 @@ int is_valid_mnt_cond(const char *name, int src)
|
|||||||
|
|
||||||
static unsigned int extract_flags(struct value_list **list, unsigned int *inv)
|
static unsigned int extract_flags(struct value_list **list, unsigned int *inv)
|
||||||
{
|
{
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0, invflags = 0;
|
||||||
*inv = 0;
|
*inv = 0;
|
||||||
|
|
||||||
struct value_list *entry, *tmp, *prev = NULL;
|
struct value_list *entry, *tmp, *prev = NULL;
|
||||||
@@ -329,11 +356,11 @@ static unsigned int extract_flags(struct value_list **list, unsigned int *inv)
|
|||||||
i = find_mnt_keyword(mnt_opts_table, entry->value);
|
i = find_mnt_keyword(mnt_opts_table, entry->value);
|
||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
flags |= mnt_opts_table[i].set;
|
flags |= mnt_opts_table[i].set;
|
||||||
*inv |= mnt_opts_table[i].clear;
|
invflags |= mnt_opts_table[i].clear;
|
||||||
PDEBUG(" extracting mount flag %s req: 0x%x inv: 0x%x"
|
PDEBUG(" extracting mount flag %s req: 0x%x inv: 0x%x"
|
||||||
" => req: 0x%x inv: 0x%x\n",
|
" => req: 0x%x inv: 0x%x\n",
|
||||||
entry->value, mnt_opts_table[i].set,
|
entry->value, mnt_opts_table[i].set,
|
||||||
mnt_opts_table[i].clear, flags, *inv);
|
mnt_opts_table[i].clear, flags, invflags);
|
||||||
if (prev)
|
if (prev)
|
||||||
prev->next = tmp;
|
prev->next = tmp;
|
||||||
if (entry == *list)
|
if (entry == *list)
|
||||||
@@ -344,9 +371,27 @@ static unsigned int extract_flags(struct value_list **list, unsigned int *inv)
|
|||||||
prev = entry;
|
prev = entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (inv)
|
||||||
|
*inv = invflags;
|
||||||
|
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool conflicting_flags(unsigned int flags, unsigned int inv)
|
||||||
|
{
|
||||||
|
if (flags & inv) {
|
||||||
|
for (int i = 0; i < 31; i++) {
|
||||||
|
unsigned int mask = 1 << i;
|
||||||
|
if ((flags & inv) & mask) {
|
||||||
|
cerr << "conflicting flag values = "
|
||||||
|
<< flags << ", " << inv << "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static struct value_list *extract_fstype(struct cond_entry **conds)
|
static struct value_list *extract_fstype(struct cond_entry **conds)
|
||||||
{
|
{
|
||||||
struct value_list *list = NULL;
|
struct value_list *list = NULL;
|
||||||
@@ -369,22 +414,19 @@ static struct value_list *extract_fstype(struct cond_entry **conds)
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct value_list *extract_options(struct cond_entry **conds, int eq)
|
static struct cond_entry *extract_options(struct cond_entry **conds, int eq)
|
||||||
{
|
{
|
||||||
struct value_list *list = NULL;
|
struct cond_entry *list = NULL, *entry, *tmp, *prev = NULL;
|
||||||
|
|
||||||
struct cond_entry *entry, *tmp, *prev = NULL;
|
|
||||||
|
|
||||||
list_for_each_safe(*conds, entry, tmp) {
|
list_for_each_safe(*conds, entry, tmp) {
|
||||||
if ((strcmp(entry->name, "options") == 0 ||
|
if ((strcmp(entry->name, "options") == 0 ||
|
||||||
strcmp(entry->name, "option") == 0) &&
|
strcmp(entry->name, "option") == 0) &&
|
||||||
entry->eq == eq) {
|
entry->eq == eq) {
|
||||||
list_remove_at(*conds, prev, entry);
|
list_remove_at(*conds, prev, entry);
|
||||||
PDEBUG(" extracting option %s\n", entry->name);
|
PDEBUG(" extracting %s %s\n", entry->name, entry->eq ?
|
||||||
list_append(entry->vals, list);
|
"=" : "in");
|
||||||
list = entry->vals;
|
list_append(entry, list);
|
||||||
entry->vals = NULL;
|
list = entry;
|
||||||
free_cond_entry(entry);
|
|
||||||
} else
|
} else
|
||||||
prev = entry;
|
prev = entry;
|
||||||
}
|
}
|
||||||
@@ -392,60 +434,129 @@ static struct value_list *extract_options(struct cond_entry **conds, int eq)
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void perror_conds(const char *rule, struct cond_entry *conds)
|
||||||
|
{
|
||||||
|
struct cond_entry *entry;
|
||||||
|
|
||||||
|
list_for_each(conds, entry) {
|
||||||
|
PERROR( "unsupported %s condition '%s%s(...)'\n", rule, entry->name, entry->eq ? "=" : " in ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void perror_vals(const char *rule, struct value_list *vals)
|
||||||
|
{
|
||||||
|
struct value_list *entry;
|
||||||
|
|
||||||
|
list_for_each(vals, entry) {
|
||||||
|
PERROR( "unsupported %s value '%s'\n", rule, entry->value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void process_one_option(struct cond_entry *&opts, unsigned int &flags,
|
||||||
|
unsigned int &inv_flags)
|
||||||
|
{
|
||||||
|
struct cond_entry *entry;
|
||||||
|
struct value_list *vals;
|
||||||
|
|
||||||
|
entry = list_pop(opts);
|
||||||
|
vals = entry->vals;
|
||||||
|
entry->vals = NULL;
|
||||||
|
/* fail if there are any unknown optional flags */
|
||||||
|
if (opts) {
|
||||||
|
PERROR(" unsupported multiple 'mount options %s(...)'\n", entry->eq ? "=" : " in ");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
free_cond_entry(entry);
|
||||||
|
|
||||||
|
flags = extract_flags(&vals, &inv_flags);
|
||||||
|
if (vals) {
|
||||||
|
perror_vals("mount option", vals);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mnt_rule::mnt_rule(struct cond_entry *src_conds, char *device_p,
|
mnt_rule::mnt_rule(struct cond_entry *src_conds, char *device_p,
|
||||||
struct cond_entry *dst_conds unused, char *mnt_point_p,
|
struct cond_entry *dst_conds unused, char *mnt_point_p,
|
||||||
int allow_p):
|
int allow_p):
|
||||||
mnt_point(mnt_point_p), device(device_p), trans(NULL), opts(NULL),
|
mnt_point(mnt_point_p), device(device_p), trans(NULL), opts(NULL),
|
||||||
flags(0), inv_flags(0), audit(0), deny(0)
|
flagsv(0), opt_flagsv(0), audit(0), deny(0)
|
||||||
{
|
{
|
||||||
/* FIXME: dst_conds are ignored atm */
|
/* FIXME: dst_conds are ignored atm */
|
||||||
dev_type = extract_fstype(&src_conds);
|
dev_type = extract_fstype(&src_conds);
|
||||||
|
|
||||||
if (src_conds) {
|
if (src_conds) {
|
||||||
struct value_list *list = extract_options(&src_conds, 0);
|
/* move options in () to local list */
|
||||||
|
struct cond_entry *opts_in = extract_options(&src_conds, 0);
|
||||||
|
|
||||||
opts = extract_options(&src_conds, 1);
|
if (opts_in) {
|
||||||
if (opts)
|
unsigned int tmpflags = 0, tmpinv_flags = 0;
|
||||||
flags = extract_flags(&opts, &inv_flags);
|
struct cond_entry *entry;
|
||||||
|
|
||||||
if (list) {
|
while ((entry = list_pop(opts_in))) {
|
||||||
unsigned int tmpflags, tmpinv_flags = 0;
|
process_one_option(entry, tmpflags,
|
||||||
|
tmpinv_flags);
|
||||||
tmpflags = extract_flags(&list, &tmpinv_flags);
|
/* optional flags if set/clear mean the same
|
||||||
/* these flags are optional so set both */
|
* thing and can be represented by a single
|
||||||
tmpflags |= tmpinv_flags;
|
* bitset, also there is no need to check for
|
||||||
tmpinv_flags |= tmpflags;
|
* conflicting flags when they are optional
|
||||||
|
*/
|
||||||
flags |= tmpflags;
|
opt_flagsv.push_back(tmpflags | tmpinv_flags);
|
||||||
inv_flags |= tmpinv_flags;
|
}
|
||||||
|
|
||||||
if (opts)
|
|
||||||
list_append(opts, list);
|
|
||||||
else if (list)
|
|
||||||
opts = list;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* move options=() to opts list */
|
||||||
|
struct cond_entry *opts_eq = extract_options(&src_conds, 1);
|
||||||
|
if (opts_eq) {
|
||||||
|
unsigned int tmpflags = 0, tmpinv_flags = 0;
|
||||||
|
struct cond_entry *entry;
|
||||||
|
|
||||||
|
while ((entry = list_pop(opts_eq))) {
|
||||||
|
process_one_option(entry, tmpflags,
|
||||||
|
tmpinv_flags);
|
||||||
|
/* throw away tmpinv_flags, only needed in
|
||||||
|
* consistancy check
|
||||||
|
*/
|
||||||
|
if (allow_p & AA_DUMMY_REMOUNT)
|
||||||
|
tmpflags |= MS_REMOUNT;
|
||||||
|
|
||||||
|
if (conflicting_flags(tmpflags, tmpinv_flags)) {
|
||||||
|
PERROR("conflicting flags in the rule\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
flagsv.push_back(tmpflags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (src_conds) {
|
||||||
|
perror_conds("mount", src_conds);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(flagsv.size() + opt_flagsv.size())) {
|
||||||
|
/* no flag options, and not remount, allow everything */
|
||||||
|
if (allow_p & AA_DUMMY_REMOUNT) {
|
||||||
|
flagsv.push_back(MS_REMOUNT);
|
||||||
|
opt_flagsv.push_back(MS_REMOUNT_FLAGS & ~MS_REMOUNT);
|
||||||
|
} else {
|
||||||
|
flagsv.push_back(MS_ALL_FLAGS);
|
||||||
|
opt_flagsv.push_back(MS_ALL_FLAGS);
|
||||||
|
}
|
||||||
|
} else if (!(flagsv.size())) {
|
||||||
|
/* no flags but opts set */
|
||||||
|
if (allow_p & AA_DUMMY_REMOUNT)
|
||||||
|
flagsv.push_back(MS_REMOUNT);
|
||||||
|
else
|
||||||
|
flagsv.push_back(0);
|
||||||
|
} else if (!(opt_flagsv.size())) {
|
||||||
|
opt_flagsv.push_back(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allow_p & AA_DUMMY_REMOUNT) {
|
if (allow_p & AA_DUMMY_REMOUNT) {
|
||||||
allow_p = AA_MAY_MOUNT;
|
allow_p = AA_MAY_MOUNT;
|
||||||
flags |= MS_REMOUNT;
|
|
||||||
inv_flags = 0;
|
|
||||||
} else if (!(flags | inv_flags)) {
|
|
||||||
/* no flag options, and not remount, allow everything */
|
|
||||||
flags = MS_ALL_FLAGS;
|
|
||||||
inv_flags = MS_ALL_FLAGS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
allow = allow_p;
|
allow = allow_p;
|
||||||
|
|
||||||
if (src_conds) {
|
|
||||||
PERROR(" unsupported mount conditions\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (opts) {
|
|
||||||
PERROR(" unsupported mount options\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ostream &mnt_rule::dump(ostream &os)
|
ostream &mnt_rule::dump(ostream &os)
|
||||||
@@ -459,7 +570,11 @@ ostream &mnt_rule::dump(ostream &os)
|
|||||||
else
|
else
|
||||||
os << "error: unknonwn mount perm";
|
os << "error: unknonwn mount perm";
|
||||||
|
|
||||||
os << " (0x" << hex << flags << " - 0x" << inv_flags << ") ";
|
for (unsigned int i = 0; i < flagsv.size(); i++)
|
||||||
|
os << " flags=(0x" << hex << flagsv[i] << ")";
|
||||||
|
for (unsigned int i = 0; i < opt_flagsv.size(); i++)
|
||||||
|
os << " flags in (0x" << hex << opt_flagsv[i] << ")";
|
||||||
|
|
||||||
if (dev_type) {
|
if (dev_type) {
|
||||||
os << " type=";
|
os << " type=";
|
||||||
print_value_list(dev_type);
|
print_value_list(dev_type);
|
||||||
@@ -515,7 +630,7 @@ int mnt_rule::expand_variables(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int build_mnt_flags(char *buffer, int size, unsigned int flags,
|
static int build_mnt_flags(char *buffer, int size, unsigned int flags,
|
||||||
unsigned int inv_flags)
|
unsigned int opt_flags)
|
||||||
{
|
{
|
||||||
char *p = buffer;
|
char *p = buffer;
|
||||||
int i, len = 0;
|
int i, len = 0;
|
||||||
@@ -528,7 +643,7 @@ static int build_mnt_flags(char *buffer, int size, unsigned int flags,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
for (i = 0; i <= 31; ++i) {
|
for (i = 0; i <= 31; ++i) {
|
||||||
if ((flags & inv_flags) & (1 << i))
|
if ((opt_flags) & (1 << i))
|
||||||
len = snprintf(p, size, "(\\x%02x|)", i + 1);
|
len = snprintf(p, size, "(\\x%02x|)", i + 1);
|
||||||
else if (flags & (1 << i))
|
else if (flags & (1 << i))
|
||||||
len = snprintf(p, size, "\\x%02x", i + 1);
|
len = snprintf(p, size, "\\x%02x", i + 1);
|
||||||
@@ -583,7 +698,9 @@ void mnt_rule::warn_once(const char *name)
|
|||||||
rule_t::warn_once(name, "mount rules not enforce");
|
rule_t::warn_once(name, "mount rules not enforce");
|
||||||
}
|
}
|
||||||
|
|
||||||
int mnt_rule::gen_policy_re(Profile &prof)
|
|
||||||
|
int mnt_rule::gen_policy_remount(Profile &prof, int &count,
|
||||||
|
unsigned int flags, unsigned int opt_flags)
|
||||||
{
|
{
|
||||||
std::string mntbuf;
|
std::string mntbuf;
|
||||||
std::string devbuf;
|
std::string devbuf;
|
||||||
@@ -592,8 +709,307 @@ int mnt_rule::gen_policy_re(Profile &prof)
|
|||||||
std::string optsbuf;
|
std::string optsbuf;
|
||||||
char class_mount_hdr[64];
|
char class_mount_hdr[64];
|
||||||
const char *vec[5];
|
const char *vec[5];
|
||||||
|
int tmpallow;
|
||||||
|
|
||||||
|
sprintf(class_mount_hdr, "\\x%02x", AA_CLASS_MOUNT);
|
||||||
|
|
||||||
|
/* remount can't be conditional on device and type */
|
||||||
|
/* rule class single byte header */
|
||||||
|
mntbuf.assign(class_mount_hdr);
|
||||||
|
if (mnt_point) {
|
||||||
|
/* both device && mnt_point or just mnt_point */
|
||||||
|
if (!convert_entry(mntbuf, mnt_point))
|
||||||
|
goto fail;
|
||||||
|
vec[0] = mntbuf.c_str();
|
||||||
|
} else {
|
||||||
|
if (!convert_entry(mntbuf, device))
|
||||||
|
goto fail;
|
||||||
|
vec[0] = mntbuf.c_str();
|
||||||
|
}
|
||||||
|
/* skip device */
|
||||||
|
vec[1] = default_match_pattern;
|
||||||
|
/* skip type */
|
||||||
|
vec[2] = default_match_pattern;
|
||||||
|
|
||||||
|
if (!build_mnt_flags(flagsbuf, PATH_MAX, flags & MS_REMOUNT_FLAGS,
|
||||||
|
opt_flags & MS_REMOUNT_FLAGS))
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
vec[3] = flagsbuf;
|
||||||
|
|
||||||
|
if (opts)
|
||||||
|
tmpallow = AA_MATCH_CONT;
|
||||||
|
else
|
||||||
|
tmpallow = allow;
|
||||||
|
|
||||||
|
/* rule for match without required data || data MATCH_CONT */
|
||||||
|
if (!prof.policy.rules->add_rule_vec(deny, tmpallow,
|
||||||
|
audit | AA_AUDIT_MNT_DATA, 4,
|
||||||
|
vec, dfaflags, false))
|
||||||
|
goto fail;
|
||||||
|
count++;
|
||||||
|
|
||||||
|
if (opts) {
|
||||||
|
/* rule with data match required */
|
||||||
|
optsbuf.clear();
|
||||||
|
if (!build_mnt_opts(optsbuf, opts))
|
||||||
|
goto fail;
|
||||||
|
vec[4] = optsbuf.c_str();
|
||||||
|
if (!prof.policy.rules->add_rule_vec(deny, allow,
|
||||||
|
audit | AA_AUDIT_MNT_DATA,
|
||||||
|
5, vec, dfaflags, false))
|
||||||
|
goto fail;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RULE_OK;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
return RULE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mnt_rule::gen_policy_bind_mount(Profile &prof, int &count,
|
||||||
|
unsigned int flags, unsigned int opt_flags)
|
||||||
|
{
|
||||||
|
std::string mntbuf;
|
||||||
|
std::string devbuf;
|
||||||
|
std::string typebuf;
|
||||||
|
char flagsbuf[PATH_MAX + 3];
|
||||||
|
std::string optsbuf;
|
||||||
|
char class_mount_hdr[64];
|
||||||
|
const char *vec[5];
|
||||||
|
|
||||||
|
sprintf(class_mount_hdr, "\\x%02x", AA_CLASS_MOUNT);
|
||||||
|
|
||||||
|
/* bind mount rules can't be conditional on dev_type or data */
|
||||||
|
/* rule class single byte header */
|
||||||
|
mntbuf.assign(class_mount_hdr);
|
||||||
|
if (!convert_entry(mntbuf, mnt_point))
|
||||||
|
goto fail;
|
||||||
|
vec[0] = mntbuf.c_str();
|
||||||
|
if (!clear_and_convert_entry(devbuf, device))
|
||||||
|
goto fail;
|
||||||
|
vec[1] = devbuf.c_str();
|
||||||
|
/* skip type */
|
||||||
|
vec[2] = default_match_pattern;
|
||||||
|
|
||||||
|
if (!build_mnt_flags(flagsbuf, PATH_MAX, flags & MS_BIND_FLAGS,
|
||||||
|
opt_flags & MS_BIND_FLAGS))
|
||||||
|
goto fail;
|
||||||
|
vec[3] = flagsbuf;
|
||||||
|
if (!prof.policy.rules->add_rule_vec(deny, allow, audit, 4, vec,
|
||||||
|
dfaflags, false))
|
||||||
|
goto fail;
|
||||||
|
count++;
|
||||||
|
|
||||||
|
return RULE_OK;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
return RULE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mnt_rule::gen_policy_change_mount_type(Profile &prof, int &count,
|
||||||
|
unsigned int flags,
|
||||||
|
unsigned int opt_flags)
|
||||||
|
{
|
||||||
|
std::string mntbuf;
|
||||||
|
std::string devbuf;
|
||||||
|
std::string typebuf;
|
||||||
|
char flagsbuf[PATH_MAX + 3];
|
||||||
|
std::string optsbuf;
|
||||||
|
char class_mount_hdr[64];
|
||||||
|
const char *vec[5];
|
||||||
|
|
||||||
|
sprintf(class_mount_hdr, "\\x%02x", AA_CLASS_MOUNT);
|
||||||
|
|
||||||
|
/* change type base rules can not be conditional on device,
|
||||||
|
* device type or data
|
||||||
|
*/
|
||||||
|
/* rule class single byte header */
|
||||||
|
mntbuf.assign(class_mount_hdr);
|
||||||
|
if (!convert_entry(mntbuf, mnt_point))
|
||||||
|
goto fail;
|
||||||
|
vec[0] = mntbuf.c_str();
|
||||||
|
/* skip device and type */
|
||||||
|
vec[1] = default_match_pattern;
|
||||||
|
vec[2] = default_match_pattern;
|
||||||
|
|
||||||
|
if (!build_mnt_flags(flagsbuf, PATH_MAX, flags & MS_MAKE_FLAGS,
|
||||||
|
opt_flags & MS_MAKE_FLAGS))
|
||||||
|
goto fail;
|
||||||
|
vec[3] = flagsbuf;
|
||||||
|
if (!prof.policy.rules->add_rule_vec(deny, allow, audit, 4, vec,
|
||||||
|
dfaflags, false))
|
||||||
|
goto fail;
|
||||||
|
count++;
|
||||||
|
|
||||||
|
return RULE_OK;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
return RULE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mnt_rule::gen_policy_move_mount(Profile &prof, int &count,
|
||||||
|
unsigned int flags, unsigned int opt_flags)
|
||||||
|
{
|
||||||
|
std::string mntbuf;
|
||||||
|
std::string devbuf;
|
||||||
|
std::string typebuf;
|
||||||
|
char flagsbuf[PATH_MAX + 3];
|
||||||
|
std::string optsbuf;
|
||||||
|
char class_mount_hdr[64];
|
||||||
|
const char *vec[5];
|
||||||
|
|
||||||
|
sprintf(class_mount_hdr, "\\x%02x", AA_CLASS_MOUNT);
|
||||||
|
|
||||||
|
/* mount move rules can not be conditional on dev_type,
|
||||||
|
* or data
|
||||||
|
*/
|
||||||
|
/* rule class single byte header */
|
||||||
|
mntbuf.assign(class_mount_hdr);
|
||||||
|
if (!convert_entry(mntbuf, mnt_point))
|
||||||
|
goto fail;
|
||||||
|
vec[0] = mntbuf.c_str();
|
||||||
|
if (!clear_and_convert_entry(devbuf, device))
|
||||||
|
goto fail;
|
||||||
|
vec[1] = devbuf.c_str();
|
||||||
|
/* skip type */
|
||||||
|
vec[2] = default_match_pattern;
|
||||||
|
|
||||||
|
if (!build_mnt_flags(flagsbuf, PATH_MAX, flags & MS_MOVE_FLAGS,
|
||||||
|
opt_flags & MS_MOVE_FLAGS))
|
||||||
|
goto fail;
|
||||||
|
vec[3] = flagsbuf;
|
||||||
|
if (!prof.policy.rules->add_rule_vec(deny, allow, audit, 4, vec,
|
||||||
|
dfaflags, false))
|
||||||
|
goto fail;
|
||||||
|
count++;
|
||||||
|
|
||||||
|
return RULE_OK;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
return RULE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mnt_rule::gen_policy_new_mount(Profile &prof, int &count,
|
||||||
|
unsigned int flags, unsigned int opt_flags)
|
||||||
|
{
|
||||||
|
std::string mntbuf;
|
||||||
|
std::string devbuf;
|
||||||
|
std::string typebuf;
|
||||||
|
char flagsbuf[PATH_MAX + 3];
|
||||||
|
std::string optsbuf;
|
||||||
|
char class_mount_hdr[64];
|
||||||
|
const char *vec[5];
|
||||||
|
int tmpallow;
|
||||||
|
|
||||||
|
sprintf(class_mount_hdr, "\\x%02x", AA_CLASS_MOUNT);
|
||||||
|
|
||||||
|
/* rule class single byte header */
|
||||||
|
mntbuf.assign(class_mount_hdr);
|
||||||
|
if (!convert_entry(mntbuf, mnt_point))
|
||||||
|
goto fail;
|
||||||
|
vec[0] = mntbuf.c_str();
|
||||||
|
if (!clear_and_convert_entry(devbuf, device))
|
||||||
|
goto fail;
|
||||||
|
vec[1] = devbuf.c_str();
|
||||||
|
typebuf.clear();
|
||||||
|
if (!build_list_val_expr(typebuf, dev_type))
|
||||||
|
goto fail;
|
||||||
|
vec[2] = typebuf.c_str();
|
||||||
|
|
||||||
|
if (!build_mnt_flags(flagsbuf, PATH_MAX, flags & MS_NEW_FLAGS,
|
||||||
|
opt_flags & MS_NEW_FLAGS))
|
||||||
|
goto fail;
|
||||||
|
vec[3] = flagsbuf;
|
||||||
|
|
||||||
|
if (opts)
|
||||||
|
tmpallow = AA_MATCH_CONT;
|
||||||
|
else
|
||||||
|
tmpallow = allow;
|
||||||
|
|
||||||
|
/* rule for match without required data || data MATCH_CONT */
|
||||||
|
if (!prof.policy.rules->add_rule_vec(deny, tmpallow,
|
||||||
|
audit | AA_AUDIT_MNT_DATA, 4,
|
||||||
|
vec, dfaflags, false))
|
||||||
|
goto fail;
|
||||||
|
count++;
|
||||||
|
|
||||||
|
if (opts) {
|
||||||
|
/* rule with data match required */
|
||||||
|
optsbuf.clear();
|
||||||
|
if (!build_mnt_opts(optsbuf, opts))
|
||||||
|
goto fail;
|
||||||
|
vec[4] = optsbuf.c_str();
|
||||||
|
if (!prof.policy.rules->add_rule_vec(deny, allow,
|
||||||
|
audit | AA_AUDIT_MNT_DATA,
|
||||||
|
5, vec, dfaflags, false))
|
||||||
|
goto fail;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return RULE_OK;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
return RULE_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mnt_rule::gen_flag_rules(Profile &prof, int &count, unsigned int flags,
|
||||||
|
unsigned int opt_flags)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* XXX: added !flags to cover cases like:
|
||||||
|
* mount options in (bind) /d -> /4,
|
||||||
|
*/
|
||||||
|
if ((allow & AA_MAY_MOUNT) && (!flags || flags == MS_ALL_FLAGS)) {
|
||||||
|
/* no mount flags specified, generate multiple rules */
|
||||||
|
if (!device && !dev_type &&
|
||||||
|
gen_policy_remount(prof, count, flags, opt_flags) == RULE_ERROR)
|
||||||
|
return RULE_ERROR;
|
||||||
|
if (!dev_type && !opts &&
|
||||||
|
gen_policy_bind_mount(prof, count, flags, opt_flags) == RULE_ERROR)
|
||||||
|
return RULE_ERROR;
|
||||||
|
if (!device && !dev_type && !opts &&
|
||||||
|
gen_policy_change_mount_type(prof, count, flags, opt_flags) == RULE_ERROR)
|
||||||
|
return RULE_ERROR;
|
||||||
|
if (!dev_type && !opts &&
|
||||||
|
gen_policy_move_mount(prof, count, flags, opt_flags) == RULE_ERROR)
|
||||||
|
return RULE_ERROR;
|
||||||
|
|
||||||
|
return gen_policy_new_mount(prof, count, flags, opt_flags);
|
||||||
|
} else if ((allow & AA_MAY_MOUNT) && (flags & MS_REMOUNT)
|
||||||
|
&& !device && !dev_type) {
|
||||||
|
return gen_policy_remount(prof, count, flags, opt_flags);
|
||||||
|
} else if ((allow & AA_MAY_MOUNT) && (flags & MS_BIND)
|
||||||
|
&& !dev_type && !opts) {
|
||||||
|
return gen_policy_bind_mount(prof, count, flags, opt_flags);
|
||||||
|
} else if ((allow & AA_MAY_MOUNT) &&
|
||||||
|
(flags & (MS_MAKE_CMDS))
|
||||||
|
&& !device && !dev_type && !opts) {
|
||||||
|
return gen_policy_change_mount_type(prof, count, flags, opt_flags);
|
||||||
|
} else if ((allow & AA_MAY_MOUNT) && (flags & MS_MOVE)
|
||||||
|
&& !dev_type && !opts) {
|
||||||
|
return gen_policy_move_mount(prof, count, flags, opt_flags);
|
||||||
|
} else if ((allow & AA_MAY_MOUNT) &&
|
||||||
|
((flags | opt_flags) & ~MS_CMDS)) {
|
||||||
|
/* generic mount if flags are set that are not covered by
|
||||||
|
* above commands
|
||||||
|
*/
|
||||||
|
return gen_policy_new_mount(prof, count, flags, opt_flags);
|
||||||
|
} /* else must be RULE_OK for some rules */
|
||||||
|
|
||||||
|
return RULE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
int mnt_rule::gen_policy_re(Profile &prof)
|
||||||
|
{
|
||||||
|
std::string mntbuf;
|
||||||
|
std::string devbuf;
|
||||||
|
std::string typebuf;
|
||||||
|
std::string optsbuf;
|
||||||
|
char class_mount_hdr[64];
|
||||||
|
const char *vec[5];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
unsigned int tmpflags, tmpinv_flags;
|
|
||||||
|
|
||||||
if (!features_supports_mount) {
|
if (!features_supports_mount) {
|
||||||
warn_once(prof.name);
|
warn_once(prof.name);
|
||||||
@@ -605,202 +1021,10 @@ int mnt_rule::gen_policy_re(Profile &prof)
|
|||||||
/* a single mount rule may result in multiple matching rules being
|
/* a single mount rule may result in multiple matching rules being
|
||||||
* created in the backend to cover all the possible choices
|
* created in the backend to cover all the possible choices
|
||||||
*/
|
*/
|
||||||
|
for (size_t i = 0; i < flagsv.size(); i++) {
|
||||||
if ((allow & AA_MAY_MOUNT) && (flags & MS_REMOUNT)
|
for (size_t j = 0; j < opt_flagsv.size(); j++) {
|
||||||
&& !device && !dev_type) {
|
if (gen_flag_rules(prof, count, flagsv[i], opt_flagsv[j]) == RULE_ERROR)
|
||||||
int tmpallow;
|
|
||||||
/* remount can't be conditional on device and type */
|
|
||||||
/* rule class single byte header */
|
|
||||||
mntbuf.assign(class_mount_hdr);
|
|
||||||
if (mnt_point) {
|
|
||||||
/* both device && mnt_point or just mnt_point */
|
|
||||||
if (!convert_entry(mntbuf, mnt_point))
|
|
||||||
goto fail;
|
goto fail;
|
||||||
vec[0] = mntbuf.c_str();
|
|
||||||
} else {
|
|
||||||
if (!convert_entry(mntbuf, device))
|
|
||||||
goto fail;
|
|
||||||
vec[0] = mntbuf.c_str();
|
|
||||||
}
|
|
||||||
/* skip device */
|
|
||||||
vec[1] = default_match_pattern;
|
|
||||||
/* skip type */
|
|
||||||
vec[2] = default_match_pattern;
|
|
||||||
|
|
||||||
tmpflags = flags;
|
|
||||||
tmpinv_flags = inv_flags;
|
|
||||||
if (tmpflags != MS_ALL_FLAGS)
|
|
||||||
tmpflags &= MS_REMOUNT_FLAGS;
|
|
||||||
if (tmpinv_flags != MS_ALL_FLAGS)
|
|
||||||
tmpflags &= MS_REMOUNT_FLAGS;
|
|
||||||
if (!build_mnt_flags(flagsbuf, PATH_MAX, tmpflags, tmpinv_flags))
|
|
||||||
goto fail;
|
|
||||||
vec[3] = flagsbuf;
|
|
||||||
|
|
||||||
if (opts)
|
|
||||||
tmpallow = AA_MATCH_CONT;
|
|
||||||
else
|
|
||||||
tmpallow = allow;
|
|
||||||
|
|
||||||
/* rule for match without required data || data MATCH_CONT */
|
|
||||||
if (!prof.policy.rules->add_rule_vec(deny, tmpallow,
|
|
||||||
audit | AA_AUDIT_MNT_DATA, 4,
|
|
||||||
vec, dfaflags, false))
|
|
||||||
goto fail;
|
|
||||||
count++;
|
|
||||||
|
|
||||||
if (opts) {
|
|
||||||
/* rule with data match required */
|
|
||||||
optsbuf.clear();
|
|
||||||
if (!build_mnt_opts(optsbuf, opts))
|
|
||||||
goto fail;
|
|
||||||
vec[4] = optsbuf.c_str();
|
|
||||||
if (!prof.policy.rules->add_rule_vec(deny, allow,
|
|
||||||
audit | AA_AUDIT_MNT_DATA,
|
|
||||||
5, vec, dfaflags, false))
|
|
||||||
goto fail;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((allow & AA_MAY_MOUNT) && (flags & MS_BIND)
|
|
||||||
&& !dev_type && !opts) {
|
|
||||||
/* bind mount rules can't be conditional on dev_type or data */
|
|
||||||
/* rule class single byte header */
|
|
||||||
mntbuf.assign(class_mount_hdr);
|
|
||||||
if (!convert_entry(mntbuf, mnt_point))
|
|
||||||
goto fail;
|
|
||||||
vec[0] = mntbuf.c_str();
|
|
||||||
if (!clear_and_convert_entry(devbuf, device))
|
|
||||||
goto fail;
|
|
||||||
vec[1] = devbuf.c_str();
|
|
||||||
/* skip type */
|
|
||||||
vec[2] = default_match_pattern;
|
|
||||||
|
|
||||||
tmpflags = flags;
|
|
||||||
tmpinv_flags = inv_flags;
|
|
||||||
if (tmpflags != MS_ALL_FLAGS)
|
|
||||||
tmpflags &= MS_BIND_FLAGS;
|
|
||||||
if (tmpinv_flags != MS_ALL_FLAGS)
|
|
||||||
tmpflags &= MS_BIND_FLAGS;
|
|
||||||
if (!build_mnt_flags(flagsbuf, PATH_MAX, tmpflags, tmpinv_flags))
|
|
||||||
goto fail;
|
|
||||||
vec[3] = flagsbuf;
|
|
||||||
if (!prof.policy.rules->add_rule_vec(deny, allow, audit, 4, vec,
|
|
||||||
dfaflags, false))
|
|
||||||
goto fail;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
if ((allow & AA_MAY_MOUNT) &&
|
|
||||||
(flags & (MS_UNBINDABLE | MS_PRIVATE | MS_SLAVE | MS_SHARED))
|
|
||||||
&& !device && !dev_type && !opts) {
|
|
||||||
/* change type base rules can not be conditional on device,
|
|
||||||
* device type or data
|
|
||||||
*/
|
|
||||||
/* rule class single byte header */
|
|
||||||
mntbuf.assign(class_mount_hdr);
|
|
||||||
if (!convert_entry(mntbuf, mnt_point))
|
|
||||||
goto fail;
|
|
||||||
vec[0] = mntbuf.c_str();
|
|
||||||
/* skip device and type */
|
|
||||||
vec[1] = default_match_pattern;
|
|
||||||
vec[2] = default_match_pattern;
|
|
||||||
|
|
||||||
tmpflags = flags;
|
|
||||||
tmpinv_flags = inv_flags;
|
|
||||||
if (tmpflags != MS_ALL_FLAGS)
|
|
||||||
tmpflags &= MS_MAKE_FLAGS;
|
|
||||||
if (tmpinv_flags != MS_ALL_FLAGS)
|
|
||||||
tmpflags &= MS_MAKE_FLAGS;
|
|
||||||
if (!build_mnt_flags(flagsbuf, PATH_MAX, tmpflags, tmpinv_flags))
|
|
||||||
goto fail;
|
|
||||||
vec[3] = flagsbuf;
|
|
||||||
if (!prof.policy.rules->add_rule_vec(deny, allow, audit, 4, vec,
|
|
||||||
dfaflags, false))
|
|
||||||
goto fail;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
if ((allow & AA_MAY_MOUNT) && (flags & MS_MOVE)
|
|
||||||
&& !dev_type && !opts) {
|
|
||||||
/* mount move rules can not be conditional on dev_type,
|
|
||||||
* or data
|
|
||||||
*/
|
|
||||||
/* rule class single byte header */
|
|
||||||
mntbuf.assign(class_mount_hdr);
|
|
||||||
if (!convert_entry(mntbuf, mnt_point))
|
|
||||||
goto fail;
|
|
||||||
vec[0] = mntbuf.c_str();
|
|
||||||
if (!clear_and_convert_entry(devbuf, device))
|
|
||||||
goto fail;
|
|
||||||
vec[1] = devbuf.c_str();
|
|
||||||
/* skip type */
|
|
||||||
vec[2] = default_match_pattern;
|
|
||||||
|
|
||||||
tmpflags = flags;
|
|
||||||
tmpinv_flags = inv_flags;
|
|
||||||
if (tmpflags != MS_ALL_FLAGS)
|
|
||||||
tmpflags &= MS_MOVE_FLAGS;
|
|
||||||
if (tmpinv_flags != MS_ALL_FLAGS)
|
|
||||||
tmpflags &= MS_MOVE_FLAGS;
|
|
||||||
if (!build_mnt_flags(flagsbuf, PATH_MAX, tmpflags, tmpinv_flags))
|
|
||||||
goto fail;
|
|
||||||
vec[3] = flagsbuf;
|
|
||||||
if (!prof.policy.rules->add_rule_vec(deny, allow, audit, 4, vec,
|
|
||||||
dfaflags, false))
|
|
||||||
goto fail;
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
if ((allow & AA_MAY_MOUNT) &&
|
|
||||||
(flags | inv_flags) & ~MS_CMDS) {
|
|
||||||
int tmpallow;
|
|
||||||
/* generic mount if flags are set that are not covered by
|
|
||||||
* above commands
|
|
||||||
*/
|
|
||||||
/* rule class single byte header */
|
|
||||||
mntbuf.assign(class_mount_hdr);
|
|
||||||
if (!convert_entry(mntbuf, mnt_point))
|
|
||||||
goto fail;
|
|
||||||
vec[0] = mntbuf.c_str();
|
|
||||||
if (!clear_and_convert_entry(devbuf, device))
|
|
||||||
goto fail;
|
|
||||||
vec[1] = devbuf.c_str();
|
|
||||||
typebuf.clear();
|
|
||||||
if (!build_list_val_expr(typebuf, dev_type))
|
|
||||||
goto fail;
|
|
||||||
vec[2] = typebuf.c_str();
|
|
||||||
|
|
||||||
tmpflags = flags;
|
|
||||||
tmpinv_flags = inv_flags;
|
|
||||||
if (tmpflags != MS_ALL_FLAGS)
|
|
||||||
tmpflags &= ~MS_CMDS;
|
|
||||||
if (tmpinv_flags != MS_ALL_FLAGS)
|
|
||||||
tmpinv_flags &= ~MS_CMDS;
|
|
||||||
if (!build_mnt_flags(flagsbuf, PATH_MAX, tmpflags, tmpinv_flags))
|
|
||||||
goto fail;
|
|
||||||
vec[3] = flagsbuf;
|
|
||||||
|
|
||||||
if (opts)
|
|
||||||
tmpallow = AA_MATCH_CONT;
|
|
||||||
else
|
|
||||||
tmpallow = allow;
|
|
||||||
|
|
||||||
/* rule for match without required data || data MATCH_CONT */
|
|
||||||
if (!prof.policy.rules->add_rule_vec(deny, tmpallow,
|
|
||||||
audit | AA_AUDIT_MNT_DATA, 4,
|
|
||||||
vec, dfaflags, false))
|
|
||||||
goto fail;
|
|
||||||
count++;
|
|
||||||
|
|
||||||
if (opts) {
|
|
||||||
/* rule with data match required */
|
|
||||||
optsbuf.clear();
|
|
||||||
if (!build_mnt_opts(optsbuf, opts))
|
|
||||||
goto fail;
|
|
||||||
vec[4] = optsbuf.c_str();
|
|
||||||
if (!prof.policy.rules->add_rule_vec(deny, allow,
|
|
||||||
audit | AA_AUDIT_MNT_DATA,
|
|
||||||
5, vec, dfaflags, false))
|
|
||||||
goto fail;
|
|
||||||
count++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (allow & AA_MAY_UMOUNT) {
|
if (allow & AA_MAY_UMOUNT) {
|
||||||
|
@@ -20,6 +20,7 @@
|
|||||||
#define __AA_MOUNT_H
|
#define __AA_MOUNT_H
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "parser.h"
|
#include "parser.h"
|
||||||
#include "rule.h"
|
#include "rule.h"
|
||||||
@@ -39,6 +40,8 @@
|
|||||||
#define MS_MAND (1 << 6)
|
#define MS_MAND (1 << 6)
|
||||||
#define MS_NOMAND 0
|
#define MS_NOMAND 0
|
||||||
#define MS_DIRSYNC (1 << 7)
|
#define MS_DIRSYNC (1 << 7)
|
||||||
|
#define MS_SYMFOLLOW 0
|
||||||
|
#define MS_NOSYMFOLLOW (1 << 8)
|
||||||
#define MS_NODIRSYNC 0
|
#define MS_NODIRSYNC 0
|
||||||
#define MS_NOATIME (1 << 10)
|
#define MS_NOATIME (1 << 10)
|
||||||
#define MS_ATIME 0
|
#define MS_ATIME 0
|
||||||
@@ -61,6 +64,7 @@
|
|||||||
#define MS_IVERSION (1 << 23)
|
#define MS_IVERSION (1 << 23)
|
||||||
#define MS_NOIVERSION 0
|
#define MS_NOIVERSION 0
|
||||||
#define MS_STRICTATIME (1 << 24)
|
#define MS_STRICTATIME (1 << 24)
|
||||||
|
#define MS_LAZYTIME (1 << 25)
|
||||||
#define MS_NOUSER (1 << 31)
|
#define MS_NOUSER (1 << 31)
|
||||||
#define MS_USER 0
|
#define MS_USER 0
|
||||||
|
|
||||||
@@ -74,12 +78,14 @@
|
|||||||
|
|
||||||
#define MS_ALL_FLAGS (MS_RDONLY | MS_NOSUID | MS_NODEV | MS_NOEXEC | \
|
#define MS_ALL_FLAGS (MS_RDONLY | MS_NOSUID | MS_NODEV | MS_NOEXEC | \
|
||||||
MS_SYNC | MS_REMOUNT | MS_MAND | MS_DIRSYNC | \
|
MS_SYNC | MS_REMOUNT | MS_MAND | MS_DIRSYNC | \
|
||||||
|
MS_NOSYMFOLLOW | \
|
||||||
MS_NOATIME | MS_NODIRATIME | MS_BIND | MS_RBIND | \
|
MS_NOATIME | MS_NODIRATIME | MS_BIND | MS_RBIND | \
|
||||||
MS_MOVE | MS_VERBOSE | MS_ACL | \
|
MS_MOVE | MS_VERBOSE | MS_ACL | \
|
||||||
MS_UNBINDABLE | MS_RUNBINDABLE | \
|
MS_UNBINDABLE | MS_RUNBINDABLE | \
|
||||||
MS_PRIVATE | MS_RPRIVATE | \
|
MS_PRIVATE | MS_RPRIVATE | \
|
||||||
MS_SLAVE | MS_RSLAVE | MS_SHARED | MS_RSHARED | \
|
MS_SLAVE | MS_RSLAVE | MS_SHARED | MS_RSHARED | \
|
||||||
MS_RELATIME | MS_IVERSION | MS_STRICTATIME | MS_USER)
|
MS_RELATIME | MS_IVERSION | MS_STRICTATIME | \
|
||||||
|
MS_LAZYTIME | MS_USER)
|
||||||
|
|
||||||
/* set of flags we don't use but define (but not with the kernel values)
|
/* set of flags we don't use but define (but not with the kernel values)
|
||||||
* for MNT_FLAGS
|
* for MNT_FLAGS
|
||||||
@@ -94,16 +100,15 @@
|
|||||||
MS_KERNMOUNT | MS_STRICTATIME)
|
MS_KERNMOUNT | MS_STRICTATIME)
|
||||||
|
|
||||||
#define MS_BIND_FLAGS (MS_BIND | MS_RBIND)
|
#define MS_BIND_FLAGS (MS_BIND | MS_RBIND)
|
||||||
#define MS_MAKE_FLAGS ((MS_UNBINDABLE | MS_RUNBINDABLE | \
|
#define MS_MAKE_CMDS (MS_UNBINDABLE | MS_RUNBINDABLE | \
|
||||||
MS_PRIVATE | MS_RPRIVATE | \
|
MS_PRIVATE | MS_RPRIVATE | \
|
||||||
MS_SLAVE | MS_RSLAVE | MS_SHARED | MS_RSHARED) | \
|
MS_SLAVE | MS_RSLAVE | MS_SHARED | MS_RSHARED)
|
||||||
(MS_ALL_FLAGS & ~(MNT_FLAGS)))
|
#define MS_MAKE_FLAGS (MS_ALL_FLAGS & ~(MNT_FLAGS))
|
||||||
#define MS_MOVE_FLAGS (MS_MOVE)
|
#define MS_MOVE_FLAGS (MS_MOVE)
|
||||||
|
|
||||||
#define MS_CMDS (MS_MOVE | MS_REMOUNT | MS_BIND | MS_RBIND | \
|
#define MS_CMDS (MS_MOVE | MS_REMOUNT | MS_BIND | MS_RBIND | MS_MAKE_CMDS)
|
||||||
MS_UNBINDABLE | MS_RUNBINDABLE | MS_PRIVATE | MS_RPRIVATE | \
|
|
||||||
MS_SLAVE | MS_RSLAVE | MS_SHARED | MS_RSHARED)
|
|
||||||
#define MS_REMOUNT_FLAGS (MS_ALL_FLAGS & ~(MS_CMDS & ~MS_REMOUNT & ~MS_BIND & ~MS_RBIND))
|
#define MS_REMOUNT_FLAGS (MS_ALL_FLAGS & ~(MS_CMDS & ~MS_REMOUNT & ~MS_BIND & ~MS_RBIND))
|
||||||
|
#define MS_NEW_FLAGS (MS_ALL_FLAGS & ~MS_CMDS)
|
||||||
|
|
||||||
#define MNT_SRC_OPT 1
|
#define MNT_SRC_OPT 1
|
||||||
#define MNT_DST_OPT 2
|
#define MNT_DST_OPT 2
|
||||||
@@ -121,6 +126,19 @@
|
|||||||
|
|
||||||
|
|
||||||
class mnt_rule: public rule_t {
|
class mnt_rule: public rule_t {
|
||||||
|
int gen_policy_remount(Profile &prof, int &count, unsigned int flags,
|
||||||
|
unsigned int opt_flags);
|
||||||
|
int gen_policy_bind_mount(Profile &prof, int &count, unsigned int flags,
|
||||||
|
unsigned int opt_flags);
|
||||||
|
int gen_policy_change_mount_type(Profile &prof, int &count,
|
||||||
|
unsigned int flags,
|
||||||
|
unsigned int opt_flags);
|
||||||
|
int gen_policy_move_mount(Profile &prof, int &count, unsigned int flags,
|
||||||
|
unsigned int opt_flags);
|
||||||
|
int gen_policy_new_mount(Profile &prof, int &count, unsigned int flags,
|
||||||
|
unsigned int opt_flags);
|
||||||
|
int gen_flag_rules(Profile &prof, int &count, unsigned int flags,
|
||||||
|
unsigned int opt_flags);
|
||||||
public:
|
public:
|
||||||
char *mnt_point;
|
char *mnt_point;
|
||||||
char *device;
|
char *device;
|
||||||
@@ -128,7 +146,7 @@ public:
|
|||||||
struct value_list *dev_type;
|
struct value_list *dev_type;
|
||||||
struct value_list *opts;
|
struct value_list *opts;
|
||||||
|
|
||||||
unsigned int flags, inv_flags;
|
std::vector<unsigned int> flagsv, opt_flagsv;
|
||||||
|
|
||||||
int allow, audit;
|
int allow, audit;
|
||||||
int deny;
|
int deny;
|
||||||
|
@@ -229,6 +229,7 @@ do { \
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define list_first(LIST) (LIST)
|
||||||
#define list_for_each(LIST, ENTRY) \
|
#define list_for_each(LIST, ENTRY) \
|
||||||
for ((ENTRY) = (LIST); (ENTRY); (ENTRY) = (ENTRY)->next)
|
for ((ENTRY) = (LIST); (ENTRY); (ENTRY) = (ENTRY)->next)
|
||||||
#define list_for_each_safe(LIST, ENTRY, TMP) \
|
#define list_for_each_safe(LIST, ENTRY, TMP) \
|
||||||
@@ -262,6 +263,16 @@ do { \
|
|||||||
prev; \
|
prev; \
|
||||||
})
|
})
|
||||||
|
|
||||||
|
#define list_pop(LIST) \
|
||||||
|
({ \
|
||||||
|
typeof(LIST) _entry = (LIST); \
|
||||||
|
if (LIST) { \
|
||||||
|
(LIST) = (LIST)->next; \
|
||||||
|
_entry->next = NULL; \
|
||||||
|
} \
|
||||||
|
_entry; \
|
||||||
|
})
|
||||||
|
|
||||||
#define list_remove_at(LIST, PREV, ENTRY) \
|
#define list_remove_at(LIST, PREV, ENTRY) \
|
||||||
if (PREV) \
|
if (PREV) \
|
||||||
(PREV)->next = (ENTRY)->next; \
|
(PREV)->next = (ENTRY)->next; \
|
||||||
|
@@ -165,6 +165,7 @@ FILE *search_path(char *filename, char **fullpath, bool *skip)
|
|||||||
if (g_includecache->find(buf)) {
|
if (g_includecache->find(buf)) {
|
||||||
/* hit do not want to re-include */
|
/* hit do not want to re-include */
|
||||||
*skip = true;
|
*skip = true;
|
||||||
|
free(buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -141,6 +141,8 @@ static int include_dir_cb(int dirfd unused, const char *name, struct stat *st,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Handle symlink here. See _aa_dirat_for_each in private.c */
|
||||||
|
|
||||||
if (S_ISREG(st->st_mode)) {
|
if (S_ISREG(st->st_mode)) {
|
||||||
if (!(yyin = fopen(path,"r")))
|
if (!(yyin = fopen(path,"r")))
|
||||||
yyerror(_("Could not open '%s' in '%s'"), path, d->filename);
|
yyerror(_("Could not open '%s' in '%s'"), path, d->filename);
|
||||||
|
@@ -1112,7 +1112,7 @@ int process_profile(int option, aa_kernel_interface *kernel_interface,
|
|||||||
retval = process_binary(option, kernel_interface,
|
retval = process_binary(option, kernel_interface,
|
||||||
cachename);
|
cachename);
|
||||||
if (!retval || skip_bad_cache_rebuild)
|
if (!retval || skip_bad_cache_rebuild)
|
||||||
return retval;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1175,7 +1175,8 @@ int process_profile(int option, aa_kernel_interface *kernel_interface,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
/* cleanup */
|
||||||
|
reset_parser(profilename);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1332,6 +1333,8 @@ static int profile_dir_cb(int dirfd unused, const char *name, struct stat *st,
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
/* Handle symlink here. See _aa_dirat_for_each in private.c */
|
||||||
|
|
||||||
if (!S_ISDIR(st->st_mode) && !is_blacklisted(name, NULL)) {
|
if (!S_ISDIR(st->st_mode) && !is_blacklisted(name, NULL)) {
|
||||||
struct dir_cb_data *cb_data = (struct dir_cb_data *)data;
|
struct dir_cb_data *cb_data = (struct dir_cb_data *)data;
|
||||||
autofree char *path = NULL;
|
autofree char *path = NULL;
|
||||||
@@ -1354,6 +1357,8 @@ static int binary_dir_cb(int dirfd unused, const char *name, struct stat *st,
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
/* Handle symlink here. See _aa_dirat_for_each in private.c */
|
||||||
|
|
||||||
if (!S_ISDIR(st->st_mode) && !is_blacklisted(name, NULL)) {
|
if (!S_ISDIR(st->st_mode) && !is_blacklisted(name, NULL)) {
|
||||||
struct dir_cb_data *cb_data = (struct dir_cb_data *)data;
|
struct dir_cb_data *cb_data = (struct dir_cb_data *)data;
|
||||||
autofree char *path = NULL;
|
autofree char *path = NULL;
|
||||||
@@ -1546,7 +1551,7 @@ int main(int argc, char *argv[])
|
|||||||
if ((retval = dirat_for_each(AT_FDCWD, profilename,
|
if ((retval = dirat_for_each(AT_FDCWD, profilename,
|
||||||
&cb_data, cb))) {
|
&cb_data, cb))) {
|
||||||
last_error = errno;
|
last_error = errno;
|
||||||
PDEBUG("Failed loading profiles from %s\n",
|
PERROR("There was an error while loading profiles from %s\n",
|
||||||
profilename);
|
profilename);
|
||||||
if (abort_on_error)
|
if (abort_on_error)
|
||||||
break;
|
break;
|
||||||
@@ -1573,6 +1578,7 @@ int main(int argc, char *argv[])
|
|||||||
if (ofile)
|
if (ofile)
|
||||||
fclose(ofile);
|
fclose(ofile);
|
||||||
aa_policy_cache_unref(policy_cache);
|
aa_policy_cache_unref(policy_cache);
|
||||||
|
aa_kernel_interface_unref(kernel_interface);
|
||||||
|
|
||||||
return last_error;
|
return last_error;
|
||||||
}
|
}
|
||||||
|
@@ -44,20 +44,6 @@
|
|||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include <linux/capability.h>
|
|
||||||
|
|
||||||
#ifndef CAP_AUDIT_WRITE
|
|
||||||
#define CAP_AUDIT_WRITE 29
|
|
||||||
#endif
|
|
||||||
#ifndef CAP_AUDIT_CONTROL
|
|
||||||
#define CAP_AUDIT_CONTROL 30
|
|
||||||
#endif
|
|
||||||
#ifndef CAP_SETFCAP
|
|
||||||
#define CAP_SETFCAP 31
|
|
||||||
#endif
|
|
||||||
#ifndef CAP_MAC_OVERRIDE
|
|
||||||
#define CAP_MAC_OVERRIDE 32
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define CIDR_32 htonl(0xffffffff)
|
#define CIDR_32 htonl(0xffffffff)
|
||||||
#define CIDR_24 htonl(0xffffff00)
|
#define CIDR_24 htonl(0xffffff00)
|
||||||
@@ -1787,7 +1773,7 @@ static int abi_features_base(struct aa_features **features, char *filename, bool
|
|||||||
{
|
{
|
||||||
autofclose FILE *f = NULL;
|
autofclose FILE *f = NULL;
|
||||||
struct stat my_stat;
|
struct stat my_stat;
|
||||||
char *fullpath = NULL;
|
autofree char *fullpath = NULL;
|
||||||
bool cached;
|
bool cached;
|
||||||
|
|
||||||
if (search) {
|
if (search) {
|
||||||
|
48
parser/profile-load
Executable file
48
parser/profile-load
Executable file
@@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# profile-load
|
||||||
|
#
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Copyright (c) 2010-2015 Canonical, Ltd.
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of version 2 of the GNU General Public
|
||||||
|
# License published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, contact Canonical, Ltd.
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Helper for loading an AppArmor profile in pre-start scripts.
|
||||||
|
|
||||||
|
[ -z "$1" ] && exit 1 # require a profile name
|
||||||
|
|
||||||
|
. /lib/apparmor/rc.apparmor.functions
|
||||||
|
|
||||||
|
# do not load in a container
|
||||||
|
[ -x /usr/bin/systemd-detect-virt ] && systemd-detect-virt --quiet --container && ! is_container_with_internal_policy && exit 0 || true
|
||||||
|
|
||||||
|
[ -d /rofs/etc/apparmor.d ] && exit 0 # do not load if running liveCD
|
||||||
|
|
||||||
|
profile=/etc/apparmor.d/"$1"
|
||||||
|
[ -e "$profile" ] || exit 0 # skip when missing profile
|
||||||
|
|
||||||
|
module=/sys/module/apparmor
|
||||||
|
[ -d $module ] || exit 0 # do not load without AppArmor in kernel
|
||||||
|
|
||||||
|
[ -x /sbin/apparmor_parser ] || exit 0 # do not load without parser
|
||||||
|
|
||||||
|
aafs=/sys/kernel/security/apparmor
|
||||||
|
[ -d $aafs ] || exit 0 # do not load if unmounted
|
||||||
|
[ -w $aafs/.load ] || exit 1 # fail if cannot load profiles
|
||||||
|
|
||||||
|
params=$module/parameters
|
||||||
|
[ -r $params/enabled ] || exit 0 # do not load if missing
|
||||||
|
read enabled < $params/enabled || exit 1 # if this fails, something went wrong
|
||||||
|
[ "$enabled" = "Y" ] || exit 0 # do not load if disabled
|
||||||
|
|
||||||
|
/sbin/apparmor_parser -r -W "$profile" || exit 0 # LP: #1058356
|
@@ -17,8 +17,8 @@ endif
|
|||||||
|
|
||||||
all: tests
|
all: tests
|
||||||
|
|
||||||
.PHONY: tests error_output gen_dbus gen_xtrans parser_sanity caching minimize equality valgrind
|
.PHONY: tests error_output gen_dbus gen_xtrans parser_sanity caching minimize equality dirtest valgrind
|
||||||
tests: error_output caching minimize equality parser_sanity
|
tests: error_output caching minimize equality dirtest parser_sanity
|
||||||
|
|
||||||
GEN_TRANS_DIRS=simple_tests/generated_x/ simple_tests/generated_perms_leading/ simple_tests/generated_perms_safe/ simple_tests/generated_dbus
|
GEN_TRANS_DIRS=simple_tests/generated_x/ simple_tests/generated_perms_leading/ simple_tests/generated_perms_safe/ simple_tests/generated_dbus
|
||||||
|
|
||||||
@@ -46,6 +46,9 @@ minimize: $(PARSER)
|
|||||||
equality: $(PARSER)
|
equality: $(PARSER)
|
||||||
LANG=C APPARMOR_PARSER="$(PARSER) $(PARSER_ARGS)" ./equality.sh
|
LANG=C APPARMOR_PARSER="$(PARSER) $(PARSER_ARGS)" ./equality.sh
|
||||||
|
|
||||||
|
dirtest: $(PARSER)
|
||||||
|
LANG=C APPARMOR_PARSER="$(PARSER) $(PARSER_ARGS)" ./dirtest.sh
|
||||||
|
|
||||||
valgrind: $(PARSER) gen_xtrans gen_dbus
|
valgrind: $(PARSER) gen_xtrans gen_dbus
|
||||||
LANG=C ./valgrind_simple.py -p "$(PARSER) $(PARSER_ARGS)" -v simple_tests
|
LANG=C ./valgrind_simple.py -p "$(PARSER) $(PARSER_ARGS)" -v simple_tests
|
||||||
|
|
||||||
|
73
parser/tst/dirtest.sh
Executable file
73
parser/tst/dirtest.sh
Executable file
@@ -0,0 +1,73 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (c) 2022
|
||||||
|
# Canonical, Ltd. (All rights reserved)
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of version 2 of the GNU General Public
|
||||||
|
# License published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, contact Canonical Ltd.
|
||||||
|
#
|
||||||
|
|
||||||
|
# simple test to ensure dir is being iterated as expected
|
||||||
|
# yes this needs to be improved and reworked
|
||||||
|
|
||||||
|
|
||||||
|
# passed in by Makefile
|
||||||
|
#APPARMOR_PARSER="${APPARMOR_PARSER:-../apparmor_parser}"
|
||||||
|
|
||||||
|
|
||||||
|
do_tst() {
|
||||||
|
local msg="$1"
|
||||||
|
local expected="$2"
|
||||||
|
local rc=0
|
||||||
|
shift 2
|
||||||
|
#global tmpdir
|
||||||
|
|
||||||
|
${APPARMOR_PARSER} "$@" > "$tmpdir/out.unsorted" 2>/dev/null
|
||||||
|
rc=$?
|
||||||
|
LC_ALL=C sort "$tmpdir/out.unsorted" > "$tmpdir/out"
|
||||||
|
if [ $rc -ne 0 ] && [ "$expected" != "fail" ] ; then
|
||||||
|
echo "failed: expected \"$expected\" but parser returned error"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if [ $rc -eq 0 ] && [ "$expected" = "fail" ] ; then
|
||||||
|
echo "succeeded unexpectedly: expected \"$expected\" but parser returned success"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if ! diff -q "$tmpdir/out" dirtest/dirtest.out ; then
|
||||||
|
echo "failed: expected \"$expected\" but output comparison failed"
|
||||||
|
diff -u dirtest/dirtest.out "$tmpdir/out"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpdir=$(mktemp -d "$tmpdir.XXXXXXXX")
|
||||||
|
chmod 755 "$tmpdir"
|
||||||
|
export tmpdir
|
||||||
|
|
||||||
|
rc=0
|
||||||
|
|
||||||
|
# pass - no parser errors and output matches
|
||||||
|
# error - parser error and output matches
|
||||||
|
# fail - comparison out parser output failed
|
||||||
|
do_tst "good dir list" pass -N dirtest/gooddir/ || rc=1
|
||||||
|
do_tst "bad link in dir" fail -N dirtest/badlink/ || rc=1
|
||||||
|
do_tst "bad profile in dir" fail -N dirtest/badprofile/ || rc=1
|
||||||
|
|
||||||
|
rm -rf "$tmpdir"
|
||||||
|
|
||||||
|
if [ $rc -eq 0 ] ; then
|
||||||
|
echo "PASS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit $rc
|
1
parser/tst/dirtest/badlink/bar
Symbolic link
1
parser/tst/dirtest/badlink/bar
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
foo
|
1
parser/tst/dirtest/badlink/good_link
Symbolic link
1
parser/tst/dirtest/badlink/good_link
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../goodtarget
|
2
parser/tst/dirtest/badlink/profileA
Normal file
2
parser/tst/dirtest/badlink/profileA
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
profile a_profile {
|
||||||
|
}
|
2
parser/tst/dirtest/badlink/profileB
Normal file
2
parser/tst/dirtest/badlink/profileB
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
profile b_profile {
|
||||||
|
}
|
3
parser/tst/dirtest/badprofile/bad
Normal file
3
parser/tst/dirtest/badprofile/bad
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
profile bad_profile {
|
||||||
|
file
|
||||||
|
}
|
1
parser/tst/dirtest/badprofile/good_link
Symbolic link
1
parser/tst/dirtest/badprofile/good_link
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../goodtarget
|
2
parser/tst/dirtest/badprofile/profileA
Normal file
2
parser/tst/dirtest/badprofile/profileA
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
profile a_profile {
|
||||||
|
}
|
2
parser/tst/dirtest/badprofile/profileB
Normal file
2
parser/tst/dirtest/badprofile/profileB
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
profile b_profile {
|
||||||
|
}
|
3
parser/tst/dirtest/dirtest.out
Normal file
3
parser/tst/dirtest/dirtest.out
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
a_profile
|
||||||
|
b_profile
|
||||||
|
good_target
|
1
parser/tst/dirtest/gooddir/good_link
Symbolic link
1
parser/tst/dirtest/gooddir/good_link
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../goodtarget
|
2
parser/tst/dirtest/gooddir/profileA
Normal file
2
parser/tst/dirtest/gooddir/profileA
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
profile a_profile {
|
||||||
|
}
|
2
parser/tst/dirtest/gooddir/profileB
Normal file
2
parser/tst/dirtest/gooddir/profileB
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
profile b_profile {
|
||||||
|
}
|
2
parser/tst/dirtest/goodtarget
Normal file
2
parser/tst/dirtest/goodtarget
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
profile good_target {
|
||||||
|
}
|
7
parser/tst/simple_tests/mount/bad_1.sd
Normal file
7
parser/tst/simple_tests/mount/bad_1.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic mount rule with incompatible options
|
||||||
|
#=EXRESULT FAIL
|
||||||
|
#
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=(rw, ro) -> /foo,
|
||||||
|
}
|
7
parser/tst/simple_tests/mount/bad_2.sd
Normal file
7
parser/tst/simple_tests/mount/bad_2.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic mount rule with incompatible options
|
||||||
|
#=EXRESULT FAIL
|
||||||
|
#
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=(rw ro) -> /foo,
|
||||||
|
}
|
7
parser/tst/simple_tests/mount/bad_3.sd
Normal file
7
parser/tst/simple_tests/mount/bad_3.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic mount rule with incompatible options
|
||||||
|
#=EXRESULT FAIL
|
||||||
|
#
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=(rw ro) fstype=procfs -> /foo,
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
#=Description basic mount rule
|
#=Description basic mount rule with incompatible options
|
||||||
#=EXRESULT PASS
|
#=EXRESULT FAIL
|
||||||
#
|
#
|
||||||
/usr/bin/foo {
|
/usr/bin/foo {
|
||||||
mount options=(rw ro) fstype=(procfs) none -> /foo,
|
mount options=(rw ro) fstype=(procfs) none -> /foo,
|
7
parser/tst/simple_tests/mount/bad_opt_29.sd
Normal file
7
parser/tst/simple_tests/mount/bad_opt_29.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic mount rule conflicting = options
|
||||||
|
#=EXRESULT FAIL
|
||||||
|
#
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=(strictatime, nostrictatime) -> /foo,
|
||||||
|
}
|
7
parser/tst/simple_tests/mount/bad_opt_30.sd
Normal file
7
parser/tst/simple_tests/mount/bad_opt_30.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic mount rule conflicting = options
|
||||||
|
#=EXRESULT FAIL
|
||||||
|
#
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=(lazytime, nolazytime) -> /foo,
|
||||||
|
}
|
7
parser/tst/simple_tests/mount/bad_opt_31.sd
Normal file
7
parser/tst/simple_tests/mount/bad_opt_31.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic mount rule conflicting = options
|
||||||
|
#=EXRESULT FAIL
|
||||||
|
#
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=(symfollow, nosymfollow) -> /foo,
|
||||||
|
}
|
@@ -3,5 +3,5 @@
|
|||||||
#=EXRESULT PASS
|
#=EXRESULT PASS
|
||||||
#
|
#
|
||||||
/usr/bin/foo {
|
/usr/bin/foo {
|
||||||
mount options=(rw, ro) -> /foo,
|
mount options=(rw nosuid) -> /foo,
|
||||||
}
|
}
|
||||||
|
@@ -1,7 +0,0 @@
|
|||||||
#
|
|
||||||
#=Description basic mount rule
|
|
||||||
#=EXRESULT PASS
|
|
||||||
#
|
|
||||||
/usr/bin/foo {
|
|
||||||
mount options=(rw ro) -> /foo,
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
#
|
|
||||||
#=Description basic mount rule
|
|
||||||
#=EXRESULT PASS
|
|
||||||
#
|
|
||||||
/usr/bin/foo {
|
|
||||||
mount options=(rw ro) fstype=procfs -> /foo,
|
|
||||||
}
|
|
8
parser/tst/simple_tests/mount/ok_opt_56.sd
Normal file
8
parser/tst/simple_tests/mount/ok_opt_56.sd
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#
|
||||||
|
#=Description basic rules to test the "nostrictatime" mount option
|
||||||
|
#=EXRESULT PASS
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=nostrictatime /a -> /1,
|
||||||
|
mount options=(nostrictatime) /b -> /2,
|
||||||
|
mount options in (nostrictatime) /d -> /4,
|
||||||
|
}
|
8
parser/tst/simple_tests/mount/ok_opt_57.sd
Normal file
8
parser/tst/simple_tests/mount/ok_opt_57.sd
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#
|
||||||
|
#=Description basic rules to test the "lazytime" mount option
|
||||||
|
#=EXRESULT PASS
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=lazytime /a -> /1,
|
||||||
|
mount options=(lazytime) /b -> /2,
|
||||||
|
mount options in (lazytime) /d -> /4,
|
||||||
|
}
|
8
parser/tst/simple_tests/mount/ok_opt_58.sd
Normal file
8
parser/tst/simple_tests/mount/ok_opt_58.sd
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#
|
||||||
|
#=Description basic rules to test the "nolazytime" mount option
|
||||||
|
#=EXRESULT PASS
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=nolazytime /a -> /1,
|
||||||
|
mount options=(nolazytime) /b -> /2,
|
||||||
|
mount options in (nolazytime) /d -> /4,
|
||||||
|
}
|
7
parser/tst/simple_tests/mount/ok_opt_59.sd
Normal file
7
parser/tst/simple_tests/mount/ok_opt_59.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic rules to test the "strictatime" mount option in combination
|
||||||
|
#=EXRESULT PASS
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=(rw,strictatime) /c -> /3,
|
||||||
|
mount options in (ro,strictatime) /e -> /5,
|
||||||
|
}
|
7
parser/tst/simple_tests/mount/ok_opt_60.sd
Normal file
7
parser/tst/simple_tests/mount/ok_opt_60.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic rules to test the "nostrictatime" mount option in combination
|
||||||
|
#=EXRESULT PASS
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=(rw,nostrictatime) /c -> /3,
|
||||||
|
mount options in (ro,nostrictatime) /e -> /5,
|
||||||
|
}
|
7
parser/tst/simple_tests/mount/ok_opt_61.sd
Normal file
7
parser/tst/simple_tests/mount/ok_opt_61.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic rules to test the "lazytime" mount option in combination
|
||||||
|
#=EXRESULT PASS
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=(rw,lazytime) /c -> /3,
|
||||||
|
mount options in (ro,lazytime) /e -> /5,
|
||||||
|
}
|
7
parser/tst/simple_tests/mount/ok_opt_62.sd
Normal file
7
parser/tst/simple_tests/mount/ok_opt_62.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic rules to test the "nolazytime" mount option in combination
|
||||||
|
#=EXRESULT PASS
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=(rw,nolazytime) /c -> /3,
|
||||||
|
mount options in (ro,nolazytime) /e -> /5,
|
||||||
|
}
|
7
parser/tst/simple_tests/mount/ok_opt_63.sd
Normal file
7
parser/tst/simple_tests/mount/ok_opt_63.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic mount rule conflicting options with in
|
||||||
|
#=EXRESULT PASS
|
||||||
|
#
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options in (strictatime, nostrictatime) -> /foo,
|
||||||
|
}
|
7
parser/tst/simple_tests/mount/ok_opt_64.sd
Normal file
7
parser/tst/simple_tests/mount/ok_opt_64.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic mount rule conflicting options with in
|
||||||
|
#=EXRESULT PASS
|
||||||
|
#
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options in (lazytime, nolazytime) -> /foo,
|
||||||
|
}
|
8
parser/tst/simple_tests/mount/ok_opt_65.sd
Normal file
8
parser/tst/simple_tests/mount/ok_opt_65.sd
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
#
|
||||||
|
#=Description basic rules to test the "nosymfollow" mount option
|
||||||
|
#=EXRESULT PASS
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=nosymfollow /a -> /1,
|
||||||
|
mount options=(nosymfollow) /b -> /2,
|
||||||
|
mount options in (nosymfollow) /d -> /4,
|
||||||
|
}
|
7
parser/tst/simple_tests/mount/ok_opt_66.sd
Normal file
7
parser/tst/simple_tests/mount/ok_opt_66.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic rules to test the "symfollow" mount option in combination
|
||||||
|
#=EXRESULT PASS
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options=(rw,symfollow) /c -> /3,
|
||||||
|
mount options in (ro,symfollow) /e -> /5,
|
||||||
|
}
|
7
parser/tst/simple_tests/mount/ok_opt_67.sd
Normal file
7
parser/tst/simple_tests/mount/ok_opt_67.sd
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#
|
||||||
|
#=Description basic mount rule conflicting options with in
|
||||||
|
#=EXRESULT PASS
|
||||||
|
#
|
||||||
|
/usr/bin/foo {
|
||||||
|
mount options in (symfollow, nosymfollow) -> /foo,
|
||||||
|
}
|
@@ -96,7 +96,7 @@ class AATestTemplate(unittest.TestCase, metaclass=AANoCleanupMetaClass):
|
|||||||
sp = subprocess.Popen(command, stdin=stdin, stdout=stdout, stderr=stderr,
|
sp = subprocess.Popen(command, stdin=stdin, stdout=stdout, stderr=stderr,
|
||||||
close_fds=True, preexec_fn=subprocess_setup, universal_newlines=True)
|
close_fds=True, preexec_fn=subprocess_setup, universal_newlines=True)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
return [127, str(e)]
|
return [127, str(e), '']
|
||||||
|
|
||||||
timeout_communicate = TimeoutFunction(sp.communicate, timeout)
|
timeout_communicate = TimeoutFunction(sp.communicate, timeout)
|
||||||
out, outerr = (None, None)
|
out, outerr = (None, None)
|
||||||
|
@@ -41,16 +41,16 @@ ifdef USE_SYSTEM
|
|||||||
LOGPROF?=aa-logprof
|
LOGPROF?=aa-logprof
|
||||||
else
|
else
|
||||||
# PYTHON_DIST_BUILD_PATH based on libapparmor/swig/python/test/Makefile.am
|
# PYTHON_DIST_BUILD_PATH based on libapparmor/swig/python/test/Makefile.am
|
||||||
PYTHON_DIST_BUILD_PATH = ../libraries/libapparmor/swig/python/build/$$($(PYTHON) -c "import sysconfig; print(\"lib.%s-%s\" %(sysconfig.get_platform(), sysconfig.get_python_version()))")
|
PYTHON_DIST_BUILD_PATH = ../libraries/libapparmor/swig/python/build/$$($(PYTHON) ../libraries/libapparmor/swig/python/test/buildpath.py)
|
||||||
LIBAPPARMOR_PATH=../libraries/libapparmor/src/.libs/
|
LIBAPPARMOR_PATH=../libraries/libapparmor/src/.libs/
|
||||||
LD_LIBRARY_PATH=$(LIBAPPARMOR_PATH):$(PYTHON_DIST_BUILD_PATH)
|
LD_LIBRARY_PATH=$(LIBAPPARMOR_PATH):$(PYTHON_DIST_BUILD_PATH)
|
||||||
PYTHONPATH=../utils/:$(PYTHON_DIST_BUILD_PATH)
|
PYTHONPATH=../utils/:$(PYTHON_DIST_BUILD_PATH)
|
||||||
PARSER?=../parser/apparmor_parser
|
PARSER?=../parser/apparmor_parser
|
||||||
# use ../utils logprof
|
# use ../utils logprof
|
||||||
LOGPROF?=LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) PYTHONPATH=$(PYTHONPATH) $(PYTHON) ../utils/aa-logprof
|
LOGPROF?=LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) PYTHONPATH=$(PYTHONPATH) $(PYTHON) ../utils/aa-logprof --configdir ../utils/
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# $(PWD) is wrong when using "make -C profiles" - explicitely set it here to get the right value
|
# $(PWD) is wrong when using "make -C profiles" - explicitly set it here to get the right value
|
||||||
PWD=$(shell pwd)
|
PWD=$(shell pwd)
|
||||||
|
|
||||||
.PHONY: test-dependencies
|
.PHONY: test-dependencies
|
||||||
@@ -83,7 +83,7 @@ local:
|
|||||||
fn=$$(basename $$profile); \
|
fn=$$(basename $$profile); \
|
||||||
echo "# Site-specific additions and overrides for '$$fn'" > ${PROFILES_SOURCE}/local/$$fn; \
|
echo "# Site-specific additions and overrides for '$$fn'" > ${PROFILES_SOURCE}/local/$$fn; \
|
||||||
grep "include[[:space:]]\\+if[[:space:]]\\+exists[[:space:]]\\+<local/$$fn>" "$$profile" >/dev/null || { echo "$$profile doesn't contain include if exists <local/$$fn>" ; exit 1; } ; \
|
grep "include[[:space:]]\\+if[[:space:]]\\+exists[[:space:]]\\+<local/$$fn>" "$$profile" >/dev/null || { echo "$$profile doesn't contain include if exists <local/$$fn>" ; exit 1; } ; \
|
||||||
done; \
|
done
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: local
|
install: local
|
||||||
@@ -119,7 +119,7 @@ CHECK_PROFILES=$(filter-out ${IGNORE_FILES} ${SUBDIRS}, $(wildcard ${PROFILES_SO
|
|||||||
CHECK_ABSTRACTIONS=$(shell find ${ABSTRACTIONS_SOURCE} -type f -print)
|
CHECK_ABSTRACTIONS=$(shell find ${ABSTRACTIONS_SOURCE} -type f -print)
|
||||||
|
|
||||||
.PHONY: check
|
.PHONY: check
|
||||||
check: check-parser check-logprof check-abstractions.d
|
check: check-parser check-logprof check-abstractions.d check-extras
|
||||||
|
|
||||||
.PHONY: check-parser
|
.PHONY: check-parser
|
||||||
check-parser: test-dependencies local
|
check-parser: test-dependencies local
|
||||||
@@ -151,3 +151,11 @@ check-abstractions.d:
|
|||||||
test "$$file" = 'ubuntu-helpers' && continue ; \
|
test "$$file" = 'ubuntu-helpers' && continue ; \
|
||||||
grep -q "^ include if exists <abstractions/$${file}.d>$$" $$file || { echo "$$file does not contain 'include if exists <abstractions/$${file}.d>'"; exit 1; } ; \
|
grep -q "^ include if exists <abstractions/$${file}.d>$$" $$file || { echo "$$file does not contain 'include if exists <abstractions/$${file}.d>'"; exit 1; } ; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
.PHONY: check-extras
|
||||||
|
check-extras:
|
||||||
|
@echo "*** Checking if all extra profiles contain include if exists <local/*>"
|
||||||
|
$(Q)cd ${EXTRAS_SOURCE} && for file in * ; do \
|
||||||
|
test "$$file" = 'README' && continue ; \
|
||||||
|
grep -q "^ include if exists <local/$${file}>$$" $$file || { echo "$$file does not contain 'include if exists <local/$${file}>'"; exit 1; } ; \
|
||||||
|
done
|
||||||
|
@@ -6,6 +6,10 @@
|
|||||||
|
|
||||||
include <abstractions/nameservice>
|
include <abstractions/nameservice>
|
||||||
|
|
||||||
|
# Allow other processes to read our /proc entries
|
||||||
|
ptrace (readby),
|
||||||
|
# Allow other processes to trace us by default
|
||||||
|
ptrace (tracedby),
|
||||||
# Allow unconfined processes to send us signals by default
|
# Allow unconfined processes to send us signals by default
|
||||||
signal (receive) peer=unconfined,
|
signal (receive) peer=unconfined,
|
||||||
# Allow apache to send us signals by default
|
# Allow apache to send us signals by default
|
||||||
|
@@ -85,5 +85,8 @@ owner @{HOME}/.local/share/openal/hrtf/{,**} r,
|
|||||||
# wildmidi
|
# wildmidi
|
||||||
/etc/wildmidi/wildmidi.cfg r,
|
/etc/wildmidi/wildmidi.cfg r,
|
||||||
|
|
||||||
|
# pipewire
|
||||||
|
/usr/share/pipewire/client.conf r,
|
||||||
|
|
||||||
# Include additions to the abstraction
|
# Include additions to the abstraction
|
||||||
include if exists <abstractions/audio.d>
|
include if exists <abstractions/audio.d>
|
||||||
|
@@ -36,8 +36,8 @@
|
|||||||
/usr/share/locale-langpack/** r,
|
/usr/share/locale-langpack/** r,
|
||||||
/usr/share/locale/** r,
|
/usr/share/locale/** r,
|
||||||
/usr/share/**/locale/** r,
|
/usr/share/**/locale/** r,
|
||||||
/usr/share/zoneinfo/ r,
|
/usr/share/zoneinfo{,-icu}/ r,
|
||||||
/usr/share/zoneinfo/** r,
|
/usr/share/zoneinfo{,-icu}/** r,
|
||||||
/usr/share/X11/locale/** r,
|
/usr/share/X11/locale/** r,
|
||||||
@{run}/systemd/journal/dev-log w,
|
@{run}/systemd/journal/dev-log w,
|
||||||
# systemd native journal API (see sd_journal_print(4))
|
# systemd native journal API (see sd_journal_print(4))
|
||||||
@@ -101,13 +101,11 @@
|
|||||||
@{PROC}/cpuinfo r,
|
@{PROC}/cpuinfo r,
|
||||||
@{sys}/devices/system/cpu/ r,
|
@{sys}/devices/system/cpu/ r,
|
||||||
@{sys}/devices/system/cpu/online r,
|
@{sys}/devices/system/cpu/online r,
|
||||||
|
@{sys}/devices/system/cpu/possible r,
|
||||||
|
|
||||||
# glibc's *printf protections read the maps file
|
# glibc's *printf protections read the maps file
|
||||||
@{PROC}/@{pid}/{maps,auxv,status} r,
|
@{PROC}/@{pid}/{maps,auxv,status} r,
|
||||||
|
|
||||||
# libgcrypt reads some flags from /proc
|
|
||||||
@{PROC}/sys/crypto/* r,
|
|
||||||
|
|
||||||
# some applications will display license information
|
# some applications will display license information
|
||||||
/usr/share/common-licenses/** r,
|
/usr/share/common-licenses/** r,
|
||||||
|
|
||||||
|
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
abi <abi/3.0>,
|
abi <abi/3.0>,
|
||||||
|
|
||||||
|
@{etc_ro}/gcrypt/hwf.deny r,
|
||||||
@{etc_ro}/gcrypt/random.conf r,
|
@{etc_ro}/gcrypt/random.conf r,
|
||||||
@{PROC}/sys/crypto/fips_enabled r,
|
@{PROC}/sys/crypto/fips_enabled r,
|
||||||
|
|
||||||
|
@@ -29,8 +29,8 @@
|
|||||||
# include <abstractions/ubuntu-browsers>
|
# include <abstractions/ubuntu-browsers>
|
||||||
# include <abstractions/ubuntu-email>
|
# include <abstractions/ubuntu-email>
|
||||||
#
|
#
|
||||||
# # Add if accesibility access is considered as required
|
# # Add if accessibility access is considered as required
|
||||||
# # (for message boxe in case exo-open fails)
|
# # (for message box in case exo-open fails)
|
||||||
# include <abstractions/dbus-accessibility>
|
# include <abstractions/dbus-accessibility>
|
||||||
#
|
#
|
||||||
# # < add additional allowed applications here >
|
# # < add additional allowed applications here >
|
||||||
@@ -51,13 +51,6 @@
|
|||||||
|
|
||||||
/{,usr/}bin/which rix,
|
/{,usr/}bin/which rix,
|
||||||
|
|
||||||
# Deny DBus
|
|
||||||
|
|
||||||
# for GTK error message dialog, not required exo-open to work.
|
|
||||||
deny dbus send
|
|
||||||
bus=session
|
|
||||||
path=/org/gtk/vfs/mounttracker,
|
|
||||||
|
|
||||||
# System files
|
# System files
|
||||||
|
|
||||||
/etc/xdg/{,xdg-*/}xfce4/helpers.rc r,
|
/etc/xdg/{,xdg-*/}xfce4/helpers.rc r,
|
||||||
|
@@ -20,7 +20,7 @@
|
|||||||
@{system_share_dirs}/mime/** r,
|
@{system_share_dirs}/mime/** r,
|
||||||
|
|
||||||
# per-user configurations
|
# per-user configurations
|
||||||
owner @{HOME}/.icons/ r,
|
owner @{HOME}/.icons/{,**} r,
|
||||||
owner @{HOME}/.recently-used.xbel* rw,
|
owner @{HOME}/.recently-used.xbel* rw,
|
||||||
owner @{HOME}/.local/share/recently-used.xbel* rw,
|
owner @{HOME}/.local/share/recently-used.xbel* rw,
|
||||||
owner @{HOME}/.config/user-dirs.dirs r,
|
owner @{HOME}/.config/user-dirs.dirs r,
|
||||||
|
67
profiles/apparmor.d/abstractions/groff
Normal file
67
profiles/apparmor.d/abstractions/groff
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
# ------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
# Copyright (C) 2002-2009 Novell/SUSE
|
||||||
|
# Copyright (C) 2009 Canonical Ltd.
|
||||||
|
# Copyright (C) 2023 SUSE LLC
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of version 2 of the GNU General Public
|
||||||
|
# License published by the Free Software Foundation.
|
||||||
|
#
|
||||||
|
# ------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Note: executing groff and nroff themself is not included in this abstraction
|
||||||
|
# so that you can choose to ix, Px or Cx them in your profile
|
||||||
|
|
||||||
|
# groff/nroff helpers, preprocessors, and postprocessors
|
||||||
|
/usr/bin/addftinfo mrix,
|
||||||
|
/usr/bin/afmtodit mrix,
|
||||||
|
/usr/bin/chem mrix,
|
||||||
|
/usr/bin/eqn mrix,
|
||||||
|
/usr/bin/eqn2graph mrix,
|
||||||
|
/usr/bin/gdiffmk mrix,
|
||||||
|
/usr/bin/geqn mrix,
|
||||||
|
/usr/bin/grap2graph mrix,
|
||||||
|
/usr/bin/grn mrix,
|
||||||
|
/usr/bin/grodvi mrix,
|
||||||
|
/usr/bin/groffer mrix,
|
||||||
|
/usr/bin/grog mrix,
|
||||||
|
/usr/bin/grolbp mrix,
|
||||||
|
/usr/bin/grolj4 mrix,
|
||||||
|
/usr/bin/gropdf mrix,
|
||||||
|
/usr/bin/grops mrix,
|
||||||
|
/usr/bin/grotty mrix,
|
||||||
|
/usr/bin/gtbl mrix,
|
||||||
|
/usr/bin/hpftodit mrix,
|
||||||
|
/usr/bin/indxbib mrix,
|
||||||
|
/usr/bin/lkbib mrix,
|
||||||
|
/usr/bin/lookbib mrix,
|
||||||
|
/usr/bin/mmroff mrix,
|
||||||
|
/usr/bin/neqn mrix,
|
||||||
|
/usr/bin/pdfmom mrix,
|
||||||
|
/usr/bin/pdfroff mrix,
|
||||||
|
/usr/bin/pfbtops mrix,
|
||||||
|
/usr/bin/pic mrix,
|
||||||
|
/usr/bin/pic2graph mrix,
|
||||||
|
/usr/bin/post-grohtml mrix,
|
||||||
|
/usr/bin/pre-grohtml mrix,
|
||||||
|
/usr/bin/preconv mrix,
|
||||||
|
/usr/bin/refer mrix,
|
||||||
|
/usr/bin/roff2dvi mrix,
|
||||||
|
/usr/bin/roff2html mrix,
|
||||||
|
/usr/bin/roff2pdf mrix,
|
||||||
|
/usr/bin/roff2ps mrix,
|
||||||
|
/usr/bin/roff2text mrix,
|
||||||
|
/usr/bin/roff2x mrix,
|
||||||
|
/usr/bin/soelim mrix,
|
||||||
|
/usr/bin/tbl mrix,
|
||||||
|
/usr/bin/tfmtodit mrix,
|
||||||
|
/usr/bin/troff mrix,
|
||||||
|
/usr/bin/xtotroff mrix,
|
||||||
|
|
||||||
|
# at least its macros and fonts
|
||||||
|
/usr/libexec/groff/** r,
|
||||||
|
/usr/share/groff/** r,
|
||||||
|
|
||||||
|
# Include additions to the abstraction
|
||||||
|
include if exists <abstractions/groff.d>
|
@@ -16,14 +16,14 @@
|
|||||||
/usr/share/gtk-2.0/ r,
|
/usr/share/gtk-2.0/ r,
|
||||||
/usr/share/gtk-2.0/gtkrc r,
|
/usr/share/gtk-2.0/gtkrc r,
|
||||||
|
|
||||||
/usr/share/gtk-3.0/ r,
|
/usr/share/gtk-{3,4}.0/ r,
|
||||||
/usr/share/gtk-3.0/settings.ini r,
|
/usr/share/gtk-{3,4}.0/settings.ini r,
|
||||||
|
|
||||||
/etc/gtk-2.0/ r,
|
/etc/gtk-2.0/ r,
|
||||||
/etc/gtk-2.0/gtkrc r,
|
/etc/gtk-2.0/gtkrc r,
|
||||||
|
|
||||||
/etc/gtk-3.0/ r,
|
/etc/gtk-{3,4}.0/ r,
|
||||||
/etc/gtk-3.0/*.conf r,
|
/etc/gtk-{3,4}.0/*.conf r,
|
||||||
|
|
||||||
/etc/gtk/gtkrc r,
|
/etc/gtk/gtkrc r,
|
||||||
|
|
||||||
@@ -36,10 +36,10 @@
|
|||||||
owner @{HOME}/.gtk-bookmarks r,
|
owner @{HOME}/.gtk-bookmarks r,
|
||||||
owner @{HOME}/.config/gtkrc r,
|
owner @{HOME}/.config/gtkrc r,
|
||||||
owner @{HOME}/.config/gtkrc-2.0 r,
|
owner @{HOME}/.config/gtkrc-2.0 r,
|
||||||
owner @{HOME}/.config/gtk-3.0/ rw,
|
owner @{HOME}/.config/gtk-{3,4}.0/ rw,
|
||||||
owner @{HOME}/.config/gtk-3.0/settings.ini r,
|
owner @{HOME}/.config/gtk-{3,4}.0/settings.ini r,
|
||||||
owner @{HOME}/.config/gtk-3.0/bookmarks r,
|
owner @{HOME}/.config/gtk-{3,4}.0/bookmarks r,
|
||||||
owner @{HOME}/.config/gtk-3.0/gtk.css r,
|
owner @{HOME}/.config/gtk-{3,4}.0/gtk.css r,
|
||||||
|
|
||||||
# for gtk file dialog
|
# for gtk file dialog
|
||||||
owner @{HOME}/.config/gtk-2.0/ rw,
|
owner @{HOME}/.config/gtk-2.0/ rw,
|
||||||
|
@@ -16,5 +16,14 @@
|
|||||||
owner @{HOME}/.config/ibus/bus/ rw,
|
owner @{HOME}/.config/ibus/bus/ rw,
|
||||||
owner @{HOME}/.config/ibus/bus/* rw,
|
owner @{HOME}/.config/ibus/bus/* rw,
|
||||||
|
|
||||||
|
# abstract path in ibus >= 1.5.22 uses $XDG_CACHE_HOME (ie, @{HOME}/.cache)
|
||||||
|
# This should use this, but due to LP: #1856738 we cannot
|
||||||
|
#unix (connect, receive, send)
|
||||||
|
# type=stream
|
||||||
|
# peer=(addr="@@{HOME}/.cache/ibus/dbus-*"),
|
||||||
|
unix (connect, receive, send)
|
||||||
|
type=stream
|
||||||
|
peer=(addr="@/home/*/.cache/ibus/dbus-*"),
|
||||||
|
|
||||||
# Include additions to the abstraction
|
# Include additions to the abstraction
|
||||||
include if exists <abstractions/ibus.d>
|
include if exists <abstractions/ibus.d>
|
||||||
|
@@ -41,8 +41,11 @@ owner @{HOME}/.config/Trolltech.conf rwk,
|
|||||||
owner @{HOME}/.config/baloofilerc r, # indexing options (excludes, etc), used by KFileWidget
|
owner @{HOME}/.config/baloofilerc r, # indexing options (excludes, etc), used by KFileWidget
|
||||||
owner @{HOME}/.config/dolphinrc r, # settings used by KFileWidget
|
owner @{HOME}/.config/dolphinrc r, # settings used by KFileWidget
|
||||||
owner @{HOME}/.config/kde.org/libphonon.conf r, # for KNotifications::sendEvent()
|
owner @{HOME}/.config/kde.org/libphonon.conf r, # for KNotifications::sendEvent()
|
||||||
|
owner @{HOME}/.config/kdedefaults/kdeglobals r, # QPlatformThemeFactory::create() -> KDEPlasmaPlatformTheme.so
|
||||||
|
owner @{HOME}/.config/kdedefaults/kwinrc r, # QStyleFactory::create() -> qt5/plugins/styles/breeze.so
|
||||||
owner @{HOME}/.config/kdeglobals r, # global settings, used by Breeze style, etc.
|
owner @{HOME}/.config/kdeglobals r, # global settings, used by Breeze style, etc.
|
||||||
owner @{HOME}/.config/klanguageoverridesrc r, # per-application languages, for KDEPrivate::initializeLanguages() from libKF5XmlGui.so
|
owner @{HOME}/.config/klanguageoverridesrc r, # per-application languages, for KDEPrivate::initializeLanguages() from libKF5XmlGui.so
|
||||||
|
owner @{HOME}/.config/kwinrc r, # QStyleFactory::create() -> qt5/plugins/styles/breeze.so
|
||||||
owner @{HOME}/.config/trashrc r, # Used by KFileWidget
|
owner @{HOME}/.config/trashrc r, # Used by KFileWidget
|
||||||
|
|
||||||
/usr/share/X11/XKeysymDB r,
|
/usr/share/X11/XKeysymDB r,
|
||||||
|
@@ -29,8 +29,8 @@
|
|||||||
# include <abstractions/ubuntu-browsers>
|
# include <abstractions/ubuntu-browsers>
|
||||||
# include <abstractions/ubuntu-email>
|
# include <abstractions/ubuntu-email>
|
||||||
#
|
#
|
||||||
# # Add if accesibility access is considered as required
|
# # Add if accessibility access is considered as required
|
||||||
# # (for message boxe in case exo-open fails)
|
# # (for message box in case exo-open fails)
|
||||||
# include <abstractions/dbus-accessibility>
|
# include <abstractions/dbus-accessibility>
|
||||||
#
|
#
|
||||||
# # Add if audio support for message box is
|
# # Add if audio support for message box is
|
||||||
|
@@ -22,6 +22,11 @@
|
|||||||
/usr/lib/@{multiarch}/krb5/plugins/preauth/ r,
|
/usr/lib/@{multiarch}/krb5/plugins/preauth/ r,
|
||||||
/usr/lib/@{multiarch}/krb5/plugins/preauth/* mr,
|
/usr/lib/@{multiarch}/krb5/plugins/preauth/* mr,
|
||||||
|
|
||||||
|
/usr/lib{,32,64}/krb5/plugins/authdata/ r,
|
||||||
|
/usr/lib{,32,64}/krb5/plugins/authdata/* mr,
|
||||||
|
/usr/lib/@{multiarch}/krb5/plugins/authdata/ r,
|
||||||
|
/usr/lib/@{multiarch}/krb5/plugins/authdata/* mr,
|
||||||
|
|
||||||
/etc/krb5.keytab rk,
|
/etc/krb5.keytab rk,
|
||||||
/etc/krb5.conf r,
|
/etc/krb5.conf r,
|
||||||
/etc/krb5.conf.d/ r,
|
/etc/krb5.conf.d/ r,
|
||||||
|
@@ -10,6 +10,8 @@
|
|||||||
# (src/intel/perf/gen_perf.c, load_oa_metrics())
|
# (src/intel/perf/gen_perf.c, load_oa_metrics())
|
||||||
@{PROC}/sys/dev/i915/perf_stream_paranoid r,
|
@{PROC}/sys/dev/i915/perf_stream_paranoid r,
|
||||||
|
|
||||||
|
@{sys}/devices/pci[0-9]*/**/{revision,config} r,
|
||||||
|
|
||||||
# User files
|
# User files
|
||||||
owner @{HOME}/.cache/ w, # if user clears all caches
|
owner @{HOME}/.cache/ w, # if user clears all caches
|
||||||
owner @{HOME}/.cache/mesa_shader_cache/ rw,
|
owner @{HOME}/.cache/mesa_shader_cache/ rw,
|
||||||
|
@@ -44,6 +44,7 @@
|
|||||||
@{run}/{resolvconf,NetworkManager,systemd/resolve,connman,netconfig}/resolv.conf r,
|
@{run}/{resolvconf,NetworkManager,systemd/resolve,connman,netconfig}/resolv.conf r,
|
||||||
@{etc_ro}/resolvconf/run/resolv.conf r,
|
@{etc_ro}/resolvconf/run/resolv.conf r,
|
||||||
@{run}/systemd/resolve/stub-resolv.conf r,
|
@{run}/systemd/resolve/stub-resolv.conf r,
|
||||||
|
/mnt/wsl/resolv.conf r,
|
||||||
|
|
||||||
@{etc_ro}/samba/lmhosts r,
|
@{etc_ro}/samba/lmhosts r,
|
||||||
@{etc_ro}/services r,
|
@{etc_ro}/services r,
|
||||||
|
@@ -24,6 +24,7 @@
|
|||||||
@{run}/systemd/userdb/io.systemd.DynamicUser rw, # systemd-exec users
|
@{run}/systemd/userdb/io.systemd.DynamicUser rw, # systemd-exec users
|
||||||
@{run}/systemd/userdb/io.systemd.Home rw, # systemd-home dirs
|
@{run}/systemd/userdb/io.systemd.Home rw, # systemd-home dirs
|
||||||
@{run}/systemd/userdb/io.systemd.NameServiceSwitch rw, # UNIX/glibc NSS
|
@{run}/systemd/userdb/io.systemd.NameServiceSwitch rw, # UNIX/glibc NSS
|
||||||
|
@{run}/systemd/userdb/io.systemd.Machine rw, # systemd-machined
|
||||||
|
|
||||||
@{PROC}/sys/kernel/random/boot_id r,
|
@{PROC}/sys/kernel/random/boot_id r,
|
||||||
|
|
||||||
|
@@ -23,9 +23,13 @@
|
|||||||
|
|
||||||
@{sys}/devices/system/memory/block_size_bytes r,
|
@{sys}/devices/system/memory/block_size_bytes r,
|
||||||
|
|
||||||
|
owner @{HOME}/.cache/nvidia/ w,
|
||||||
|
owner @{HOME}/.cache/nvidia/GLCache/ rw,
|
||||||
|
owner @{HOME}/.cache/nvidia/GLCache/** rwk,
|
||||||
owner @{HOME}/.nv/ w,
|
owner @{HOME}/.nv/ w,
|
||||||
owner @{HOME}/.nv/GLCache/ rw,
|
owner @{HOME}/.nv/GLCache/ rw,
|
||||||
owner @{HOME}/.nv/GLCache/** rwk,
|
owner @{HOME}/.nv/GLCache/** rwk,
|
||||||
|
owner @{PROC}/@{pid}/comm r, # somehwere in libnvidia-glcore.so
|
||||||
|
|
||||||
unix (send, receive) type=dgram peer=(addr="@nvidia[0-9a-f]*"),
|
unix (send, receive) type=dgram peer=(addr="@nvidia[0-9a-f]*"),
|
||||||
|
|
||||||
|
@@ -11,11 +11,10 @@
|
|||||||
abi <abi/3.0>,
|
abi <abi/3.0>,
|
||||||
|
|
||||||
/etc/ssl/openssl.cnf r,
|
/etc/ssl/openssl.cnf r,
|
||||||
|
/etc/ssl/openssl-*.cnf r,
|
||||||
/etc/ssl/{engdef,engines}.d/ r,
|
/etc/ssl/{engdef,engines}.d/ r,
|
||||||
/etc/ssl/{engdef,engines}.d/*.cnf r,
|
/etc/ssl/{engdef,engines}.d/*.cnf r,
|
||||||
/usr/share/ssl/openssl.cnf r,
|
/usr/share/ssl/openssl.cnf r,
|
||||||
@{PROC}/sys/crypto/fips_enabled r,
|
|
||||||
|
|
||||||
|
|
||||||
# Include additions to the abstraction
|
# Include additions to the abstraction
|
||||||
include if exists <abstractions/openssl.d>
|
include if exists <abstractions/openssl.d>
|
||||||
|
@@ -13,8 +13,7 @@
|
|||||||
abi <abi/3.0>,
|
abi <abi/3.0>,
|
||||||
|
|
||||||
# shared snippets for config files
|
# shared snippets for config files
|
||||||
/etc/php{,5,7,8}/**/ r,
|
/etc/php{,5,7,8}/** r,
|
||||||
/etc/php{,5,7,8}/**.ini r,
|
|
||||||
|
|
||||||
# Xlibs
|
# Xlibs
|
||||||
/usr/X11R6/lib{,32,64}/lib*.so* mr,
|
/usr/X11R6/lib{,32,64}/lib*.so* mr,
|
||||||
|
@@ -23,16 +23,19 @@
|
|||||||
/var/lib/samba/** rwk,
|
/var/lib/samba/** rwk,
|
||||||
/var/log/samba/cores/ rw,
|
/var/log/samba/cores/ rw,
|
||||||
/var/log/samba/cores/** rw,
|
/var/log/samba/cores/** rw,
|
||||||
/var/log/samba/* w,
|
/var/log/samba/* rw,
|
||||||
@{run}/{,lock/}samba/ w,
|
@{run}/{,lock/}samba/ w,
|
||||||
@{run}/{,lock/}samba/*.tdb rw,
|
@{run}/{,lock/}samba/*.tdb rwk,
|
||||||
@{run}/{,lock/}samba/msg.lock/ rwk,
|
@{run}/{,lock/}samba/msg.{lock,sock}/ rwk,
|
||||||
@{run}/{,lock/}samba/msg.lock/[0-9]* rwk,
|
@{run}/{,lock/}samba/msg.{lock,sock}/[0-9]* rwk,
|
||||||
|
/var/cache/samba/*.tdb rwk,
|
||||||
/var/cache/samba/msg.lock/ rwk,
|
/var/cache/samba/msg.lock/ rwk,
|
||||||
/var/cache/samba/msg.lock/[0-9]* rwk,
|
/var/cache/samba/msg.lock/[0-9]* rwk,
|
||||||
|
|
||||||
# required for clustering
|
# required for clustering
|
||||||
/var/lib/ctdb/** rwk,
|
/var/lib/ctdb/** rwk,
|
||||||
|
|
||||||
|
deny capability net_admin, # noisy setsockopt() calls from systemd
|
||||||
|
|
||||||
# Include additions to the abstraction
|
# Include additions to the abstraction
|
||||||
include if exists <abstractions/samba.d>
|
include if exists <abstractions/samba.d>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user