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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/anondate{,-get,-set}
profile anondate @{exec_path} {
  include <abstractions/base>
  include <abstractions/consoles>
  include <abstractions/nameservice-strict>
  include <abstractions/python>

  @{exec_path} mrix,

  @{sh_path} rix,
  @{bin}/cat rix,
  @{bin}/cp rix,
  @{bin}/date rix,
  @{bin}/grep rix,
  @{bin}/minimum-unixtime-show rix,
  @{bin}/rm rix,
  @{bin}/systemd-cat rix,
  @{bin}/tee rix,
  @{bin}/timeout rix,
  @{bin}/tor-circuit-established-check  rix,
  @{bin}/touch rix,
  @{bin}/whoami rix,

  @{lib}/helper-scripts/{,**} r,
  @{lib}/helper-scripts/tor_bootstrap_check.py  rPx,
  @{lib}/helper-scripts/tor_consensus_valid-after.py rPx,

  /usr/share/timesanitycheck/{,**} r,

  /var/lib/sdwdate/time-replay-protection-utc-unixtime r,

  owner /tmp/tmp.@{rand10} rw,

        @{run}/tor/control.authcookie r,
        @{run}/tor/log r,
  owner @{run}/sdwdate/* rw,

  include if exists <local/anondate>
}

# vim:syntax=apparmor
