+ allow log rotate as well.
Signed-off-by: Petr Vorel <[email protected]>
---
Changes v1->v2
* support log rotate patterns (requested by Chris PeBenito)
Changes v2->v3:
* update to current master
---
policy/modules/services/dnsmasq.fc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/policy/modules/services/dnsmasq.fc b/policy/modules/services/dnsmasq.fc
index a6d7f115..91c18d46 100644
--- a/policy/modules/services/dnsmasq.fc
+++ b/policy/modules/services/dnsmasq.fc
@@ -16,4 +16,4 @@
/var/lib/misc/dnsmasq\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0)
/var/lib/dnsmasq(/.*)? gen_context(system_u:object_r:dnsmasq_lease_t,s0)
-/var/log/dnsmasq.* -- gen_context(system_u:object_r:dnsmasq_var_log_t,s0)
+/var/log/dnsmasq(.*)?\.log(\..+) -- gen_context(system_u:object_r:dnsmasq_var_log_t,s0)
--
2.19.1
* lxc-net pid and lease files:
/var/run/lxc/dnsmasq.pid
/var/lib/misc/dnsmasq.*.leases
* lxd-bridge pid and lease files:
/var/run/lxd-bridge/dnsmasq.pid
/var/lib/lxd-bridge/dnsmasq.*.leases
/var/lib/lxd/networks/*/dnsmasq.leases
/var/lib/lxd/networks/*/dnsmasq.pid
* NetworkManager pid, lease and configuration files:
/var/lib/NetworkManager/dnsmasq-*.leases
/run/nm-dns-dnsmasq.conf
/run/nm-dnsmasq-*.pid
/run/sendsigs.omit.d/*dnsmasq.pid
/run/NetworkManager/dnsmasq.conf
/run/NetworkManager/dnsmasq.pid
+ sort /var/lib/ lines.
Signed-off-by: Petr Vorel <[email protected]>
---
Changes v2->v3:
* more sorting
Changes v1->v2
* fix sorting (requested by Chris PeBenito)
* fix missing dot escapes (requested by Chris PeBenito)
* change some stars to plus
---
policy/modules/services/dnsmasq.fc | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/policy/modules/services/dnsmasq.fc b/policy/modules/services/dnsmasq.fc
index 91c18d46..7df6e973 100644
--- a/policy/modules/services/dnsmasq.fc
+++ b/policy/modules/services/dnsmasq.fc
@@ -5,6 +5,11 @@
/run/dnsmasq.* -- gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
/run/libvirt/network(/.*)? gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
+/run/(lxc|lxd-bridge|NetworkManager)/dnsmasq\.pid -- gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
+/run/NetworkManager/dnsmasq\.conf gen_context(system_u:object_r:dnsmasq_etc_t,s0)
+/run/nm-dns-dnsmasq\.conf gen_context(system_u:object_r:dnsmasq_etc_t,s0)
+/run/nm-dnsmasq-.+\.pid -- gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
+/run/sendsigs\.omit\.d/.*dnsmasq\.pid -- gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
/usr/bin/dnsmasq -- gen_context(system_u:object_r:dnsmasq_exec_t,s0)
@@ -13,7 +18,11 @@
/usr/sbin/dnsmasq -- gen_context(system_u:object_r:dnsmasq_exec_t,s0)
-/var/lib/misc/dnsmasq\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0)
/var/lib/dnsmasq(/.*)? gen_context(system_u:object_r:dnsmasq_lease_t,s0)
+/var/lib/lxd-bridge/dnsmasq\..+\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0)
+/var/lib/lxd/networks/\.*/dnsmasq\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0)
+/var/lib/lxd/networks/\.+/dnsmasq\.pid -- gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
+/var/lib/misc/dnsmasq(\..+)?\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0)
+/var/lib/NetworkManager/dnsmasq-.+\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0)
/var/log/dnsmasq(.*)?\.log(\..+) -- gen_context(system_u:object_r:dnsmasq_var_log_t,s0)
--
2.19.1
On 11/12/18 3:47 AM, Petr Vorel wrote:
> * lxc-net pid and lease files:
> /var/run/lxc/dnsmasq.pid
> /var/lib/misc/dnsmasq.*.leases
>
> * lxd-bridge pid and lease files:
> /var/run/lxd-bridge/dnsmasq.pid
> /var/lib/lxd-bridge/dnsmasq.*.leases
> /var/lib/lxd/networks/*/dnsmasq.leases
> /var/lib/lxd/networks/*/dnsmasq.pid
>
> * NetworkManager pid, lease and configuration files:
> /var/lib/NetworkManager/dnsmasq-*.leases
> /run/nm-dns-dnsmasq.conf
> /run/nm-dnsmasq-*.pid
> /run/sendsigs.omit.d/*dnsmasq.pid
> /run/NetworkManager/dnsmasq.conf
> /run/NetworkManager/dnsmasq.pid
>
> + sort /var/lib/ lines.
>
> Signed-off-by: Petr Vorel <[email protected]>
> ---
> Changes v2->v3:
> * more sorting
>
> Changes v1->v2
> * fix sorting (requested by Chris PeBenito)
> * fix missing dot escapes (requested by Chris PeBenito)
> * change some stars to plus
> ---
> policy/modules/services/dnsmasq.fc | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/policy/modules/services/dnsmasq.fc b/policy/modules/services/dnsmasq.fc
> index 91c18d46..7df6e973 100644
> --- a/policy/modules/services/dnsmasq.fc
> +++ b/policy/modules/services/dnsmasq.fc
> @@ -5,6 +5,11 @@
>
> /run/dnsmasq.* -- gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
> /run/libvirt/network(/.*)? gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
> +/run/(lxc|lxd-bridge|NetworkManager)/dnsmasq\.pid -- gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
> +/run/NetworkManager/dnsmasq\.conf gen_context(system_u:object_r:dnsmasq_etc_t,s0)
> +/run/nm-dns-dnsmasq\.conf gen_context(system_u:object_r:dnsmasq_etc_t,s0)
> +/run/nm-dnsmasq-.+\.pid -- gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
> +/run/sendsigs\.omit\.d/.*dnsmasq\.pid -- gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
>
> /usr/bin/dnsmasq -- gen_context(system_u:object_r:dnsmasq_exec_t,s0)
>
> @@ -13,7 +18,11 @@
>
> /usr/sbin/dnsmasq -- gen_context(system_u:object_r:dnsmasq_exec_t,s0)
>
> -/var/lib/misc/dnsmasq\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0)
> /var/lib/dnsmasq(/.*)? gen_context(system_u:object_r:dnsmasq_lease_t,s0)
> +/var/lib/lxd-bridge/dnsmasq\..+\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0)
> +/var/lib/lxd/networks/\.*/dnsmasq\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0)
> +/var/lib/lxd/networks/\.+/dnsmasq\.pid -- gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
> +/var/lib/misc/dnsmasq(\..+)?\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0)
> +/var/lib/NetworkManager/dnsmasq-.+\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0)
>
> /var/log/dnsmasq(.*)?\.log(\..+) -- gen_context(system_u:object_r:dnsmasq_var_log_t,s0)
I got this error:
/sbin/setfiles: file_contexts: Multiple different specifications for
/run/nm-dns-dnsmasq\.conf
(system_u:object_r:NetworkManager_var_run_t:s0 and
system_u:object_r:dnsmasq_etc_t:s0).
This made me think about this patch more. Is NetworkManager creating
these config files?
--
Chris PeBenito
Hi,
> I got this error:
> /sbin/setfiles: file_contexts: Multiple different specifications for
> /run/nm-dns-dnsmasq\.conf (system_u:object_r:NetworkManager_var_run_t:s0 and
> system_u:object_r:dnsmasq_etc_t:s0).
> This made me think about this patch more. Is NetworkManager creating these
> config files?
I'm sorry for wrong patch, drop this one. Old NetworkManager commit
d82669d3f ("build: unify NetworkManager path handling (some paths are changed)")
deprecated some locations:
/var/run/NetworkManager.pid -> /var/run/NetworkManager/NetworkManager.pid
/var/run/nm-dns-dnsmasq.pid -> /var/run/NetworkManager/dnsmasq.pid
/var/run/nm-dns-dnsmasq.conf -> /var/run/NetworkManager/dnsmasq.conf
I'll verify patch further and prepare v4 with fixed paths.
But maybe first patch could be accepted.
Kind regards,
Petr
On 11/12/18 3:47 AM, Petr Vorel wrote:
> + allow log rotate as well.
>
> Signed-off-by: Petr Vorel <[email protected]>
> ---
> Changes v1->v2
> * support log rotate patterns (requested by Chris PeBenito)
>
> Changes v2->v3:
> * update to current master
> ---
> policy/modules/services/dnsmasq.fc | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/policy/modules/services/dnsmasq.fc b/policy/modules/services/dnsmasq.fc
> index a6d7f115..91c18d46 100644
> --- a/policy/modules/services/dnsmasq.fc
> +++ b/policy/modules/services/dnsmasq.fc
> @@ -16,4 +16,4 @@
> /var/lib/misc/dnsmasq\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0)
> /var/lib/dnsmasq(/.*)? gen_context(system_u:object_r:dnsmasq_lease_t,s0)
>
> -/var/log/dnsmasq.* -- gen_context(system_u:object_r:dnsmasq_var_log_t,s0)
> +/var/log/dnsmasq(.*)?\.log(\..+) -- gen_context(system_u:object_r:dnsmasq_var_log_t,s0)
Merged.
--
Chris PeBenito