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

abi <abi/4.0>,

include <tunables/global>

@{name} = Mullvad*VPN
@{lib_dirs} = /opt/@{name} 
@{config_dirs} = @{user_config_dirs}/@{name}
@{cache_dirs} = @{user_cache_dirs}/@{name}

@{exec_path} = @{lib_dirs}/mullvad-gui
profile mullvad-gui /opt/Mullvad*VPN/mullvad-gui  flags=(attach_disconnected,complain) {
  include <abstractions/base>
  include <abstractions/common/electron>

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

  @{exec_path} mrix,
  @{sh_path}    rix,

  @{bin}/gsettings     rix,
  @{open_path}         rpx -> child-open-browsers,

  owner @{user_cache_dirs}/dconf/user rw,

  owner @{tmp}/.org.chromium.Chromium.@{rand6}/@{name}*.png rw,

  @{run}/systemd/inhibit/*.ref rw,

  /dev/tty rw,

  deny @{user_share_dirs}/gvfs-metadata/* r,
  deny /etc/machine-id r,
  deny /var/lib/dbus/machine-id r,

  include if exists <local/mullvad-gui>
}

# vim:syntax=apparmor
