Skip to contentSkip to conversation

MLS unix socket sendto/connectto

refpolicy Christopher J. PeBenito 4 participants 11 messages Nov 4, 2010 – Nov 10, 2010

lore
Share & tools
lore
#0 lore raw

The current MLS constraints for unix socket sendto/connectto are:

# UNIX domain socket ops
mlsconstrain unix_stream_socket connectto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

mlsconstrain unix_dgram_socket sendto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

These were added earlier this year (except the last t2 exception which was added more recently). My concern is with the mlstrustedobject part.
We need an exception like this to handle domains such as syslog, so
they can receive messages from any level. But I think we need a different attribute since domain types are used for the process itself and also it's /proc/pid files, so by making the domain a trusted object, the /proc/pid become trusted objects too. Opinions?

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#1 lore raw
Quoted 21 lines · Christopher J. PeBenito

The current MLS constraints for unix socket sendto/connectto are:

# UNIX domain socket ops
mlsconstrain unix_stream_socket connectto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

mlsconstrain unix_dgram_socket sendto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));
Quoted 7 lines

These were added earlier this year (except the last t2 exception which was added more recently). My concern is with the mlstrustedobject part.
We need an exception like this to handle domains such as syslog, so
they can receive messages from any level. But I think we need a different attribute since domain types are used for the process itself and also it's /proc/pid files, so by making the domain a trusted object, the /proc/pid become trusted objects too. Opinions?

Is there a reason why we don't have transition rules for things like sockets? Granted, they are probably only useful for unix sockets, but I think they could come in handy for things like this where we don't want to start messing around with adding setsockcreatecon() calls to the code.

Signature · 2 lines
paul moore
linux @ hp
#2 lore raw
Quoted 30 lines · Paul Moore
Quoted 21 lines · Christopher J. PeBenito

The current MLS constraints for unix socket sendto/connectto are:

# UNIX domain socket ops
mlsconstrain unix_stream_socket connectto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

mlsconstrain unix_dgram_socket sendto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));
Quoted 7 lines

These were added earlier this year (except the last t2 exception which was added more recently). My concern is with the mlstrustedobject part.
We need an exception like this to handle domains such as syslog, so
they can receive messages from any level. But I think we need a different attribute since domain types are used for the process itself and also it's /proc/pid files, so by making the domain a trusted object, the /proc/pid become trusted objects too. Opinions?

Quoted 5 lines

Is there a reason why we don't have transition rules for things like sockets? Granted, they are probably only useful for unix sockets, but I think they could come in handy for things like this where we don't want to start messing around with adding setsockcreatecon() calls to the code.

I don't understand; how would a transition help here?

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#3 lore raw
Quoted 31 lines · Christopher J. PeBenito
Quoted 30 lines · Paul Moore
Quoted 28 lines · Christopher J. PeBenito

The current MLS constraints for unix socket sendto/connectto are:

# UNIX domain socket ops
mlsconstrain unix_stream_socket connectto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

mlsconstrain unix_dgram_socket sendto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

These were added earlier this year (except the last t2 exception which was added more recently). My concern is with the mlstrustedobject part.
We need an exception like this to handle domains such as syslog, so
they can receive messages from any level. But I think we need a different attribute since domain types are used for the process itself and also it's /proc/pid files, so by making the domain a trusted object, the /proc/pid become trusted objects too. Opinions?

Quoted 7 lines
Quoted 5 lines

Is there a reason why we don't have transition rules for things like sockets? Granted, they are probably only useful for unix sockets, but I think they could come in handy for things like this where we don't want to start messing around with adding setsockcreatecon() calls to the code.

I don't understand; how would a transition help here?

I was thinking that a type transition could be used when /dev/log was created so that it could be created with a new type which we could assign to the mlstrustedobject attribute.

Signature · 2 lines
paul moore
linux @ hp
#4 lore raw
Quoted 38 lines · Paul Moore
Quoted 37 lines · Christopher J. PeBenito
Quoted 35 lines · Paul Moore
Quoted 21 lines · Christopher J. PeBenito

The current MLS constraints for unix socket sendto/connectto are:

# UNIX domain socket ops
mlsconstrain unix_stream_socket connectto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

mlsconstrain unix_dgram_socket sendto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));
Quoted 7 lines

These were added earlier this year (except the last t2 exception which was added more recently). My concern is with the mlstrustedobject part.
We need an exception like this to handle domains such as syslog, so
they can receive messages from any level. But I think we need a different attribute since domain types are used for the process itself and also it's /proc/pid files, so by making the domain a trusted object, the /proc/pid become trusted objects too. Opinions?

