mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-04 16:25:10 +00:00
Compare commits
133 Commits
v4.1.0-bet
...
v3.0.4
Author | SHA1 | Date | |
---|---|---|---|
|
939530b2b8 | ||
|
b4fc4c3c14 | ||
|
59a22c5786 | ||
|
f3ee5a1849 | ||
|
2c25ed160e | ||
|
edf59286e5 | ||
|
1e9e0e40a9 | ||
|
5049cdb45f | ||
|
aa82f874e2 | ||
|
fa98c9aafa | ||
|
033ed7837c | ||
|
5ca5b3879f | ||
|
ab4cfb5e84 | ||
|
d1e2ab6a77 | ||
|
b4cc405b80 | ||
|
c2c2cf005c | ||
|
0e4d3e6b30 | ||
|
af8d5021a5 | ||
|
8c63d75a20 | ||
|
7371119f28 | ||
|
e8041a7f48 | ||
|
b23de50180 | ||
|
9aac5e09d7 | ||
|
cb285b0cdd | ||
|
609a262447 | ||
|
e186512671 | ||
|
ca6f239790 | ||
|
c903b36d05 | ||
|
66ede4ae7a | ||
|
663b9636ed | ||
|
73e2f0cd8c | ||
|
37f5326d0e | ||
|
06dc32a9f3 | ||
|
b1a6f9c86e | ||
|
dc00e28558 | ||
|
6cfc6eeec2 | ||
|
4fbd6468ac | ||
|
e9e9340eff | ||
|
1a6c042ac6 | ||
|
5a5f969a5e | ||
|
59ec31bcb3 | ||
|
b1b046f4b6 | ||
|
53e34f9d53 | ||
|
93f080fe8e | ||
|
79d03f4279 | ||
|
d01bfaefc7 | ||
|
4d8bbf97fc | ||
|
5d030f7765 | ||
|
bcef865116 | ||
|
b86bb506ef | ||
|
64fbb1e25b | ||
|
2cedb8794c | ||
|
37e691bd8a | ||
|
5af298855f | ||
|
071eb797ef | ||
|
c7d426255b | ||
|
0729b13293 | ||
|
3396bf8d77 | ||
|
debe35adf5 | ||
|
ec44a2c46b | ||
|
4ba0e3897a | ||
|
4a9d52c7e6 | ||
|
27c931f089 | ||
|
9e22a6e1e3 | ||
|
fe64edc828 | ||
|
7ab110df19 | ||
|
244334eab3 | ||
|
4831e933f0 | ||
|
b5a2a1ec13 | ||
|
4ee00aa076 | ||
|
55da3a19c2 | ||
|
e58742c028 | ||
|
7f84e8bc4e | ||
|
8b939b8dd4 | ||
|
4c6f8352b1 | ||
|
f79ea041a4 | ||
|
4983fda88b | ||
|
3db5d76282 | ||
|
1cd34e5ce6 | ||
|
06b56e2511 | ||
|
377613433f | ||
|
6e8df906bf | ||
|
f65572d847 | ||
|
b35b15ae70 | ||
|
acf97383ae | ||
|
88acc4006d | ||
|
42c12930a3 | ||
|
9d24cef8d5 | ||
|
e35e838034 | ||
|
c848e8e270 | ||
|
f5c0fe6dce | ||
|
49f3b6649b | ||
|
543da0cee9 | ||
|
c4a2f5d9b1 | ||
|
b0f08aa9d6 | ||
|
f8cdac9017 | ||
|
4c7042c1fc | ||
|
900b595cab | ||
|
4992a6ab86 | ||
|
dd7f1817b4 | ||
|
ec93821b54 | ||
|
7497ff4353 | ||
|
c4150a1659 | ||
|
cd464446b6 | ||
|
ba23532a59 | ||
|
11d1f3812f | ||
|
51144b5cbb | ||
|
3e18c0785a | ||
|
15595eb51d | ||
|
ad30555a96 | ||
|
b0e12a5788 | ||
|
1ba978b65c | ||
|
3c2ddc2ede | ||
|
805cb2c796 | ||
|
8cb1f8f4f6 | ||
|
ff72ea9a56 | ||
|
eab43b5358 | ||
|
bf75381287 | ||
|
80efc15e18 | ||
|
49db93a79d | ||
|
935003883e | ||
|
5ee729331a | ||
|
d89478794e | ||
|
738c7c60ba | ||
|
e142376368 | ||
|
8f39da5501 | ||
|
2f774431cb | ||
|
b64bf7771a | ||
|
848664b47b | ||
|
526c902ba2 | ||
|
b73b8ed432 | ||
|
59589308eb | ||
|
2ef17fa972 |
81
.gitignore
vendored
81
.gitignore
vendored
@@ -1,4 +1,4 @@
|
|||||||
apparmor-
|
apparmor-*
|
||||||
cscope.*
|
cscope.*
|
||||||
binutils/aa-enabled
|
binutils/aa-enabled
|
||||||
binutils/aa-enabled.1
|
binutils/aa-enabled.1
|
||||||
@@ -6,28 +6,15 @@ binutils/aa-exec
|
|||||||
binutils/aa-exec.1
|
binutils/aa-exec.1
|
||||||
binutils/aa-features-abi
|
binutils/aa-features-abi
|
||||||
binutils/aa-features-abi.1
|
binutils/aa-features-abi.1
|
||||||
binutils/aa-load
|
|
||||||
binutils/aa-status
|
binutils/aa-status
|
||||||
binutils/aa-status.8
|
binutils/aa-status.8
|
||||||
binutils/cJSON.o
|
binutils/cJSON.o
|
||||||
binutils/po/*.mo
|
binutils/po/*.mo
|
||||||
changehat/mod_apparmor/.libs
|
|
||||||
changehat/mod_apparmor/mod_apparmor.8
|
|
||||||
changehat/mod_apparmor/mod_apparmor.8.html
|
|
||||||
changehat/mod_apparmor/mod_apparmor.la
|
|
||||||
changehat/mod_apparmor/mod_apparmor.lo
|
|
||||||
changehat/mod_apparmor/mod_apparmor.slo
|
|
||||||
changehat/mod_apparmor/mod_apparmor.so
|
|
||||||
changehat/mod_apparmor/pod2htmd.tmp
|
|
||||||
changehat/pam_apparmor/get_options.o
|
|
||||||
changehat/pam_apparmor/pam_apparmor.o
|
|
||||||
changehat/pam_apparmor/pam_apparmor.so
|
|
||||||
parser/po/*.mo
|
parser/po/*.mo
|
||||||
parser/af_names.h
|
parser/af_names.h
|
||||||
parser/cap_names.h
|
parser/cap_names.h
|
||||||
parser/generated_cap_names.h
|
parser/generated_cap_names.h
|
||||||
parser/generated_af_names.h
|
parser/generated_af_names.h
|
||||||
parser/errnos.h
|
|
||||||
parser/tst_lib
|
parser/tst_lib
|
||||||
parser/tst_misc
|
parser/tst_misc
|
||||||
parser/tst_regex
|
parser/tst_regex
|
||||||
@@ -39,9 +26,38 @@ parser/parser_version.h
|
|||||||
parser/parser_yacc.c
|
parser/parser_yacc.c
|
||||||
parser/parser_yacc.h
|
parser/parser_yacc.h
|
||||||
parser/pod2htm*.tmp
|
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/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/*.7
|
||||||
parser/*.5
|
parser/*.5
|
||||||
parser/*.8
|
parser/*.8
|
||||||
@@ -180,6 +196,7 @@ libraries/libapparmor/testsuite/libaalogparse.test/Makefile
|
|||||||
libraries/libapparmor/testsuite/libaalogparse.test/Makefile.in
|
libraries/libapparmor/testsuite/libaalogparse.test/Makefile.in
|
||||||
libraries/libapparmor/testsuite/test_multi/out
|
libraries/libapparmor/testsuite/test_multi/out
|
||||||
libraries/libapparmor/testsuite/test_multi_multi-test_multi.o
|
libraries/libapparmor/testsuite/test_multi_multi-test_multi.o
|
||||||
|
changehat/mod_apparmor/.libs
|
||||||
utils/*.8
|
utils/*.8
|
||||||
utils/*.8.html
|
utils/*.8.html
|
||||||
utils/*.5
|
utils/*.5
|
||||||
@@ -190,7 +207,6 @@ utils/apparmor/*.pyc
|
|||||||
utils/apparmor/rule/*.pyc
|
utils/apparmor/rule/*.pyc
|
||||||
utils/apparmor.egg-info/
|
utils/apparmor.egg-info/
|
||||||
utils/build/
|
utils/build/
|
||||||
!utils/emacs/apparmor-mode.el
|
|
||||||
utils/htmlcov/
|
utils/htmlcov/
|
||||||
utils/test/common_test.pyc
|
utils/test/common_test.pyc
|
||||||
utils/test/.coverage
|
utils/test/.coverage
|
||||||
@@ -200,11 +216,7 @@ utils/vim/apparmor.vim
|
|||||||
utils/vim/apparmor.vim.5
|
utils/vim/apparmor.vim.5
|
||||||
utils/vim/apparmor.vim.5.html
|
utils/vim/apparmor.vim.5.html
|
||||||
utils/vim/pod2htmd.tmp
|
utils/vim/pod2htmd.tmp
|
||||||
tests/regression/apparmor/*.o
|
|
||||||
tests/regression/apparmor/aa_policy_cache
|
|
||||||
tests/regression/apparmor/access
|
tests/regression/apparmor/access
|
||||||
tests/regression/apparmor/at_secure
|
|
||||||
tests/regression/apparmor/attach_disconnected
|
|
||||||
tests/regression/apparmor/changehat
|
tests/regression/apparmor/changehat
|
||||||
tests/regression/apparmor/changehat_fail
|
tests/regression/apparmor/changehat_fail
|
||||||
tests/regression/apparmor/changehat_fork
|
tests/regression/apparmor/changehat_fork
|
||||||
@@ -219,10 +231,6 @@ tests/regression/apparmor/chgrp
|
|||||||
tests/regression/apparmor/chmod
|
tests/regression/apparmor/chmod
|
||||||
tests/regression/apparmor/chown
|
tests/regression/apparmor/chown
|
||||||
tests/regression/apparmor/clone
|
tests/regression/apparmor/clone
|
||||||
tests/regression/apparmor/dbus_eavesdrop
|
|
||||||
tests/regression/apparmor/dbus_message
|
|
||||||
tests/regression/apparmor/dbus_service
|
|
||||||
tests/regression/apparmor/dbus_unrequested_reply
|
|
||||||
tests/regression/apparmor/deleted
|
tests/regression/apparmor/deleted
|
||||||
tests/regression/apparmor/env_check
|
tests/regression/apparmor/env_check
|
||||||
tests/regression/apparmor/environ
|
tests/regression/apparmor/environ
|
||||||
@@ -233,40 +241,26 @@ tests/regression/apparmor/fchdir
|
|||||||
tests/regression/apparmor/fchgrp
|
tests/regression/apparmor/fchgrp
|
||||||
tests/regression/apparmor/fchmod
|
tests/regression/apparmor/fchmod
|
||||||
tests/regression/apparmor/fchown
|
tests/regression/apparmor/fchown
|
||||||
tests/regression/apparmor/fd_inheritance
|
|
||||||
tests/regression/apparmor/fd_inheritor
|
|
||||||
tests/regression/apparmor/fork
|
tests/regression/apparmor/fork
|
||||||
tests/regression/apparmor/introspect
|
|
||||||
tests/regression/apparmor/io_uring
|
|
||||||
tests/regression/apparmor/link
|
tests/regression/apparmor/link
|
||||||
tests/regression/apparmor/link_subset
|
tests/regression/apparmor/link_subset
|
||||||
tests/regression/apparmor/mkdir
|
tests/regression/apparmor/mkdir
|
||||||
tests/regression/apparmor/mmap
|
tests/regression/apparmor/mmap
|
||||||
tests/regression/apparmor/mount
|
tests/regression/apparmor/mount
|
||||||
tests/regression/apparmor/move_mount
|
|
||||||
tests/regression/apparmor/named_pipe
|
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/net_raw
|
||||||
tests/regression/apparmor/open
|
tests/regression/apparmor/open
|
||||||
tests/regression/apparmor/openat
|
tests/regression/apparmor/openat
|
||||||
tests/regression/apparmor/pipe
|
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
|
||||||
tests/regression/apparmor/ptrace_helper
|
tests/regression/apparmor/ptrace_helper
|
||||||
tests/regression/apparmor/pwrite
|
tests/regression/apparmor/pwrite
|
||||||
tests/regression/apparmor/query_label
|
|
||||||
tests/regression/apparmor/readdir
|
tests/regression/apparmor/readdir
|
||||||
tests/regression/apparmor/rename
|
tests/regression/apparmor/rename
|
||||||
tests/regression/apparmor/rw
|
tests/regression/apparmor/rw
|
||||||
tests/regression/apparmor/socketpair
|
|
||||||
tests/regression/apparmor/swap
|
tests/regression/apparmor/swap
|
||||||
tests/regression/apparmor/symlink
|
tests/regression/apparmor/symlink
|
||||||
tests/regression/apparmor/syscall_chroot
|
tests/regression/apparmor/syscall_chroot
|
||||||
tests/regression/apparmor/syscall_ioperm
|
|
||||||
tests/regression/apparmor/syscall_iopl
|
|
||||||
tests/regression/apparmor/syscall_mknod
|
tests/regression/apparmor/syscall_mknod
|
||||||
tests/regression/apparmor/syscall_mlockall
|
tests/regression/apparmor/syscall_mlockall
|
||||||
tests/regression/apparmor/syscall_ptrace
|
tests/regression/apparmor/syscall_ptrace
|
||||||
@@ -277,20 +271,11 @@ tests/regression/apparmor/syscall_setpriority
|
|||||||
tests/regression/apparmor/syscall_setscheduler
|
tests/regression/apparmor/syscall_setscheduler
|
||||||
tests/regression/apparmor/syscall_sysctl
|
tests/regression/apparmor/syscall_sysctl
|
||||||
tests/regression/apparmor/sysctl_proc
|
tests/regression/apparmor/sysctl_proc
|
||||||
tests/regression/apparmor/sysv_mq_rcv
|
|
||||||
tests/regression/apparmor/sysv_mq_snd
|
|
||||||
tests/regression/apparmor/tcp
|
tests/regression/apparmor/tcp
|
||||||
tests/regression/apparmor/transition
|
|
||||||
tests/regression/apparmor/unix_fd_client
|
tests/regression/apparmor/unix_fd_client
|
||||||
tests/regression/apparmor/unix_fd_server
|
tests/regression/apparmor/unix_fd_server
|
||||||
tests/regression/apparmor/unix_socket
|
|
||||||
tests/regression/apparmor/unix_socket_client
|
|
||||||
tests/regression/apparmor/unlink
|
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
|
||||||
tests/regression/apparmor/xattrs_profile
|
|
||||||
tests/regression/apparmor/coredump
|
tests/regression/apparmor/coredump
|
||||||
**/__pycache__/
|
**/__pycache__/
|
||||||
*.orig
|
*.orig
|
||||||
|
122
.gitlab-ci.yml
122
.gitlab-ci.yml
@@ -1,5 +1,9 @@
|
|||||||
---
|
---
|
||||||
image: ubuntu:latest
|
image: ubuntu:latest
|
||||||
|
before_script:
|
||||||
|
- export DEBIAN_FRONTEND=noninteractive && apt-get update -qq && apt-get install --no-install-recommends -y build-essential apache2-dev autoconf automake bison dejagnu flex libpam-dev libtool perl liblocale-gettext-perl pkg-config python-all-dev python3-all-dev pyflakes3 ruby-dev swig lsb-release python3-notify2 python3-psutil python3-setuptools zlib1g-dev
|
||||||
|
- lsb_release -a
|
||||||
|
- uname -a
|
||||||
|
|
||||||
# XXX - add a deploy stage to publish man pages, docs, and coverage
|
# XXX - add a deploy stage to publish man pages, docs, and coverage
|
||||||
# reports
|
# reports
|
||||||
@@ -8,21 +12,8 @@ stages:
|
|||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
|
|
||||||
.ubuntu-before_script:
|
|
||||||
before_script:
|
|
||||||
- export DEBIAN_FRONTEND=noninteractive
|
|
||||||
- apt-get update -qq
|
|
||||||
- apt-get install --no-install-recommends -y gcc perl liblocale-gettext-perl linux-libc-dev lsb-release make
|
|
||||||
- lsb_release -a
|
|
||||||
- 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
|
|
||||||
|
|
||||||
build-all:
|
build-all:
|
||||||
stage: build
|
stage: build
|
||||||
extends:
|
|
||||||
- .ubuntu-before_script
|
|
||||||
artifacts:
|
artifacts:
|
||||||
name: ${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
|
name: ${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHA}
|
||||||
expire_in: 30 days
|
expire_in: 30 days
|
||||||
@@ -36,7 +27,6 @@ build-all:
|
|||||||
- changehat/pam_apparmor/
|
- changehat/pam_apparmor/
|
||||||
- profiles/
|
- profiles/
|
||||||
script:
|
script:
|
||||||
- *install-c-build-deps
|
|
||||||
- cd libraries/libapparmor && ./autogen.sh && ./configure --with-perl --with-python --prefix=/usr && make && cd ../.. || { cat config.log ; exit 1 ; }
|
- cd libraries/libapparmor && ./autogen.sh && ./configure --with-perl --with-python --prefix=/usr && make && cd ../.. || { cat config.log ; exit 1 ; }
|
||||||
- make -C parser
|
- make -C parser
|
||||||
- make -C binutils
|
- make -C binutils
|
||||||
@@ -45,83 +35,16 @@ build-all:
|
|||||||
- make -C changehat/pam_apparmor
|
- make -C changehat/pam_apparmor
|
||||||
- make -C profiles
|
- make -C profiles
|
||||||
|
|
||||||
test-libapparmor:
|
test-all:
|
||||||
stage: test
|
stage: test
|
||||||
needs: ["build-all"]
|
|
||||||
extends:
|
|
||||||
- .ubuntu-before_script
|
|
||||||
script:
|
script:
|
||||||
- *install-c-build-deps
|
|
||||||
- make -C libraries/libapparmor check
|
- make -C libraries/libapparmor check
|
||||||
|
|
||||||
test-parser:
|
|
||||||
stage: test
|
|
||||||
needs: ["build-all"]
|
|
||||||
extends:
|
|
||||||
- .ubuntu-before_script
|
|
||||||
script:
|
|
||||||
- *install-c-build-deps
|
|
||||||
- make -C parser check
|
- make -C parser check
|
||||||
|
|
||||||
test-binutils:
|
|
||||||
stage: test
|
|
||||||
needs: ["build-all"]
|
|
||||||
extends:
|
|
||||||
- .ubuntu-before_script
|
|
||||||
script:
|
|
||||||
- make -C binutils check
|
- make -C binutils check
|
||||||
|
|
||||||
test-utils:
|
|
||||||
stage: test
|
|
||||||
needs: ["build-all"]
|
|
||||||
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
|
|
||||||
|
|
||||||
# See apparmor/apparmor#221
|
|
||||||
- make -C parser/tst gen_dbus
|
|
||||||
- make -C parser/tst gen_xtrans
|
|
||||||
- make -C utils check
|
- make -C utils check
|
||||||
- make -C utils/test coverage-regression
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- utils/test/htmlcov/
|
|
||||||
when: always
|
|
||||||
|
|
||||||
test-mod-apparmor:
|
|
||||||
stage: test
|
|
||||||
needs: ["build-all"]
|
|
||||||
extends:
|
|
||||||
- .ubuntu-before_script
|
|
||||||
script:
|
|
||||||
- make -C changehat/mod_apparmor check
|
- make -C changehat/mod_apparmor check
|
||||||
|
|
||||||
test-profiles:
|
|
||||||
stage: test
|
|
||||||
needs: ["build-all"]
|
|
||||||
extends:
|
|
||||||
- .ubuntu-before_script
|
|
||||||
script:
|
|
||||||
- make -C profiles check-parser
|
- make -C profiles check-parser
|
||||||
- make -C profiles check-abstractions.d
|
- make -C profiles check-abstractions.d
|
||||||
- make -C profiles check-local
|
|
||||||
|
|
||||||
shellcheck:
|
|
||||||
stage: test
|
|
||||||
needs: []
|
|
||||||
extends:
|
|
||||||
- .ubuntu-before_script
|
|
||||||
script:
|
|
||||||
- apt-get install --no-install-recommends -y python3-minimal file shellcheck xmlstarlet
|
|
||||||
- shellcheck --version
|
|
||||||
- './tests/bin/shellcheck-tree --format=checkstyle
|
|
||||||
| xmlstarlet tr tests/checkstyle2junit.xslt
|
|
||||||
> shellcheck.xml'
|
|
||||||
artifacts:
|
|
||||||
when: always
|
|
||||||
reports:
|
|
||||||
junit: shellcheck.xml
|
|
||||||
|
|
||||||
# Disabled due to aa-logprof dependency on /sbin/apparmor_parser existing
|
# Disabled due to aa-logprof dependency on /sbin/apparmor_parser existing
|
||||||
# - make -C profiles check-profiles
|
# - make -C profiles check-profiles
|
||||||
@@ -130,38 +53,3 @@ shellcheck:
|
|||||||
# - stage: test
|
# - stage: test
|
||||||
# - script:
|
# - script:
|
||||||
# - cd changehat/pam_apparmor && make check
|
# - cd changehat/pam_apparmor && make check
|
||||||
|
|
||||||
include:
|
|
||||||
- template: SAST.gitlab-ci.yml
|
|
||||||
- template: Secret-Detection.gitlab-ci.yml
|
|
||||||
|
|
||||||
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"
|
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
# Don't follow source'd scripts
|
|
||||||
disable=SC1090
|
|
||||||
disable=SC1091
|
|
||||||
|
|
||||||
# dash supports 'local'
|
|
||||||
disable=SC2039
|
|
||||||
disable=SC3043
|
|
||||||
|
|
||||||
# dash supports 'echo -n'
|
|
||||||
disable=SC3037
|
|
@@ -181,9 +181,6 @@ $ make check # depends on the parser having been built first
|
|||||||
$ make install
|
$ 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
|
[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
|
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".]
|
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):
|
following packages (Debian package names, other distros may vary):
|
||||||
* python3-notify2
|
* python3-notify2
|
||||||
* python3-psutil
|
* python3-psutil
|
||||||
* python3-tk
|
|
||||||
* python3-ttkthemes
|
|
||||||
* python3-gi
|
|
||||||
|
|
||||||
Perl is no longer needed since none of the utilities shipped to end users depend
|
Perl is no longer needed since none of the utilities shipped to end users depend
|
||||||
on it anymore.
|
on it anymore.
|
||||||
|
@@ -48,10 +48,10 @@ endif
|
|||||||
# Internationalization support. Define a package and a LOCALEDIR
|
# Internationalization support. Define a package and a LOCALEDIR
|
||||||
EXTRA_CFLAGS+=-DPACKAGE=\"${NAME}\" -DLOCALEDIR=\"${LOCALEDIR}\"
|
EXTRA_CFLAGS+=-DPACKAGE=\"${NAME}\" -DLOCALEDIR=\"${LOCALEDIR}\"
|
||||||
|
|
||||||
SRCS = aa_enabled.c aa_load.c
|
SRCS = aa_enabled.c
|
||||||
HDRS =
|
HDRS =
|
||||||
BINTOOLS = aa-enabled aa-exec aa-features-abi
|
BINTOOLS = aa-enabled aa-exec aa-features-abi
|
||||||
SBINTOOLS = aa-status aa-load
|
SBINTOOLS = aa-status
|
||||||
|
|
||||||
AALIB = -Wl,-Bstatic -lapparmor -Wl,-Bdynamic -lpthread
|
AALIB = -Wl,-Bstatic -lapparmor -Wl,-Bdynamic -lpthread
|
||||||
|
|
||||||
@@ -126,9 +126,6 @@ endif
|
|||||||
aa-features-abi: aa_features_abi.c $(LIBAPPARMOR_A)
|
aa-features-abi: aa_features_abi.c $(LIBAPPARMOR_A)
|
||||||
$(CC) $(LDFLAGS) $(EXTRA_CFLAGS) -o $@ $< $(LIBS) $(AALIB)
|
$(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)
|
aa-enabled: aa_enabled.c $(LIBAPPARMOR_A)
|
||||||
$(CC) $(LDFLAGS) $(EXTRA_CFLAGS) -o $@ $< $(LIBS) $(AALIB)
|
$(CC) $(LDFLAGS) $(EXTRA_CFLAGS) -o $@ $< $(LIBS) $(AALIB)
|
||||||
|
|
||||||
|
@@ -72,18 +72,11 @@ displays the number of loaded non-enforcing AppArmor policies.
|
|||||||
|
|
||||||
=item --kill
|
=item --kill
|
||||||
|
|
||||||
displays the number of loaded enforcing AppArmor policies that will
|
displays the number of loaded enforcing AppArmor policies that will kill tasks on policy violations.
|
||||||
kill tasks on policy violations.
|
|
||||||
|
|
||||||
=item --prompt
|
|
||||||
|
|
||||||
displays the number of loaded enforcing AppArmor policies, with
|
|
||||||
fallback to userspace mediation.
|
|
||||||
|
|
||||||
=item --special-unconfined
|
=item --special-unconfined
|
||||||
|
|
||||||
displays the number of loaded non-enforcing AppArmor policies that are
|
displays the number of loaded non-enforcing AppArmor policies that are in the special unconfined mode.
|
||||||
in the special unconfined mode.
|
|
||||||
|
|
||||||
=item --process-mixed
|
=item --process-mixed
|
||||||
displays the number of processes confined by profile stacks with
|
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
|
same as --json, formatted to be readable by humans as well
|
||||||
as by machines.
|
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
|
=item --help
|
||||||
|
|
||||||
displays a short usage statement.
|
displays a short usage statement.
|
||||||
@@ -165,8 +124,7 @@ if apparmor is enabled but no policy is loaded.
|
|||||||
|
|
||||||
=item B<3>
|
=item B<3>
|
||||||
|
|
||||||
if the apparmor control files aren't available under
|
if the apparmor control files aren't available under /sys/kernel/security/.
|
||||||
/sys/kernel/security/.
|
|
||||||
|
|
||||||
=item B<4>
|
=item B<4>
|
||||||
|
|
||||||
@@ -182,9 +140,8 @@ if an internal error occurred.
|
|||||||
=head1 BUGS
|
=head1 BUGS
|
||||||
|
|
||||||
B<aa-status> must be run as root to read the state of the loaded
|
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
|
policy from the apparmor module. It uses the /proc filesystem to determine
|
||||||
determine which processes are confined and so is susceptible to race
|
which processes are confined and so is susceptible to race conditions.
|
||||||
conditions.
|
|
||||||
|
|
||||||
If you find any additional bugs, please report them at
|
If you find any additional bugs, please report them at
|
||||||
L<https://gitlab.com/apparmor/apparmor/-/issues>.
|
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
@@ -1,66 +0,0 @@
|
|||||||
# Copyright (C) 2015 Canonical Ltd
|
|
||||||
# This file is distributed under the same license as the AppArmor package.
|
|
||||||
# John Johansen <john.johansen@canonical.com>, 2015.
|
|
||||||
#
|
|
||||||
#, fuzzy
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
|
||||||
"Report-Msgid-Bugs-To: apparmor@lists.ubuntu.com\n"
|
|
||||||
"POT-Creation-Date: 2015-11-28 10:23-0800\n"
|
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
||||||
"Language: \n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=CHARSET\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
|
|
||||||
#: ../aa_enabled.c:26
|
|
||||||
#, c-format
|
|
||||||
msgid ""
|
|
||||||
"%s: [options]\n"
|
|
||||||
" options:\n"
|
|
||||||
" -q | --quiet Don't print out any messages\n"
|
|
||||||
" -h | --help Print help\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../aa_enabled.c:45
|
|
||||||
#, c-format
|
|
||||||
msgid "unknown or incompatible options\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../aa_enabled.c:55
|
|
||||||
#, c-format
|
|
||||||
msgid "unknown option '%s'\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../aa_enabled.c:64
|
|
||||||
#, c-format
|
|
||||||
msgid "Yes\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../aa_enabled.c:71
|
|
||||||
#, c-format
|
|
||||||
msgid "No - not available on this system.\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../aa_enabled.c:74
|
|
||||||
#, c-format
|
|
||||||
msgid "No - disabled at boot.\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../aa_enabled.c:77
|
|
||||||
#, c-format
|
|
||||||
msgid "Maybe - policy interface not available.\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../aa_enabled.c:81
|
|
||||||
#, c-format
|
|
||||||
msgid "Maybe - insufficient permissions to determine availability.\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: ../aa_enabled.c:84
|
|
||||||
#, c-format
|
|
||||||
msgid "Error - '%s'\n"
|
|
||||||
msgstr ""
|
|
@@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: apparmor@lists.ubuntu.com\n"
|
"Report-Msgid-Bugs-To: apparmor@lists.ubuntu.com\n"
|
||||||
"POT-Creation-Date: 2020-10-14 03:52-0700\n"
|
"POT-Creation-Date: 2020-10-14 03:58-0700\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@@ -22,7 +22,7 @@ msgstr ""
|
|||||||
msgid ""
|
msgid ""
|
||||||
"%s: [options]\n"
|
"%s: [options]\n"
|
||||||
" options:\n"
|
" options:\n"
|
||||||
" -x | --exclusive Shared interfaces must be available\n"
|
" -x | --exclusive Shared interfaces must be availabe\n"
|
||||||
" -q | --quiet Don't print out any messages\n"
|
" -q | --quiet Don't print out any messages\n"
|
||||||
" -h | --help Print help\n"
|
" -h | --help Print help\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: apparmor@lists.ubuntu.com\n"
|
"Report-Msgid-Bugs-To: apparmor@lists.ubuntu.com\n"
|
||||||
"POT-Creation-Date: 2020-10-14 03:52-0700\n"
|
"POT-Creation-Date: 2020-10-14 03:58-0700\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: apparmor@lists.ubuntu.com\n"
|
"Report-Msgid-Bugs-To: apparmor@lists.ubuntu.com\n"
|
||||||
"POT-Creation-Date: 2020-10-14 03:52-0700\n"
|
"POT-Creation-Date: 2020-10-14 03:58-0700\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@@ -412,7 +412,7 @@ register_hooks(unused_ apr_pool_t *p)
|
|||||||
|
|
||||||
module AP_MODULE_DECLARE_DATA apparmor_module = {
|
module AP_MODULE_DECLARE_DATA apparmor_module = {
|
||||||
STANDARD20_MODULE_STUFF,
|
STANDARD20_MODULE_STUFF,
|
||||||
aa_create_dir_config, /* dir config creator */
|
aa_create_dir_config, /* dir config creater */
|
||||||
NULL, /* dir merger --- default is to override */
|
NULL, /* dir merger --- default is to override */
|
||||||
/* immunix_merge_dir_config, */ /* dir merger --- default is to override */
|
/* immunix_merge_dir_config, */ /* dir merger --- default is to override */
|
||||||
aa_create_srv_config, /* server config */
|
aa_create_srv_config, /* server config */
|
||||||
|
@@ -67,10 +67,10 @@ to syslog.
|
|||||||
References
|
References
|
||||||
----------
|
----------
|
||||||
Project webpage:
|
Project webpage:
|
||||||
https://apparmor.net/
|
http://developer.novell.com/wiki/index.php/Novell_AppArmor
|
||||||
|
|
||||||
To provide feedback or ask questions please contact the
|
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.
|
for the AppArmor team.
|
||||||
|
|
||||||
See also: change_hat(3), and the Linux-PAM online documentation at
|
See also: change_hat(3), and the Linux-PAM online documentation at
|
||||||
|
@@ -66,8 +66,8 @@ under src/jni_src.
|
|||||||
cp dist/libJNIChangeHat.so /usr/lib
|
cp dist/libJNIChangeHat.so /usr/lib
|
||||||
|
|
||||||
[Note: you must ensure that the target directory is passed to tomcat via the
|
[Note: you must ensure that the target directory is passed to tomcat via the
|
||||||
java.library.path property. This can be accomplished by setting the JAVA_OPTS
|
java.library.path propert. This can be accomplished by setting the JAVA_OPTS
|
||||||
environment variable, export JAVA_OPTS=-Djava.library.path, or set via the
|
enviroment variable, export JAVA_OPTS=-Djava.library.path, or set via the
|
||||||
env variable LD_LIBRARY_PATH to include this directory so that tomcat can
|
env variable LD_LIBRARY_PATH to include this directory so that tomcat can
|
||||||
find this library at startup]
|
find this library at startup]
|
||||||
|
|
||||||
@@ -108,13 +108,13 @@ under src/jni_src.
|
|||||||
Once the installation steps above have been started you are ready to begin
|
Once the installation steps above have been started you are ready to begin
|
||||||
creating a profile for your application. The profile creation tool genprof will
|
creating a profile for your application. The profile creation tool genprof will
|
||||||
guide you through generating a profile and its support for change_hat will
|
guide you through generating a profile and its support for change_hat will
|
||||||
prompt you create discrete hats as requested by the changeHatValve during
|
prompt you create discrete hats as requested byt the changeHatValve during
|
||||||
tomcat execution.
|
tomcat execution.
|
||||||
|
|
||||||
1. Create a basic profile for the tomcat server.
|
1. Create a basic profile for the tomcat server.
|
||||||
|
|
||||||
- Run the command "genprof PATH_TO_CATALINA.SH"
|
- Run the command "genprof PATH_TO_CATALINA.SH"
|
||||||
- In a separate window start tomcat and then stop tomcat
|
- In a seperate window start tomcat and then stop tomcat
|
||||||
- In the genprof window press "S" to scan for events
|
- In the genprof window press "S" to scan for events
|
||||||
- Answer the questions about the initial profile for tomcat
|
- Answer the questions about the initial profile for tomcat
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ tomcat execution.
|
|||||||
- Stop the tomcat server
|
- Stop the tomcat server
|
||||||
- Deploy your WAR file or equivalent files under the container.
|
- Deploy your WAR file or equivalent files under the container.
|
||||||
- execute "genprof PATH_TO_CATALINA.SH"
|
- execute "genprof PATH_TO_CATALINA.SH"
|
||||||
- In a separate window start tomcat and then exercise your web application
|
- In a seperate window start tomcat and then exercise your web application
|
||||||
- In the genprof window press "S" to scan for events
|
- In the genprof window press "S" to scan for events
|
||||||
During the prompting you will be asked questions similar to:
|
During the prompting you will be asked questions similar to:
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ all subsequent resource requests will be mediated in this hew hat (or security
|
|||||||
context).
|
context).
|
||||||
If you choose to use the default hat: genprof will mediate all resource
|
If you choose to use the default hat: genprof will mediate all resource
|
||||||
requests in the default hat for the duration of processing this request.
|
requests in the default hat for the duration of processing this request.
|
||||||
When the request processing is complete the valve will change_hat back to the
|
When the request processng is complete the valve will change_hat back to the
|
||||||
parent context.
|
parent context.
|
||||||
|
|
||||||
|
|
||||||
@@ -188,9 +188,10 @@ parent context.
|
|||||||
8. Feedback/Resources
|
8. Feedback/Resources
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Project webpage:
|
|
||||||
https://apparmor.net/
|
|
||||||
|
|
||||||
To provide feedback or ask questions please contact the
|
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
|
||||||
for the AppArmor team.
|
AppArmor team.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -66,8 +66,8 @@ under src/jni_src.
|
|||||||
cp dist/libJNIChangeHat.so /usr/lib
|
cp dist/libJNIChangeHat.so /usr/lib
|
||||||
|
|
||||||
[Note: you must ensure that the target directory is passed to tomcat via the
|
[Note: you must ensure that the target directory is passed to tomcat via the
|
||||||
java.library.path property. This can be accomplished by setting the JAVA_OPTS
|
java.library.path propert. This can be accomplished by setting the JAVA_OPTS
|
||||||
environment variable, export JAVA_OPTS=-Djava.library.path, or set via the
|
enviroment variable, export JAVA_OPTS=-Djava.library.path, or set via the
|
||||||
env variable LD_LIBRARY_PATH to include this directory so that tomcat can
|
env variable LD_LIBRARY_PATH to include this directory so that tomcat can
|
||||||
find this library at startup]
|
find this library at startup]
|
||||||
|
|
||||||
@@ -108,13 +108,13 @@ under src/jni_src.
|
|||||||
Once the installation steps above have been started you are ready to begin
|
Once the installation steps above have been started you are ready to begin
|
||||||
creating a profile for your application. The profile creation tool genprof will
|
creating a profile for your application. The profile creation tool genprof will
|
||||||
guide you through generating a profile and its support for change_hat will
|
guide you through generating a profile and its support for change_hat will
|
||||||
prompt you create discrete hats as requested by the changeHatValve during
|
prompt you create discrete hats as requested byt the changeHatValve during
|
||||||
tomcat execution.
|
tomcat execution.
|
||||||
|
|
||||||
1. Create a basic profile for the tomcat server.
|
1. Create a basic profile for the tomcat server.
|
||||||
|
|
||||||
- Run the command "genprof PATH_TO_CATALINA.SH"
|
- Run the command "genprof PATH_TO_CATALINA.SH"
|
||||||
- In a separate window start tomcat and then stop tomcat
|
- In a seperate window start tomcat and then stop tomcat
|
||||||
- In the genprof window press "S" to scan for events
|
- In the genprof window press "S" to scan for events
|
||||||
- Answer the questions about the initial profile for tomcat
|
- Answer the questions about the initial profile for tomcat
|
||||||
|
|
||||||
@@ -124,7 +124,7 @@ tomcat execution.
|
|||||||
- Stop the tomcat server
|
- Stop the tomcat server
|
||||||
- Deploy your WAR file or equivalent files under the container.
|
- Deploy your WAR file or equivalent files under the container.
|
||||||
- execute "genprof PATH_TO_CATALINA.SH"
|
- execute "genprof PATH_TO_CATALINA.SH"
|
||||||
- In a separate window start tomcat and then exercise your web application
|
- In a seperate window start tomcat and then exercise your web application
|
||||||
- In the genprof window press "S" to scan for events
|
- In the genprof window press "S" to scan for events
|
||||||
During the prompting you will be asked questions similar to:
|
During the prompting you will be asked questions similar to:
|
||||||
|
|
||||||
@@ -180,7 +180,7 @@ all subsequent resource requests will be mediated in this hew hat (or security
|
|||||||
context).
|
context).
|
||||||
If you choose to use the default hat: genprof will mediate all resource
|
If you choose to use the default hat: genprof will mediate all resource
|
||||||
requests in the default hat for the duration of processing this request.
|
requests in the default hat for the duration of processing this request.
|
||||||
When the request processing is complete the valve will change_hat back to the
|
When the request processng is complete the valve will change_hat back to the
|
||||||
parent context.
|
parent context.
|
||||||
|
|
||||||
|
|
||||||
@@ -188,9 +188,10 @@ parent context.
|
|||||||
8. Feedback/Resources
|
8. Feedback/Resources
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
Project webpage:
|
|
||||||
https://apparmor.net/
|
|
||||||
|
|
||||||
To provide feedback or ask questions please contact the
|
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
|
||||||
for the AppArmor team.
|
AppArmor team.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -42,7 +42,6 @@ endif
|
|||||||
|
|
||||||
define nl
|
define nl
|
||||||
|
|
||||||
|
|
||||||
endef
|
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
|
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~beta2
|
3.0.4
|
||||||
|
@@ -6,7 +6,7 @@
|
|||||||
# the source tree
|
# the source tree
|
||||||
# =====================
|
# =====================
|
||||||
|
|
||||||
# It doesn't make sense for AppArmor to mediate PF_UNIX, filter it out. Search
|
# It doesn't make sence for AppArmor to mediate PF_UNIX, filter it out. Search
|
||||||
# for "PF_" constants since that is what is required in bits/socket.h, but
|
# for "PF_" constants since that is what is required in bits/socket.h, but
|
||||||
# rewrite as "AF_".
|
# rewrite as "AF_".
|
||||||
|
|
||||||
|
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])
|
AC_MSG_ERROR([C99 mode is required to build libapparmor])
|
||||||
fi
|
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(
|
AC_OUTPUT(
|
||||||
Makefile
|
Makefile
|
||||||
doc/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.
|
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
|
=back
|
||||||
|
|
||||||
=head1 NOTES
|
=head1 NOTES
|
||||||
|
@@ -125,7 +125,7 @@ layer. Binary policy cache files will be located in the directory
|
|||||||
returned by this function.
|
returned by this function.
|
||||||
|
|
||||||
The aa_policy_cache_dir_levels() function provides access to the number
|
The aa_policy_cache_dir_levels() function provides access to the number
|
||||||
of directories that are being overlaid to create the policy cache.
|
of directories that are being overlayed to create the policy cache.
|
||||||
|
|
||||||
|
|
||||||
=head1 RETURN VALUE
|
=head1 RETURN VALUE
|
||||||
|
@@ -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
|
aa_stack_profile("profile_a"), the equivalent of this shell command can be
|
||||||
used:
|
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
|
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:
|
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
|
These raw AppArmor filesystem operations must only be used when using
|
||||||
libapparmor is not a viable option.
|
libapparmor is not a viable option.
|
||||||
@@ -184,7 +184,6 @@ with apparmor_parser(8):
|
|||||||
/etc/passwd r,
|
/etc/passwd r,
|
||||||
|
|
||||||
# Needed for aa_stack_profile()
|
# Needed for aa_stack_profile()
|
||||||
change-profile -> &i_cant_be_trusted_anymore,
|
|
||||||
/usr/lib/libapparmor*.so* mr,
|
/usr/lib/libapparmor*.so* mr,
|
||||||
/proc/[0-9]*/attr/current w,
|
/proc/[0-9]*/attr/current w,
|
||||||
}
|
}
|
||||||
|
@@ -148,7 +148,6 @@ typedef struct
|
|||||||
unsigned long net_local_port;
|
unsigned long net_local_port;
|
||||||
char *net_foreign_addr;
|
char *net_foreign_addr;
|
||||||
unsigned long net_foreign_port;
|
unsigned long net_foreign_port;
|
||||||
|
|
||||||
char *dbus_bus;
|
char *dbus_bus;
|
||||||
char *dbus_path;
|
char *dbus_path;
|
||||||
char *dbus_interface;
|
char *dbus_interface;
|
||||||
@@ -160,12 +159,6 @@ typedef struct
|
|||||||
char *fs_type;
|
char *fs_type;
|
||||||
char *flags;
|
char *flags;
|
||||||
char *src_name;
|
char *src_name;
|
||||||
|
|
||||||
char *class;
|
|
||||||
|
|
||||||
char *net_addr;
|
|
||||||
char *peer_addr;
|
|
||||||
char *execpath;
|
|
||||||
} aa_log_record;
|
} aa_log_record;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -157,8 +157,6 @@ extern int aa_features_write_to_file(aa_features *features,
|
|||||||
int dirfd, const char *path);
|
int dirfd, const char *path);
|
||||||
extern bool aa_features_is_equal(aa_features *features1,
|
extern bool aa_features_is_equal(aa_features *features1,
|
||||||
aa_features *features2);
|
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 bool aa_features_supports(aa_features *features, const char *str);
|
||||||
extern char *aa_features_id(aa_features *features);
|
extern char *aa_features_id(aa_features *features);
|
||||||
extern char *aa_features_value(aa_features *features, const char *str, size_t *len);
|
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,
|
extern char *aa_policy_cache_dir_path_preview(aa_features *kernel_features,
|
||||||
int dirfd, const char *path);
|
int dirfd, const char *path);
|
||||||
|
|
||||||
extern int aa_split_overlay_str(char *str, char ***vec, size_t max_size, bool immutable);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -11,13 +11,9 @@ INCLUDES = $(all_includes)
|
|||||||
# 3. If any interfaces have been added, removed, or changed since the last
|
# 3. If any interfaces have been added, removed, or changed since the last
|
||||||
# update,
|
# update,
|
||||||
# - increment AA_LIB_CURRENT
|
# - increment AA_LIB_CURRENT
|
||||||
# - by 1 if bugfix release
|
|
||||||
# - by 5 on larger releases. This gives room to fix library interface
|
|
||||||
# problems in the unlikely event where an interface has to break.
|
|
||||||
# - set AA_LIB_REVISION to 0.
|
# - set AA_LIB_REVISION to 0.
|
||||||
# 4. If any interfaces have been added since the last public release, then
|
# 4. If any interfaces have been added since the last public release, then
|
||||||
# - increment AA_LIB_AGE by the same amount that AA_LIB_CURRENT was
|
# - increment AA_LIB_AGE.
|
||||||
# incremented.
|
|
||||||
# 5. If any interfaces have been removed or changed since the last public
|
# 5. If any interfaces have been removed or changed since the last public
|
||||||
# release, then
|
# release, then
|
||||||
# - set AA_LIB_AGE to 0.
|
# - set AA_LIB_AGE to 0.
|
||||||
@@ -30,12 +26,9 @@ INCLUDES = $(all_includes)
|
|||||||
# For more information, see:
|
# For more information, see:
|
||||||
# http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
|
# http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
|
||||||
#
|
#
|
||||||
# After changing the AA_LIB_* variables, also update EXPECTED_SO_NAME.
|
AA_LIB_CURRENT = 9
|
||||||
|
AA_LIB_REVISION = 2
|
||||||
AA_LIB_CURRENT = 20
|
AA_LIB_AGE = 8
|
||||||
AA_LIB_REVISION = 0
|
|
||||||
AA_LIB_AGE = 19
|
|
||||||
EXPECTED_SO_NAME = libapparmor.so.1.19.0
|
|
||||||
|
|
||||||
SUFFIXES = .pc.in .pc
|
SUFFIXES = .pc.in .pc
|
||||||
|
|
||||||
@@ -45,6 +38,7 @@ include $(COMMONDIR)/Make.rules
|
|||||||
BUILT_SOURCES = grammar.h scanner.h af_protos.h
|
BUILT_SOURCES = grammar.h scanner.h af_protos.h
|
||||||
AM_LFLAGS = -v
|
AM_LFLAGS = -v
|
||||||
AM_YFLAGS = -d -p aalogparse_
|
AM_YFLAGS = -d -p aalogparse_
|
||||||
|
AM_CFLAGS = -Wall $(EXTRA_WARNINGS) -fPIC -flto-partition=none
|
||||||
AM_CPPFLAGS = -D_GNU_SOURCE -I$(top_srcdir)/include/
|
AM_CPPFLAGS = -D_GNU_SOURCE -I$(top_srcdir)/include/
|
||||||
scanner.h: scanner.l
|
scanner.h: scanner.l
|
||||||
$(LEX) -v $<
|
$(LEX) -v $<
|
||||||
@@ -52,13 +46,13 @@ scanner.h: scanner.l
|
|||||||
scanner.c: scanner.l
|
scanner.c: scanner.l
|
||||||
|
|
||||||
af_protos.h:
|
af_protos.h:
|
||||||
echo '#include <netinet/in.h>' | $(CC) $(CPPFLAGS) -E -dD - | LC_ALL=C sed -n -e "/IPPROTO_MAX/d" -e "s/^\#define[ \\t]\\+IPPROTO_\\([A-Z0-9_]\\+\\)\\(.*\\)$$/AA_GEN_PROTO_ENT(\\UIPPROTO_\\1, \"\\L\\1\")/p" > $@
|
echo '#include <netinet/in.h>' | $(CC) $(CPPFLAGS) -E -dM - | LC_ALL=C sed -n -e "/IPPROTO_MAX/d" -e "s/^\#define[ \\t]\\+IPPROTO_\\([A-Z0-9_]\\+\\)\\(.*\\)$$/AA_GEN_PROTO_ENT(\\UIPPROTO_\\1, \"\\L\\1\")/p" > $@
|
||||||
|
|
||||||
lib_LTLIBRARIES = libapparmor.la
|
lib_LTLIBRARIES = libapparmor.la
|
||||||
noinst_HEADERS = grammar.h parser.h scanner.h af_protos.h private.h PMurHash.h
|
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_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
|
-Wl,--version-script=$(top_srcdir)/src/libapparmor.map
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
@@ -83,8 +77,4 @@ 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
|
||||||
|
@@ -35,7 +35,6 @@
|
|||||||
#include "PMurHash.h"
|
#include "PMurHash.h"
|
||||||
|
|
||||||
#define FEATURES_FILE "/sys/kernel/security/apparmor/features"
|
#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 HASH_SIZE (8 + 1) /* 32 bits binary to hex + NUL terminator */
|
||||||
#define STRING_SIZE 8192
|
#define STRING_SIZE 8192
|
||||||
@@ -195,8 +194,6 @@ 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;
|
||||||
@@ -659,44 +656,6 @@ bool aa_features_is_equal(aa_features *features1, aa_features *features2)
|
|||||||
strcmp(features1->string, features2->string) == 0;
|
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)
|
static const char *features_lookup(aa_features *features, const char *str)
|
||||||
{
|
{
|
||||||
const char *features_string = features->string;
|
const char *features_string = features->string;
|
||||||
@@ -705,7 +664,7 @@ static const char *features_lookup(aa_features *features, const char *str)
|
|||||||
|
|
||||||
/* Empty strings are not accepted. Neither are leading '/' chars. */
|
/* Empty strings are not accepted. Neither are leading '/' chars. */
|
||||||
if (!str || str[0] == '/')
|
if (!str || str[0] == '/')
|
||||||
return NULL;
|
return false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Break @str into an array of components. For example,
|
* Break @str into an array of components. For example,
|
||||||
@@ -718,7 +677,7 @@ static const char *features_lookup(aa_features *features, const char *str)
|
|||||||
|
|
||||||
/* At least one valid token is required */
|
/* At least one valid token is required */
|
||||||
if (!num_components)
|
if (!num_components)
|
||||||
return NULL;
|
return false;
|
||||||
|
|
||||||
/* Ensure that all components are valid and found */
|
/* Ensure that all components are valid and found */
|
||||||
for (i = 0; i < num_components; i++) {
|
for (i = 0; i < num_components; i++) {
|
||||||
|
@@ -114,7 +114,6 @@ aa_record_event_type lookup_aa_event(unsigned int type)
|
|||||||
%token TOK_PERIOD
|
%token TOK_PERIOD
|
||||||
%token TOK_QUESTION_MARK
|
%token TOK_QUESTION_MARK
|
||||||
%token TOK_SINGLE_QUOTE
|
%token TOK_SINGLE_QUOTE
|
||||||
%token TOK_NONE
|
|
||||||
|
|
||||||
%token TOK_TYPE_REJECT
|
%token TOK_TYPE_REJECT
|
||||||
%token TOK_TYPE_AUDIT
|
%token TOK_TYPE_AUDIT
|
||||||
@@ -160,9 +159,7 @@ 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
|
||||||
@@ -188,9 +185,6 @@ 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_UNIX_PEER_ADDR
|
|
||||||
%token TOK_KEY_EXECPATH
|
|
||||||
%token TOK_KEY_CLASS
|
|
||||||
|
|
||||||
%token TOK_SOCKLOGD_KERNEL
|
%token TOK_SOCKLOGD_KERNEL
|
||||||
%token TOK_SYSLOG_KERNEL
|
%token TOK_SYSLOG_KERNEL
|
||||||
@@ -252,7 +246,7 @@ syslog_type:
|
|||||||
{ ret_record->version = AA_RECORD_SYNTAX_V2; free($3); }
|
{ ret_record->version = AA_RECORD_SYNTAX_V2; free($3); }
|
||||||
| syslog_date syslog_id TOK_DMESG_STAMP key_type audit_id key_list
|
| syslog_date syslog_id TOK_DMESG_STAMP key_type audit_id key_list
|
||||||
{ ret_record->version = AA_RECORD_SYNTAX_V2; free($3); }
|
{ 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
|
| 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); }
|
{ 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
|
| syslog_date syslog_id TOK_DMESG_STAMP TOK_AUDIT TOK_COLON key_type audit_id audit_user_msg_tail
|
||||||
@@ -357,23 +351,15 @@ 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_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
|
|
||||||
{ 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
|
||||||
{ free($3); /* Ignore - hostname from user AVC messages */ }
|
{ free($3); /* Ignore - hostname from user AVC messages */ }
|
||||||
| TOK_KEY_HOSTNAME TOK_EQUALS TOK_QUESTION_MARK
|
| 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_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
|
| TOK_KEY_TERMINAL TOK_EQUALS safe_string
|
||||||
{ free($3); /* Ignore - TTY from user AVC messages */ }
|
{ free($3); /* Ignore - TTY from user AVC messages */ }
|
||||||
| TOK_KEY_EXE TOK_EQUALS safe_string
|
| TOK_KEY_EXE TOK_EQUALS safe_string
|
||||||
@@ -392,7 +378,7 @@ key: TOK_KEY_OPERATION TOK_EQUALS TOK_QUOTED_STRING
|
|||||||
| TOK_KEY_CAPABILITY TOK_EQUALS TOK_DIGITS
|
| TOK_KEY_CAPABILITY TOK_EQUALS TOK_DIGITS
|
||||||
{ /* need to reverse map number to string, need to figure out
|
{ /* need to reverse map number to string, need to figure out
|
||||||
* how to get auto generation of reverse mapping table into
|
* how to get auto generation of reverse mapping table into
|
||||||
* autotools Makefile. For now just drop assuming capname is
|
* autotools Makefile. For now just drop assumming capname is
|
||||||
* present which it should be with current kernels */
|
* present which it should be with current kernels */
|
||||||
}
|
}
|
||||||
| TOK_KEY_CAPNAME TOK_EQUALS TOK_QUOTED_STRING
|
| TOK_KEY_CAPNAME TOK_EQUALS TOK_QUOTED_STRING
|
||||||
@@ -400,7 +386,7 @@ key: TOK_KEY_OPERATION TOK_EQUALS TOK_QUOTED_STRING
|
|||||||
ret_record->name = $3;
|
ret_record->name = $3;
|
||||||
}
|
}
|
||||||
| TOK_KEY_OFFSET TOK_EQUALS TOK_DIGITS
|
| TOK_KEY_OFFSET TOK_EQUALS TOK_DIGITS
|
||||||
{ /* offset is used for reporting where an error occurred unpacking
|
{ /* offset is used for reporting where an error occured unpacking
|
||||||
* loaded policy. We can just drop this currently
|
* loaded policy. We can just drop this currently
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@@ -426,21 +412,19 @@ key: TOK_KEY_OPERATION TOK_EQUALS TOK_QUOTED_STRING
|
|||||||
{ ret_record->dbus_member = $3; }
|
{ ret_record->dbus_member = $3; }
|
||||||
| TOK_KEY_SIGNAL TOK_EQUALS TOK_ID
|
| TOK_KEY_SIGNAL TOK_EQUALS TOK_ID
|
||||||
{ ret_record->signal = $3; }
|
{ ret_record->signal = $3; }
|
||||||
|
|
||||||
| TOK_KEY_FSTYPE TOK_EQUALS TOK_QUOTED_STRING
|
| TOK_KEY_FSTYPE TOK_EQUALS TOK_QUOTED_STRING
|
||||||
{ ret_record->fs_type = $3; }
|
{ ret_record->fs_type = $3; }
|
||||||
| TOK_KEY_FLAGS TOK_EQUALS TOK_QUOTED_STRING
|
| TOK_KEY_FLAGS TOK_EQUALS TOK_QUOTED_STRING
|
||||||
{ ret_record->flags = $3; }
|
{ ret_record->flags = $3; }
|
||||||
| TOK_KEY_SRCNAME TOK_EQUALS TOK_QUOTED_STRING
|
| TOK_KEY_SRCNAME TOK_EQUALS TOK_QUOTED_STRING
|
||||||
{ ret_record->src_name = $3; }
|
{ ret_record->src_name = $3; }
|
||||||
| TOK_KEY_EXECPATH TOK_EQUALS TOK_QUOTED_STRING
|
|
||||||
{ ret_record->execpath = $3; }
|
|
||||||
| TOK_MSG_REST
|
| TOK_MSG_REST
|
||||||
{
|
{
|
||||||
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:
|
||||||
|
@@ -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)
|
static int procattr_open(pid_t tid, const char *attr, int flags)
|
||||||
{
|
{
|
||||||
autofree char *tmp = NULL;
|
char *tmp;
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
tmp = procattr_path(tid, attr);
|
tmp = procattr_path(tid, attr);
|
||||||
@@ -471,7 +471,7 @@ static int procattr_open(pid_t tid, const char *attr, int flags)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
fd = open(tmp, flags);
|
fd = open(tmp, flags);
|
||||||
|
free(tmp);
|
||||||
/* Test is we can fallback to the old interface (this is ugly).
|
/* Test is we can fallback to the old interface (this is ugly).
|
||||||
* If we haven't tried the old interface already
|
* If we haven't tried the old interface already
|
||||||
* proc_attr_base == proc_attr_base_old - no fallback
|
* 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
|
* old interface where is_enabled() is only successful if
|
||||||
* the old interface is available to apparmor.
|
* 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) {
|
if (fd == -1 && tmp != proc_attr_base_old && param_check_enabled() != 0) {
|
||||||
free(tmp);
|
if (asprintf(&tmp, proc_attr_base_old, tid, attr) < 0)
|
||||||
if (asprintf(&tmp, proc_attr_base_old, tid, attr) < 0) {
|
|
||||||
/* tmp is undefined, make sure it is null for autofree*/
|
|
||||||
tmp = NULL;
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
|
||||||
fd = open(tmp, flags);
|
fd = open(tmp, flags);
|
||||||
|
free(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return fd;
|
return fd;
|
||||||
@@ -1322,9 +1319,9 @@ int aa_query_link_path_len(const char *label, size_t label_len,
|
|||||||
query[pos] = 0;
|
query[pos] = 0;
|
||||||
query[++pos] = AA_CLASS_FILE;
|
query[++pos] = AA_CLASS_FILE;
|
||||||
memcpy(query + pos + 1, link, link_len);
|
memcpy(query + pos + 1, link, link_len);
|
||||||
/* The kernel does the query in two parts; we could simulate this
|
/* The kernel does the query in two parts we could similate this
|
||||||
* doing the following, however as long as policy is compiled
|
* doing the following, however as long as policy is compiled
|
||||||
* correctly this isn't required, and it requires an extra round
|
* correctly this isn't requied, and it requires and extra round
|
||||||
* trip to the kernel and adds a race on policy replacement between
|
* trip to the kernel and adds a race on policy replacement between
|
||||||
* the two queries.
|
* the two queries.
|
||||||
*
|
*
|
||||||
@@ -1358,121 +1355,3 @@ int aa_query_link_path(const char *label, const char *target, const char *link,
|
|||||||
strlen(target), link, strlen(link),
|
strlen(target), link, strlen(link),
|
||||||
allowed, audited);
|
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;
|
|
||||||
}
|
|
||||||
|
@@ -90,7 +90,7 @@ static int write_buffer(int fd, const char *buffer, int size)
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* write_policy_buffer - load compiled policy into the kernel
|
* write_policy_buffer - load compiled policy into the kernel
|
||||||
* @fd: kernel interface to write to
|
* @fd: kernel iterface to write to
|
||||||
* @atomic: whether to load all policy in buffer atomically (true)
|
* @atomic: whether to load all policy in buffer atomically (true)
|
||||||
* @buffer: buffer of policy to load
|
* @buffer: buffer of policy to load
|
||||||
* @size: the size of the data in the buffer
|
* @size: the size of the data in the buffer
|
||||||
@@ -205,7 +205,7 @@ static int write_policy_file_to_iface(aa_kernel_interface *kernel_interface,
|
|||||||
* @apparmorfs: path to the apparmor directory of the mounted securityfs (can
|
* @apparmorfs: path to the apparmor directory of the mounted securityfs (can
|
||||||
* be NULL and the path will be auto discovered)
|
* be NULL and the path will be auto discovered)
|
||||||
*
|
*
|
||||||
* Returns: 0 on success, -1 on error with errno set and *@kernel_interface
|
* Returns: 0 on success, -1 on error with errnot set and *@kernel_interface
|
||||||
* pointing to NULL
|
* pointing to NULL
|
||||||
*/
|
*/
|
||||||
int aa_kernel_interface_new(aa_kernel_interface **kernel_interface,
|
int aa_kernel_interface_new(aa_kernel_interface **kernel_interface,
|
||||||
|
@@ -103,15 +103,6 @@ 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->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);
|
|
||||||
|
|
||||||
free(record);
|
free(record);
|
||||||
}
|
}
|
||||||
|
@@ -124,14 +124,6 @@ APPARMOR_3.0 {
|
|||||||
*;
|
*;
|
||||||
} APPARMOR_2.13.1;
|
} APPARMOR_2.13.1;
|
||||||
|
|
||||||
APPARMOR_3.1 {
|
|
||||||
global:
|
|
||||||
aa_features_check;
|
|
||||||
aa_split_overlay_str;
|
|
||||||
local:
|
|
||||||
*;
|
|
||||||
} APPARMOR_3.0;
|
|
||||||
|
|
||||||
PRIVATE {
|
PRIVATE {
|
||||||
global:
|
global:
|
||||||
_aa_is_blacklisted;
|
_aa_is_blacklisted;
|
||||||
|
@@ -45,8 +45,6 @@ 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);
|
||||||
@@ -147,6 +145,36 @@ repeat:
|
|||||||
return path;
|
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)
|
static int create_cache(aa_policy_cache *policy_cache, aa_features *features)
|
||||||
{
|
{
|
||||||
if (aa_policy_cache_remove(policy_cache->dirfd[0], "."))
|
if (aa_policy_cache_remove(policy_cache->dirfd[0], "."))
|
||||||
@@ -164,7 +192,7 @@ static int create_cache(aa_policy_cache *policy_cache, aa_features *features)
|
|||||||
static int init_cache_features(aa_policy_cache *policy_cache,
|
static int init_cache_features(aa_policy_cache *policy_cache,
|
||||||
aa_features *kernel_features, bool create)
|
aa_features *kernel_features, bool create)
|
||||||
{
|
{
|
||||||
if (aa_features_check(policy_cache->dirfd[0], ".",
|
if (cache_check_features(policy_cache->dirfd[0], ".",
|
||||||
kernel_features)) {
|
kernel_features)) {
|
||||||
/* EEXIST must come before ENOENT for short circuit eval */
|
/* EEXIST must come before ENOENT for short circuit eval */
|
||||||
if (!create || errno == EEXIST || errno != ENOENT)
|
if (!create || errno == EEXIST || errno != ENOENT)
|
||||||
@@ -201,13 +229,13 @@ static int cache_miss_cb(int dirfd, const struct dirent *ent, void *arg)
|
|||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
return -1;
|
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 */
|
/* found cache dir matching pattern */
|
||||||
data->cache_name = cache_name;
|
data->cache_name = cache_name;
|
||||||
/* return 1 to stop iteration and signal dir found */
|
/* return 1 to stop iteration and signal dir found */
|
||||||
return 1;
|
return 1;
|
||||||
} else if (errno != EEXIST) {
|
} 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);
|
free(cache_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -243,12 +271,12 @@ static int cache_dir_from_path_and_features(char **cache_path,
|
|||||||
if (len == -1)
|
if (len == -1)
|
||||||
return -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);
|
PDEBUG("cache_dir_from_path_and_features() found '%s'\n", cache_dir);
|
||||||
*cache_path = cache_dir;
|
*cache_path = cache_dir;
|
||||||
return 0;
|
return 0;
|
||||||
} else if (errno != EEXIST) {
|
} 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);
|
free(cache_dir);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ struct ignored_suffix_t {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct ignored_suffix_t ignored_suffixes[] = {
|
static struct ignored_suffix_t ignored_suffixes[] = {
|
||||||
/* Debian packaging files, which are in flux during install
|
/* Debian packging files, which are in flux during install
|
||||||
should be silently ignored. */
|
should be silently ignored. */
|
||||||
{ ".dpkg-new", 9, 1 },
|
{ ".dpkg-new", 9, 1 },
|
||||||
{ ".dpkg-old", 9, 1 },
|
{ ".dpkg-old", 9, 1 },
|
||||||
@@ -147,7 +147,7 @@ int _aa_is_blacklisted(const char *name)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* automatically free allocated variables tagged with autofree on fn exit */
|
/* automaticly free allocated variables tagged with autofree on fn exit */
|
||||||
void _aa_autofree(void *p)
|
void _aa_autofree(void *p)
|
||||||
{
|
{
|
||||||
void **_p = (void**)p;
|
void **_p = (void**)p;
|
||||||
@@ -452,8 +452,7 @@ 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. If the file is a symlink
|
* use the openat, fstatat, and related fns.
|
||||||
* _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
|
||||||
*/
|
*/
|
||||||
@@ -486,34 +485,14 @@ 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 (fstatat(cb_dirfd, dir->d_name, &my_stat, AT_SYMLINK_NOFOLLOW)) {
|
if (rc)
|
||||||
|
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\x1d]
|
ws [ \t\r\n]
|
||||||
|
|
||||||
equals "="
|
equals "="
|
||||||
digit [[:digit:]]
|
digit [[:digit:]]
|
||||||
@@ -90,7 +90,6 @@ question_mark "?"
|
|||||||
single_quote "'"
|
single_quote "'"
|
||||||
mode_chars ([RrWwaLlMmkXx])|([Pp][Xx])|([Uu][Xx])|([Ii][Xx])|([Pp][Ii][Xx])
|
mode_chars ([RrWwaLlMmkXx])|([Pp][Xx])|([Uu][Xx])|([Ii][Xx])|([Pp][Ii][Xx])
|
||||||
modes ({mode_chars}+)|({mode_chars}+::{mode_chars}*)|(::{mode_chars}*)
|
modes ({mode_chars}+)|({mode_chars}+::{mode_chars}*)|(::{mode_chars}*)
|
||||||
none "none"
|
|
||||||
/* New message types */
|
/* New message types */
|
||||||
|
|
||||||
aa_reject_type "APPARMOR_DENIED"
|
aa_reject_type "APPARMOR_DENIED"
|
||||||
@@ -122,8 +121,6 @@ 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"
|
||||||
@@ -141,9 +138,7 @@ 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"
|
||||||
@@ -158,28 +153,19 @@ key_capname "capname"
|
|||||||
key_offset "offset"
|
key_offset "offset"
|
||||||
key_target "target"
|
key_target "target"
|
||||||
key_laddr "laddr"
|
key_laddr "laddr"
|
||||||
key_saddr "saddr"
|
|
||||||
key_faddr "faddr"
|
key_faddr "faddr"
|
||||||
key_daddr "daddr"
|
|
||||||
key_lport "lport"
|
key_lport "lport"
|
||||||
key_srcport "src"
|
|
||||||
key_fport "fport"
|
key_fport "fport"
|
||||||
key_destport "dest"
|
|
||||||
key_bus "bus"
|
key_bus "bus"
|
||||||
key_dest "dest"
|
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"
|
|
||||||
key_tcontext "tcontext"
|
|
||||||
key_unix_peer_addr "peer_addr"
|
|
||||||
key_execpath "execpath"
|
|
||||||
audit "audit"
|
audit "audit"
|
||||||
|
|
||||||
/* network addrs */
|
/* network addrs */
|
||||||
@@ -310,8 +296,6 @@ yy_flex_debug = 0;
|
|||||||
{period} { return(TOK_PERIOD); }
|
{period} { return(TOK_PERIOD); }
|
||||||
{question_mark} { return(TOK_QUESTION_MARK); }
|
{question_mark} { return(TOK_QUESTION_MARK); }
|
||||||
{single_quote} { return(TOK_SINGLE_QUOTE); }
|
{single_quote} { return(TOK_SINGLE_QUOTE); }
|
||||||
{none} { return(TOK_NONE); }
|
|
||||||
|
|
||||||
|
|
||||||
{key_apparmor} { BEGIN(audit_types); return(TOK_KEY_APPARMOR); }
|
{key_apparmor} { BEGIN(audit_types); return(TOK_KEY_APPARMOR); }
|
||||||
{key_type} { BEGIN(audit_types); return(TOK_KEY_TYPE); }
|
{key_type} { BEGIN(audit_types); return(TOK_KEY_TYPE); }
|
||||||
@@ -323,8 +307,6 @@ 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); }
|
||||||
@@ -337,21 +319,18 @@ yy_flex_debug = 0;
|
|||||||
{key_peer_profile} { BEGIN(safe_string); return(TOK_KEY_PEER_PROFILE); }
|
{key_peer_profile} { BEGIN(safe_string); return(TOK_KEY_PEER_PROFILE); }
|
||||||
{key_label} { BEGIN(safe_string); return(TOK_KEY_LABEL); }
|
{key_label} { BEGIN(safe_string); return(TOK_KEY_LABEL); }
|
||||||
{key_peer_label} { BEGIN(safe_string); return(TOK_KEY_PEER_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_family} { return(TOK_KEY_FAMILY); }
|
||||||
{key_sock_type} { return(TOK_KEY_SOCK_TYPE); }
|
{key_sock_type} { return(TOK_KEY_SOCK_TYPE); }
|
||||||
{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); }
|
||||||
{key_ses} { return(TOK_KEY_SES); }
|
{key_ses} { return(TOK_KEY_SES); }
|
||||||
{key_hostname} { return(TOK_KEY_HOSTNAME); }
|
{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_terminal} { return(TOK_KEY_TERMINAL); }
|
||||||
{key_exe} { BEGIN(safe_string); return(TOK_KEY_EXE); }
|
{key_exe} { BEGIN(safe_string); return(TOK_KEY_EXE); }
|
||||||
{key_comm} { BEGIN(safe_string); return(TOK_KEY_COMM); }
|
{key_comm} { BEGIN(safe_string); return(TOK_KEY_COMM); }
|
||||||
@@ -360,26 +339,18 @@ yy_flex_debug = 0;
|
|||||||
{key_offset} { return(TOK_KEY_OFFSET); }
|
{key_offset} { return(TOK_KEY_OFFSET); }
|
||||||
{key_target} { return(TOK_KEY_TARGET); }
|
{key_target} { return(TOK_KEY_TARGET); }
|
||||||
{key_laddr} { yy_push_state(ip_addr, yyscanner); return(TOK_KEY_LADDR); }
|
{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_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_lport} { return(TOK_KEY_LPORT); }
|
||||||
{key_srcport} { return(TOK_KEY_LPORT); }
|
|
||||||
{key_fport} { return(TOK_KEY_FPORT); }
|
{key_fport} { return(TOK_KEY_FPORT); }
|
||||||
{key_destport} { return(TOK_KEY_FPORT); }
|
|
||||||
{key_bus} { return(TOK_KEY_BUS); }
|
{key_bus} { return(TOK_KEY_BUS); }
|
||||||
{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_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); }
|
{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); }
|
||||||
|
@@ -135,7 +135,7 @@ static int do_test_walk_one(const char **str, const struct component *component,
|
|||||||
|
|
||||||
static int test_walk_one(void)
|
static int test_walk_one(void)
|
||||||
{
|
{
|
||||||
struct component c = (struct component) { NULL, 0 };
|
struct component c;
|
||||||
const char *str;
|
const char *str;
|
||||||
int rc = 0;
|
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_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_gettaskcon(pid_t target, char **label, char **mode);
|
||||||
extern int aa_getcon(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_getpeercon(int fd, char **label, char **mode);
|
||||||
extern int aa_query_label(uint32_t mask, char *query, size_t size, int *allow,
|
extern int aa_query_label(uint32_t mask, char *query, size_t size, int *allow,
|
||||||
int *audit);
|
int *audit);
|
||||||
|
@@ -14,7 +14,7 @@ MOSTLYCLEANFILES=libapparmor_wrap.c LibAppArmor.py
|
|||||||
|
|
||||||
all-local: libapparmor_wrap.c setup.py
|
all-local: libapparmor_wrap.c setup.py
|
||||||
if test ! -f libapparmor_wrap.c; then cp $(srcdir)/libapparmor_wrap.c . ; fi
|
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:
|
install-exec-local:
|
||||||
$(PYTHON) setup.py install --root="/$(DESTDIR)" --prefix="$(prefix)"
|
$(PYTHON) setup.py install --root="/$(DESTDIR)" --prefix="$(prefix)"
|
||||||
|
@@ -1 +1,6 @@
|
|||||||
|
import sys
|
||||||
|
|
||||||
|
if sys.version_info[0] >= 3:
|
||||||
from LibAppArmor.LibAppArmor import *
|
from LibAppArmor.LibAppArmor import *
|
||||||
|
else:
|
||||||
|
from .LibAppArmor import *
|
||||||
|
@@ -2,7 +2,7 @@ from setuptools import setup, Extension
|
|||||||
import string
|
import string
|
||||||
|
|
||||||
setup(name = 'LibAppArmor',
|
setup(name = 'LibAppArmor',
|
||||||
version = '@VERSION@'.replace('~', '-'),
|
version = '@VERSION@',
|
||||||
author = 'AppArmor Dev Team',
|
author = 'AppArmor Dev Team',
|
||||||
author_email = 'apparmor@lists.ubuntu.com',
|
author_email = 'apparmor@lists.ubuntu.com',
|
||||||
url = 'https://wiki.apparmor.net',
|
url = 'https://wiki.apparmor.net',
|
||||||
|
@@ -10,7 +10,8 @@ test_python.py: test_python.py.in $(top_builddir)/config.status
|
|||||||
|
|
||||||
CLEANFILES = test_python.py
|
CLEANFILES = test_python.py
|
||||||
|
|
||||||
PYTHON_DIST_BUILD_PATH = '$(builddir)/../build/$$($(PYTHON) buildpath.py)'
|
# bah, how brittle is this?
|
||||||
|
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 = \
|
||||||
|
@@ -1,14 +0,0 @@
|
|||||||
#!/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.{}-{}".format(sysconfig.get_platform(), identifier))
|
|
@@ -13,7 +13,6 @@
|
|||||||
import ctypes
|
import ctypes
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import LibAppArmor as libapparmor
|
import LibAppArmor as libapparmor
|
||||||
|
|
||||||
TESTDIR = "../../../testsuite/test_multi"
|
TESTDIR = "../../../testsuite/test_multi"
|
||||||
@@ -35,7 +34,6 @@ 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
|
||||||
@@ -64,8 +62,8 @@ class AAPythonBindingsTests(unittest.TestCase):
|
|||||||
self.maxDiff = None
|
self.maxDiff = None
|
||||||
|
|
||||||
def _runtest(self, testname):
|
def _runtest(self, testname):
|
||||||
infile = testname + ".in"
|
infile = "%s.in" % (testname)
|
||||||
outfile = testname + ".out"
|
outfile = "%s.out" % (testname)
|
||||||
# infile *should* only contain one line
|
# infile *should* only contain one line
|
||||||
with open(os.path.join(TESTDIR, infile), 'r') as f:
|
with open(os.path.join(TESTDIR, infile), 'r') as f:
|
||||||
line = f.read()
|
line = f.read()
|
||||||
@@ -77,11 +75,11 @@ class AAPythonBindingsTests(unittest.TestCase):
|
|||||||
|
|
||||||
expected = self.parse_output_file(outfile)
|
expected = self.parse_output_file(outfile)
|
||||||
self.assertEqual(expected, record,
|
self.assertEqual(expected, record,
|
||||||
"expected records did not match\n"
|
"expected records did not match\n" +
|
||||||
"expected = {}\nactual = {}".format(expected, record))
|
"expected = %s\nactual = %s" % (expected, record))
|
||||||
|
|
||||||
def parse_output_file(self, outfile):
|
def parse_output_file(self, outfile):
|
||||||
"""parse testcase .out file and return dict"""
|
'''parse testcase .out file and return dict'''
|
||||||
|
|
||||||
output = dict()
|
output = dict()
|
||||||
with open(os.path.join(TESTDIR, outfile), 'r') as f:
|
with open(os.path.join(TESTDIR, outfile), 'r') as f:
|
||||||
@@ -93,7 +91,7 @@ class AAPythonBindingsTests(unittest.TestCase):
|
|||||||
count += 1
|
count += 1
|
||||||
if line == "START":
|
if line == "START":
|
||||||
self.assertEqual(count, 1,
|
self.assertEqual(count, 1,
|
||||||
"Unexpected output format in " + outfile)
|
"Unexpected output format in %s" % (outfile))
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
key, value = line.split(": ", 1)
|
key, value = line.split(": ", 1)
|
||||||
@@ -107,10 +105,10 @@ class AAPythonBindingsTests(unittest.TestCase):
|
|||||||
return output
|
return output
|
||||||
|
|
||||||
def create_record_dict(self, record):
|
def create_record_dict(self, record):
|
||||||
"""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]
|
||||||
@@ -130,7 +128,7 @@ class AAPythonBindingsTests(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
def find_testcases(testdir):
|
def find_testcases(testdir):
|
||||||
"""dig testcases out of passed directory"""
|
'''dig testcases out of passed directory'''
|
||||||
|
|
||||||
for f in os.listdir(testdir):
|
for f in os.listdir(testdir):
|
||||||
if f.endswith(".in"):
|
if f.endswith(".in"):
|
||||||
@@ -141,10 +139,9 @@ def main():
|
|||||||
for f in find_testcases(TESTDIR):
|
for f in find_testcases(TESTDIR):
|
||||||
def stub_test(self, testname=f):
|
def stub_test(self, testname=f):
|
||||||
self._runtest(testname)
|
self._runtest(testname)
|
||||||
stub_test.__doc__ = "test " + f
|
stub_test.__doc__ = "test %s" % (f)
|
||||||
setattr(AAPythonBindingsTests, 'test_' + f, stub_test)
|
setattr(AAPythonBindingsTests, 'test_%s' % (f), stub_test)
|
||||||
return unittest.main(verbosity=2)
|
return unittest.main(verbosity=2)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
# Runs all tests with the extension "multi" for several times.
|
# Runs all tests with the extention "multi" for several times.
|
||||||
# Each test program <programname>.multi has its own subdirectory
|
# Each testprogram <programname>.multi has an own subdirectory
|
||||||
# <programmname> in which several testcases are defined for this program
|
# <programmname> in which several testcases are defined for this program
|
||||||
# Each testcase has 3 files:
|
# Each testcase has 3 files:
|
||||||
#
|
#
|
||||||
|
@@ -1,3 +1,5 @@
|
|||||||
|
#define _GNU_SOURCE /* for glibc's basename version */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@@ -5,12 +7,6 @@
|
|||||||
|
|
||||||
#include <aalogparse.h>
|
#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 print_results(aa_log_record *record);
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
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_long("Peer PID", record->peer_pid, 0);
|
||||||
print_string("Active hat", record->active_hat);
|
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("Network family", record->net_family);
|
||||||
print_string("Socket type", record->net_sock_type);
|
print_string("Socket type", record->net_sock_type);
|
||||||
print_string("Protocol", record->net_protocol);
|
print_string("Protocol", record->net_protocol);
|
||||||
@@ -140,10 +134,6 @@ 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("Execpath", record->execpath);
|
|
||||||
|
|
||||||
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);
|
||||||
|
@@ -1 +0,0 @@
|
|||||||
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"
|
|
@@ -1,15 +0,0 @@
|
|||||||
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
|
|
@@ -1,4 +0,0 @@
|
|||||||
/usr/bin/dolphin {
|
|
||||||
/home/otis/.config/kdedefaults/kdeglobals r,
|
|
||||||
|
|
||||||
}
|
|
@@ -1,4 +1,4 @@
|
|||||||
/usr/lib/NetworkManager/nm-dhcp-client.action {
|
/usr/lib/NetworkManager/nm-dhcp-client.action {
|
||||||
network inet6 dgram port=10580,
|
network inet6 dgram,
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
/usr/sbin/apache2 {
|
/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 {
|
/usr/sbin/apache2 {
|
||||||
|
|
||||||
^www.xxxxxxxxxx.co.uk {
|
^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/apache-tomcat-8.0.33/bin/catalina.sh {
|
||||||
|
|
||||||
^/usr/local/jdk1.8.0_92/bin/java {
|
^/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 @@
|
|||||||
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=?'
|
|
@@ -1,15 +0,0 @@
|
|||||||
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
|
|
@@ -1,4 +0,0 @@
|
|||||||
/tmp/apparmor/tests/regression/apparmor/dbus_message {
|
|
||||||
dbus send bus=session path=/org/freedesktop/DBus interface=org.freedesktop.DBus member=Hello peer=(label=unconfined),
|
|
||||||
|
|
||||||
}
|
|
@@ -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 {
|
/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,
|
|
||||||
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user