Commit graph

7242 commits

Author SHA1 Message Date
Jorge Sancho Larraz
7a98040b1b profiles/a/frr: remove owner keyword causing failures 2025-02-05 16:29:29 +01:00
Jorge Sancho Larraz
fa28d65f44 profiles/a/frr-snmp: use abstractions/openssl 2025-02-05 16:27:57 +01:00
Jorge Sancho Larraz
78ea948e4b profiles/abstractions/frr: typo 2025-01-07 11:55:37 +01:00
Jorge Sancho Larraz
045bb7d77e profiles/*frr*: fix includes 2025-01-07 11:39:10 +01:00
Jorge Sancho Larraz
e20400f10f profiles/ospf6d: remove duplicated /etc/services r 2025-01-07 11:36:25 +01:00
Jorge Sancho Larraz
63e3a04e30 profiles/abstractions/frr: add owner to world-writable directories 2025-01-07 11:36:17 +01:00
Jorge Sancho Larraz
7ff8f21d04 profiles/*frr*: missing clean up after including abstractions/nameservice-strict to abstraction frr ( 8d644e0d18) 2024-11-07 12:03:57 +01:00
Jorge Sancho Larraz
142d72100c profiles/*frr*: update profiles name 2024-11-07 11:47:42 +01:00
Jorge Sancho Larraz
c63d37f193 profiles/*frr*: add owner to @{PROC}/@{pid}/task/@{tid}/comm rw, 2024-11-07 11:41:10 +01:00
Jorge Sancho Larraz
77b20c9ba1 profiles/*frr*: set # LOGPROF-SUGGEST: no
in frr specific profiles
2024-11-07 11:21:28 +01:00
Jorge Sancho Larraz
8d644e0d18 profiles/*frr*: include abstractions/nameservice-strict 2024-11-07 11:18:03 +01:00
Jorge Sancho Larraz
df917755f2 profiles/*frr*: replace @{DAEMON_NAME} with @{profile_name} 2024-11-07 11:07:17 +01:00
Jorge Sancho Larraz
d48cdea589 profiles/usr.lib.frr.ospfd: add missing rule and use @{pid} and @{tid} 2024-10-17 10:41:01 +02:00
Jorge Sancho Larraz
bcbed6d1e7 profiles: add frr related profiles 2024-10-16 18:08:37 +02:00
Christian Boltz
04c9ffbb19 Merge Replace sigalarm-based subprocess timeout with the built-in one
The timeout parameter for subprocess.Popen.communicate has been available since Python 3.3. Given the fragility of SIGALRM based mechanisms, there's no reason to reimplement our own timeout instead of using the built-in one.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1377
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2024-10-16 12:25:33 +00:00
Ryan Lee
ed0b539c94 Replace sigalarm-based subprocess timeout with the built-in one
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2024-10-15 16:51:17 -07:00
Georgia Garcia
68376e7fee Merge abstraction: add nameservice-strict.
As I have read multiple MR mentioning the `nameservice-strict`. Therefore, I thought it would make sense to directly import it here.

To give some context, this abstraction is probably the most commonly included abstraction (after `base`). In `apparmor.d`, it is used by over 700 profiles (only counting direct import). Therefore, adding new rules can have an important impact over a lot of profiles.

Note: the abstraction is a direct import from https://gitlab.com/roddhjav/apparmor.d. The license is the same, I obviously kept Morfikov copyright line. However, I am not sure either or not the SPDX identifier can be used here.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1368
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Approved-by: Christian Boltz <apparmor@cboltz.de>
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-10-11 12:36:42 +00:00
Alexandre Pujol
1966c36c1d
abstraction: add missing abi in nameservice-strict. 2024-10-09 21:42:48 +01:00
Alexandre Pujol
62e7220271
abstraction: include nss-systemd in nameservice-strict. 2024-10-09 21:25:57 +01:00
Alexandre Pujol
1a8d8f3695
abstraction: add nameservice-strict.
Imported from gitlab.com/roddhjav/apparmor.d
2024-10-09 19:57:16 +01:00
Georgia Garcia
a522e11129 Merge Support name resolution via libnss-libvirt
Add support for hostname resolution via libnss-libvirt. This change has been tested against the latest oracular version 10.6.0-1ubuntu3.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1362
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-10-09 15:12:05 +00:00
Giampaolo Fresi Roglia
e53f300821
nameservice: add support for libnss-libvirt 2024-10-09 10:12:26 +02:00
John Johansen
bb460ba467 Merge .gitlab-ci.yml: run pipeline in merge requests too
Hopefully this will allow us to run pipelines in regular branches but
also run it on merge requests on the parent project. This is needed
for users that are not verified by Gitlab.
https://docs.gitlab.com/ee/ci/pipelines/merge_request_pipelines.html#run-pipelines-in-the-parent-project

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1346
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-10-04 21:31:51 +00:00
John Johansen
254b324a83 Merge Rename aa_log_record struct fields (C only) to allow inclusion in C++
Do an identifier rename combined with preprocessor directives and SWIG directives to allow the header to be included in C++ while keeping backwards compatibility to the extent possible.

Closes: #439 

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

Closes #439
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1342
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-10-04 21:28:14 +00:00
Ryan Lee
2d7440350f Basic test that uses aa_log_record struct fields via old, C++-incompatible names
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2024-10-03 12:46:00 -07:00
Ryan Lee
645b1406d1 Basic test that invokes aalogparse functions from C++ code
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2024-10-03 12:45:55 -07:00
Ryan Lee
3cb61b6b41 Add extern "C" decls to aalogparse.h for C++ usage of aalogparse
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2024-10-03 12:44:25 -07:00
Ryan Lee
e2c407c614 Add SWIG renames for fields to preserve backcompat
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2024-10-03 12:44:18 -07:00
Ryan Lee
3f5180527d Rename aa_log_record struct fields (C only) to allow inclusion in C++
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2024-10-03 12:43:33 -07:00
John Johansen
b52c9bb860 Merge Convert original_aa from hasher to dict
This requires adding some `.get()` guards at one place, but should
otherwise be a boring change.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1347
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-10-03 18:36:29 +00:00
Ryan Lee
5b141dd580 Merge Remove aa_query_label from SWIG bindings
This is one of those functions that never worked anyways, because it
modified the passed-in label in place. Moreover, it is a low-level
interface that requires its callers to manually construct a binary query.
As such, it would be better not to expose it and to add wrappers like
aa_query_file_path for the other query classes if that functionality is
needed later.

The removal of this function from the bindings was dropped from !1337 because it exposed functionality that was not present in wrappers around aa_query_label. However, upon further discussion, we decided that it'd be better to remove it now and add other wrappers to libapparmor itself if the functionality provided by the existing wrappers became insufficient.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1352
Approved-by: John Johansen <john@jjmx.net>
Merged-by: Ryan Lee <rlee287@yahoo.com>
2024-10-03 18:25:52 +00:00
Ryan Lee
d3603a1f20 Remove aa_query_label from SWIG bindings
This is one of those functions that never worked anyways, because it
modified the passed-in label in place. Moreover, it is a low-level
interface that requires its callers to manually construct a binary query.
As such, it would be better not to expose it and to add wrappers like
aa_query_file_path for the other query classes if that functionality is
needed later.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2024-10-03 10:59:25 -07:00
Georgia Garcia
7867a46e2e Merge gitlab-ci.yml: only run coverity in the upstream project
This pipeline only makes sense to run in the upstream project where
the coverity variables are defined, so they currently fail in forks.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1351
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-10-03 17:46:54 +00:00
Georgia Garcia
c382efe119 gitlab-ci.yml: only run coverity in the upstream project
This pipeline only makes sense to run in the upstream project where
the coverity variables are defined, so they currently fail in forks.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-10-03 11:12:36 -03:00
Christian Boltz
a56516851e
Convert original_aa from hasher to dict
This requires adding some `.get()` guards at one place, but should
otherwise be a boring change.
2024-10-02 22:44:04 +02:00
Georgia Garcia
248e5673ef .gitlab-ci.yml: run pipeline in merge requests too
Hopefully this will allow us to run pipelines in regular branches but
also run it on merge requests on the parent project. This is needed
for users that are not verified by Gitlab.
https://docs.gitlab.com/ee/ci/pipelines/merge_request_pipelines.html#run-pipelines-in-the-parent-project
2024-10-02 17:37:27 -03:00
John Johansen
07fe0e9a1b Merge Fix ABI break for aa_log_record
Commit 3c825eb001 adds a field called `execpath` to the `aa_log_record` struct. This field was added in the middle of the struct instead of the end, causing an ABI break in libapparmor without a corresponding major version number bump.
Bug report: https://bugs.launchpad.net/apparmor/+bug/2083435
This is fixed by simply moving execpath at the end of the struct.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1345
Approved-by: Ryan Lee <rlee287@yahoo.com>
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-10-01 22:06:45 +00:00
Maxime Bélair
c86c87e886 Fix ABI break for aa_log_record 2024-10-01 22:06:45 +00:00
Ryan Lee
d35a6939be Merge Remove broken SWIG functions that we don't actually want to expose
It doesn't make sense to expose the *_raw functions or the varg version
of aa_change_hatv to higher-level languages. While technically a breaking
change, the generated bindings for these functions never actually worked
anyways:

 - aa_change_hat_vargs uses C varargs, which SWIG passes in NULL for by
   default. It does not attempt to process the passed-in arguments at all
   (and in fact caused an unused-argument compiler warning when compiling
   the generated bindings).
 - aa_getprocattr_raw and aa_getpeercon_raw both place output into a ``char
   **mode`` pointer. SWIG by default generates these as opaque pointer
   object arguments, rendering them unusable for getting output. Future
   patches would be needed to fix ``char**`` arguments for the other functions
   that use them. Moreover, these functions expect their caller to handle
   memory allocation, which is also not possible from a higher-level
   language point of view.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1337
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Ryan Lee <rlee287@yahoo.com>
2024-10-01 19:16:38 +00:00
Ryan Lee
bdc8889cc0 Remove private _aa_is_blacklisted from SWIG bindings
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2024-10-01 11:58:07 -07:00
Ryan Lee
2bd1884654 Remove SWIG aa_change_hat_vargs, aa_get_procattr_raw, aa_get_peercon_raw
It doesn't make sense to expose the *_raw functions or the varg version
of aa_change_hatv to higher-level languages. While technically a breaking
change, the generated bindings for these functions never actually worked
anyways:

 - aa_change_hat_vargs uses C varargs, which SWIG passes in NULL for by
   default. It does not attempt to process the passed-in arguments at all
   (and in fact caused an unused-argument compiler warning when compiling
   the generated bindings).
 - aa_getprocattr_raw and aa_getpeercon_raw both place output into a char
   **mode pointer. SWIG by default generates these as opaque pointer
   object arguments, rendering them unusable for getting output. Future
   patches would be needed to fix char** arguments for the other functions
   that use them. Moreover, these functions expect their caller to handle
   memory allocation, which is also not possible from a higher-level
   language point of view.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2024-10-01 11:58:07 -07:00
Ryan Lee
bcab725670 Merge Improvements to the SWIG binding handling of aa_log_record and %exception memory management
This patchset adds annotations so that SWIG can automatically manage the memory lifetimes of aa_log_record objects, and ensures proper cleanup is done in the %exception handler.

This is the first of a sequence of MRs to overhaul the SWIG bindings and fix pieces that never actually worked in the first place. As fixing those other pieces will require breaking changes, I am separating out the non-breaking changes into separate MRs.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1334
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Ryan Lee <rlee287@yahoo.com>
2024-10-01 18:55:24 +00:00
Ryan Lee
61b1501f48 Apply 1 suggestion(s) to 1 file(s)
Co-authored-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-10-01 18:38:04 +00:00
Christian Boltz
4b6df10fe3 Merge ping: allow reading /proc/sys/net/ipv6/conf/all/disable_ipv6
Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082190

I propose this patch for 3.0..master.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1340
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2024-09-30 21:42:56 +00:00
Christian Boltz
62ff290c02 Merge abstractions/mesa: allow ~/.cache/mesa_shader_cache_db/
... which is used by Mesa 24.2.2

Reported by darix.

Fixes: https://bugs.launchpad.net/bugs/2081692

I propose this addition for 3.x, 4.0 and master

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1333
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2024-09-30 21:40:03 +00:00
Christian Boltz
247bdd5deb Merge apparmor.vim: Add missing units for rlimit cpu and rttime
... and allow whitespace between the number and the unit.

I propose this patch for 3.x, 4.0 and master.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1336
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2024-09-30 21:35:40 +00:00
Christian Boltz
df4d7cb8da
ping: allow reading /proc/sys/net/ipv6/conf/all/disable_ipv6
Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082190
2024-09-27 12:05:29 +02:00
Ryan Lee
398f0790de Add DeprecationWarning emission to Python free_record wrapper
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2024-09-26 11:57:04 -07:00
Ryan Lee
4a7a8fa213 Make Python-side free_record a no-op to prevent double-free
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2024-09-26 11:57:04 -07:00
Ryan Lee
e5fd0fc636 Annotate SWIG aa_log_record alloc+dealloc
Swig generates a "thisown" attribute, which is an escape hatch in case
higher-level code does something weird and needs to tell SWIG whether to
free the C object when Python garbage collects it. Adding this attribute
is not a breaking change w.r.t access to the other attributes of the parsed
record.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2024-09-26 11:57:04 -07:00