# 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/3.0>,

include <tunables/global>

@{exec_path} = @{bin}/debsecan
profile debsecan @{exec_path} {
  include <abstractions/base>
  include <abstractions/consoles>
  include <abstractions/python>
  include <abstractions/nameservice-strict>
  include <abstractions/ssl_certs>

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

  @{exec_path} r,
  @{bin}/python3.@{int} r,

  @{bin}/           r,
  @{sh_path}        rix,

  # Send results using email
  @{bin}/exim4  rPx,

  /etc/apt/apt.conf.d/{,*} r,
  /etc/apt/apt.conf r,

  /etc/default/debsecan rw,

  /usr/share/dpkg/cputable r,
  /usr/share/dpkg/tupletable r,

  /var/lib/dpkg/status r,

  /var/lib/debsecan/history{,.*} rw,

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

  # file_inherit
  /tmp/#@{int} rw,

  include if exists <local/debsecan>
}

# vim:syntax=apparmor
