#include <tunables/global>

/usr/sbin/kopano-search flags=(attach_disconnected) {
  #include <abstractions/base>
  #include <abstractions/nameservice>
  #include <abstractions/python>
  #include <abstractions/user-tmp>
  #include <kopano-client.aa>

  capability chown,
  capability dac_override,
  capability dac_read_search,
  capability setgid,
  capability setuid,

  @{PROC}/@{pid}/cmdline r,
  @{PROC}/@{pid}/mounts r,
  @{PROC}/@{pid}/status r,
  @{PROC}/@{pid}/task/@{tid}/comm rw,

  deny /usr/lib/python2.7/dist-packages/kopano_search/*.pyc w,

  # FIXME: it would be nice if search would use search- like pa
  /dev/shm/* rwl,

  /lib/ld-*.so mr,
  /lib64/ld-*.so mr,
  /lib/@{multiarch}/ld-*.so mr,
  /usr/bin/python2.7 ix,
  /usr/sbin/kopano-search r,

  /etc/kopano/search.cfg r,

  /bin/dash Pix,
  /bin/rm Pix,
  /sbin/ldconfig Pix,

  /run/kopano/search.pid rw,
  /run/kopano/search.pid.lock lrw,
  /run/kopano/search.sock rw,
  /run/kopano/*.*-* rw,

  /var/lib/kopano/search/** rwlk,
  /var/log/kopano/search.log rw,
}
