#include <tunables/global>

/usr/sbin/kopano-search {
  #include <abstractions/base>
  #include <abstractions/nameservice>
  #include <abstractions/python>
  #include <abstractions/user-tmp>

  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,

  /etc/gss/mech.d/ r,
  /etc/gss/mech.d/*.conf r,

  /lib/x86_64-linux-gnu/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,

  /etc/mapi.d/ r,
  /etc/mapi.d/*.inf r,
  /usr/lib/mapi.d/ r,
  /usr/lib/mapi.d/*.inf r,

  /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,
}
