# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2026 Roman Beslik <me@beroal.in.ua>
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/amule
@{att} = ""
profile amule /{,usr/}bin/amule {
  include <abstractions/base-strict>
  include <abstractions/dconf-write>
  include <abstractions/gnome-strict>
  include <abstractions/nameservice-strict>
  include <abstractions/ssl_certs>

  network inet dgram,
  network inet stream,
  network inet6 dgram,
  network inet6 stream,
  network netlink raw,

  # Previewing files isn't allowed
  # because aMule opens viewers directly instead of via `xdg-open`.
  # If aMule uses `xdg-open` in your time,
  # uncomment the following line to allow previewing files.
  # @{open_path} rpx -> child-open,

  @{exec_path} mr,
  @{bin}/ffprobe ix,
  @{bin}/uname rix,
  @{sh_path} rix,

  @{system_share_dirs}/amule/{,**} r,

  owner @{HOME}/.aMule/{,**} rwk,
  @{user_torrents_dirs}/{,**} rw,

  owner @{tmp}/amule-mediaprobe@{rand6} rw,
  owner @{tmp}/@{rand9} rw,

  @{sys}/fs/cgroup/user.slice/user-@{uid}.slice/session-@{word}.scope/cpu.max r,

        @{PROC}/@{pid}/net/if_inet6 r,
  owner @{PROC}/@{pid}/cgroup r,

  include if exists <local/amule>
}

# vim:syntax=apparmor
