mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 06:45:38 +00:00
Add explicit WSL detection to is_container_with_internal_policy
This commit is contained in:
@@ -68,7 +68,7 @@ is_apparmor_present() {
|
|||||||
# something like `systemd-detect-virt --container`.
|
# something like `systemd-detect-virt --container`.
|
||||||
#
|
#
|
||||||
# The only known container environments capable of supporting internal policy
|
# The only known container environments capable of supporting internal policy
|
||||||
# are LXD and LXC environment.
|
# are LXD and LXC environments, and Windows Subsystem for Linux.
|
||||||
#
|
#
|
||||||
# Returns 0 if the container environment is capable of having its own internal
|
# Returns 0 if the container environment is capable of having its own internal
|
||||||
# policy and non-zero otherwise.
|
# policy and non-zero otherwise.
|
||||||
@@ -90,6 +90,11 @@ is_container_with_internal_policy() {
|
|||||||
local ns_stacked
|
local ns_stacked
|
||||||
local ns_name
|
local ns_name
|
||||||
|
|
||||||
|
# WSL needs to be detected explicitly
|
||||||
|
if [ $(systemd-detect-virt --container) = "wsl" ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
if ! [ -f "$ns_stacked_path" ] || ! [ -f "$ns_name_path" ]; then
|
if ! [ -f "$ns_stacked_path" ] || ! [ -f "$ns_name_path" ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user