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

abi <abi/3.0>,

include <tunables/global>

@{name} = opera{,-beta,-developer}
@{lib_dirs} = @{lib}/@{multiarch}/@{name}

@{exec_path} = @{lib_dirs}/opera_sandbox
profile opera-sandbox @{exec_path} {
  include <abstractions/base>
  include <abstractions/fontconfig-cache-read>
  include <abstractions/fonts>

  capability setgid,
  capability setuid,
  capability sys_admin,
  capability sys_chroot,
  capability sys_resource,

  signal (receive) set=(term, kill) peer=opera,

  @{exec_path} mr,

  @{lib_dirs}/opera{,-beta,-developer} rPx,

        @{PROC} r,
        @{PROC}/@{pids}/ r,
  owner @{PROC}/@{pid}/fd/ r,
  owner @{PROC}/@{pid}/oom_{,score_}adj rw,

  include if exists <local/opera-sandbox>
}
