SELinux-Refpolicy Archive on lore.kernel.org
 help / Atom feed
* [PATCH 1/2] dnsmasq: Require log files to have .log suffix
@ 2018-11-07 20:57 Petr Vorel
  2018-11-07 20:57 ` [PATCH 2/2] dnsmasq: Add support for lxc-net, lxd-bridge, NetworkManager Petr Vorel
  2018-11-10  0:25 ` [PATCH 1/2] dnsmasq: Require log files to have .log suffix Chris PeBenito
  0 siblings, 2 replies; 5+ messages in thread
From: Petr Vorel @ 2018-11-07 20:57 UTC (permalink / raw)
  To: selinux-refpolicy; +Cc: Petr Vorel, Chris PeBenito, Dan Walsh

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 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 29d71c91..4c34df3c 100644
--- a/policy/modules/services/dnsmasq.fc
+++ b/policy/modules/services/dnsmasq.fc
@@ -13,7 +13,7 @@
 /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)
 
 /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)
-- 
2.19.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] dnsmasq: Add support for lxc-net, lxd-bridge, NetworkManager
  2018-11-07 20:57 [PATCH 1/2] dnsmasq: Require log files to have .log suffix Petr Vorel
@ 2018-11-07 20:57 ` Petr Vorel
  2018-11-10  0:30   ` Chris PeBenito
  2018-11-10  0:25 ` [PATCH 1/2] dnsmasq: Require log files to have .log suffix Chris PeBenito
  1 sibling, 1 reply; 5+ messages in thread
From: Petr Vorel @ 2018-11-07 20:57 UTC (permalink / raw)
  To: selinux-refpolicy; +Cc: Petr Vorel, Chris PeBenito, Dan Walsh

* 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

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 policy/modules/services/dnsmasq.fc | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/policy/modules/services/dnsmasq.fc b/policy/modules/services/dnsmasq.fc
index 4c34df3c..d1fb367e 100644
--- a/policy/modules/services/dnsmasq.fc
+++ b/policy/modules/services/dnsmasq.fc
@@ -1,5 +1,7 @@
 /etc/dnsmasq\.conf	--	gen_context(system_u:object_r:dnsmasq_etc_t,s0)
 /etc/dnsmasq\.d(/.*)?   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/NetworkManager/dnsmasq.conf   gen_context(system_u:object_r:dnsmasq_etc_t,s0)
 
 /etc/rc\.d/init\.d/dnsmasq	--	gen_context(system_u:object_r:dnsmasq_initrc_exec_t,s0)
 
@@ -10,10 +12,18 @@
 
 /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/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/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)
 
 /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)
+/var/lib/lxd/networks/\.+/dnsmasq.pid	--	gen_context(system_u:object_r:dnsmasq_var_run_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)
-- 
2.19.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] dnsmasq: Require log files to have .log suffix
  2018-11-07 20:57 [PATCH 1/2] dnsmasq: Require log files to have .log suffix Petr Vorel
  2018-11-07 20:57 ` [PATCH 2/2] dnsmasq: Add support for lxc-net, lxd-bridge, NetworkManager Petr Vorel
@ 2018-11-10  0:25 ` Chris PeBenito
  2018-11-12  6:55   ` Petr Vorel
  1 sibling, 1 reply; 5+ messages in thread
From: Chris PeBenito @ 2018-11-10  0:25 UTC (permalink / raw)
  To: Petr Vorel, selinux-refpolicy; +Cc: Dan Walsh

On 11/07/2018 03:57 PM, Petr Vorel wrote:
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>   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 29d71c91..4c34df3c 100644
> --- a/policy/modules/services/dnsmasq.fc
> +++ b/policy/modules/services/dnsmasq.fc
> @@ -13,7 +13,7 @@
>   /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)
>   
>   /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)

This would exclude rotated logs, e.g. something like dnsmasq.log.1 or 
dnsmasq.log.1.gz, which would be undesirable.