Is there a reason why we don't have transition rules for things like sockets? Granted, they are probably only useful for unix sockets, but I think they could come in handy for things like this where we don't want to start messing around with adding setsockcreatecon() calls to the code.

Quoted 5 lines
Quoted 1 line

I don't understand; how would a transition help here?

I was thinking that a type transition could be used when /dev/log was created so that it could be created with a new type which we could assign to the mlstrustedobject attribute.

Wrong check. The check on /dev/log is a sock_file check (eg foo_t to devlog_t). The above constraints are for foo_t to syslogd_t, as an example.

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#5 lore raw
Quoted 39 lines · Christopher J. PeBenito
Quoted 38 lines · Paul Moore
Quoted 37 lines · Christopher J. PeBenito
Quoted 35 lines · Paul Moore
Quoted 21 lines · Christopher J. PeBenito

The current MLS constraints for unix socket sendto/connectto are:

# UNIX domain socket ops
mlsconstrain unix_stream_socket connectto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

mlsconstrain unix_dgram_socket sendto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));
Quoted 7 lines

These were added earlier this year (except the last t2 exception which was added more recently). My concern is with the mlstrustedobject part.
We need an exception like this to handle domains such as syslog, so
they can receive messages from any level. But I think we need a different attribute since domain types are used for the process itself and also it's /proc/pid files, so by making the domain a trusted object, the /proc/pid become trusted objects too. Opinions?

Is there a reason why we don't have transition rules for things like sockets? Granted, they are probably only useful for unix sockets, but I think they could come in handy for things like this where we don't want to start messing around with adding setsockcreatecon() calls to the code.

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

I don't understand; how would a transition help here?

I was thinking that a type transition could be used when /dev/log was created so that it could be created with a new type which we could assign to the mlstrustedobject attribute.

Wrong check. The check on /dev/log is a sock_file check (eg foo_t to devlog_t). The above constraints are for foo_t to syslogd_t, as an example.

Sorry. You were showing the MLS constraints for unix sockets so I thought that is what you were concerned about.

Signature · 2 lines
paul moore
linux @ hp
#6 lore raw
In reply to Christopher J. PeBenito

Thanks, Chris for the clarification. I tend to agree that we should have something different as we don't want this on a process per your proc pid example. Let me think about this a little bit.

-Chad

Quoted 76 lines

-----Original Message-----
From: Christopher J. PeBenito [mailto:cpebenito at tresys.com]
Sent: Friday, November 05, 2010 8:44 AM
To: Paul Moore
Cc: Stephen Smalley; Daniel J Walsh; Chad Hanson; refpolicy at oss.tresys.com
Subject: Re: MLS unix socket sendto/connectto

Quoted 28 lines · Paul Moore
Quoted 27 lines · Christopher J. PeBenito
Quoted 26 lines · Paul Moore
Quoted 25 lines · Christopher J. PeBenito

The current MLS constraints for unix socket sendto/connectto are:

# UNIX domain socket ops
mlsconstrain unix_stream_socket connectto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 
domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 
domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

mlsconstrain unix_dgram_socket sendto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 
domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 
domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

These were added earlier this year (except the last t2 exception which was added more recently). My concern is with the

mlstrustedobject part.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

We need an exception like this to handle domains such

as syslog,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

so they can receive messages from any level. But I

think we need a

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

different attribute since domain types are used for the process itself and also it's /proc/pid files, so by making the domain a trusted object, the /proc/pid become trusted objects

too. Opinions?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Is there a reason why we don't have transition rules for

things like

Quoted 1 line
Quoted 1 line
Quoted 1 line

sockets? Granted, they are probably only useful for unix

sockets,

Quoted 1 line
Quoted 1 line
Quoted 1 line

but I think they could come in handy for things like this

where we

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

don't want to start messing around with adding setsockcreatecon() calls to the code.

I don't understand; how would a transition help here?

I was thinking that a type transition could be used when

/dev/log was

Quoted 2 lines

created so that it could be created with a new type which we could assign to the mlstrustedobject attribute.

Wrong check. The check on /dev/log is a sock_file check (eg foo_t to devlog_t). The above constraints are for foo_t to syslogd_t, as an example.

--
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com

#7 lore raw

Hi SELinux experts,

I read your discussion thread, it seems that we would think about using the type_transition rule to define a new type for the UNIX socket created by a domain, which we could add to the mlstrustedobject attribute, rather than the creator's domain(say syslogd_t) to this attribute(Similar to what the files_xxxx_filetrans() interface does).

