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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/gpg-connect-agent
profile gpg-connect-agent @{exec_path} {
  include <abstractions/base>
  include <abstractions/consoles>

  @{exec_path} mr,

  @{bin}/gpg-agent rPx,

  /etc/inputrc r,

  owner @{run}/user/@{uid}/gnupg/ w,
  owner @{run}/user/@{uid}/gnupg/d.*/ rw,

  owner @{tmp}/tmp.*/.#lk0x@{hex}.*.@{pid} rw,
  owner @{tmp}/tmp.*/.#lk0x@{hex}.*.@{pid}x rwl -> /tmp/*/.#lk0x@{hex}.*.@{pid},
  owner @{tmp}/tmp.*/gnupg_spawn_agent_sentinel.lock rwl -> /tmp/*/.#lk0x@{hex}.*.@{pid},

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

  include if exists <local/gpg-connect-agent>
}


# vim:syntax=apparmor
