SELinux-Refpolicy Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] Add interface to allow relabeling of iso 9660 filesystems.
@ 2019-03-05 22:32 Sugar, David
  2019-03-06  8:20 ` Dominick Grift
  2019-03-07 23:55 ` Chris PeBenito
  0 siblings, 2 replies; 4+ messages in thread
From: Sugar, David @ 2019-03-05 22:32 UTC (permalink / raw)
  To: selinux-refpolicy

I have a case where I'm labeling media with my own types to control
access.  But that is requiring that I relabel from iso9660_t to my
own type.  This interface allows that relabel.

type=AVC msg=audit(1551621984.372:919): avc:  denied  { relabelfrom } for  pid=9717 comm="mount" scontext=staff_u:staff_r:mymedia_sudo_t:s0-s0:c0.c1023 tcontext=system_u:object_r:iso9660_t:s0 tclass=filesystem permissive=0

Signed-off-by: Dave Sugar <dsugar@tresys.com>
---
 policy/modules/kernel/filesystem.if | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/policy/modules/kernel/filesystem.if b/policy/modules/kernel/filesystem.if
index 048b9d65..a22cb6ba 100644
--- a/policy/modules/kernel/filesystem.if
+++ b/policy/modules/kernel/filesystem.if
@@ -2505,6 +2505,25 @@ interface(`fs_remount_iso9660_fs',`
 	allow $1 iso9660_t:filesystem remount;
 ')
 
+########################################
+## <summary>
+##	Allow changing of the label of a
+##	filesystem with iso9660 type
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`fs_relabelfrom_iso9660_fs',`
+	gen_require(`
+		type iso9660_t;
+	')
+
+	allow $1 iso9660_t:filesystem relabelfrom;
+')
+
 ########################################
 ## <summary>
 ##	Unmount an iso9660 filesystem, which
-- 
2.20.1


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

* Re: [PATCH] Add interface to allow relabeling of iso 9660 filesystems.
  2019-03-05 22:32 [PATCH] Add interface to allow relabeling of iso 9660 filesystems Sugar, David
@ 2019-03-06  8:20 ` Dominick Grift
  2019-03-06 14:18   ` Sugar, David
  2019-03-07 23:55 ` Chris PeBenito
  1 sibling, 1 reply; 4+ messages in thread
From: Dominick Grift @ 2019-03-06  8:20 UTC (permalink / raw)
  To: Sugar\, David; +Cc: selinux-refpolicy\

"Sugar, David" <dsugar@tresys.com> writes:

> I have a case where I'm labeling media with my own types to control
> access.  But that is requiring that I relabel from iso9660_t to my
> own type.  This interface allows that relabel.

Not sure why you would want this as iso9600 is read-only any way, I
suppose you want to block read access for entities that can already read iso9660.

>
> type=AVC msg=audit(1551621984.372:919): avc:  denied  { relabelfrom } for  pid=9717 comm="mount" scontext=staff_u:staff_r:mymedia_sudo_t:s0-s0:c0.c1023 tcontext=system_u:object_r:iso9660_t:s0 tclass=filesystem permissive=0
>
> Signed-off-by: Dave Sugar <dsugar@tresys.com>
> ---
>  policy/modules/kernel/filesystem.if | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/policy/modules/kernel/filesystem.if b/policy/modules/kernel/filesystem.if
> index 048b9d65..a22cb6ba 100644
> --- a/policy/modules/kernel/filesystem.if
> +++ b/policy/modules/kernel/filesystem.if
> @@ -2505,6 +2505,25 @@ interface(`fs_remount_iso9660_fs',`
>  	allow $1 iso9660_t:filesystem remount;
>  ')
>  
> +########################################
> +## <summary>
> +##	Allow changing of the label of a
> +##	filesystem with iso9660 type
> +## </summary>
> +## <param name="domain">
> +##	<summary>
> +##	Domain allowed access.
> +##	</summary>
> +## </param>
> +#
> +interface(`fs_relabelfrom_iso9660_fs',`
> +	gen_require(`
> +		type iso9660_t;
> +	')
> +
> +	allow $1 iso9660_t:filesystem relabelfrom;
> +')
> +
>  ########################################
>  ## <summary>
>  ##	Unmount an iso9660 filesystem, which

-- 
Key fingerprint = 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02
https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02
Dominick Grift

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

* Re: [PATCH] Add interface to allow relabeling of iso 9660 filesystems.
  2019-03-06  8:20 ` Dominick Grift
@ 2019-03-06 14:18   ` Sugar, David
  0 siblings, 0 replies; 4+ messages in thread
From: Sugar, David @ 2019-03-06 14:18 UTC (permalink / raw)
  To: Dominick Grift; +Cc: selinux-refpolicy



On 3/6/19 3:20 AM, Dominick Grift wrote:
> "Sugar, David" <dsugar@tresys.com> writes:
> 
>> I have a case where I'm labeling media with my own types to control
>> access.  But that is requiring that I relabel from iso9660_t to my
>> own type.  This interface allows that relabel.
> 
> Not sure why you would want this as iso9600 is read-only any way, I
> suppose you want to block read access for entities that can already read iso9660.
> 

In what I am working on I have to support encrypted USB devices.  Many 
of these devices work by first presenting a read-only partition.  It 
shows up as /dev/sr#.  This partition is used to unlock the encrypted 
partition (which then shows up as /dev/sd*#).

When mounting the read-only partition I'm providing a specific context 
to the mount command.  I think during the mount it initially gets the 
context iso9660_t and then relabels from that to my context.  Note that 
I am not transitioning to the call to mount, but running mount in my domain.

And I kind of do want to keep other domains from accessing this mounted 
partition.

>>
>> type=AVC msg=audit(1551621984.372:919): avc:  denied  { relabelfrom } for  pid=9717 comm="mount" scontext=staff_u:staff_r:mymedia_sudo_t:s0-s0:c0.c1023 tcontext=system_u:object_r:iso9660_t:s0 tclass=filesystem permissive=0
>>
>> Signed-off-by: Dave Sugar <dsugar@tresys.com>
>> ---
>>   policy/modules/kernel/filesystem.if | 19 +++++++++++++++++++
>>   1 file changed, 19 insertions(+)
>>
>> diff --git a/policy/modules/kernel/filesystem.if b/policy/modules/kernel/filesystem.if
>> index 048b9d65..a22cb6ba 100644
>> --- a/policy/modules/kernel/filesystem.if
>> +++ b/policy/modules/kernel/filesystem.if
>> @@ -2505,6 +2505,25 @@ interface(`fs_remount_iso9660_fs',`
>>   	allow $1 iso9660_t:filesystem remount;
>>   ')
>>   
>> +########################################
>> +## <summary>
>> +##	Allow changing of the label of a
>> +##	filesystem with iso9660 type
>> +## </summary>
>> +## <param name="domain">
>> +##	<summary>
>> +##	Domain allowed access.
>> +##	</summary>
>> +## </param>
>> +#
>> +interface(`fs_relabelfrom_iso9660_fs',`
>> +	gen_require(`
>> +		type iso9660_t;
>> +	')
>> +
>> +	allow $1 iso9660_t:filesystem relabelfrom;
>> +')
>> +
>>   ########################################
>>   ## <summary>
>>   ##	Unmount an iso9660 filesystem, which
> 

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

* Re: [PATCH] Add interface to allow relabeling of iso 9660 filesystems.
  2019-03-05 22:32 [PATCH] Add interface to allow relabeling of iso 9660 filesystems Sugar, David
  2019-03-06  8:20 ` Dominick Grift
@ 2019-03-07 23:55 ` Chris PeBenito
  1 sibling, 0 replies; 4+ messages in thread
From: Chris PeBenito @ 2019-03-07 23:55 UTC (permalink / raw)
  To: Sugar, David, selinux-refpolicy

On 3/5/19 5:32 PM, Sugar, David wrote:
> I have a case where I'm labeling media with my own types to control
> access.  But that is requiring that I relabel from iso9660_t to my
> own type.  This interface allows that relabel.
> 
> type=AVC msg=audit(1551621984.372:919): avc:  denied  { relabelfrom } for  pid=9717 comm="mount" scontext=staff_u:staff_r:mymedia_sudo_t:s0-s0:c0.c1023 tcontext=system_u:object_r:iso9660_t:s0 tclass=filesystem permissive=0
> 
> Signed-off-by: Dave Sugar <dsugar@tresys.com>
> ---
>   policy/modules/kernel/filesystem.if | 19 +++++++++++++++++++
>   1 file changed, 19 insertions(+)
> 
> diff --git a/policy/modules/kernel/filesystem.if b/policy/modules/kernel/filesystem.if
> index 048b9d65..a22cb6ba 100644
> --- a/policy/modules/kernel/filesystem.if
> +++ b/policy/modules/kernel/filesystem.if
> @@ -2505,6 +2505,25 @@ interface(`fs_remount_iso9660_fs',`
>   	allow $1 iso9660_t:filesystem remount;
>   ')
>   
> +########################################
> +## <summary>
> +##	Allow changing of the label of a
> +##	filesystem with iso9660 type
> +## </summary>
> +## <param name="domain">
> +##	<summary>
> +##	Domain allowed access.
> +##	</summary>
> +## </param>
> +#
> +interface(`fs_relabelfrom_iso9660_fs',`
> +	gen_require(`
> +		type iso9660_t;
> +	')
> +
> +	allow $1 iso9660_t:filesystem relabelfrom;
> +')
> +
>   ########################################
>   ## <summary>
>   ##	Unmount an iso9660 filesystem, which

Merged.

-- 
Chris PeBenito

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-05 22:32 [PATCH] Add interface to allow relabeling of iso 9660 filesystems Sugar, David
2019-03-06  8:20 ` Dominick Grift
2019-03-06 14:18   ` Sugar, David
2019-03-07 23:55 ` Chris PeBenito

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