Or, alternatively we could call setsockcreratecon() in syslog-ng source code to specify the new type for the socket syslogd created, but as Paul suggested, this would mean that we would have to mess around the userspace applications by adding the call of setsockcreratecon().

Have I got it?

Thanks,
Harry

Quoted 88 lines

Date: Fri, 5 Nov 2010 09:53:39 -0400
From: chanson at TrustedCS.com
To: cpebenito at tresys.com; paul.moore at hp.com
CC: refpolicy at oss.tresys.com
Subject: Re: [refpolicy] MLS unix socket sendto/connectto

Thanks, Chris for the clarification. I tend to agree that we should have something different as we don't want this on a process per your proc pid example. Let me think about this a little bit.

-Chad

Quoted 71 lines

-----Original Message-----
From: Christopher J. PeBenito [mailto:cpebenito at tresys.com]
Sent: Friday, November 05, 2010 8:44 AM
To: Paul Moore
Cc: Stephen Smalley; Daniel J Walsh; Chad Hanson; refpolicy at oss.tresys.com
Subject: Re: MLS unix socket sendto/connectto

Quoted 28 lines · Paul Moore
Quoted 27 lines · Christopher J. PeBenito
Quoted 26 lines · Paul Moore
Quoted 25 lines · Christopher J. PeBenito

The current MLS constraints for unix socket sendto/connectto are:

# UNIX domain socket ops
mlsconstrain unix_stream_socket connectto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 
domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 
domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

mlsconstrain unix_dgram_socket sendto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 
domby
h2 )) or
         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 
domby l2
)) or
         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

These were added earlier this year (except the last t2 exception which was added more recently). My concern is with the

mlstrustedobject part.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

We need an exception like this to handle domains such

as syslog,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

so they can receive messages from any level. But I

think we need a

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

different attribute since domain types are used for the process itself and also it's /proc/pid files, so by making the domain a trusted object, the /proc/pid become trusted objects

too. Opinions?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Is there a reason why we don't have transition rules for

things like

Quoted 1 line
Quoted 1 line
Quoted 1 line

sockets? Granted, they are probably only useful for unix

sockets,

Quoted 1 line
Quoted 1 line
Quoted 1 line

but I think they could come in handy for things like this

where we

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

don't want to start messing around with adding setsockcreatecon() calls to the code.

I don't understand; how would a transition help here?

I was thinking that a type transition could be used when

/dev/log was

Quoted 2 lines

created so that it could be created with a new type which we could assign to the mlstrustedobject attribute.

Wrong check. The check on /dev/log is a sock_file check (eg foo_t to devlog_t). The above constraints are for foo_t to syslogd_t, as an example.

Quoted 5 lines

--
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com

Quoted 4 lines

_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://oss.tresys.com/pipermail/refpolicy/attachments/20101110/8fff1883/attachment.html

#8 lore raw
Quoted 5 lines · HarryCiao

I read your discussion thread, it seems that we would think about using the type_transition rule to define a new type for the UNIX socket created by a domain, which we could add to the mlstrustedobject attribute, rather than the creator's domain(say syslogd_t) to this attribute(Similar to what the files_xxxx_filetrans() interface does).

The problem is that there isn't a container or related type to transition over. For example, for syslog's socket there is the following type_transition:

type_transition syslogd_t device_t:sock_file devlog_t;

in this case, device_t is the type of the directory in which syslog creates the socket. But what would be the related type for sockets?

Quoted 4 lines

Or, alternatively we could call setsockcreratecon() in syslog-ng source code to specify the new type for the socket syslogd created, but as Paul suggested, this would mean that we would have to mess around the userspace applications by adding the call of setsockcreratecon().

Correct, we'd rather not require all syslog daemons to be modified so they work right with the policy.

Quoted 98 lines

Have I got it?

Thanks,
Harry

Quoted 87 lines

Date: Fri, 5 Nov 2010 09:53:39 -0400
From: chanson at TrustedCS.com
To: cpebenito at tresys.com; paul.moore at hp.com
CC: refpolicy at oss.tresys.com
Subject: Re: [refpolicy] MLS unix socket sendto/connectto

Thanks, Chris for the clarificatio n. I tend to agree that we should have something different as we don't want this on a process per your proc pid example. Let me think about this a little bit.

-Chad

Quoted 70 lines

-----Original Message-----
From: Christopher J. PeBenito [mailto:cpebenito at tresys.com]
Sent: Friday, November 05, 2010 8:44 AM
To: Paul Moore
Cc: Stephen Smalley; Daniel J Walsh; Chad Hanson; refpolicy at oss.tresys.com
Subject: Re: MLS unix socket sendto/connectto