-- 
Chris PeBenito

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] dnsmasq: Add support for lxc-net, lxd-bridge, NetworkManager
  2018-11-07 20:57 ` [PATCH 2/2] dnsmasq: Add support for lxc-net, lxd-bridge, NetworkManager Petr Vorel
@ 2018-11-10  0:30   ` Chris PeBenito
  0 siblings, 0 replies; 5+ messages in thread
From: Chris PeBenito @ 2018-11-10  0:30 UTC (permalink / raw)
  To: Petr Vorel, selinux-refpolicy; +Cc: Chris PeBenito, Dan Walsh

On 11/07/2018 03:57 PM, 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
> 
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
>   policy/modules/services/dnsmasq.fc | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/policy/modules/services/dnsmasq.fc b/policy/modules/services/dnsmasq.fc
> index 4c34df3c..d1fb367e 100644
> --- a/policy/modules/services/dnsmasq.fc
> +++ b/policy/modules/services/dnsmasq.fc
> @@ -1,5 +1,7 @@
>   /etc/dnsmasq\.conf	--	gen_context(system_u:object_r:dnsmasq_etc_t,s0)
>   /etc/dnsmasq\.d(/.*)?   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/NetworkManager/dnsmasq.conf   gen_context(system_u:object_r:dnsmasq_etc_t,s0)

Unfortunately there already was some ordering problems in the file (I've 
since fixed them).  These should go with the other /run lines.  Also 
escape the \.conf.


>   /etc/rc\.d/init\.d/dnsmasq	--	gen_context(system_u:object_r:dnsmasq_initrc_exec_t,s0)
>   
> @@ -10,10 +12,18 @@
>   
>   /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/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/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)
>   
>   /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)
> +/var/lib/lxd/networks/\.+/dnsmasq.pid	--	gen_context(system_u:object_r:dnsmasq_var_run_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)

Same thing here with the line placement.



-- 
Chris PeBenito

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] dnsmasq: Require log files to have .log suffix
  2018-11-10  0:25 ` [PATCH 1/2] dnsmasq: Require log files to have .log suffix Chris PeBenito
@ 2018-11-12  6:55   ` Petr Vorel
  0 siblings, 0 replies; 5+ messages in thread
From: Petr Vorel @ 2018-11-12  6:55 UTC (permalink / raw)
  To: Chris PeBenito; +Cc: selinux-refpolicy, Dan Walsh

Hi Chris,

...
> > +++ b/policy/modules/services/dnsmasq.fc
> > @@ -13,7 +13,7 @@
> >   /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)
> >   /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)

> This would exclude rotated logs, e.g. something like dnsmasq.log.1 or
> dnsmasq.log.1.gz, which would be undesirable.

I didn't know dnsmasq need to open logs already handled by logrotate (I thought
logrotate creates these).
But I see apache has similar pattern.

I added the patern in v2:
/var/log/dnsmasq(.*)?\.log(\..+)

Kind regards,
Petr

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-07 20:57 [PATCH 1/2] dnsmasq: Require log files to have .log suffix Petr Vorel
2018-11-07 20:57 ` [PATCH 2/2] dnsmasq: Add support for lxc-net, lxd-bridge, NetworkManager Petr Vorel
2018-11-10  0:30   ` Chris PeBenito
2018-11-10  0:25 ` [PATCH 1/2] dnsmasq: Require log files to have .log suffix Chris PeBenito
2018-11-12  6:55   ` Petr Vorel

SELinux-Refpolicy Archive on lore.kernel.org

Archives are clonable: git clone --mirror https://lore.kernel.org/selinux-refpolicy/0 selinux-refpolicy/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 selinux-refpolicy selinux-refpolicy/ https://lore.kernel.org/selinux-refpolicy \
		selinux-refpolicy@vger.kernel.org selinux-refpolicy@archiver.kernel.org
	public-inbox-index selinux-refpolicy


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.selinux-refpolicy


AGPL code for this site: git clone https://public-inbox.org/ public-inbox