# ------------------------------------------------------------------
#
#    Copyright (C) 2002-2006 Novell/SUSE
#    Copyright (C) 2018 Canonical, Ltd.
#    Copyright (C) 2019 Christian Boltz
#
#    This program is free software; you can redistribute it and/or
#    modify it under the terms of version 2 of the GNU General Public
#    License published by the Free Software Foundation.
#
# ------------------------------------------------------------------

abi <abi/4.0>,

include <tunables/global>

profile postfix-master /usr/lib{,exec}/postfix/{bin/,sbin/,}master {
  include <abstractions/base>
  include <abstractions/nameservice>
  include <abstractions/postfix-common>

  capability net_bind_service,
  capability kill,
  capability dac_override,
  capability dac_read_search,

  signal send peer=postfix-*,
  signal peer=@{profile_name},

  unix (send receive) type=stream peer=(label=postfix-*),

  /etc/postfix/master.cf                       r,
  /{var/spool/postfix/,}pid/master.pid            rwk,
  /{var/spool/postfix/,}pid/unix.lmtp             wk,

  /{var/spool/postfix/,}private/*                 wl,
  /{var/spool/postfix/,}private/tlsmgr            rwl,
  /{var/spool/postfix/,}public/{cleanup,flush,pickup,postlog,qmgr,showq,tlsmgr} rwl,

  /usr/lib{,exec}/postfix/{bin/,sbin/,}anvil               Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}bounce              Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}cleanup             Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}error               Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}flush               Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}local               Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}lmtp                mrPx,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}master              mrix,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}nqmgr               Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}proxymap            Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}pickup              Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}pipe                Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}postfix-tlsproxy    Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}postscreen          Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}qmgr                Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}scache              Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}showq               Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}smtp                Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}smtpd               Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}spawn               Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}tlsmgr              Px,
  /usr/lib{,exec}/postfix/{bin/,sbin/,}trivial-rewrite     Px,

  owner /var/lib/postfix/master.lock rwk,

  # Site-specific additions and overrides. See local/README for details.
  include if exists <local/postfix-master>
}
