# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 EricLin
# SPDX-License-Identifier: GPL-2.0-only

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/xray
@{att} = /att/xray/
profile xray /{,usr/}bin/xray  flags=(attach_disconnected,attach_disconnected.path=@{att},complain) {
  include <abstractions/attached/base>
  include <abstractions/attached/consoles>

  network inet dgram,
  network inet stream,
  network inet raw,
  network inet6 dgram,
  network inet6 raw,
  network netlink raw,

  @{exec_path} mr,

  /etc/xray/{,*} r,
  /usr/share/xray/**.dat r,
  /usr/share/v2ray/**.dat r,

  @{PROC}/sys/net/core/somaxconn r,

  include if exists <local/xray>
}

# vim:syntax=apparmor
