mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
Merge Add netcat-openbsd profile
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1327 Approved-by: Maxime Bélair <maxime.belair@canonical.com> Merged-by: Maxime Bélair <maxime.belair@canonical.com>
This commit is contained in:
commit
c8dc701666
27
profiles/apparmor.d/nc.openbsd
Normal file
27
profiles/apparmor.d/nc.openbsd
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#------------------------------------------------------------------
|
||||||
|
# Copyright (C) 2024 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.
|
||||||
|
#------------------------------------------------------------------
|
||||||
|
# vim: ft=apparmor
|
||||||
|
|
||||||
|
abi <abi/4.0>,
|
||||||
|
|
||||||
|
include <tunables/global>
|
||||||
|
|
||||||
|
profile nc.openbsd /usr/bin/nc.openbsd {
|
||||||
|
include <abstractions/base>
|
||||||
|
include <abstractions/nameservice>
|
||||||
|
|
||||||
|
file rw /**,
|
||||||
|
|
||||||
|
# we need to enable all networking in order to allow DCCP (this also allows unix sockets)
|
||||||
|
network,
|
||||||
|
|
||||||
|
/usr/bin/nc.openbsd mr,
|
||||||
|
|
||||||
|
# Site-specific additions and overrides. See local/README for details.
|
||||||
|
include if exists <local/nc.openbsd>
|
||||||
|
}
|
12
tests/profiles/nc.openbsd/task.yaml
Normal file
12
tests/profiles/nc.openbsd/task.yaml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
summary: smoke test for the nc.openbsd profile
|
||||||
|
execute: |
|
||||||
|
# IPv4, IPv6
|
||||||
|
nc -4 -l 4321 & (echo "hi" | nc -4 -q 0 127.0.0.1 4321)
|
||||||
|
nc -6 -l 4321 & (echo "hi" | nc -6 -q 0 ::1 4321)
|
||||||
|
|
||||||
|
# UNIX sockets
|
||||||
|
nc -l -U /tmp/socket & (echo "hi" | nc -q 0 -U /tmp/socket)
|
||||||
|
nc -l -U '@tmpsocket' & (echo "hi" | nc -q 0 -U '@tmpsocket')
|
||||||
|
|
||||||
|
# The profile is attached based on the program path.
|
||||||
|
"$SPREAD_PATH"/tests/bin/actual-profile-of nc.openbsd | MATCH 'nc.openbsd \(enforce\)'
|
Loading…
x
Reference in New Issue
Block a user