You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

190 lines
5.7 KiB

  1. --- a/profiles/apparmor.d/usr.sbin.dnsmasq
  2. +++ b/profiles/apparmor.d/usr.sbin.dnsmasq
  3. @@ -1,3 +1,10 @@
  4. +# Last Modified: Thu Jun 10 01:23:44 2021
  5. +abi <abi/3.0>,
  6. +
  7. +include <tunables/global>
  8. +
  9. +@{TFTP_DIR} = /srv/tftp /srv/tftpboot /var/tftp
  10. +
  11. # ------------------------------------------------------------------
  12. #
  13. # Copyright (C) 2009 John Dong <jdong@ubuntu.com>
  14. @@ -9,126 +16,95 @@
  15. #
  16. # ------------------------------------------------------------------
  17. -abi <abi/3.0>,
  18. -
  19. -@{TFTP_DIR}=/var/tftp /srv/tftp /srv/tftpboot
  20. -include <tunables/global>
  21. profile dnsmasq /usr/{bin,sbin}/dnsmasq flags=(attach_disconnected) {
  22. include <abstractions/base>
  23. include <abstractions/dbus>
  24. include <abstractions/nameservice>
  25. + include <abstractions/user-tmp>
  26. + include if exists <local/usr.sbin.dnsmasq>
  27. capability chown,
  28. + capability dac_override,
  29. + capability net_admin, # for DHCP server
  30. capability net_bind_service,
  31. + capability net_raw, # for DHCP server ping checks
  32. capability setgid,
  33. capability setuid,
  34. - capability dac_override,
  35. - capability net_admin, # for DHCP server
  36. - capability net_raw, # for DHCP server ping checks
  37. +
  38. network inet raw,
  39. network inet6 raw,
  40. - signal (receive) peer=/usr/{bin,sbin}/libvirtd,
  41. - signal (receive) peer=libvirtd,
  42. - ptrace (readby) peer=/usr/{bin,sbin}/libvirtd,
  43. - ptrace (readby) peer=libvirtd,
  44. + signal receive peer=/usr/{bin,sbin}/libvirtd,
  45. + signal receive peer=libvirtd,
  46. - owner /dev/tty rw,
  47. + ptrace readby peer=/usr/{bin,sbin}/libvirtd,
  48. + ptrace readby peer=libvirtd,
  49. - @{PROC}/@{pid}/fd/ r,
  50. -
  51. - /etc/dnsmasq.conf r,
  52. - /etc/dnsmasq.d/ r,
  53. - /etc/dnsmasq.d/* r,
  54. - /etc/dnsmasq.d-available/ r,
  55. - /etc/dnsmasq.d-available/* r,
  56. - /etc/ethers r,
  57. - /etc/NetworkManager/dnsmasq.d/ r,
  58. - /etc/NetworkManager/dnsmasq.d/* r,
  59. /etc/NetworkManager/dnsmasq-shared.d/ r,
  60. /etc/NetworkManager/dnsmasq-shared.d/* r,
  61. + /etc/NetworkManager/dnsmasq.d/ r,
  62. + /etc/NetworkManager/dnsmasq.d/* r,
  63. /etc/dnsmasq-conf.conf r,
  64. /etc/dnsmasq-resolv.conf r,
  65. -
  66. - /usr/{bin,sbin}/dnsmasq mr,
  67. -
  68. - /var/log/dnsmasq*.log w,
  69. -
  70. + /etc/dnsmasq.conf r,
  71. + /etc/dnsmasq.d-available/ r,
  72. + /etc/dnsmasq.d-available/* r,
  73. + /etc/dnsmasq.d/ r,
  74. + /etc/dnsmasq.d/* r,
  75. + /etc/ethers r,
  76. + /tmp/** r,
  77. + /usr/libexec/libvirt_leaseshelper Cx -> libvirt_leaseshelper,
  78. + /usr/lib{,64}/libvirt/libvirt_leaseshelper Cx -> libvirt_leaseshelper,
  79. /usr/share/dnsmasq{-base,}/ r,
  80. /usr/share/dnsmasq{-base,}/* r,
  81. -
  82. - @{run}/*dnsmasq*.pid w,
  83. - @{run}/dnsmasq-forwarders.conf r,
  84. - @{run}/dnsmasq/ r,
  85. - @{run}/dnsmasq/* rw,
  86. -
  87. + /usr/{bin,sbin}/dnsmasq mr,
  88. + /var/lib/NetworkManager/dnsmasq-*.leases rw,
  89. + /var/lib/libvirt/dnsmasq/ r,
  90. + /var/lib/libvirt/dnsmasq/* r,
  91. + /var/lib/lxd-bridge/dnsmasq.*.leases rw,
  92. + /var/lib/lxd/networks/*/dnsmasq.* r,
  93. + /var/lib/lxd/networks/*/dnsmasq.leases rw,
  94. + /var/lib/lxd/networks/*/dnsmasq.pid rw,
  95. + /var/lib/misc/dnsmasq.*.leases rw,
  96. /var/lib/misc/dnsmasq.leases rw, # Required only for DHCP server usage
  97. -
  98. + /var/log/dnsmasq*.log w,
  99. /{,usr/}bin/{ba,da,}sh ix, # Required to execute --dhcp-script argument
  100. -
  101. - # access to iface mtu needed for Router Advertisement messages in IPv6
  102. - # Neighbor Discovery protocol (RFC 2461)
  103. + @{PROC}/@{pid}/fd/ r,
  104. @{PROC}/sys/net/ipv6/conf/*/mtu r,
  105. -
  106. - # for the read-only TFTP server
  107. @{TFTP_DIR}/ r,
  108. @{TFTP_DIR}/** r,
  109. -
  110. - # libvirt config and hosts file for dnsmasq
  111. - /var/lib/libvirt/dnsmasq/ r,
  112. - /var/lib/libvirt/dnsmasq/* r,
  113. -
  114. - # libvirt pid files for dnsmasq
  115. - @{run}/libvirt/network/ r,
  116. + @{run}/*dnsmasq*.pid w,
  117. + @{run}/NetworkManager/NetworkManager.pid w,
  118. + @{run}/NetworkManager/dnsmasq.conf r,
  119. + @{run}/NetworkManager/dnsmasq.pid w,
  120. + @{run}/dnsmasq-forwarders.conf r,
  121. + @{run}/dnsmasq/ r,
  122. + @{run}/dnsmasq/* rw,
  123. + @{run}/libvirt/network/ r,
  124. @{run}/libvirt/network/*.pid rw,
  125. -
  126. - # libvirt lease helper
  127. - /usr/lib{,64}/libvirt/libvirt_leaseshelper Cx -> libvirt_leaseshelper,
  128. - /usr/libexec/libvirt_leaseshelper Cx -> libvirt_leaseshelper,
  129. -
  130. - # lxc-net pid and lease files
  131. - @{run}/lxc/dnsmasq.pid rw,
  132. - /var/lib/misc/dnsmasq.*.leases rw,
  133. -
  134. - # lxd-bridge pid and lease files
  135. - @{run}/lxd-bridge/dnsmasq.pid rw,
  136. - /var/lib/lxd-bridge/dnsmasq.*.leases rw,
  137. - /var/lib/lxd/networks/*/dnsmasq.* r,
  138. - /var/lib/lxd/networks/*/dnsmasq.leases rw,
  139. - /var/lib/lxd/networks/*/dnsmasq.pid rw,
  140. -
  141. - # NetworkManager integration
  142. - /var/lib/NetworkManager/dnsmasq-*.leases rw,
  143. + @{run}/lxc/dnsmasq.pid rw,
  144. + @{run}/lxd-bridge/dnsmasq.pid rw,
  145. @{run}/nm-dns-dnsmasq.conf r,
  146. @{run}/nm-dnsmasq-*.pid rw,
  147. @{run}/sendsigs.omit.d/*dnsmasq.pid w,
  148. - @{run}/NetworkManager/dnsmasq.conf r,
  149. - @{run}/NetworkManager/dnsmasq.pid w,
  150. - @{run}/NetworkManager/NetworkManager.pid w,
  151. + owner /dev/tty rw,
  152. +
  153. profile libvirt_leaseshelper {
  154. include <abstractions/base>
  155. /etc/libnl-3/classid r,
  156. -
  157. - /usr/lib{,64}/libvirt/libvirt_leaseshelper m,
  158. /usr/libexec/libvirt_leaseshelper m,
  159. -
  160. - owner @{PROC}/@{pid}/net/psched r,
  161. - owner @{PROC}/@{pid}/status r,
  162. -
  163. + /usr/lib{,64}/libvirt/libvirt_leaseshelper m,
  164. + /var/lib/libvirt/dnsmasq/*.leases rw,
  165. + /var/lib/libvirt/dnsmasq/*.status* rw,
  166. + @{run}/leaseshelper.pid rwk,
  167. @{sys}/devices/system/cpu/ r,
  168. @{sys}/devices/system/node/ r,
  169. @{sys}/devices/system/node/*/meminfo r,
  170. + owner @{PROC}/@{pid}/net/psched r,
  171. + owner @{PROC}/@{pid}/status r,
  172. - # libvirt lease and status files for dnsmasq
  173. - /var/lib/libvirt/dnsmasq/*.leases rw,
  174. - /var/lib/libvirt/dnsmasq/*.status* rw,
  175. -
  176. - @{run}/leaseshelper.pid rwk,
  177. }
  178. -
  179. - # Site-specific additions and overrides. See local/README for details.
  180. - include if exists <local/usr.sbin.dnsmasq>
  181. }