apparmor.d/profiles/dhclient-script

110 lines
2.6 KiB
Text
Raw Normal View History

# vim:syntax=apparmor
# ------------------------------------------------------------------
#
2021-01-10 16:35:07 +01:00
# Copyright (C) 2018-2021 Mikhail Morfikov
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License published by the Free Software Foundation.
#
# ------------------------------------------------------------------
2020-12-10 22:33:39 +01:00
abi <abi/3.0>,
2020-12-10 22:33:39 +01:00
include <tunables/global>
@{exec_path} = /{usr/,}sbin/dhclient-script
profile dhclient-script @{exec_path} {
2020-12-10 22:33:39 +01:00
include <abstractions/base>
include <abstractions/nameservice>
include <abstractions/openssl>
include <abstractions/ssl_certs>
# Needed?
audit deny capability sys_module,
@{exec_path} mr,
2020-12-09 10:30:52 +01:00
/{usr/,}bin/{,ba,da}sh mrix,
2020-12-09 10:30:52 +01:00
/{usr/,}bin/ping rPx,
/{usr/,}bin/run-parts rCx -> run-parts,
# To remove the following error:
# /sbin/dhclient-script: 133: hostname: Permission denied
2021-03-21 17:04:10 +01:00
/{usr/,}bin/hostname rix,
# To read scripts
2020-12-09 10:30:52 +01:00
/etc/dhcp/ r,
/etc/dhcp/dhclient-{enter,exit}-hooks.d/{,*} r,
# For debug script
/{usr/,}bin/date rix,
/etc/dhcp/debug r,
owner /tmp/dhclient-script.debug rw,
# For ddclient script
2020-12-09 10:30:52 +01:00
/{usr/,}sbin/ddclient rPx,
/etc/default/ddclient r,
/{usr/,}bin/logger rix,
# For samba script
/{usr/,}bin/mv rix,
/etc/samba/dhcp.conf{,.new} rw,
# For netbios name servers settings from a DHCP server
/var/lib/samba/dhcp.conf{,.new} rw,
# Many scripts may use the ip tool
capability net_admin,
/{usr/,}bin/ip rix,
# For loadbalance
/etc/iproute2/rt_tables r,
/etc/iproute2/rt_tables.d/{,*} r,
owner @{PROC}/@{pid}/loginuid r,
# For updating the /etc/resolv.conf file
/{usr/,}bin/readlink rix,
/{usr/,}bin/rm rix,
/{usr/,}bin/chown rix,
/{usr/,}bin/chmod rix,
/{usr/,}bin/sed rix,
/etc/fstab r,
/etc/resolv.conf.dhclient-new.@{pid} rw,
/etc/resolv.conf rw,
# For stable-privacy addresses
/{usr/,}sbin/sysctl rix,
/{usr/,}bin/head rix,
/{usr/,}bin/xxd rix,
/{usr/,}bin/paste rix,
/{usr/,}bin/fold rix,
/{usr/,}bin/tr rix,
@{PROC}sys/net/ipv6/conf/*/stable_secret w,
# For printing env
/{usr/,}bin/printenv rix,
owner /tmp/variables.txt w,
2020-09-27 22:26:01 +02:00
# For ntpd/ntpsec
2020-10-25 10:23:34 +01:00
@{run}/systemd/netif/leases/ r,
2020-09-27 22:26:01 +02:00
# file_inherit
/var/lib/dhcp/dhclient.leases r,
profile run-parts {
2020-12-10 22:33:39 +01:00
include <abstractions/base>
/{usr/,}bin/run-parts mr,
/etc/dhcp/dhclient-{enter,exit}-hooks.d/ r,
# file_inherit
owner /var/lib/dhcp/dhclient.leases r,
}
2020-12-10 22:33:39 +01:00
include if exists <local/dhclient-script>
}