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

abi <abi/4.0>,

include <tunables/global>

@{exec_path} = @{bin}/fping{,6}
@{att} = ""
profile fping /{,usr/}bin/fping{,6} flags=(complain) {
  include <abstractions/base-strict>
  include <abstractions/nameservice-strict>

  # This CAP can be blocked when the net.ipv4.ping_group_range sysctl parametr is set. Otherwise it
  # will return the following error:
  #  fping: can't create socket (must run as root?)
  deny capability net_raw,

  network inet dgram,
  network inet6 dgram,
  network inet raw,
  network inet6 raw,

  @{exec_path} mr,

  include if exists <local/fping>
}

# vim:syntax=apparmor