Quoted 27 lines · Paul Moore
Quoted 26 lines · Christopher J. PeBenito
Quoted 25 lines · Paul Moore
Quoted 24 lines · Christopher J. PeBenito

The current MLS constraints for unix socket sendto/connectto are:
*> > >>>> # UNIX domain socket ops
mlsconstrain unix_stream_socket connectto
(( l1 eq l2 ) or
(( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
(( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
( t1 == mlsnetwrite ) or
( t2 == mlstrustedobject ));

mlsconstrain unix_dgram_socket sendto
(( l1 eq l2 ) or
(( t1 == mlsnetwriteranged ) and ( l1 dom l2 ) and ( l1 domby
h2 )) or
(( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) and ( l1 domby l2
)) or
( t1 == mlsnetwrite ) or
( t2 == mlstrustedobject ));

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

These were added earlier this year (except the last t2 exception which was added more recently). My concern is with the

mlstrustedobject part.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

We need an exception like this to handle domains such

as syslog,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

so they can receive messages from any level. But I

think we need a

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

different attribute since domain types are used for the process itself and also it's /proc/pid files, so by making the domain a trusted object, the /proc/pid become trusted objects

too. Opinions?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Is there a reason why we don't have transition rules for

things like

Quoted 1 line
Quoted 1 line
Quoted 1 line

sockets? Granted, they are probably only useful for unix

sockets,

Quoted 1 line
Quoted 1 line
Quoted 1 line

but I think they could come in handy for things like this

where we

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

don't want to start messing around with adding setsockcreatecon() calls to the code.

I don't understand; how would a transition help here?

I was thinking that a type transition could be used when

/dev/log was

Quoted 2 lines

created so that it could be created with a new type which we could assign to the mlstrustedobject attribute.

Wrong check. The check on /dev /log is a sock_file check (eg foo_t to devlog_t). The above constraints are for foo_t to syslogd_t, as an example.

Quoted 5 lines

--
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com

Quoted 4 lines

_______________________________________________
refpolicy mailing list
refpolicy at oss.tresys.com
http://oss.tresys.com/mailman/listinfo/refpolicy

*

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com
#9 lore raw
In reply to Christopher J. PeBenito

I'm actually thinking we want to have a new attribute, like mlstrustedsocket or mlstrustedunixsocket, to replace the mlstrustedobject on these constraints. I agree with the earlier comments that mlstrustedobject doesn't seem right for this constraint. I would say this because the most of the time the "object" of these unix domain sockets constraints is a process (domain) which is not desired to be a trusted object.

This would simplify your policy changes as well.

-Chad

Quoted 102 lines

-----Original Message-----
From: Chad Hanson
Sent: Friday, November 05, 2010 9:54 AM
To: 'Christopher J. PeBenito'; Paul Moore
Cc: Stephen Smalley; Daniel J Walsh; refpolicy at oss.tresys.com
Subject: RE: MLS unix socket sendto/connectto

Thanks, Chris for the clarification. I tend to agree that we should have something different as we don't want this on a process per your proc pid example. Let me think about this a little bit.

-Chad

Quoted 12 lines

-----Original Message-----
From: Christopher J. PeBenito [mailto:cpebenito at tresys.com]
Sent: Friday, November 05, 2010 8:44 AM
To: Paul Moore
Cc: Stephen Smalley; Daniel J Walsh; Chad Hanson; refpolicy at oss.tresys.com
Subject: Re: MLS unix socket sendto/connectto

Quoted 3 lines · Paul Moore
Quoted 2 lines · Christopher J. PeBenito
Quoted 1 line · Paul Moore

On Thu, 2010-11-04 at 09:19 -0400, Christopher J.

Quoted 1 line · PeBenito
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

The current MLS constraints for unix socket

sendto/connectto are:

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

# UNIX domain socket ops
mlsconstrain unix_stream_socket connectto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 

) and ( l1

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

domby
h2 )) or

         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) 

and ( l1

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

domby l2
)) or

         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

mlsconstrain unix_dgram_socket sendto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 

) and ( l1

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

domby
h2 )) or

         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) 

and ( l1

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

domby l2
)) or

         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

These were added earlier this year (except the last t2

exception

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

which was added more recently). My concern is with the

mlstrustedobject part.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

We need an exception like this to handle domains such

as syslog,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

so they can receive messages from any level. But I

think we need a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

different attribute since domain types are used for

the process

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

itself and also it's /proc/pid files, so by making the

domain a

Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

trusted object, the /proc/pid become trusted objects

too. Opinions?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Is there a reason why we don't have transition rules for

things like

