mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-02 23:35:37 +00:00
Compare commits
54 Commits
v4.1.0-bet
...
v3.1.3
Author | SHA1 | Date | |
---|---|---|---|
|
c8eefe440c | ||
|
df3b9601de | ||
|
a9fa20a456 | ||
|
089064439d | ||
|
1759c1bd24 | ||
|
68de30cf76 | ||
|
925ccfe482 | ||
|
dc4b38acf0 | ||
|
9f25b5f6ff | ||
|
6e2eabd424 | ||
|
c8ce78e00c | ||
|
7526ba4b0a | ||
|
0eaf6d3649 | ||
|
e44e9187ae | ||
|
677051bd02 | ||
|
21ca572de6 | ||
|
6c240a473b | ||
|
eec9086ecf | ||
|
81d8af7c13 | ||
|
a9bea8a377 | ||
|
3aa895073a | ||
|
dcf7e9a0d5 | ||
|
57fec9624d | ||
|
aee9bf56c0 | ||
|
0295fadab3 | ||
|
5bc35342ed | ||
|
6cc9160246 | ||
|
5452053f5b | ||
|
da906cda8c | ||
|
a19754f52f | ||
|
379a486b87 | ||
|
5ad91d482d | ||
|
19bbc5dfc3 | ||
|
66cb0ed739 | ||
|
d179a704e7 | ||
|
4244737f65 | ||
|
e617f04681 | ||
|
9d826aae65 | ||
|
465c861b02 | ||
|
dc85d04805 | ||
|
a40923006c | ||
|
1fe80c0f85 | ||
|
8043dda3f6 | ||
|
e95080e140 | ||
|
45125cedd3 | ||
|
969a8f7618 | ||
|
770b8f1e88 | ||
|
3345250f72 | ||
|
51cf0848c7 | ||
|
e0c0a6a6a5 | ||
|
ea127f13cd | ||
|
480cb56553 | ||
|
075c69a4eb | ||
|
f9dbaa38ec |
48
.gitignore
vendored
48
.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
apparmor-
|
||||
apparmor-*
|
||||
cscope.*
|
||||
binutils/aa-enabled
|
||||
binutils/aa-enabled.1
|
||||
@@ -6,7 +6,6 @@ binutils/aa-exec
|
||||
binutils/aa-exec.1
|
||||
binutils/aa-features-abi
|
||||
binutils/aa-features-abi.1
|
||||
binutils/aa-load
|
||||
binutils/aa-status
|
||||
binutils/aa-status.8
|
||||
binutils/cJSON.o
|
||||
@@ -16,7 +15,6 @@ parser/af_names.h
|
||||
parser/cap_names.h
|
||||
parser/generated_cap_names.h
|
||||
parser/generated_af_names.h
|
||||
parser/errnos.h
|
||||
parser/tst_lib
|
||||
parser/tst_misc
|
||||
parser/tst_regex
|
||||
@@ -28,9 +26,38 @@ parser/parser_version.h
|
||||
parser/parser_yacc.c
|
||||
parser/parser_yacc.h
|
||||
parser/pod2htm*.tmp
|
||||
parser/libapparmor_re/*.o
|
||||
parser/af_rule.o
|
||||
parser/af_unix.o
|
||||
parser/common_optarg.o
|
||||
parser/dbus.o
|
||||
parser/default_features.o
|
||||
parser/lib.o
|
||||
parser/libapparmor_re/aare_rules.o
|
||||
parser/libapparmor_re/chfa.o
|
||||
parser/libapparmor_re/expr-tree.o
|
||||
parser/libapparmor_re/hfa.o
|
||||
parser/libapparmor_re/libapparmor_re.a
|
||||
parser/*.o
|
||||
parser/libapparmor_re/parse.o
|
||||
parser/mount.o
|
||||
parser/network.o
|
||||
parser/parser_alias.o
|
||||
parser/parser_common.o
|
||||
parser/parser_include.o
|
||||
parser/parser_interface.o
|
||||
parser/parser_lex.o
|
||||
parser/parser_main.o
|
||||
parser/parser_merge.o
|
||||
parser/parser_misc.o
|
||||
parser/parser_policy.o
|
||||
parser/parser_regex.o
|
||||
parser/parser_symtab.o
|
||||
parser/parser_variable.o
|
||||
parser/parser_yacc.o
|
||||
parser/policy_cache.o
|
||||
parser/profile.o
|
||||
parser/ptrace.o
|
||||
parser/rule.o
|
||||
parser/signal.o
|
||||
parser/*.7
|
||||
parser/*.5
|
||||
parser/*.8
|
||||
@@ -180,7 +207,6 @@ utils/apparmor/*.pyc
|
||||
utils/apparmor/rule/*.pyc
|
||||
utils/apparmor.egg-info/
|
||||
utils/build/
|
||||
!utils/emacs/apparmor-mode.el
|
||||
utils/htmlcov/
|
||||
utils/test/common_test.pyc
|
||||
utils/test/.coverage
|
||||
@@ -227,23 +253,17 @@ tests/regression/apparmor/fd_inheritance
|
||||
tests/regression/apparmor/fd_inheritor
|
||||
tests/regression/apparmor/fork
|
||||
tests/regression/apparmor/introspect
|
||||
tests/regression/apparmor/io_uring
|
||||
tests/regression/apparmor/link
|
||||
tests/regression/apparmor/link_subset
|
||||
tests/regression/apparmor/mkdir
|
||||
tests/regression/apparmor/mmap
|
||||
tests/regression/apparmor/mount
|
||||
tests/regression/apparmor/move_mount
|
||||
tests/regression/apparmor/named_pipe
|
||||
tests/regression/apparmor/net_inet_rcv
|
||||
tests/regression/apparmor/net_inet_snd
|
||||
tests/regression/apparmor/net_raw
|
||||
tests/regression/apparmor/open
|
||||
tests/regression/apparmor/openat
|
||||
tests/regression/apparmor/pipe
|
||||
tests/regression/apparmor/pivot_root
|
||||
tests/regression/apparmor/posix_mq_rcv
|
||||
tests/regression/apparmor/posix_mq_snd
|
||||
tests/regression/apparmor/ptrace
|
||||
tests/regression/apparmor/ptrace_helper
|
||||
tests/regression/apparmor/pwrite
|
||||
@@ -267,8 +287,6 @@ tests/regression/apparmor/syscall_setpriority
|
||||
tests/regression/apparmor/syscall_setscheduler
|
||||
tests/regression/apparmor/syscall_sysctl
|
||||
tests/regression/apparmor/sysctl_proc
|
||||
tests/regression/apparmor/sysv_mq_rcv
|
||||
tests/regression/apparmor/sysv_mq_snd
|
||||
tests/regression/apparmor/tcp
|
||||
tests/regression/apparmor/transition
|
||||
tests/regression/apparmor/unix_fd_client
|
||||
@@ -276,8 +294,6 @@ tests/regression/apparmor/unix_fd_server
|
||||
tests/regression/apparmor/unix_socket
|
||||
tests/regression/apparmor/unix_socket_client
|
||||
tests/regression/apparmor/unlink
|
||||
tests/regression/apparmor/userns
|
||||
tests/regression/apparmor/userns_setns
|
||||
tests/regression/apparmor/uservars.inc
|
||||
tests/regression/apparmor/xattrs
|
||||
tests/regression/apparmor/xattrs_profile
|
||||
|
@@ -17,7 +17,7 @@ stages:
|
||||
- uname -a
|
||||
|
||||
.install-c-build-deps: &install-c-build-deps
|
||||
- apt-get install --no-install-recommends -y build-essential apache2-dev autoconf autoconf-archive automake bison dejagnu flex libpam-dev libtool pkg-config python3-all-dev python3-setuptools ruby-dev swig zlib1g-dev
|
||||
- apt-get install --no-install-recommends -y build-essential apache2-dev autoconf automake bison dejagnu flex libpam-dev libtool pkg-config python3-all-dev python3-setuptools ruby-dev swig zlib1g-dev
|
||||
|
||||
build-all:
|
||||
stage: build
|
||||
@@ -77,8 +77,7 @@ test-utils:
|
||||
extends:
|
||||
- .ubuntu-before_script
|
||||
script:
|
||||
- apt-get install --no-install-recommends -y libc6-dev libjs-jquery libjs-jquery-throttle-debounce libjs-jquery-isonscreen libjs-jquery-tablesorter flake8 python3-coverage python3-notify2 python3-psutil python3-setuptools python3-tk python3-ttkthemes python3-gi
|
||||
|
||||
- apt-get install --no-install-recommends -y libc6-dev libjs-jquery libjs-jquery-throttle-debounce libjs-jquery-isonscreen libjs-jquery-tablesorter pyflakes3 python3-coverage python3-notify2 python3-psutil python3-setuptools
|
||||
# See apparmor/apparmor#221
|
||||
- make -C parser/tst gen_dbus
|
||||
- make -C parser/tst gen_xtrans
|
||||
@@ -105,7 +104,6 @@ test-profiles:
|
||||
script:
|
||||
- make -C profiles check-parser
|
||||
- make -C profiles check-abstractions.d
|
||||
- make -C profiles check-local
|
||||
|
||||
shellcheck:
|
||||
stage: test
|
||||
@@ -113,7 +111,7 @@ shellcheck:
|
||||
extends:
|
||||
- .ubuntu-before_script
|
||||
script:
|
||||
- apt-get install --no-install-recommends -y python3-minimal file shellcheck xmlstarlet
|
||||
- apt-get install --no-install-recommends -y file shellcheck xmlstarlet
|
||||
- shellcheck --version
|
||||
- './tests/bin/shellcheck-tree --format=checkstyle
|
||||
| xmlstarlet tr tests/checkstyle2junit.xslt
|
||||
@@ -138,30 +136,3 @@ include:
|
||||
variables:
|
||||
SAST_EXCLUDED_ANALYZERS: "eslint,flawfinder,semgrep,spotbugs"
|
||||
SAST_BANDIT_EXCLUDED_PATHS: "*/tst/*, */test/*"
|
||||
|
||||
.send-to-coverity: &send-to-coverity
|
||||
- curl https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME
|
||||
--form token=$COVERITY_SCAN_TOKEN --form email=$GITLAB_USER_EMAIL
|
||||
--form file=@$(ls apparmor-*-cov-int.tar.gz) --form version="$(git describe --tags)"
|
||||
--form description="$(git describe --tags) / $CI_COMMIT_TITLE / $CI_COMMIT_REF_NAME:$CI_PIPELINE_ID"
|
||||
|
||||
coverity:
|
||||
stage: .post
|
||||
extends:
|
||||
- .ubuntu-before_script
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
script:
|
||||
- apt-get install --no-install-recommends -y curl git texlive-latex-recommended
|
||||
- *install-c-build-deps
|
||||
- curl -o /tmp/cov-analysis-linux64.tgz https://scan.coverity.com/download/linux64
|
||||
--form project=$COVERITY_SCAN_PROJECT_NAME --form token=$COVERITY_SCAN_TOKEN
|
||||
- tar xfz /tmp/cov-analysis-linux64.tgz
|
||||
- COV_VERSION=$(ls -dt cov-analysis-linux64-* | head -1)
|
||||
- PATH=$PATH:$(pwd)/$COV_VERSION/bin
|
||||
- make coverity
|
||||
- *send-to-coverity
|
||||
artifacts:
|
||||
paths:
|
||||
- "apparmor-*.tar.gz"
|
||||
|
@@ -181,9 +181,6 @@ $ make check # depends on the parser having been built first
|
||||
$ make install
|
||||
```
|
||||
|
||||
Note that the empty local/* profile sniplets no longer get created by default.
|
||||
If you want them, run `make local` before running `make check`.
|
||||
|
||||
[Note that for the parser, binutils, and utils, if you only wish to build/use
|
||||
some of the locale languages, you can override the default by passing
|
||||
the LANGS arguments to make; e.g. make all install "LANGS=en_US fr".]
|
||||
@@ -354,9 +351,6 @@ The aa-notify tool's Python dependencies can be satisfied by installing the
|
||||
following packages (Debian package names, other distros may vary):
|
||||
* python3-notify2
|
||||
* python3-psutil
|
||||
* python3-tk
|
||||
* python3-ttkthemes
|
||||
* python3-gi
|
||||
|
||||
Perl is no longer needed since none of the utilities shipped to end users depend
|
||||
on it anymore.
|
||||
|
@@ -48,10 +48,10 @@ endif
|
||||
# Internationalization support. Define a package and a LOCALEDIR
|
||||
EXTRA_CFLAGS+=-DPACKAGE=\"${NAME}\" -DLOCALEDIR=\"${LOCALEDIR}\"
|
||||
|
||||
SRCS = aa_enabled.c aa_load.c
|
||||
SRCS = aa_enabled.c
|
||||
HDRS =
|
||||
BINTOOLS = aa-enabled aa-exec aa-features-abi
|
||||
SBINTOOLS = aa-status aa-load
|
||||
SBINTOOLS = aa-status
|
||||
|
||||
AALIB = -Wl,-Bstatic -lapparmor -Wl,-Bdynamic -lpthread
|
||||
|
||||
@@ -126,9 +126,6 @@ endif
|
||||
aa-features-abi: aa_features_abi.c $(LIBAPPARMOR_A)
|
||||
$(CC) $(LDFLAGS) $(EXTRA_CFLAGS) -o $@ $< $(LIBS) $(AALIB)
|
||||
|
||||
aa-load: aa_load.c $(LIBAPPARMOR_A)
|
||||
$(CC) $(LDFLAGS) $(EXTRA_CFLAGS) -o $@ $< $(LIBS) $(AALIB)
|
||||
|
||||
aa-enabled: aa_enabled.c $(LIBAPPARMOR_A)
|
||||
$(CC) $(LDFLAGS) $(EXTRA_CFLAGS) -o $@ $< $(LIBS) $(AALIB)
|
||||
|
||||
|
@@ -72,18 +72,11 @@ displays the number of loaded non-enforcing AppArmor policies.
|
||||
|
||||
=item --kill
|
||||
|
||||
displays the number of loaded enforcing AppArmor policies that will
|
||||
kill tasks on policy violations.
|
||||
|
||||
=item --prompt
|
||||
|
||||
displays the number of loaded enforcing AppArmor policies, with
|
||||
fallback to userspace mediation.
|
||||
displays the number of loaded enforcing AppArmor policies that will kill tasks on policy violations.
|
||||
|
||||
=item --special-unconfined
|
||||
|
||||
displays the number of loaded non-enforcing AppArmor policies that are
|
||||
in the special unconfined mode.
|
||||
displays the number of loaded non-enforcing AppArmor policies that are in the special unconfined mode.
|
||||
|
||||
=item --process-mixed
|
||||
displays the number of processes confined by profile stacks with
|
||||
@@ -104,40 +97,6 @@ set in a JSON format, fit for machine consumption.
|
||||
same as --json, formatted to be readable by humans as well
|
||||
as by machines.
|
||||
|
||||
=item --show
|
||||
|
||||
what data sets to show information about. Currently I<processes>,
|
||||
I<profiles>, I<all> for both processes and profiles. The default is
|
||||
I<all>.
|
||||
|
||||
=item --count
|
||||
|
||||
display only counts for selected information.
|
||||
|
||||
=item --filter.mode=filter
|
||||
|
||||
Allows specifying a posix regular expression filter that will be
|
||||
applied against the displayed processess and profiles apparmor profile
|
||||
mode, reducing the output.
|
||||
|
||||
=item --filter.profiles=filter
|
||||
|
||||
Allows specifying a posix regular expression filter that will be
|
||||
applied against the displayed processess and profiles confining
|
||||
profile, reducing the output.
|
||||
|
||||
=item --filter.pid=filter
|
||||
|
||||
Allows specifying a posix regular expression filter that will be
|
||||
applied against the displayed processes, so that only processes pids
|
||||
matching the expression will be displayed.
|
||||
|
||||
=item --filter.exe=filter
|
||||
|
||||
Allows specifying a posix regular expression filter that will be
|
||||
applied against the displayed processes, so that only processes
|
||||
executable name matching the expression will be displayed.
|
||||
|
||||
=item --help
|
||||
|
||||
displays a short usage statement.
|
||||
@@ -165,8 +124,7 @@ if apparmor is enabled but no policy is loaded.
|
||||
|
||||
=item B<3>
|
||||
|
||||
if the apparmor control files aren't available under
|
||||
/sys/kernel/security/.
|
||||
if the apparmor control files aren't available under /sys/kernel/security/.
|
||||
|
||||
=item B<4>
|
||||
|
||||
@@ -182,9 +140,8 @@ if an internal error occurred.
|
||||
=head1 BUGS
|
||||
|
||||
B<aa-status> must be run as root to read the state of the loaded
|
||||
policy from the apparmor module. It uses the /proc filesystem to
|
||||
determine which processes are confined and so is susceptible to race
|
||||
conditions.
|
||||
policy from the apparmor module. It uses the /proc filesystem to determine
|
||||
which processes are confined and so is susceptible to race conditions.
|
||||
|
||||
If you find any additional bugs, please report them at
|
||||
L<https://gitlab.com/apparmor/apparmor/-/issues>.
|
||||
|
@@ -1,409 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2020 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.
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE /* for asprintf() */
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <getopt.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdarg.h>
|
||||
#include <stddef.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <sys/apparmor.h>
|
||||
|
||||
#include <libintl.h>
|
||||
#define _(s) gettext(s)
|
||||
|
||||
/* TODO: implement config locations - value can change */
|
||||
#define DEFAULT_CONFIG_LOCATIONS "/etc/apparmor/parser.conf"
|
||||
#define DEFAULT_POLICY_LOCATIONS "/var/cache/apparmor:/etc/apparmor.d/cache.d:/etc/apparmor.d/cache"
|
||||
#define CACHE_FEATURES_FILE ".features"
|
||||
|
||||
bool opt_debug = false;
|
||||
bool opt_verbose = false;
|
||||
bool opt_dryrun = false;
|
||||
bool opt_force = false;
|
||||
bool opt_config = false;
|
||||
|
||||
#define warning(fmt, args...) _error(_("aa-load: WARN: " fmt "\n"), ## args)
|
||||
#define error(fmt, args...) _error(_("aa-load: ERROR: " fmt "\n"), ## args)
|
||||
static void _error(const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
#define verbose(fmt, args...) _debug(opt_verbose, _(fmt "\n"), ## args)
|
||||
#define debug(fmt, args...) _debug(opt_debug, _("aa-load: DEBUG: " fmt "\n"), ## args)
|
||||
static void _debug(bool opt_displayit, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
if (!opt_displayit)
|
||||
return;
|
||||
|
||||
va_start(args, fmt);
|
||||
vfprintf(stderr, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
static int have_enough_privilege(const char *command)
|
||||
{
|
||||
uid_t uid, euid;
|
||||
|
||||
uid = getuid();
|
||||
euid = geteuid();
|
||||
|
||||
if (uid != 0 && euid != 0) {
|
||||
error("%s: Sorry. You need root privileges to run this program.\n",
|
||||
command);
|
||||
return EPERM;
|
||||
}
|
||||
|
||||
if (uid != 0 && euid == 0) {
|
||||
error("%s: Aborting! You've set this program setuid root.\n"
|
||||
"Anybody who can run this program can update "
|
||||
"your AppArmor profiles.\n", command);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int load_config(const char *file)
|
||||
{
|
||||
/* TODO */
|
||||
return ENOENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* load a single policy cache file to the kernel
|
||||
*/
|
||||
static int load_policy_file(const char *file)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
struct aa_kernel_interface *kernel_interface;
|
||||
|
||||
if (aa_kernel_interface_new(&kernel_interface, NULL, NULL)) {
|
||||
rc = -errno;
|
||||
error("Failed to open kernel interface '%s': %m", file);
|
||||
return rc;
|
||||
}
|
||||
if (!opt_dryrun &&
|
||||
aa_kernel_interface_replace_policy_from_file(kernel_interface,
|
||||
AT_FDCWD, file)) {
|
||||
rc = -errno;
|
||||
error("Failed to load policy into kernel '%s': %m", file);
|
||||
}
|
||||
aa_kernel_interface_unref(kernel_interface);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void validate_features(const char *dir_path)
|
||||
{
|
||||
aa_features *kernel_features;
|
||||
|
||||
if (aa_features_new_from_kernel(&kernel_features) == -1) {
|
||||
error("Failed to obtain features: %m");
|
||||
return;
|
||||
}
|
||||
|
||||
if (aa_features_check(AT_FDCWD, dir_path, kernel_features) == -1) {
|
||||
if (errno == ENOENT) {
|
||||
/* features file does not exist
|
||||
* not an issue when loading cache policies from dir
|
||||
*/
|
||||
}
|
||||
else if (errno == EEXIST) {
|
||||
warning("Overlay features do not match kernel features");
|
||||
}
|
||||
}
|
||||
aa_features_unref(kernel_features);
|
||||
}
|
||||
|
||||
/**
|
||||
* load a directory of policy cache files to the kernel
|
||||
* This does not do a subdir search to find the kernel match but
|
||||
* tries to load the dir regardless of whether its features match
|
||||
*
|
||||
* The hierarchy looks like
|
||||
*
|
||||
* dir/
|
||||
* .features
|
||||
* profile1
|
||||
* ...
|
||||
*/
|
||||
|
||||
static int load_policy_dir(const char *dir_path)
|
||||
{
|
||||
DIR *d;
|
||||
struct dirent *dir;
|
||||
int rc = 0;
|
||||
char *file;
|
||||
size_t len;
|
||||
|
||||
validate_features(dir_path);
|
||||
|
||||
d = opendir(dir_path);
|
||||
if (!d) {
|
||||
rc = -errno;
|
||||
error("Failed to open directory '%s': %m", dir_path);
|
||||
return rc;
|
||||
}
|
||||
|
||||
while ((dir = readdir(d)) != NULL) {
|
||||
/* Only check regular files for now */
|
||||
if (dir->d_type == DT_REG) {
|
||||
/* As per POSIX dir->d_name has at most NAME_MAX characters */
|
||||
len = strnlen(dir->d_name, NAME_MAX);
|
||||
/* Ignores .features */
|
||||
if (strncmp(dir->d_name, CACHE_FEATURES_FILE, len) == 0) {
|
||||
continue;
|
||||
}
|
||||
if (asprintf(&file, "%s/%s", dir_path, dir->d_name) == -1) {
|
||||
error("Failure allocating memory");
|
||||
closedir(d);
|
||||
return -1;
|
||||
}
|
||||
load_policy_file(file);
|
||||
free(file);
|
||||
file = NULL;
|
||||
}
|
||||
}
|
||||
closedir(d);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* load_hashed_policy - find policy hashed dir and load it
|
||||
*
|
||||
* load/replace all policy from a policy hierarchy directory
|
||||
*
|
||||
* Returns: 0 on success < -errno
|
||||
*
|
||||
* It will find the subdir that matches the kernel and load all
|
||||
* precompiled policy files from it.
|
||||
*
|
||||
* The hierarchy looks something like
|
||||
*
|
||||
* location/
|
||||
* kernel_hash1.0/
|
||||
* .features
|
||||
* profile1
|
||||
* ...
|
||||
* kernel_hash2.0/
|
||||
* .features
|
||||
* profile1
|
||||
* ...
|
||||
*/
|
||||
static int load_policy_by_hash(const char *location)
|
||||
{
|
||||
aa_policy_cache *policy_cache = NULL;
|
||||
int rc;
|
||||
|
||||
if ((rc = aa_policy_cache_new(&policy_cache, NULL, AT_FDCWD, location, 0))) {
|
||||
rc = -errno;
|
||||
error("Failed to open policy cache '%s': %m", location);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (opt_debug) {
|
||||
/* show hash directory under location that matches the
|
||||
* current kernel
|
||||
*/
|
||||
char *cache_loc = aa_policy_cache_dir_path_preview(NULL, AT_FDCWD, location);
|
||||
if (!cache_loc) {
|
||||
rc = -errno;
|
||||
error("Failed to find cache location '%s': %m", location);
|
||||
goto out;
|
||||
}
|
||||
debug("Loading cache from '%s'\n", cache_loc);
|
||||
free(cache_loc);
|
||||
}
|
||||
|
||||
if (!opt_dryrun) {
|
||||
if ((rc = aa_policy_cache_replace_all(policy_cache, NULL)) < 0) {
|
||||
error("Failed to load policy cache '%s': %m", location);
|
||||
} else {
|
||||
verbose("Success - Loaded policy cache '%s'", location);
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
aa_policy_cache_unref(policy_cache);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* load_arg - calls specific load functions for files and directories
|
||||
*
|
||||
* load/replace all policy files/dir in arg
|
||||
*
|
||||
* Returns: 0 on success, 1 on failure.
|
||||
*
|
||||
* It will load by hash subtree first, and fallback to a cache dir
|
||||
* If not a directory, it will try to load it as a cache file
|
||||
*/
|
||||
static int load_arg(char *arg)
|
||||
{
|
||||
char **location = NULL;
|
||||
int i, n, rc = 0;
|
||||
|
||||
|
||||
/* arg can specify an overlay of multiple cache locations */
|
||||
if ((n = aa_split_overlay_str(arg, &location, 0, true)) == -1) {
|
||||
error("Failed to parse overlay locations: %m");
|
||||
return 1;
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
struct stat st;
|
||||
debug("Trying to open %s", location[i]);
|
||||
if (stat(location[i], &st) == -1) {
|
||||
error("Failed stat of '%s': %m", location[i]);
|
||||
rc = 1;
|
||||
continue;
|
||||
}
|
||||
if (S_ISDIR(st.st_mode)) {
|
||||
/* try hash dir subtree first */
|
||||
if (load_policy_by_hash(location[i]) < 0) {
|
||||
error("Failed load policy by hash '%s': %m", location[i]);
|
||||
rc = 1;
|
||||
}
|
||||
/* fall back to cache dir */
|
||||
if (load_policy_dir(location[i]) < 0) {
|
||||
error("Failed load policy by directory '%s': %m", location[i]);
|
||||
rc = 1;
|
||||
}
|
||||
|
||||
} else if (load_policy_file(location[i]) < 0) {
|
||||
rc = 1;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
free(location[i]);
|
||||
free(location);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void print_usage(const char *command)
|
||||
{
|
||||
printf("Usage: %s [OPTIONS] (cache file|cache dir|cache base dir)]*\n"
|
||||
"Load Precompiled AppArmor policy from a cache location or \n"
|
||||
"locations.\n\n"
|
||||
"Options:\n"
|
||||
" -f, --force load policy even if abi does not match the kernel\n"
|
||||
" -d, --debug display debug messages\n"
|
||||
" -v, --verbose display progress and error messages\n"
|
||||
" -n, --dry-run do everything except actual load\n"
|
||||
" -h, --help this message\n",
|
||||
command);
|
||||
}
|
||||
|
||||
static const char *short_options = "c:dfvnh";
|
||||
struct option long_options[] = {
|
||||
{"config", 1, 0, 'c'},
|
||||
{"debug", 0, 0, 'd'},
|
||||
{"force", 0, 0, 'f'},
|
||||
{"verbose", 0, 0, 'v'},
|
||||
{"dry-run", 0, 0, 'n'},
|
||||
{"help", 0, 0, 'h'},
|
||||
{NULL, 0, 0, 0},
|
||||
};
|
||||
|
||||
static int process_args(int argc, char **argv)
|
||||
{
|
||||
int c, o;
|
||||
|
||||
opterr = 1;
|
||||
while ((c = getopt_long(argc, argv, short_options, long_options, &o)) != -1) {
|
||||
switch(c) {
|
||||
case 0:
|
||||
error("error in argument processing\n");
|
||||
exit(1);
|
||||
break;
|
||||
case 'd':
|
||||
opt_debug = true;
|
||||
break;
|
||||
case 'f':
|
||||
opt_force = true;
|
||||
break;
|
||||
case 'v':
|
||||
opt_verbose = true;
|
||||
break;
|
||||
case 'n':
|
||||
opt_dryrun = true;
|
||||
break;
|
||||
case 'h':
|
||||
print_usage(argv[0]);
|
||||
exit(0);
|
||||
break;
|
||||
case 'c':
|
||||
/* TODO: reserved config location,
|
||||
* act as a bad arg for now, when added update usage
|
||||
*/
|
||||
//opt_config = true; uncomment when implemented
|
||||
/* Fall through */
|
||||
default:
|
||||
error("unknown argument: '%s'\n\n", optarg);
|
||||
print_usage(argv[1]);
|
||||
exit(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return optind;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, rc = 0;
|
||||
|
||||
optind = process_args(argc, argv);
|
||||
|
||||
if (!opt_dryrun && have_enough_privilege(argv[0]))
|
||||
return 1;
|
||||
|
||||
/* if no location use the default one */
|
||||
if (optind == argc) {
|
||||
if (!opt_config && load_config(DEFAULT_CONFIG_LOCATIONS) == 0) {
|
||||
verbose("Loaded policy config");
|
||||
}
|
||||
if ((rc = load_arg(DEFAULT_POLICY_LOCATIONS)))
|
||||
verbose("Loading policy from default location '%s'", DEFAULT_POLICY_LOCATIONS);
|
||||
else
|
||||
debug("No policy specified, and no policy config or policy in default locations");
|
||||
}
|
||||
for (i = optind; i < argc; i++) {
|
||||
/* Try to load all policy locations even if one fails
|
||||
* but always return an error if any fail
|
||||
*/
|
||||
|
||||
int tmp = load_arg(argv[i]);
|
||||
if (!rc)
|
||||
rc = tmp;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@@ -67,10 +67,10 @@ to syslog.
|
||||
References
|
||||
----------
|
||||
Project webpage:
|
||||
https://apparmor.net/
|
||||
http://developer.novell.com/wiki/index.php/Novell_AppArmor
|
||||
|
||||
To provide feedback or ask questions please contact the
|
||||
apparmor@lists.ubuntu.com mail list. This is the development list
|
||||
apparmor-dev@forge.novell.com mail list. This is the development list
|
||||
for the AppArmor team.
|
||||
|
||||
See also: change_hat(3), and the Linux-PAM online documentation at
|
||||
|
@@ -188,9 +188,10 @@ parent context.
|
||||
8. Feedback/Resources
|
||||
-----------------
|
||||
|
||||
Project webpage:
|
||||
https://apparmor.net/
|
||||
To provide feedback or ask questions please contact the
|
||||
apparmor-dev@forge.novell.com mail list. This is the development list for the
|
||||
AppArmor team.
|
||||
|
||||
|
||||
|
||||
|
||||
To provide feedback or ask questions please contact the
|
||||
apparmor@lists.ubuntu.com mail list. This is the development list
|
||||
for the AppArmor team.
|
||||
|
@@ -188,9 +188,10 @@ parent context.
|
||||
8. Feedback/Resources
|
||||
-----------------
|
||||
|
||||
Project webpage:
|
||||
https://apparmor.net/
|
||||
To provide feedback or ask questions please contact the
|
||||
apparmor-dev@forge.novell.com mail list. This is the development list for the
|
||||
AppArmor team.
|
||||
|
||||
|
||||
|
||||
|
||||
To provide feedback or ask questions please contact the
|
||||
apparmor@lists.ubuntu.com mail list. This is the development list
|
||||
for the AppArmor team.
|
||||
|
@@ -42,7 +42,6 @@ endif
|
||||
|
||||
define nl
|
||||
|
||||
|
||||
endef
|
||||
|
||||
REPO_VERSION_CMD=[ -x /usr/bin/git ] && /usr/bin/git describe --tags --long --abbrev=16 --match 'v*' 2> /dev/null || awk '{ print $2 }' common/.stamp_rev
|
||||
|
@@ -1 +1 @@
|
||||
4.1.0~beta1
|
||||
3.1.3
|
||||
|
Binary file not shown.
@@ -92,14 +92,6 @@ if test "$ac_cv_prog_cc_c99" = "no"; then
|
||||
AC_MSG_ERROR([C99 mode is required to build libapparmor])
|
||||
fi
|
||||
|
||||
m4_ifndef([AX_CHECK_COMPILE_FLAG], [AC_MSG_ERROR(['autoconf-archive' missing])])
|
||||
EXTRA_CFLAGS="-Wall $EXTRA_WARNINGS -fPIC"
|
||||
AX_CHECK_COMPILE_FLAG([-flto-partition=none], , , [-Werror])
|
||||
AS_VAR_IF([ax_cv_check_cflags__Werror__flto_partition_none], [yes],
|
||||
[EXTRA_CFLAGS="$EXTRA_CFLAGS -flto-partition=none"]
|
||||
,)
|
||||
AC_SUBST([AM_CFLAGS], ["$EXTRA_CFLAGS"])
|
||||
|
||||
AC_OUTPUT(
|
||||
Makefile
|
||||
doc/Makefile
|
||||
|
@@ -116,14 +116,6 @@ The specified I<file/task> does not exist or is not visible.
|
||||
|
||||
The confinement data is too large to fit in the supplied buffer.
|
||||
|
||||
=item B<ENOPROTOOPT>
|
||||
|
||||
The kernel doesn't support the SO_PEERLABEL option in sockets. This happens
|
||||
mainly when the kernel lacks 'fine grained unix mediation' support. It also
|
||||
can happen on LSM stacking kernels where another LSM has claimed this
|
||||
interface and decides to return this error, although this is really a
|
||||
corner case.
|
||||
|
||||
=back
|
||||
|
||||
=head1 NOTES
|
||||
|
@@ -109,12 +109,12 @@ To immediately stack a profile named "profile_a", as performed with
|
||||
aa_stack_profile("profile_a"), the equivalent of this shell command can be
|
||||
used:
|
||||
|
||||
$ echo -n "stack profile_a" > /proc/self/attr/current
|
||||
$ echo -n "stackprofile profile_a" > /proc/self/attr/current
|
||||
|
||||
To stack a profile named "profile_a" at the next exec, as performed with
|
||||
aa_stack_onexec("profile_a"), the equivalent of this shell command can be used:
|
||||
|
||||
$ echo -n "stack profile_a" > /proc/self/attr/exec
|
||||
$ echo -n "stackexec profile_a" > /proc/self/attr/exec
|
||||
|
||||
These raw AppArmor filesystem operations must only be used when using
|
||||
libapparmor is not a viable option.
|
||||
@@ -184,7 +184,6 @@ with apparmor_parser(8):
|
||||
/etc/passwd r,
|
||||
|
||||
# Needed for aa_stack_profile()
|
||||
change-profile -> &i_cant_be_trusted_anymore,
|
||||
/usr/lib/libapparmor*.so* mr,
|
||||
/proc/[0-9]*/attr/current w,
|
||||
}
|
||||
|
@@ -148,9 +148,6 @@ typedef struct
|
||||
unsigned long net_local_port;
|
||||
char *net_foreign_addr;
|
||||
unsigned long net_foreign_port;
|
||||
|
||||
char *execpath;
|
||||
|
||||
char *dbus_bus;
|
||||
char *dbus_path;
|
||||
char *dbus_interface;
|
||||
@@ -164,9 +161,6 @@ typedef struct
|
||||
char *src_name;
|
||||
|
||||
char *class;
|
||||
|
||||
char *net_addr;
|
||||
char *peer_addr;
|
||||
} aa_log_record;
|
||||
|
||||
/**
|
||||
|
@@ -157,8 +157,6 @@ extern int aa_features_write_to_file(aa_features *features,
|
||||
int dirfd, const char *path);
|
||||
extern bool aa_features_is_equal(aa_features *features1,
|
||||
aa_features *features2);
|
||||
extern int aa_features_check(int dirfd, const char *path,
|
||||
aa_features *features);
|
||||
extern bool aa_features_supports(aa_features *features, const char *str);
|
||||
extern char *aa_features_id(aa_features *features);
|
||||
extern char *aa_features_value(aa_features *features, const char *str, size_t *len);
|
||||
@@ -211,8 +209,6 @@ extern char *aa_policy_cache_filename(aa_policy_cache *policy_cache, const char
|
||||
extern char *aa_policy_cache_dir_path_preview(aa_features *kernel_features,
|
||||
int dirfd, const char *path);
|
||||
|
||||
extern int aa_split_overlay_str(char *str, char ***vec, size_t max_size, bool immutable);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@@ -32,10 +32,10 @@ INCLUDES = $(all_includes)
|
||||
#
|
||||
# After changing the AA_LIB_* variables, also update EXPECTED_SO_NAME.
|
||||
|
||||
AA_LIB_CURRENT = 20
|
||||
AA_LIB_REVISION = 0
|
||||
AA_LIB_AGE = 19
|
||||
EXPECTED_SO_NAME = libapparmor.so.1.19.0
|
||||
AA_LIB_CURRENT = 13
|
||||
AA_LIB_REVISION = 2
|
||||
AA_LIB_AGE = 12
|
||||
EXPECTED_SO_NAME = libapparmor.so.1.12.2
|
||||
|
||||
SUFFIXES = .pc.in .pc
|
||||
|
||||
@@ -45,6 +45,7 @@ include $(COMMONDIR)/Make.rules
|
||||
BUILT_SOURCES = grammar.h scanner.h af_protos.h
|
||||
AM_LFLAGS = -v
|
||||
AM_YFLAGS = -d -p aalogparse_
|
||||
AM_CFLAGS = -Wall $(EXTRA_WARNINGS) -fPIC -flto-partition=none
|
||||
AM_CPPFLAGS = -D_GNU_SOURCE -I$(top_srcdir)/include/
|
||||
scanner.h: scanner.l
|
||||
$(LEX) -v $<
|
||||
@@ -58,7 +59,7 @@ lib_LTLIBRARIES = libapparmor.la
|
||||
noinst_HEADERS = grammar.h parser.h scanner.h af_protos.h private.h PMurHash.h
|
||||
|
||||
libapparmor_la_SOURCES = grammar.y libaalogparse.c kernel.c scanner.c private.c features.c kernel_interface.c policy_cache.c PMurHash.c
|
||||
libapparmor_la_LDFLAGS = -version-info $(AA_LIB_CURRENT):$(AA_LIB_REVISION):$(AA_LIB_AGE) -XCClinker -Bdynamic -pthread \
|
||||
libapparmor_la_LDFLAGS = -version-info $(AA_LIB_CURRENT):$(AA_LIB_REVISION):$(AA_LIB_AGE) -XCClinker -dynamic -pthread \
|
||||
-Wl,--version-script=$(top_srcdir)/src/libapparmor.map
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
|
@@ -35,7 +35,6 @@
|
||||
#include "PMurHash.h"
|
||||
|
||||
#define FEATURES_FILE "/sys/kernel/security/apparmor/features"
|
||||
#define CACHE_FEATURES_FILE ".features"
|
||||
|
||||
#define HASH_SIZE (8 + 1) /* 32 bits binary to hex + NUL terminator */
|
||||
#define STRING_SIZE 8192
|
||||
@@ -659,44 +658,6 @@ bool aa_features_is_equal(aa_features *features1, aa_features *features2)
|
||||
strcmp(features1->string, features2->string) == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* aa_features_check - check if features from a directory matches an aa_features object
|
||||
* @dirfd: a directory file descriptory or AT_FDCWD (see openat(2))
|
||||
* @path: the path containing the features
|
||||
* @features: features to be matched against
|
||||
*
|
||||
* Returns: 0 on success, -1 on failure. errno is set to EEXIST when there's not a match
|
||||
*/
|
||||
int aa_features_check(int dirfd, const char *path,
|
||||
aa_features *features)
|
||||
{
|
||||
aa_features *local_features = NULL;
|
||||
autofree char *name = NULL;
|
||||
bool rc;
|
||||
int len;
|
||||
|
||||
len = asprintf(&name, "%s/%s", path, CACHE_FEATURES_FILE);
|
||||
if (len == -1) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* verify that path dir .features matches */
|
||||
if (aa_features_new(&local_features, dirfd, name)) {
|
||||
PDEBUG("could not setup new features object for dirfd '%d' '%s'\n", dirfd, name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = aa_features_is_equal(local_features, features);
|
||||
aa_features_unref(local_features);
|
||||
if (!rc) {
|
||||
errno = EEXIST;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const char *features_lookup(aa_features *features, const char *str)
|
||||
{
|
||||
const char *features_string = features->string;
|
||||
|
@@ -114,7 +114,6 @@ aa_record_event_type lookup_aa_event(unsigned int type)
|
||||
%token TOK_PERIOD
|
||||
%token TOK_QUESTION_MARK
|
||||
%token TOK_SINGLE_QUOTE
|
||||
%token TOK_NONE
|
||||
|
||||
%token TOK_TYPE_REJECT
|
||||
%token TOK_TYPE_AUDIT
|
||||
@@ -188,8 +187,6 @@ aa_record_event_type lookup_aa_event(unsigned int type)
|
||||
%token TOK_KEY_FSTYPE
|
||||
%token TOK_KEY_FLAGS
|
||||
%token TOK_KEY_SRCNAME
|
||||
%token TOK_KEY_UNIX_PEER_ADDR
|
||||
%token TOK_KEY_EXECPATH
|
||||
%token TOK_KEY_CLASS
|
||||
|
||||
%token TOK_SOCKLOGD_KERNEL
|
||||
@@ -252,7 +249,7 @@ syslog_type:
|
||||
{ ret_record->version = AA_RECORD_SYNTAX_V2; free($3); }
|
||||
| syslog_date syslog_id TOK_DMESG_STAMP key_type audit_id key_list
|
||||
{ ret_record->version = AA_RECORD_SYNTAX_V2; free($3); }
|
||||
/* needs update: hard newline in handling multiline log messages */
|
||||
/* needs update: hard newline in handling mutiline log messages */
|
||||
| syslog_date syslog_id TOK_DMESG_STAMP TOK_AUDIT TOK_COLON key_type audit_id audit_user_msg_partial_tail
|
||||
{ ret_record->version = AA_RECORD_SYNTAX_V2; free($3); }
|
||||
| syslog_date syslog_id TOK_DMESG_STAMP TOK_AUDIT TOK_COLON key_type audit_id audit_user_msg_tail
|
||||
@@ -357,13 +354,6 @@ key: TOK_KEY_OPERATION TOK_EQUALS TOK_QUOTED_STRING
|
||||
{ ret_record->fsuid = $3;}
|
||||
| TOK_KEY_OUID TOK_EQUALS TOK_DIGITS
|
||||
{ ret_record->ouid = $3;}
|
||||
| TOK_KEY_ADDR TOK_EQUALS TOK_QUESTION_MARK
|
||||
| TOK_KEY_ADDR TOK_EQUALS TOK_NONE
|
||||
| TOK_KEY_ADDR TOK_EQUALS safe_string
|
||||
{ ret_record->net_addr = $3; }
|
||||
| TOK_KEY_UNIX_PEER_ADDR TOK_EQUALS TOK_NONE
|
||||
| TOK_KEY_UNIX_PEER_ADDR TOK_EQUALS safe_string
|
||||
{ ret_record->peer_addr = $3; }
|
||||
| TOK_KEY_FSUID_UPPER TOK_EQUALS TOK_QUOTED_STRING
|
||||
{ free($3);} /* Ignore - fsuid username */
|
||||
| TOK_KEY_OUID_UPPER TOK_EQUALS TOK_QUOTED_STRING
|
||||
@@ -373,7 +363,10 @@ key: TOK_KEY_OPERATION TOK_EQUALS TOK_QUOTED_STRING
|
||||
| TOK_KEY_HOSTNAME TOK_EQUALS safe_string
|
||||
{ free($3); /* Ignore - hostname from user AVC messages */ }
|
||||
| TOK_KEY_HOSTNAME TOK_EQUALS TOK_QUESTION_MARK
|
||||
| TOK_KEY_ADDR TOK_EQUALS TOK_QUESTION_MARK
|
||||
| TOK_KEY_TERMINAL TOK_EQUALS TOK_QUESTION_MARK
|
||||
| TOK_KEY_ADDR TOK_EQUALS safe_string
|
||||
{ free($3); /* Ignore - IP address from user AVC messages */ }
|
||||
| TOK_KEY_TERMINAL TOK_EQUALS safe_string
|
||||
{ free($3); /* Ignore - TTY from user AVC messages */ }
|
||||
| TOK_KEY_EXE TOK_EQUALS safe_string
|
||||
@@ -426,14 +419,14 @@ key: TOK_KEY_OPERATION TOK_EQUALS TOK_QUOTED_STRING
|
||||
{ ret_record->dbus_member = $3; }
|
||||
| TOK_KEY_SIGNAL TOK_EQUALS TOK_ID
|
||||
{ ret_record->signal = $3; }
|
||||
|
||||
| TOK_KEY_FSTYPE TOK_EQUALS TOK_QUOTED_STRING
|
||||
{ ret_record->fs_type = $3; }
|
||||
| TOK_KEY_FLAGS TOK_EQUALS TOK_QUOTED_STRING
|
||||
{ ret_record->flags = $3; }
|
||||
| TOK_KEY_SRCNAME TOK_EQUALS TOK_QUOTED_STRING
|
||||
{ ret_record->src_name = $3; }
|
||||
| TOK_KEY_EXECPATH TOK_EQUALS TOK_QUOTED_STRING
|
||||
{ ret_record->execpath = $3; }
|
||||
|
||||
| TOK_MSG_REST
|
||||
{
|
||||
ret_record->event = AA_RECORD_INVALID;
|
||||
|
@@ -463,7 +463,7 @@ static char *procattr_path(pid_t pid, const char *attr)
|
||||
|
||||
static int procattr_open(pid_t tid, const char *attr, int flags)
|
||||
{
|
||||
autofree char *tmp = NULL;
|
||||
char *tmp;
|
||||
int fd;
|
||||
|
||||
tmp = procattr_path(tid, attr);
|
||||
@@ -471,7 +471,7 @@ static int procattr_open(pid_t tid, const char *attr, int flags)
|
||||
return -1;
|
||||
}
|
||||
fd = open(tmp, flags);
|
||||
|
||||
free(tmp);
|
||||
/* Test is we can fallback to the old interface (this is ugly).
|
||||
* If we haven't tried the old interface already
|
||||
* proc_attr_base == proc_attr_base_old - no fallback
|
||||
@@ -483,14 +483,11 @@ static int procattr_open(pid_t tid, const char *attr, int flags)
|
||||
* old interface where is_enabled() is only successful if
|
||||
* the old interface is available to apparmor.
|
||||
*/
|
||||
if (fd == -1 && param_check_enabled() != 0 && strncmp(tmp, proc_attr_base_old, strlen(proc_attr_base_old)) != 0) {
|
||||
free(tmp);
|
||||
if (asprintf(&tmp, proc_attr_base_old, tid, attr) < 0) {
|
||||
/* tmp is undefined, make sure it is null for autofree*/
|
||||
tmp = NULL;
|
||||
if (fd == -1 && tmp != proc_attr_base_old && param_check_enabled() != 0) {
|
||||
if (asprintf(&tmp, proc_attr_base_old, tid, attr) < 0)
|
||||
return -1;
|
||||
}
|
||||
fd = open(tmp, flags);
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
return fd;
|
||||
@@ -1358,121 +1355,3 @@ int aa_query_link_path(const char *label, const char *target, const char *link,
|
||||
strlen(target), link, strlen(link),
|
||||
allowed, audited);
|
||||
}
|
||||
|
||||
static int alloc_substring(char ***v, char *s, char *p,
|
||||
size_t max_size, size_t n, bool immutable)
|
||||
{
|
||||
if (max_size) {
|
||||
if (n >= max_size) {
|
||||
errno = E2BIG;
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
char ** tmpv;
|
||||
tmpv = (char **) realloc(*v, (n + 1) * sizeof(char *));
|
||||
if (tmpv == NULL) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
*v = tmpv;
|
||||
}
|
||||
if (immutable) {
|
||||
char *tmp;
|
||||
tmp = (char *) malloc(p - s + 1);
|
||||
if (tmp == NULL) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
memcpy(tmp, s, p - s);
|
||||
tmp[p - s] = 0;
|
||||
(*v)[n] = tmp;
|
||||
} else {
|
||||
(*v)[n] = s;
|
||||
if (*p)
|
||||
*p = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* aa_split_overlay_str - split a string into potentially multiple strings
|
||||
* @str: the string to split
|
||||
* @vec: vector to put string pointers into, IF null will be allocated
|
||||
* @max_size: maximum number of ents to put in @vec, IF 0 dynamic
|
||||
* @immutable: true if @str should not be modified.
|
||||
*
|
||||
* Returns: the number of entries in vec on success. -1 on error and errno set.
|
||||
*
|
||||
* Split a comma or colon separated string into substrings.
|
||||
*
|
||||
* IF @vec == NULL
|
||||
* the vec will be dynamically allocated
|
||||
* ELSE
|
||||
* passed in @vec will be used, and NOT updated/extended
|
||||
*
|
||||
* IF @max_size == 0 && @vec == NULL
|
||||
* @vec will be dynamically resized
|
||||
* ELSE
|
||||
* @vec will be fixed at @max_size
|
||||
*
|
||||
* IF @immutable is true
|
||||
* the substrings placed in @vec will be allocated copies.
|
||||
* ELSE
|
||||
* @str will be updated in place and @vec[x] will point into @str
|
||||
*/
|
||||
int aa_split_overlay_str(char *str, char ***vec, size_t max_size, bool immutable)
|
||||
{
|
||||
char *s = str;
|
||||
char *p = str;
|
||||
int rc, n = 0;
|
||||
char **v = *vec;
|
||||
|
||||
if (!*vec) {
|
||||
if (max_size) {
|
||||
v = (char **) malloc(max_size * sizeof(char *));
|
||||
if (v == NULL) {
|
||||
rc = ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (*p) {
|
||||
if (*p == '\\') {
|
||||
if (*(p + 1) != 0)
|
||||
p++;
|
||||
} else if (*p == ',' || *p == ':') {
|
||||
if (p != s) {
|
||||
if (alloc_substring(&v, s, p, max_size, n, immutable) == -1) {
|
||||
rc = errno;
|
||||
goto err;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
p++;
|
||||
s = p;
|
||||
} else
|
||||
p++;
|
||||
}
|
||||
if (p != s) {
|
||||
if (alloc_substring(&v, s, p, max_size, n, immutable) == -1) {
|
||||
rc = errno;
|
||||
goto err;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
|
||||
*vec = v;
|
||||
return n;
|
||||
err:
|
||||
if (immutable) {
|
||||
for (int i = 0; i < n; i++) {
|
||||
free(v[i]);
|
||||
}
|
||||
}
|
||||
if (!*vec)
|
||||
free(v);
|
||||
errno = rc;
|
||||
return -1;
|
||||
}
|
||||
|
@@ -103,13 +103,6 @@ void free_record(aa_log_record *record)
|
||||
free(record->flags);
|
||||
if (record->src_name != NULL)
|
||||
free(record->src_name);
|
||||
if (record->net_addr != NULL)
|
||||
free(record->net_addr);
|
||||
if (record->peer_addr != NULL)
|
||||
free(record->peer_addr);
|
||||
if (record->execpath != NULL)
|
||||
free(record->execpath);
|
||||
|
||||
if (record->class != NULL)
|
||||
free(record->class);
|
||||
|
||||
|
@@ -124,14 +124,6 @@ APPARMOR_3.0 {
|
||||
*;
|
||||
} APPARMOR_2.13.1;
|
||||
|
||||
APPARMOR_3.1 {
|
||||
global:
|
||||
aa_features_check;
|
||||
aa_split_overlay_str;
|
||||
local:
|
||||
*;
|
||||
} APPARMOR_3.0;
|
||||
|
||||
PRIVATE {
|
||||
global:
|
||||
_aa_is_blacklisted;
|
||||
|
@@ -147,6 +147,36 @@ repeat:
|
||||
return path;
|
||||
}
|
||||
|
||||
static int cache_check_features(int dirfd, const char *cache_name,
|
||||
aa_features *features)
|
||||
{
|
||||
aa_features *local_features = NULL;
|
||||
autofree char *name = NULL;
|
||||
bool rc;
|
||||
int len;
|
||||
|
||||
len = asprintf(&name, "%s/%s", cache_name, CACHE_FEATURES_FILE);
|
||||
if (len == -1) {
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* verify that cache dir .features matches */
|
||||
if (aa_features_new(&local_features, dirfd, name)) {
|
||||
PDEBUG("could not setup new features object for dirfd '%d' '%s'\n", dirfd, name);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rc = aa_features_is_equal(local_features, features);
|
||||
aa_features_unref(local_features);
|
||||
if (!rc) {
|
||||
errno = EEXIST;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int create_cache(aa_policy_cache *policy_cache, aa_features *features)
|
||||
{
|
||||
if (aa_policy_cache_remove(policy_cache->dirfd[0], "."))
|
||||
@@ -164,8 +194,8 @@ static int create_cache(aa_policy_cache *policy_cache, aa_features *features)
|
||||
static int init_cache_features(aa_policy_cache *policy_cache,
|
||||
aa_features *kernel_features, bool create)
|
||||
{
|
||||
if (aa_features_check(policy_cache->dirfd[0], ".",
|
||||
kernel_features)) {
|
||||
if (cache_check_features(policy_cache->dirfd[0], ".",
|
||||
kernel_features)) {
|
||||
/* EEXIST must come before ENOENT for short circuit eval */
|
||||
if (!create || errno == EEXIST || errno != ENOENT)
|
||||
return -1;
|
||||
@@ -201,13 +231,13 @@ static int cache_miss_cb(int dirfd, const struct dirent *ent, void *arg)
|
||||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
if (!aa_features_check(dirfd, cache_name, data->features) || errno == ENOENT) {
|
||||
if (!cache_check_features(dirfd, cache_name, data->features) || errno == ENOENT) {
|
||||
/* found cache dir matching pattern */
|
||||
data->cache_name = cache_name;
|
||||
/* return 1 to stop iteration and signal dir found */
|
||||
return 1;
|
||||
} else if (errno != EEXIST) {
|
||||
PDEBUG("aa_features_check() failed for dirfd '%d' '%s'\n", dirfd, cache_name);
|
||||
PDEBUG("cache_check_features() failed for dirfd '%d' '%s'\n", dirfd, cache_name);
|
||||
free(cache_name);
|
||||
return -1;
|
||||
}
|
||||
@@ -243,12 +273,12 @@ static int cache_dir_from_path_and_features(char **cache_path,
|
||||
if (len == -1)
|
||||
return -1;
|
||||
|
||||
if (!aa_features_check(dirfd, cache_dir, features) || errno == ENOENT) {
|
||||
if (!cache_check_features(dirfd, cache_dir, features) || errno == ENOENT) {
|
||||
PDEBUG("cache_dir_from_path_and_features() found '%s'\n", cache_dir);
|
||||
*cache_path = cache_dir;
|
||||
return 0;
|
||||
} else if (errno != EEXIST) {
|
||||
PDEBUG("aa_features_check() failed for dirfd '%d' %s\n", dirfd, cache_dir);
|
||||
PDEBUG("cache_check_features() failed for dirfd '%d' %s\n", dirfd, cache_dir);
|
||||
free(cache_dir);
|
||||
return -1;
|
||||
}
|
||||
|
@@ -90,7 +90,6 @@ question_mark "?"
|
||||
single_quote "'"
|
||||
mode_chars ([RrWwaLlMmkXx])|([Pp][Xx])|([Uu][Xx])|([Ii][Xx])|([Pp][Ii][Xx])
|
||||
modes ({mode_chars}+)|({mode_chars}+::{mode_chars}*)|(::{mode_chars}*)
|
||||
none "none"
|
||||
/* New message types */
|
||||
|
||||
aa_reject_type "APPARMOR_DENIED"
|
||||
@@ -158,13 +157,9 @@ key_capname "capname"
|
||||
key_offset "offset"
|
||||
key_target "target"
|
||||
key_laddr "laddr"
|
||||
key_saddr "saddr"
|
||||
key_faddr "faddr"
|
||||
key_daddr "daddr"
|
||||
key_lport "lport"
|
||||
key_srcport "src"
|
||||
key_fport "fport"
|
||||
key_destport "dest"
|
||||
key_bus "bus"
|
||||
key_dest "dest"
|
||||
key_path "path"
|
||||
@@ -177,9 +172,6 @@ key_fstype "fstype"
|
||||
key_flags "flags"
|
||||
key_srcname "srcname"
|
||||
key_class "class"
|
||||
key_tcontext "tcontext"
|
||||
key_unix_peer_addr "peer_addr"
|
||||
key_execpath "execpath"
|
||||
audit "audit"
|
||||
|
||||
/* network addrs */
|
||||
@@ -310,8 +302,6 @@ yy_flex_debug = 0;
|
||||
{period} { return(TOK_PERIOD); }
|
||||
{question_mark} { return(TOK_QUESTION_MARK); }
|
||||
{single_quote} { return(TOK_SINGLE_QUOTE); }
|
||||
{none} { return(TOK_NONE); }
|
||||
|
||||
|
||||
{key_apparmor} { BEGIN(audit_types); return(TOK_KEY_APPARMOR); }
|
||||
{key_type} { BEGIN(audit_types); return(TOK_KEY_TYPE); }
|
||||
@@ -337,7 +327,6 @@ yy_flex_debug = 0;
|
||||
{key_peer_profile} { BEGIN(safe_string); return(TOK_KEY_PEER_PROFILE); }
|
||||
{key_label} { BEGIN(safe_string); return(TOK_KEY_LABEL); }
|
||||
{key_peer_label} { BEGIN(safe_string); return(TOK_KEY_PEER_LABEL); }
|
||||
{key_tcontext} { BEGIN(safe_string); return(TOK_KEY_PEER_LABEL); }
|
||||
{key_family} { return(TOK_KEY_FAMILY); }
|
||||
{key_sock_type} { return(TOK_KEY_SOCK_TYPE); }
|
||||
{key_protocol} { return(TOK_KEY_PROTOCOL); }
|
||||
@@ -351,7 +340,7 @@ yy_flex_debug = 0;
|
||||
{key_sauid} { return(TOK_KEY_SAUID); }
|
||||
{key_ses} { return(TOK_KEY_SES); }
|
||||
{key_hostname} { return(TOK_KEY_HOSTNAME); }
|
||||
{key_addr} { BEGIN(safe_string); return(TOK_KEY_ADDR); }
|
||||
{key_addr} { return(TOK_KEY_ADDR); }
|
||||
{key_terminal} { return(TOK_KEY_TERMINAL); }
|
||||
{key_exe} { BEGIN(safe_string); return(TOK_KEY_EXE); }
|
||||
{key_comm} { BEGIN(safe_string); return(TOK_KEY_COMM); }
|
||||
@@ -360,13 +349,9 @@ yy_flex_debug = 0;
|
||||
{key_offset} { return(TOK_KEY_OFFSET); }
|
||||
{key_target} { return(TOK_KEY_TARGET); }
|
||||
{key_laddr} { yy_push_state(ip_addr, yyscanner); return(TOK_KEY_LADDR); }
|
||||
{key_saddr} { yy_push_state(ip_addr, yyscanner); return(TOK_KEY_LADDR); }
|
||||
{key_faddr} { yy_push_state(ip_addr, yyscanner); return(TOK_KEY_FADDR); }
|
||||
{key_daddr} { yy_push_state(ip_addr, yyscanner); return(TOK_KEY_FADDR); }
|
||||
{key_lport} { return(TOK_KEY_LPORT); }
|
||||
{key_srcport} { return(TOK_KEY_LPORT); }
|
||||
{key_fport} { return(TOK_KEY_FPORT); }
|
||||
{key_destport} { return(TOK_KEY_FPORT); }
|
||||
{key_bus} { return(TOK_KEY_BUS); }
|
||||
{key_path} { return(TOK_KEY_PATH); }
|
||||
{key_interface} { return(TOK_KEY_INTERFACE); }
|
||||
@@ -377,8 +362,6 @@ yy_flex_debug = 0;
|
||||
{key_fstype} { return(TOK_KEY_FSTYPE); }
|
||||
{key_flags} { BEGIN(safe_string); return(TOK_KEY_FLAGS); }
|
||||
{key_srcname} { BEGIN(safe_string); return(TOK_KEY_SRCNAME); }
|
||||
{key_unix_peer_addr} { BEGIN(safe_string); return(TOK_KEY_UNIX_PEER_ADDR); }
|
||||
{key_execpath} { BEGIN(safe_string); return(TOK_KEY_EXECPATH); }
|
||||
{key_class} { BEGIN(safe_string); return(TOK_KEY_CLASS); }
|
||||
|
||||
{socklogd_kernel} { BEGIN(dmesg_timestamp); return(TOK_SOCKLOGD_KERNEL); }
|
||||
|
@@ -135,7 +135,7 @@ static int do_test_walk_one(const char **str, const struct component *component,
|
||||
|
||||
static int test_walk_one(void)
|
||||
{
|
||||
struct component c = (struct component) { NULL, 0 };
|
||||
struct component c;
|
||||
const char *str;
|
||||
int rc = 0;
|
||||
|
||||
|
@@ -55,7 +55,7 @@ extern int aa_getprocattr_raw(pid_t tid, const char *attr, char *buf, int len,
|
||||
extern int aa_getprocattr(pid_t tid, const char *attr, char **buf, char **mode);
|
||||
extern int aa_gettaskcon(pid_t target, char **label, char **mode);
|
||||
extern int aa_getcon(char **label, char **mode);
|
||||
extern int aa_getpeercon_raw(int fd, char *buf, socklen_t *len, char **mode);
|
||||
extern int aa_getpeercon_raw(int fd, char *buf, int *len, char **mode);
|
||||
extern int aa_getpeercon(int fd, char **label, char **mode);
|
||||
extern int aa_query_label(uint32_t mask, char *query, size_t size, int *allow,
|
||||
int *audit);
|
||||
|
@@ -14,7 +14,7 @@ MOSTLYCLEANFILES=libapparmor_wrap.c LibAppArmor.py
|
||||
|
||||
all-local: libapparmor_wrap.c setup.py
|
||||
if test ! -f libapparmor_wrap.c; then cp $(srcdir)/libapparmor_wrap.c . ; fi
|
||||
CC="$(CC)" CFLAGS="$(PYTHON_CPPFLAGS) $(CFLAGS) $(EXTRA_WARNINGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(PYTHON_LDFLAGS) $(LDFLAGS)" $(PYTHON) setup.py build
|
||||
CC="$(CC)" CFLAGS="$(PYTHON_CPPFLAGS) $(EXTRA_WARNINGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(PYTHON_LDFLAGS) $(LDFLAGS)" $(PYTHON) setup.py build
|
||||
|
||||
install-exec-local:
|
||||
$(PYTHON) setup.py install --root="/$(DESTDIR)" --prefix="$(prefix)"
|
||||
|
@@ -2,7 +2,7 @@ from setuptools import setup, Extension
|
||||
import string
|
||||
|
||||
setup(name = 'LibAppArmor',
|
||||
version = '@VERSION@'.replace('~', '-'),
|
||||
version = '@VERSION@',
|
||||
author = 'AppArmor Dev Team',
|
||||
author_email = 'apparmor@lists.ubuntu.com',
|
||||
url = 'https://wiki.apparmor.net',
|
||||
|
@@ -11,4 +11,4 @@ if tuple(map(int, setuptools.__version__.split("."))) >= (62, 1):
|
||||
identifier = sys.implementation.cache_tag
|
||||
else:
|
||||
identifier = "%d.%d" % sys.version_info[:2]
|
||||
print("lib.{}-{}".format(sysconfig.get_platform(), identifier))
|
||||
print("lib.%s-%s" % (sysconfig.get_platform(), identifier))
|
||||
|
@@ -64,8 +64,8 @@ class AAPythonBindingsTests(unittest.TestCase):
|
||||
self.maxDiff = None
|
||||
|
||||
def _runtest(self, testname):
|
||||
infile = testname + ".in"
|
||||
outfile = testname + ".out"
|
||||
infile = "%s.in" % (testname)
|
||||
outfile = "%s.out" % (testname)
|
||||
# infile *should* only contain one line
|
||||
with open(os.path.join(TESTDIR, infile), 'r') as f:
|
||||
line = f.read()
|
||||
@@ -78,7 +78,7 @@ class AAPythonBindingsTests(unittest.TestCase):
|
||||
expected = self.parse_output_file(outfile)
|
||||
self.assertEqual(expected, record,
|
||||
"expected records did not match\n"
|
||||
"expected = {}\nactual = {}".format(expected, record))
|
||||
"expected = %s\nactual = %s" % (expected, record))
|
||||
|
||||
def parse_output_file(self, outfile):
|
||||
"""parse testcase .out file and return dict"""
|
||||
@@ -93,7 +93,7 @@ class AAPythonBindingsTests(unittest.TestCase):
|
||||
count += 1
|
||||
if line == "START":
|
||||
self.assertEqual(count, 1,
|
||||
"Unexpected output format in " + outfile)
|
||||
"Unexpected output format in %s" % (outfile))
|
||||
continue
|
||||
else:
|
||||
key, value = line.split(": ", 1)
|
||||
@@ -141,8 +141,8 @@ def main():
|
||||
for f in find_testcases(TESTDIR):
|
||||
def stub_test(self, testname=f):
|
||||
self._runtest(testname)
|
||||
stub_test.__doc__ = "test " + f
|
||||
setattr(AAPythonBindingsTests, 'test_' + f, stub_test)
|
||||
stub_test.__doc__ = "test %s" % (f)
|
||||
setattr(AAPythonBindingsTests, 'test_%s' % (f), stub_test)
|
||||
return unittest.main(verbosity=2)
|
||||
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
#define _GNU_SOURCE /* for glibc's basename version */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -5,12 +7,6 @@
|
||||
|
||||
#include <aalogparse.h>
|
||||
|
||||
static const char *basename(const char *path)
|
||||
{
|
||||
const char *p = strrchr(path, '/');
|
||||
return p ? p + 1 : path;
|
||||
}
|
||||
|
||||
int print_results(aa_log_record *record);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
@@ -119,8 +115,6 @@ int print_results(aa_log_record *record)
|
||||
print_long("Peer PID", record->peer_pid, 0);
|
||||
print_string("Active hat", record->active_hat);
|
||||
|
||||
print_string("Net Addr", record->net_addr);
|
||||
print_string("Peer Addr", record->peer_addr);
|
||||
print_string("Network family", record->net_family);
|
||||
print_string("Socket type", record->net_sock_type);
|
||||
print_string("Protocol", record->net_protocol);
|
||||
@@ -140,8 +134,6 @@ int print_results(aa_log_record *record)
|
||||
print_string("Flags", record->flags);
|
||||
print_string("Src name", record->src_name);
|
||||
|
||||
print_string("Execpath", record->execpath);
|
||||
|
||||
print_string("Class", record->class);
|
||||
|
||||
print_long("Epoch", record->epoch, 0);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/usr/lib/NetworkManager/nm-dhcp-client.action {
|
||||
network inet6 dgram port=10580,
|
||||
network inet6 dgram,
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/usr/sbin/apache2 {
|
||||
network inet6 stream ip=::ffff:192.168.236.159 port=80 peer=(ip=::ffff:192.168.103.80 port=61985),
|
||||
network inet6 stream,
|
||||
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/usr/sbin/apache2 {
|
||||
|
||||
^www.xxxxxxxxxx.co.uk {
|
||||
network (send) inet6 stream ip=::ffff:192.168.1.100 port=80 peer=(ip=::ffff:192.168.1.100 port=45658),
|
||||
network inet6 stream,
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/usr/local/apache-tomcat-8.0.33/bin/catalina.sh {
|
||||
|
||||
^/usr/local/jdk1.8.0_92/bin/java {
|
||||
network (receive) inet6 stream ip=::ffff:127.0.0.1 port=8080 peer=(ip=::ffff:127.0.0.1 port=52308),
|
||||
network inet6 stream,
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1 +0,0 @@
|
||||
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"
|
@@ -1,16 +0,0 @@
|
||||
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
|
@@ -1,4 +0,0 @@
|
||||
profile cargo {
|
||||
owner /var/tmp/portage/dev-lang/rust-1.67.1/work/rustc-1.67.1-src/build/bootstrap/debug/libbootstrap.rlib m,
|
||||
|
||||
}
|
@@ -1 +0,0 @@
|
||||
[ 4584.703379] audit: type=1400 audit(1680266735.359:69): apparmor="DENIED" operation="uring_sqpoll" class="io_uring" profile="/root/apparmor/tests/regression/apparmor/io_uring" pid=1320 comm="io_uring" requested="sqpoll" denied="sqpoll"
|
@@ -1,13 +0,0 @@
|
||||
START
|
||||
File: testcase_io_uring_01.in
|
||||
Event type: AA_RECORD_DENIED
|
||||
Audit ID: 1680266735.359:69
|
||||
Operation: uring_sqpoll
|
||||
Mask: sqpoll
|
||||
Denied Mask: sqpoll
|
||||
Profile: /root/apparmor/tests/regression/apparmor/io_uring
|
||||
Command: io_uring
|
||||
PID: 1320
|
||||
Class: io_uring
|
||||
Epoch: 1680266735
|
||||
Audit subid: 69
|
@@ -1,4 +0,0 @@
|
||||
/root/apparmor/tests/regression/apparmor/io_uring {
|
||||
io_uring sqpoll,
|
||||
|
||||
}
|
@@ -1 +0,0 @@
|
||||
[ 4584.491076] audit: type=1400 audit(1680266735.147:63): apparmor="DENIED" operation="uring_override" class="io_uring" profile="/root/apparmor/tests/regression/apparmor/io_uring" pid=1193 comm="io_uring" requested="override_creds" denied="override_creds" tcontext="/root/apparmor/tests/regression/apparmor/io_uring"
|
@@ -1,14 +0,0 @@
|
||||
START
|
||||
File: testcase_io_uring_02.in
|
||||
Event type: AA_RECORD_DENIED
|
||||
Audit ID: 1680266735.147:63
|
||||
Operation: uring_override
|
||||
Mask: override_creds
|
||||
Denied Mask: override_creds
|
||||
Profile: /root/apparmor/tests/regression/apparmor/io_uring
|
||||
Peer profile: /root/apparmor/tests/regression/apparmor/io_uring
|
||||
Command: io_uring
|
||||
PID: 1193
|
||||
Class: io_uring
|
||||
Epoch: 1680266735
|
||||
Audit subid: 63
|
@@ -1,4 +0,0 @@
|
||||
/root/apparmor/tests/regression/apparmor/io_uring {
|
||||
io_uring override_creds label=/root/apparmor/tests/regression/apparmor/io_uring,
|
||||
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
/home/ubuntu/bzr/apparmor/tests/regression/apparmor/mount {
|
||||
mount fstype=(ext2) options=(mand, rw) /dev/loop0/ -> /tmp/sdtest.19033-29001-MPfz98/mountpoint/,
|
||||
mount fstype=ext2 options="rw, mand" /dev/loop0/ -> /tmp/sdtest.19033-29001-MPfz98/mountpoint/,
|
||||
|
||||
}
|
||||
|
@@ -1 +0,0 @@
|
||||
type=AVC msg=audit(1715045678.914:344186): apparmor="ALLOWED" operation="mount" info="failed flags match" error=-13 profile="steam" name="/newroot/dev/" pid=26487 comm="srt-bwrap" flags="rw, nosuid, nodev, remount, bind, silent, relatime"
|
@@ -1,14 +0,0 @@
|
||||
START
|
||||
File: testcase_mount_02.in
|
||||
Event type: AA_RECORD_ALLOWED
|
||||
Audit ID: 1715045678.914:344186
|
||||
Operation: mount
|
||||
Profile: steam
|
||||
Name: /newroot/dev/
|
||||
Command: srt-bwrap
|
||||
Info: failed flags match
|
||||
ErrorCode: 13
|
||||
PID: 26487
|
||||
Flags: rw, nosuid, nodev, remount, bind, silent, relatime
|
||||
Epoch: 1715045678
|
||||
Audit subid: 344186
|
@@ -1,4 +0,0 @@
|
||||
profile steam {
|
||||
mount options=(bind, nodev, nosuid, relatime, remount, rw, silent) -> /newroot/dev/,
|
||||
|
||||
}
|
@@ -1 +0,0 @@
|
||||
Apr 05 19:36:19 ubuntu kernel: audit: type=1400 audit(1649187379.660:255): apparmor="DENIED" operation="create" profile="/root/apparmor/tests/regression/apparmor/posix_mq_rcv" name="/queuename" pid=791 comm="posix_mq_rcv" requested="create" denied="create" class="posix_mqueue" fsuid=0 ouid=0
|
@@ -1,16 +0,0 @@
|
||||
START
|
||||
File: testcase_mqueue_01.in
|
||||
Event type: AA_RECORD_DENIED
|
||||
Audit ID: 1649187379.660:255
|
||||
Operation: create
|
||||
Mask: create
|
||||
Denied Mask: create
|
||||
fsuid: 0
|
||||
ouid: 0
|
||||
Profile: /root/apparmor/tests/regression/apparmor/posix_mq_rcv
|
||||
Name: /queuename
|
||||
Command: posix_mq_rcv
|
||||
PID: 791
|
||||
Class: posix_mqueue
|
||||
Epoch: 1649187379
|
||||
Audit subid: 255
|
@@ -1,4 +0,0 @@
|
||||
/root/apparmor/tests/regression/apparmor/posix_mq_rcv {
|
||||
mqueue create type=posix /queuename,
|
||||
|
||||
}
|
@@ -1,2 +0,0 @@
|
||||
Apr 05 19:36:29 ubuntu kernel: audit: type=1400 audit(1649187389.828:262): apparmor="DENIED" operation="open" profile="/root/apparmor/tests/regression/apparmor/posix_mq_rcv" name="/queuename" pid=848 comm="posix_mq_rcv" requested="read create" denied="read" class="posix_mqueue" fsuid=0 ouid=0
|
||||
|
@@ -1,16 +0,0 @@
|
||||
START
|
||||
File: testcase_mqueue_02.in
|
||||
Event type: AA_RECORD_DENIED
|
||||
Audit ID: 1649187389.828:262
|
||||
Operation: open
|
||||
Mask: read create
|
||||
Denied Mask: read
|
||||
fsuid: 0
|
||||
ouid: 0
|
||||
Profile: /root/apparmor/tests/regression/apparmor/posix_mq_rcv
|
||||
Name: /queuename
|
||||
Command: posix_mq_rcv
|
||||
PID: 848
|
||||
Class: posix_mqueue
|
||||
Epoch: 1649187389
|
||||
Audit subid: 262
|
@@ -1,4 +0,0 @@
|
||||
/root/apparmor/tests/regression/apparmor/posix_mq_rcv {
|
||||
mqueue read type=posix /queuename,
|
||||
|
||||
}
|
@@ -1 +0,0 @@
|
||||
Apr 05 19:36:39 ubuntu kernel: audit: type=1400 audit(1649187399.973:265): apparmor="DENIED" operation="unlink" profile="/root/apparmor/tests/regression/apparmor/posix_mq_rcv" name="/queuename" pid=897 comm="posix_mq_rcv" requested="delete" denied="delete" class="posix_mqueue" fsuid=0 ouid=0
|
@@ -1,16 +0,0 @@
|
||||
START
|
||||
File: testcase_mqueue_03.in
|
||||
Event type: AA_RECORD_DENIED
|
||||
Audit ID: 1649187399.973:265
|
||||
Operation: unlink
|
||||
Mask: delete
|
||||
Denied Mask: delete
|
||||
fsuid: 0
|
||||
ouid: 0
|
||||
Profile: /root/apparmor/tests/regression/apparmor/posix_mq_rcv
|
||||
Name: /queuename
|
||||
Command: posix_mq_rcv
|
||||
PID: 897
|
||||
Class: posix_mqueue
|
||||
Epoch: 1649187399
|
||||
Audit subid: 265
|
@@ -1,4 +0,0 @@
|
||||
/root/apparmor/tests/regression/apparmor/posix_mq_rcv {
|
||||
mqueue delete type=posix /queuename,
|
||||
|
||||
}
|
@@ -1 +0,0 @@
|
||||
Jun 02 16:58:20 ubuntu kernel: audit: type=1400 audit(1654189100.680:1011): apparmor="DENIED" operation="sysv_mqueue" profile="/root/apparmor/tests/regression/apparmor/sysv_mq_rcv" name="123" pid=13574 comm="sysv_mq_rcv" requested="create" denied="create" class="sysv_mqueue" fsuid=0 ouid=0
|
@@ -1,16 +0,0 @@
|
||||
START
|
||||
File: testcase_mqueue_04.in
|
||||
Event type: AA_RECORD_DENIED
|
||||
Audit ID: 1654189100.680:1011
|
||||
Operation: sysv_mqueue
|
||||
Mask: create
|
||||
Denied Mask: create
|
||||
fsuid: 0
|
||||
ouid: 0
|
||||
Profile: /root/apparmor/tests/regression/apparmor/sysv_mq_rcv
|
||||
Name: 123
|
||||
Command: sysv_mq_rcv
|
||||
PID: 13574
|
||||
Class: sysv_mqueue
|
||||
Epoch: 1654189100
|
||||
Audit subid: 1011
|
@@ -1,4 +0,0 @@
|
||||
/root/apparmor/tests/regression/apparmor/sysv_mq_rcv {
|
||||
mqueue create type=sysv 123,
|
||||
|
||||
}
|
@@ -1 +0,0 @@
|
||||
Jun 02 17:15:45 ubuntu kernel: audit: type=1400 audit(1654190145.439:1135): apparmor="DENIED" operation="sysv_mqueue" profile="/root/apparmor/tests/regression/apparmor/sysv_mq_snd" name="123" pid=15849 comm="sysv_mq_snd" requested="open" denied="open" class="sysv_mqueue"
|
@@ -1,14 +0,0 @@
|
||||
START
|
||||
File: testcase_mqueue_05.in
|
||||
Event type: AA_RECORD_DENIED
|
||||
Audit ID: 1654190145.439:1135
|
||||
Operation: sysv_mqueue
|
||||
Mask: open
|
||||
Denied Mask: open
|
||||
Profile: /root/apparmor/tests/regression/apparmor/sysv_mq_snd
|
||||
Name: 123
|
||||
Command: sysv_mq_snd
|
||||
PID: 15849
|
||||
Class: sysv_mqueue
|
||||
Epoch: 1654190145
|
||||
Audit subid: 1135
|
@@ -1,4 +0,0 @@
|
||||
/root/apparmor/tests/regression/apparmor/sysv_mq_snd {
|
||||
mqueue open type=sysv 123,
|
||||
|
||||
}
|
@@ -1 +0,0 @@
|
||||
Jun 02 17:15:37 ubuntu kernel: audit: type=1400 audit(1654190137.559:1122): apparmor="DENIED" operation="sysv_mqueue" profile="/root/apparmor/tests/regression/apparmor/sysv_mq_rcv" name="123" pid=15632 comm="sysv_mq_rcv" requested="read" denied="read" class="sysv_mqueue" fsuid=0 ouid=0
|
@@ -1,16 +0,0 @@
|
||||
START
|
||||
File: testcase_mqueue_06.in
|
||||
Event type: AA_RECORD_DENIED
|
||||
Audit ID: 1654190137.559:1122
|
||||
Operation: sysv_mqueue
|
||||
Mask: read
|
||||
Denied Mask: read
|
||||
fsuid: 0
|
||||
ouid: 0
|
||||
Profile: /root/apparmor/tests/regression/apparmor/sysv_mq_rcv
|
||||
Name: 123
|
||||
Command: sysv_mq_rcv
|
||||
PID: 15632
|
||||
Class: sysv_mqueue
|
||||
Epoch: 1654190137
|
||||
Audit subid: 1122
|
@@ -1,4 +0,0 @@
|
||||
/root/apparmor/tests/regression/apparmor/sysv_mq_rcv {
|
||||
mqueue read type=sysv 123,
|
||||
|
||||
}
|
@@ -1 +0,0 @@
|
||||
Jun 02 17:15:51 ubuntu kernel: audit: type=1400 audit(1654190151.003:1145): apparmor="DENIED" operation="sysv_mqueue" profile="/root/apparmor/tests/regression/apparmor/sysv_mq_rcv" name="123" pid=15973 comm="sysv_mq_rcv" requested="delete" denied="delete" class="sysv_mqueue" fsuid=1001 ouid=1001
|
@@ -1,16 +0,0 @@
|
||||
START
|
||||
File: testcase_mqueue_07.in
|
||||
Event type: AA_RECORD_DENIED
|
||||
Audit ID: 1654190151.003:1145
|
||||
Operation: sysv_mqueue
|
||||
Mask: delete
|
||||
Denied Mask: delete
|
||||
fsuid: 1001
|
||||
ouid: 1001
|
||||
Profile: /root/apparmor/tests/regression/apparmor/sysv_mq_rcv
|
||||
Name: 123
|
||||
Command: sysv_mq_rcv
|
||||
PID: 15973
|
||||
Class: sysv_mqueue
|
||||
Epoch: 1654190151
|
||||
Audit subid: 1145
|
@@ -1,4 +0,0 @@
|
||||
/root/apparmor/tests/regression/apparmor/sysv_mq_rcv {
|
||||
mqueue delete type=sysv 123,
|
||||
|
||||
}
|
@@ -1 +0,0 @@
|
||||
Jun 02 17:15:55 ubuntu kernel: audit: type=1400 audit(1654190155.699:1155): apparmor="DENIED" operation="sysv_mqueue" profile="/root/apparmor/tests/regression/apparmor/sysv_mq_snd" name="123" pid=16148 comm="sysv_mq_snd" requested="write" denied="write" class="sysv_mqueue" fsuid=1001 ouid=1001
|
@@ -1,16 +0,0 @@
|
||||
START
|
||||
File: testcase_mqueue_08.in
|
||||
Event type: AA_RECORD_DENIED
|
||||
Audit ID: 1654190155.699:1155
|
||||
Operation: sysv_mqueue
|
||||
Mask: write
|
||||
Denied Mask: write
|
||||
fsuid: 1001
|
||||
ouid: 1001
|
||||
Profile: /root/apparmor/tests/regression/apparmor/sysv_mq_snd
|
||||
Name: 123
|
||||
Command: sysv_mq_snd
|
||||
PID: 16148
|
||||
Class: sysv_mqueue
|
||||
Epoch: 1654190155
|
||||
Audit subid: 1155
|
@@ -1,4 +0,0 @@
|
||||
/root/apparmor/tests/regression/apparmor/sysv_mq_snd {
|
||||
mqueue write type=sysv 123,
|
||||
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
/usr/bin/evince-thumbnailer {
|
||||
network inet stream ip=192.168.66.150 port=765 peer=(ip=192.168.66.200 port=2049),
|
||||
network inet stream,
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/usr/bin/evince-thumbnailer {
|
||||
network inet stream port=765 peer=(port=2049),
|
||||
network inet stream,
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/usr/lib/dovecot/imap-login {
|
||||
network inet6 stream port=143,
|
||||
network inet6 stream,
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/home/ubuntu/tmp/nc {
|
||||
network inet6 stream ip=::1 port=2048 peer=(ip=::1 port=33986),
|
||||
network inet6 stream,
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
/home/ubuntu/tmp/nc {
|
||||
network inet6 stream ip=::ffff:127.0.0.1 port=2048 peer=(ip=::ffff:127.0.0.1 port=59180),
|
||||
network inet6 stream,
|
||||
|
||||
}
|
||||
|
@@ -1 +0,0 @@
|
||||
[319992.813426] audit: type=1400 audit(1716557137.764:477): apparmor="DENIED" operation="recvmsg" class="net" info="failed remote addr match" error=-13 profile="/home/ubuntu/apparmor/tests/regression/apparmor/net_inet_rcv" pid=22237 comm="net_inet_rcv" laddr=127.0.97.3 lport=3456 saddr=127.0.97.3 src=3456 family="inet" sock_type="dgram" protocol=17 requested="receive" denied="receive"
|
@@ -1,20 +0,0 @@
|
||||
START
|
||||
File: testcase_network_06.in
|
||||
Event type: AA_RECORD_DENIED
|
||||
Audit ID: 1716557137.764:477
|
||||
Operation: recvmsg
|
||||
Mask: receive
|
||||
Denied Mask: receive
|
||||
Profile: /home/ubuntu/apparmor/tests/regression/apparmor/net_inet_rcv
|
||||
Command: net_inet_rcv
|
||||
Info: failed remote addr match
|
||||
ErrorCode: 13
|
||||
PID: 22237
|
||||
Network family: inet
|
||||
Socket type: dgram
|
||||
Protocol: udp
|
||||
Local addr: 127.0.97.3
|
||||
Local port: 3456
|
||||
Class: net
|
||||
Epoch: 1716557137
|
||||
Audit subid: 477
|
@@ -1,4 +0,0 @@
|
||||
/home/ubuntu/apparmor/tests/regression/apparmor/net_inet_rcv {
|
||||
network (receive) inet dgram ip=127.0.97.3 port=3456,
|
||||
|
||||
}
|
@@ -1 +0,0 @@
|
||||
[321266.557863] audit: type=1400 audit(1716558411.518:583): apparmor="DENIED" operation="bind" class="net" profile="/home/ubuntu/apparmor/tests/regression/apparmor/net_inet_rcv" pid=23602 comm="net_inet_rcv" saddr=127.0.97.3 src=3456 family="inet" sock_type="dgram" protocol=17 requested="bind" denied="bind"
|
@@ -1,18 +0,0 @@
|
||||
START
|
||||
File: testcase_network_07.in
|
||||
Event type: AA_RECORD_DENIED
|
||||
Audit ID: 1716558411.518:583
|
||||
Operation: bind
|
||||
Mask: bind
|
||||
Denied Mask: bind
|
||||
Profile: /home/ubuntu/apparmor/tests/regression/apparmor/net_inet_rcv
|
||||
Command: net_inet_rcv
|
||||
PID: 23602
|
||||
Network family: inet
|
||||
Socket type: dgram
|
||||
Protocol: udp
|
||||
Local addr: 127.0.97.3
|
||||
Local port: 3456
|
||||
Class: net
|
||||
Epoch: 1716558411
|
||||
Audit subid: 583
|
@@ -1,4 +0,0 @@
|
||||
/home/ubuntu/apparmor/tests/regression/apparmor/net_inet_rcv {
|
||||
network (bind) inet dgram ip=127.0.97.3 port=3456,
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user