# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only

# https://github.com/SagerNet/sing-box

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/sing-box
profile sing-box @{exec_path} {
  include <abstractions/base>
  include <abstractions/nameservice-strict>
  include <abstractions/user-tmp>

  capability net_bind_service,

  network inet stream,
  network inet6 stream,
  network inet dgram,
  network inet6 dgram,

  @{exec_path} mr,

  @{bin}/tor mrix,

  /usr/share/sing-box/* r,

  @{etc_ro}/sing-box/config.json r,

  owner @{user_share_dirs}/certmagic/** rw,

  include if exists <local/sing-box>
}

# vim:syntax=apparmor
