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

abi <abi/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/dino-im
profile dino-im @{exec_path} {
  include <abstractions/base>
  include <abstractions/dconf-write>
  include <abstractions/desktop>
  include <abstractions/fontconfig-cache-read>
  include <abstractions/nameservice-strict>
  include <abstractions/ssl_certs>

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

  @{exec_path} mr,

  # Needed for GPG/PGP support
  @{bin}/gpg{,2}         rCx -> gpg,
  @{bin}/gpgconf         rCx -> gpg,
  @{bin}/gpgsm           rCx -> gpg,

  owner @{user_share_dirs}/dino/ rw,
  owner @{user_share_dirs}/dino/** rwk,

  owner @{PROC}/@{pid}/fd/ r,

  profile gpg {
    include <abstractions/base>

    @{bin}/gpg{,2} mr,
    @{bin}/gpgconf mr,
    @{bin}/gpgsm   mr,

    owner @{HOME}/.gnupg/ rw,
    owner @{HOME}/.gnupg/** rwkl -> @{HOME}/.gnupg/**,

    include if exists <local/dino-im_gpg>
  }

  include if exists <local/dino-im>
}

# vim:syntax=apparmor