Quoted 1 line
Quoted 1 line
Quoted 1 line

sockets? Granted, they are probably only useful for unix

sockets,

Quoted 1 line
Quoted 1 line
Quoted 1 line

but I think they could come in handy for things like this

where we

Quoted 1 line
Quoted 1 line
Quoted 1 line

don't want to start messing around with adding

setsockcreatecon()

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

calls to the code.

I don't understand; how would a transition help here?

I was thinking that a type transition could be used when

/dev/log was

Quoted 1 line

created so that it could be created with a new type which

we could

Quoted 3 lines
Quoted 1 line

assign to the mlstrustedobject attribute.

Wrong check. The check on /dev/log is a sock_file check

(eg foo_t to

Quoted 10 lines

devlog_t). The above constraints are for foo_t to syslogd_t, as an example.

--
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com

#10 lore raw

I think I would go with mlstrustedsocket, in case we end up needing it for other socket types.

Quoted 114 lines · chanson at TrustedCS.com

I'm actually thinking we want to have a new attribute, like mlstrustedsocket or mlstrustedunixsocket, to replace the mlstrustedobject on these constraints. I agree with the earlier comments that mlstrustedobject doesn't seem right for this constraint. I would say this because the most of the time the "object" of these unix domain sockets constraints is a process (domain) which is not desired to be a trusted object.

This would simplify your policy changes as well.

-Chad

Quoted 102 lines

-----Original Message-----
From: Chad Hanson
Sent: Friday, November 05, 2010 9:54 AM
To: 'Christopher J. PeBenito'; Paul Moore
Cc: Stephen Smalley; Daniel J Walsh; refpolicy at oss.tresys.com
Subject: RE: MLS unix socket sendto/connectto

Thanks, Chris for the clarification. I tend to agree that we should have something different as we don't want this on a process per your proc pid example. Let me think about this a little bit.

-Chad

Quoted 12 lines

-----Original Message-----
From: Christopher J. PeBenito [mailto:cpebenito at tresys.com]
Sent: Friday, November 05, 2010 8:44 AM
To: Paul Moore
Cc: Stephen Smalley; Daniel J Walsh; Chad Hanson; refpolicy at oss.tresys.com
Subject: Re: MLS unix socket sendto/connectto

Quoted 3 lines · Paul Moore
Quoted 2 lines · Christopher J. PeBenito
Quoted 1 line · Paul Moore

On Thu, 2010-11-04 at 09:19 -0400, Christopher J.

Quoted 1 line · PeBenito
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

The current MLS constraints for unix socket

sendto/connectto are:

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

# UNIX domain socket ops
mlsconstrain unix_stream_socket connectto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 

) and ( l1

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

domby
h2 )) or

         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) 

and ( l1

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

domby l2
)) or

         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

mlsconstrain unix_dgram_socket sendto

        (( l1 eq l2 ) or
         (( t1 == mlsnetwriteranged ) and ( l1 dom l2 

) and ( l1

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

domby
h2 )) or

         (( t1 == mlsnetwritetoclr ) and ( h1 dom l2 ) 

and ( l1

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

domby l2
)) or

         ( t1 == mlsnetwrite ) or
         ( t2 == mlstrustedobject ));

These were added earlier this year (except the last t2

exception

Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

which was added more recently). My concern is with the

mlstrustedobject part.

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

We need an exception like this to handle domains such

as syslog,

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

so they can receive messages from any level. But I

think we need a

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

different attribute since domain types are used for

the process

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

itself and also it's /proc/pid files, so by making the

domain a

Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

trusted object, the /proc/pid become trusted objects

too. Opinions?

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

Is there a reason why we don't have transition rules for

things like

Quoted 1 line
Quoted 1 line
Quoted 1 line

sockets? Granted, they are probably only useful for unix

sockets,

Quoted 1 line
Quoted 1 line
Quoted 1 line

but I think they could come in handy for things like this

where we

Quoted 1 line
Quoted 1 line
Quoted 1 line

don't want to start messing around with adding

setsockcreatecon()

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

calls to the code.

I don't understand; how would a transition help here?

I was thinking that a type transition could be used when

/dev/log was

Quoted 1 line

created so that it could be created with a new type which

we could

Quoted 3 lines
Quoted 1 line

assign to the mlstrustedobject attribute.

Wrong check. The check on /dev/log is a sock_file check

(eg foo_t to

Quoted 10 lines

devlog_t). The above constraints are for foo_t to syslogd_t, as an example.

--
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com

Signature · 3 lines
Chris PeBenito
Tresys Technology, LLC
www.tresys.com | oss.tresys.com