* questions about persistent storage of security contexts
@ 2008-07-21 23:10 Andrew Warner
2008-07-22 0:35 ` Eric Paris
0 siblings, 1 reply; 11+ messages in thread
From: Andrew Warner @ 2008-07-21 23:10 UTC (permalink / raw)
To: selinux
[-- Attachment #1: Type: text/plain, Size: 2166 bytes --]
Hello,
I am currently developing an "SELinux aware" DBMS (primarily TE and MLS)
that is characterized by:
1. The need to store a security context (in some recoverable form) in
our persistent database (storage size of the context is an important factor)
2. The need to frequently perform a high number of security access
checks in a performance sensitive way
My question relates to the first characteristic from above. I am having
trouble deciding on the best way to store the security context in the
database. From my research I see (I think!) three different
representations for a security context: 1) string; 2) raw; 3) SID.
The string representation, generally, seems clear as this is what is
shown in all documentation as the context representation that exists in
user space. My only question regarding the string representation is: is
there is any hard limit to the length of the security context string? Do
I need to allow for no theoretical size limit on a context string if I
choose to store it?
I am inferring the the raw representation exists from seeing *_raw
functions (e.g., security_compute_create_raw) referenced in selinux
header files. Other than seeing these functions declared I am having
trouble finding out much about a raw representation. Is there any
advantage to storing/manipulating a context in its raw representation?
That is, are they more suited for a fast security access check, are they
smaller in size, or do they have a fixed or maximum length?
The SID I have also seen mentioned in various documentations but can
determine little about them. My guess is that they are an integer value
that is used for fast internal access, particularly for the AVC. Are
SIDs indeed integer values? Are they persistent or are they meaningful
only for a particular OS session?
I have also considered maintaining my own internal, persistent mapping
between string based contexts and an integer representation, the mapping
being stored/indexed inside the DBMS. This gives me a small storage
overhead with a fixed size.
Any answers, pointers to documentation, or other help would be greatly
appreciated!
Andy Warner
[-- Attachment #2: Type: text/html, Size: 2510 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: questions about persistent storage of security contexts
2008-07-21 23:10 questions about persistent storage of security contexts Andrew Warner
@ 2008-07-22 0:35 ` Eric Paris
2008-07-22 1:40 ` KaiGai Kohei
2008-07-22 2:01 ` Stephen Smalley
0 siblings, 2 replies; 11+ messages in thread
From: Eric Paris @ 2008-07-22 0:35 UTC (permalink / raw)
To: Andrew Warner; +Cc: selinux
On Mon, Jul 21, 2008 at 7:10 PM, Andrew Warner <warner@rubix.com> wrote:
> Hello,
>
> I am currently developing an "SELinux aware" DBMS (primarily TE and MLS)
> that is characterized by:
>
> 1. The need to store a security context (in some recoverable form) in our
> persistent database (storage size of the context is an important factor)
> 2. The need to frequently perform a high number of security access checks in
> a performance sensitive way
>
> My question relates to the first characteristic from above. I am having
> trouble deciding on the best way to store the security context in the
> database. From my research I see (I think!) three different representations
> for a security context: 1) string; 2) raw; 3) SID.
>
> The string representation, generally, seems clear as this is what is shown
> in all documentation as the context representation that exists in user
> space. My only question regarding the string representation is: is there is
> any hard limit to the length of the security context string? Do I need to
> allow for no theoretical size limit on a context string if I choose to store
> it?
No hard limit that I can think of. There might be one somewhere but I
wouldn't count on it.
> I am inferring the the raw representation exists from seeing *_raw functions
> (e.g., security_compute_create_raw) referenced in selinux header files.
> Other than seeing these functions declared I am having trouble finding out
> much about a raw representation. Is there any advantage to
> storing/manipulating a context in its raw representation? That is, are they
> more suited for a fast security access check, are they smaller in size, or
> do they have a fixed or maximum length?
The _raw is actually what you want. _raw basically just means strings
without any translations from things like mcstransd. Given a context
like user_u:role_r:type_t the "raw" on an MLS system maybe
"user_u:object_r:type_t::s0." Throwing a context with the MLS portion
attched at the !raw functions will work just fine.
> The SID I have also seen mentioned in various documentations but can
> determine little about them. My guess is that they are an integer value that
> is used for fast internal access, particularly for the AVC. Are SIDs indeed
> integer values? Are they persistent or are they meaningful only for a
> particular OS session?
That's exactly what they are. They are kernel internal integer
representations that are (for the most part) only meaningful for that
session. There are some 'initial sids' that are always the same, but
no userspace app should care about 'sids' in the general sense.
> I have also considered maintaining my own internal, persistent mapping
> between string based contexts and an integer representation, the mapping
> being stored/indexed inside the DBMS. This gives me a small storage overhead
> with a fixed size.
I don't have a problem with internal mapping like that.
But, don't we already have sepostgresql? Maybe you should be looking
to see if that fits your needs or you might get ideas from the work
that they performed?
-Eric
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: questions about persistent storage of security contexts
2008-07-22 0:35 ` Eric Paris
@ 2008-07-22 1:40 ` KaiGai Kohei
2008-07-22 10:39 ` Andrew Warner
2008-07-22 2:01 ` Stephen Smalley
1 sibling, 1 reply; 11+ messages in thread
From: KaiGai Kohei @ 2008-07-22 1:40 UTC (permalink / raw)
To: Andrew Warner; +Cc: Eric Paris, selinux
>> I have also considered maintaining my own internal, persistent mapping
>> between string based contexts and an integer representation, the mapping
>> being stored/indexed inside the DBMS. This gives me a small storage overhead
>> with a fixed size.
>
> I don't have a problem with internal mapping like that.
In SE-PostgreSQL, it maintains own internal mapping between text represented
security context and its integer identifier. The 'pg_security' system catalog
stores the pair of them.
Any tuple (including system catalog) has its security context. It is stored
within padding area of HeapTupleHeader as an integer value, and it means the
primary key of 'pg_security' system catalog.
It also enables to boost userspace AVC, because this idea makes possible to
implement it using a relationship between identifiers (not a text representation).
When the security policy is reloaded and it makes invalidate the stored context,
the stored one is dealt as 'unlabeled_t'.
> But, don't we already have sepostgresql? Maybe you should be looking
> to see if that fits your needs or you might get ideas from the work
> that they performed?
FYI:
http://code.google.com/p/sepgsql/
Andrew, what is your intended base RDBMS?
Currently, SE-PostgreSQL is the only SELinux awared RDBMS.
It is now under reviewing for the next release (v8.4) cycle.
http://wiki.postgresql.org/wiki/CommitFest:2008-07
However, I think we can apply SELinux for any other relational model implementation.
Thanks,
--
OSS Platform Development Division, NEC
KaiGai Kohei <kaigai@ak.jp.nec.com>
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: questions about persistent storage of security contexts
2008-07-22 0:35 ` Eric Paris
2008-07-22 1:40 ` KaiGai Kohei
@ 2008-07-22 2:01 ` Stephen Smalley
2008-07-22 11:58 ` Andy Warner
1 sibling, 1 reply; 11+ messages in thread
From: Stephen Smalley @ 2008-07-22 2:01 UTC (permalink / raw)
To: Eric Paris; +Cc: Andrew Warner, selinux
On Mon, 2008-07-21 at 20:35 -0400, Eric Paris wrote:
> On Mon, Jul 21, 2008 at 7:10 PM, Andrew Warner <warner@rubix.com> wrote:
> > Hello,
> >
> > I am currently developing an "SELinux aware" DBMS (primarily TE and MLS)
> > that is characterized by:
> >
> > 1. The need to store a security context (in some recoverable form) in our
> > persistent database (storage size of the context is an important factor)
> > 2. The need to frequently perform a high number of security access checks in
> > a performance sensitive way
> >
> > My question relates to the first characteristic from above. I am having
> > trouble deciding on the best way to store the security context in the
> > database. From my research I see (I think!) three different representations
> > for a security context: 1) string; 2) raw; 3) SID.
> >
> > The string representation, generally, seems clear as this is what is shown
> > in all documentation as the context representation that exists in user
> > space. My only question regarding the string representation is: is there is
> > any hard limit to the length of the security context string? Do I need to
> > allow for no theoretical size limit on a context string if I choose to store
> > it?
>
> No hard limit that I can think of. There might be one somewhere but I
> wouldn't count on it.
Correct - the core logic imposes no fixed limits on the context strings,
although the kernel interfaces do impose certain practical limits (e.g.
page size). The NFSv4 support will likewise impose certain limits in
accordance with existing limits on the size of containing structures.
> > I am inferring the the raw representation exists from seeing *_raw functions
> > (e.g., security_compute_create_raw) referenced in selinux header files.
> > Other than seeing these functions declared I am having trouble finding out
> > much about a raw representation. Is there any advantage to
> > storing/manipulating a context in its raw representation? That is, are they
> > more suited for a fast security access check, are they smaller in size, or
> > do they have a fixed or maximum length?
>
> The _raw is actually what you want. _raw basically just means strings
> without any translations from things like mcstransd. Given a context
> like user_u:role_r:type_t the "raw" on an MLS system maybe
> "user_u:object_r:type_t::s0." Throwing a context with the MLS portion
> attched at the !raw functions will work just fine.
>
> > The SID I have also seen mentioned in various documentations but can
> > determine little about them. My guess is that they are an integer value that
> > is used for fast internal access, particularly for the AVC. Are SIDs indeed
> > integer values? Are they persistent or are they meaningful only for a
> > particular OS session?
>
> That's exactly what they are. They are kernel internal integer
> representations that are (for the most part) only meaningful for that
> session. There are some 'initial sids' that are always the same, but
> no userspace app should care about 'sids' in the general sense.
>
> > I have also considered maintaining my own internal, persistent mapping
> > between string based contexts and an integer representation, the mapping
> > being stored/indexed inside the DBMS. This gives me a small storage overhead
> > with a fixed size.
>
> I don't have a problem with internal mapping like that.
The original SELinux filesystem labeling implementation used something
like that - they were called "persistent security identifiers" (PSIDs),
and were maintained as private indices per-filesystem that mapped to
security context strings.
> But, don't we already have sepostgresql? Maybe you should be looking
> to see if that fits your needs or you might get ideas from the work
> that they performed?
Yes, I'd recommend looking at SE-PostgreSQL as a worked example of
applying the Flask architecture to a DBMS, including not only its
approach to storing security contexts but also its approach to the
userspace AVC. You can find a link to that work from the Related Work
page off of the SELinux web site.
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: questions about persistent storage of security contexts
2008-07-22 1:40 ` KaiGai Kohei
@ 2008-07-22 10:39 ` Andrew Warner
2008-07-22 11:13 ` KaiGai Kohei
0 siblings, 1 reply; 11+ messages in thread
From: Andrew Warner @ 2008-07-22 10:39 UTC (permalink / raw)
To: KaiGai Kohei; +Cc: Eric Paris, selinux
[-- Attachment #1: Type: text/plain, Size: 3336 bytes --]
Thanks for the information. I have previously looked at the
SE-PostgreSQL code/documentation. It was helpful and most interesting.
The base DBMS I am using is called Trusted RUBIX, which is an CC EAL-4
(Trusted Solaris) evaluated MLS DBMS. We have been contracted to
integrate SELinux TE and MLS (Red Hat flavor) into our DBMS. So,
obviously using SE-PostgreSQL is not an option :-) In the bigger
picture, this current work is a small (and rather detached) step towards
a high robustness (EAL-6+) DBMS solution.
Historically, our company (and myself personally) have been involved in
high(er) assurance MLS DBMS products/research for a number of years. As
such, we tend to use a more "traditional" minimized trust, reference
monitor architecture as opposed to inserting hooks and using query
modification for our security enforcement. This means, for instance,
that a label object permeates much of our kernel code at a fairly low
level as well as storage objects. Thus, the runtime and storage
representation must be chosen carefully as it will touch much of our
kernel code. We also support full polyinstantiation of named objects,
which dictates an efficient label mechanism. (Integration of TE + MLS
into traditional MLS polyinstantiation behavior is an interesting topic!)
Out of curiosity, KaiGai, a question about how SE-PostgreSQL presents
the security context to a user. From your security guide I see that the
context is a selectable column. But, what SQL type is the column? For
instance, do you define your own SQL type, such as "Security Context" or
is it a VARCHAR that has special constraints placed upon it to force it
to conform to the structure of a security context?
Blessings,
Andy
KaiGai Kohei wrote:
>>> I have also considered maintaining my own internal, persistent mapping
>>> between string based contexts and an integer representation, the
>>> mapping
>>> being stored/indexed inside the DBMS. This gives me a small storage
>>> overhead
>>> with a fixed size.
>>
>> I don't have a problem with internal mapping like that.
>
> In SE-PostgreSQL, it maintains own internal mapping between text
> represented
> security context and its integer identifier. The 'pg_security' system
> catalog
> stores the pair of them.
>
> Any tuple (including system catalog) has its security context. It is
> stored
> within padding area of HeapTupleHeader as an integer value, and it
> means the
> primary key of 'pg_security' system catalog.
>
> It also enables to boost userspace AVC, because this idea makes
> possible to
> implement it using a relationship between identifiers (not a text
> representation).
>
>
> When the security policy is reloaded and it makes invalidate the
> stored context,
> the stored one is dealt as 'unlabeled_t'.
>
>> But, don't we already have sepostgresql? Maybe you should be looking
>> to see if that fits your needs or you might get ideas from the work
>> that they performed?
>
> FYI:
> http://code.google.com/p/sepgsql/
>
> Andrew, what is your intended base RDBMS?
>
> Currently, SE-PostgreSQL is the only SELinux awared RDBMS.
> It is now under reviewing for the next release (v8.4) cycle.
> http://wiki.postgresql.org/wiki/CommitFest:2008-07
>
> However, I think we can apply SELinux for any other relational model
> implementation.
>
> Thanks,
[-- Attachment #2: Type: text/html, Size: 4169 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: questions about persistent storage of security contexts
2008-07-22 10:39 ` Andrew Warner
@ 2008-07-22 11:13 ` KaiGai Kohei
2008-07-22 11:34 ` Andy Warner
0 siblings, 1 reply; 11+ messages in thread
From: KaiGai Kohei @ 2008-07-22 11:13 UTC (permalink / raw)
To: Andrew Warner; +Cc: Eric Paris, selinux
Andrew Warner wrote:
> Thanks for the information. I have previously looked at the
> SE-PostgreSQL code/documentation. It was helpful and most interesting.
> The base DBMS I am using is called Trusted RUBIX, which is an CC EAL-4
> (Trusted Solaris) evaluated MLS DBMS. We have been contracted to
> integrate SELinux TE and MLS (Red Hat flavor) into our DBMS. So,
> obviously using SE-PostgreSQL is not an option :-) In the bigger
> picture, this current work is a small (and rather detached) step towards
> a high robustness (EAL-6+) DBMS solution.
It's so amazing!
> Historically, our company (and myself personally) have been involved in
> high(er) assurance MLS DBMS products/research for a number of years. As
> such, we tend to use a more "traditional" minimized trust, reference
> monitor architecture as opposed to inserting hooks and using query
> modification for our security enforcement. This means, for instance,
> that a label object permeates much of our kernel code at a fairly low
> level as well as storage objects. Thus, the runtime and storage
> representation must be chosen carefully as it will touch much of our
> kernel code. We also support full polyinstantiation of named objects,
> which dictates an efficient label mechanism. (Integration of TE + MLS
> into traditional MLS polyinstantiation behavior is an interesting topic!)
I have considered the way to implement polyinstantiation database for
any object (including rows) on SE-PostgreSQL, but there were several
difficult matters.
Especially, it is a tough work to keep PK/FK integrities when security
policy is reloaded...
> Out of curiosity, KaiGai, a question about how SE-PostgreSQL presents
> the security context to a user. From your security guide I see that the
> context is a selectable column. But, what SQL type is the column? For
> instance, do you define your own SQL type, such as "Security Context" or
> is it a VARCHAR that has special constraints placed upon it to force it
> to conform to the structure of a security context?
In the latest version, the "security_context" system column is declared
as TEXT type. Users can give their input as a normal text, then SE-PostgreSQL
translate it into internal integer value just before actuall INSERT/UPDATE.
Thus, we can describe the following SQL, using operators for TEXT type. :-)
SELECT security_context || ':s0:c' || id AS security_context, id, name, price
INTO new_tbl FROM old_tbl WHERE id < 256;
Thanks,
> Blessings,
>
> Andy
>
> KaiGai Kohei wrote:
>>>> I have also considered maintaining my own internal, persistent mapping
>>>> between string based contexts and an integer representation, the
>>>> mapping
>>>> being stored/indexed inside the DBMS. This gives me a small storage
>>>> overhead
>>>> with a fixed size.
>>>
>>> I don't have a problem with internal mapping like that.
>>
>> In SE-PostgreSQL, it maintains own internal mapping between text
>> represented
>> security context and its integer identifier. The 'pg_security' system
>> catalog
>> stores the pair of them.
>>
>> Any tuple (including system catalog) has its security context. It is
>> stored
>> within padding area of HeapTupleHeader as an integer value, and it
>> means the
>> primary key of 'pg_security' system catalog.
>>
>> It also enables to boost userspace AVC, because this idea makes
>> possible to
>> implement it using a relationship between identifiers (not a text
>> representation).
>>
>>
>> When the security policy is reloaded and it makes invalidate the
>> stored context,
>> the stored one is dealt as 'unlabeled_t'.
>>
>>> But, don't we already have sepostgresql? Maybe you should be looking
>>> to see if that fits your needs or you might get ideas from the work
>>> that they performed?
>>
>> FYI:
>> http://code.google.com/p/sepgsql/
>>
>> Andrew, what is your intended base RDBMS?
>>
>> Currently, SE-PostgreSQL is the only SELinux awared RDBMS.
>> It is now under reviewing for the next release (v8.4) cycle.
>> http://wiki.postgresql.org/wiki/CommitFest:2008-07
>>
>> However, I think we can apply SELinux for any other relational model
>> implementation.
>>
>> Thanks,
--
OSS Platform Development Division, NEC
KaiGai Kohei <kaigai@ak.jp.nec.com>
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: questions about persistent storage of security contexts
2008-07-22 11:13 ` KaiGai Kohei
@ 2008-07-22 11:34 ` Andy Warner
0 siblings, 0 replies; 11+ messages in thread
From: Andy Warner @ 2008-07-22 11:34 UTC (permalink / raw)
To: KaiGai Kohei; +Cc: Eric Paris, selinux
KaiGai Kohei wrote:
> Andrew Warner wrote:
>> Thanks for the information. I have previously looked at the
>> SE-PostgreSQL code/documentation. It was helpful and most
>> interesting. The base DBMS I am using is called Trusted RUBIX, which
>> is an CC EAL-4 (Trusted Solaris) evaluated MLS DBMS. We have been
>> contracted to integrate SELinux TE and MLS (Red Hat flavor) into our
>> DBMS. So, obviously using SE-PostgreSQL is not an option :-) In the
>> bigger picture, this current work is a small (and rather detached)
>> step towards a high robustness (EAL-6+) DBMS solution.
>
> It's so amazing!
>
>> Historically, our company (and myself personally) have been involved
>> in high(er) assurance MLS DBMS products/research for a number of
>> years. As such, we tend to use a more "traditional" minimized trust,
>> reference monitor architecture as opposed to inserting hooks and
>> using query modification for our security enforcement. This means,
>> for instance, that a label object permeates much of our kernel code
>> at a fairly low level as well as storage objects. Thus, the runtime
>> and storage representation must be chosen carefully as it will touch
>> much of our kernel code. We also support full polyinstantiation of
>> named objects, which dictates an efficient label mechanism.
>> (Integration of TE + MLS into traditional MLS polyinstantiation
>> behavior is an interesting topic!)
>
> I have considered the way to implement polyinstantiation database for
> any object (including rows) on SE-PostgreSQL, but there were several
> difficult matters.
>
> Especially, it is a tough work to keep PK/FK integrities when security
> policy is reloaded...
Yes, PK/FK is one of the more difficult areas of integrating a MAC
policy into a traditional RDBMS. In the end I have found that you must
make compromises between the PK/FK integrity and MAC security. You
simply can't have all of both. Generally, you must compromise the
integrity constraint and keep the MAC enforcement. Or, at least remove
any high bandwidth channels that infer values of objects which the MAC
policy disallows viewing. Polyinstantiation helps, but also raises some
interesting issues like which version of a polyinstantiated object
should be presented to a user and which objects you want to
polyinstantiate. Full polyinstantiation of tables, catalogs, etc can
make the view of the data model overly dynamic and confusing. If you do
not provide full polyinstantiation then you are allowing covert
information flows in violation of the MAC policy.
Being the newbie is SELinux that I am :-), I do not understand why the
security policy being reloaded makes PK/FK integrity especially tough
work. Could you expand on that a little? (I am not even sure I fully
understand what happens when a security policy is "reloaded.)
Blessings,
Andy
>
>> Out of curiosity, KaiGai, a question about how SE-PostgreSQL presents
>> the security context to a user. From your security guide I see that
>> the context is a selectable column. But, what SQL type is the column?
>> For instance, do you define your own SQL type, such as "Security
>> Context" or is it a VARCHAR that has special constraints placed upon
>> it to force it to conform to the structure of a security context?
>
> In the latest version, the "security_context" system column is declared
> as TEXT type. Users can give their input as a normal text, then
> SE-PostgreSQL
> translate it into internal integer value just before actuall
> INSERT/UPDATE.
>
> Thus, we can describe the following SQL, using operators for TEXT
> type. :-)
>
> SELECT security_context || ':s0:c' || id AS security_context, id,
> name, price
> INTO new_tbl FROM old_tbl WHERE id < 256;
>
> Thanks,
>
>> Blessings,
>>
>> Andy
>>
>> KaiGai Kohei wrote:
>>>>> I have also considered maintaining my own internal, persistent
>>>>> mapping
>>>>> between string based contexts and an integer representation, the
>>>>> mapping
>>>>> being stored/indexed inside the DBMS. This gives me a small
>>>>> storage overhead
>>>>> with a fixed size.
>>>>
>>>> I don't have a problem with internal mapping like that.
>>>
>>> In SE-PostgreSQL, it maintains own internal mapping between text
>>> represented
>>> security context and its integer identifier. The 'pg_security'
>>> system catalog
>>> stores the pair of them.
>>>
>>> Any tuple (including system catalog) has its security context. It is
>>> stored
>>> within padding area of HeapTupleHeader as an integer value, and it
>>> means the
>>> primary key of 'pg_security' system catalog.
>>>
>>> It also enables to boost userspace AVC, because this idea makes
>>> possible to
>>> implement it using a relationship between identifiers (not a text
>>> representation).
>>>
>>>
>>> When the security policy is reloaded and it makes invalidate the
>>> stored context,
>>> the stored one is dealt as 'unlabeled_t'.
>>>
>>>> But, don't we already have sepostgresql? Maybe you should be looking
>>>> to see if that fits your needs or you might get ideas from the work
>>>> that they performed?
>>>
>>> FYI:
>>> http://code.google.com/p/sepgsql/
>>>
>>> Andrew, what is your intended base RDBMS?
>>>
>>> Currently, SE-PostgreSQL is the only SELinux awared RDBMS.
>>> It is now under reviewing for the next release (v8.4) cycle.
>>> http://wiki.postgresql.org/wiki/CommitFest:2008-07
>>>
>>> However, I think we can apply SELinux for any other relational model
>>> implementation.
>>>
>>> Thanks,
>
>
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: questions about persistent storage of security contexts
2008-07-22 2:01 ` Stephen Smalley
@ 2008-07-22 11:58 ` Andy Warner
2008-07-22 12:32 ` Stephen Smalley
0 siblings, 1 reply; 11+ messages in thread
From: Andy Warner @ 2008-07-22 11:58 UTC (permalink / raw)
To: Stephen Smalley; +Cc: Eric Paris, selinux
[-- Attachment #1: Type: text/plain, Size: 6251 bytes --]
Thanks for the info, all is now clear!
One more question (from an SELinux newbie!) that has been nagging away
at me in regards to the MLS portion of the security context. In the MLS
label we have the sensitivity (s0, s1, etc) and the category (c0, c2,
etc). Now, as for the categories, its seems clear that in order for
label1 to (potentially) dominate label2, then label1 must contain all
the categories contained in label2 (i.e., *:c1,c3 can potentially
dominate *:c3 where as *:c1 can never dominate *:c3). c0, c1, etc are
just names of categories and the only relationship between them is
equality or non-equality.
But with the sensitivity we have an ordering relationship, e.g., s3 is
greater than (or higher, or strictly dominates) s1. The numbering
applied to the sensitivity seems to imply (or define?) what that
ordering is (s3 is greater than s1 because 3 is greater than 1). Is this
numerical ordering a fixed part of the SELinux MLS policy or are the
sensitivities simply "names" and how the policy is written defines the
ordering. That is, is it possible for a configuration of SELinux MLS to
have s0 strictly dominate s3?
My reason for asking is, if the "numerical ordering" of the
sensitivities is always true then I can easily write my own functions to
perform dominance checks of the MLS labels and those functions do not
need to consult the SELinux API. If the sensitivities are just "names"
and the policy instance can define any ordering relationship, then any
functions written to perform dominance checks must call the SELinux API
and seem non-trivial because no dominance check (only) API is provided
and the TE behavior will somehow need to be "filtered" from the security
check result.
Blessings,
Andy
Stephen Smalley wrote:
> On Mon, 2008-07-21 at 20:35 -0400, Eric Paris wrote:
>
>> On Mon, Jul 21, 2008 at 7:10 PM, Andrew Warner <warner@rubix.com> wrote:
>>
>>> Hello,
>>>
>>> I am currently developing an "SELinux aware" DBMS (primarily TE and MLS)
>>> that is characterized by:
>>>
>>> 1. The need to store a security context (in some recoverable form) in our
>>> persistent database (storage size of the context is an important factor)
>>> 2. The need to frequently perform a high number of security access checks in
>>> a performance sensitive way
>>>
>>> My question relates to the first characteristic from above. I am having
>>> trouble deciding on the best way to store the security context in the
>>> database. From my research I see (I think!) three different representations
>>> for a security context: 1) string; 2) raw; 3) SID.
>>>
>>> The string representation, generally, seems clear as this is what is shown
>>> in all documentation as the context representation that exists in user
>>> space. My only question regarding the string representation is: is there is
>>> any hard limit to the length of the security context string? Do I need to
>>> allow for no theoretical size limit on a context string if I choose to store
>>> it?
>>>
>> No hard limit that I can think of. There might be one somewhere but I
>> wouldn't count on it.
>>
>
> Correct - the core logic imposes no fixed limits on the context strings,
> although the kernel interfaces do impose certain practical limits (e.g.
> page size). The NFSv4 support will likewise impose certain limits in
> accordance with existing limits on the size of containing structures.
>
>
>>> I am inferring the the raw representation exists from seeing *_raw functions
>>> (e.g., security_compute_create_raw) referenced in selinux header files.
>>> Other than seeing these functions declared I am having trouble finding out
>>> much about a raw representation. Is there any advantage to
>>> storing/manipulating a context in its raw representation? That is, are they
>>> more suited for a fast security access check, are they smaller in size, or
>>> do they have a fixed or maximum length?
>>>
>> The _raw is actually what you want. _raw basically just means strings
>> without any translations from things like mcstransd. Given a context
>> like user_u:role_r:type_t the "raw" on an MLS system maybe
>> "user_u:object_r:type_t::s0." Throwing a context with the MLS portion
>> attched at the !raw functions will work just fine.
>>
>>
>>> The SID I have also seen mentioned in various documentations but can
>>> determine little about them. My guess is that they are an integer value that
>>> is used for fast internal access, particularly for the AVC. Are SIDs indeed
>>> integer values? Are they persistent or are they meaningful only for a
>>> particular OS session?
>>>
>> That's exactly what they are. They are kernel internal integer
>> representations that are (for the most part) only meaningful for that
>> session. There are some 'initial sids' that are always the same, but
>> no userspace app should care about 'sids' in the general sense.
>>
>>
>>> I have also considered maintaining my own internal, persistent mapping
>>> between string based contexts and an integer representation, the mapping
>>> being stored/indexed inside the DBMS. This gives me a small storage overhead
>>> with a fixed size.
>>>
>> I don't have a problem with internal mapping like that.
>>
>
> The original SELinux filesystem labeling implementation used something
> like that - they were called "persistent security identifiers" (PSIDs),
> and were maintained as private indices per-filesystem that mapped to
> security context strings.
>
>
>> But, don't we already have sepostgresql? Maybe you should be looking
>> to see if that fits your needs or you might get ideas from the work
>> that they performed?
>>
>
> Yes, I'd recommend looking at SE-PostgreSQL as a worked example of
> applying the Flask architecture to a DBMS, including not only its
> approach to storing security contexts but also its approach to the
> userspace AVC. You can find a link to that work from the Related Work
> page off of the SELinux web site.
>
>
>
> --
> This message was distributed to subscribers of the selinux mailing list.
> If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
> the words "unsubscribe selinux" without quotes as the message.
>
>
[-- Attachment #2: Type: text/html, Size: 7113 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: questions about persistent storage of security contexts
2008-07-22 11:58 ` Andy Warner
@ 2008-07-22 12:32 ` Stephen Smalley
2008-07-22 14:30 ` Andy Warner
0 siblings, 1 reply; 11+ messages in thread
From: Stephen Smalley @ 2008-07-22 12:32 UTC (permalink / raw)
To: Andy Warner; +Cc: Eric Paris, selinux
On Tue, 2008-07-22 at 13:58 +0200, Andy Warner wrote:
>
> Thanks for the info, all is now clear!
>
> One more question (from an SELinux newbie!) that has been nagging away
> at me in regards to the MLS portion of the security context. In the
> MLS label we have the sensitivity (s0, s1, etc) and the category (c0,
> c2, etc). Now, as for the categories, its seems clear that in order
> for label1 to (potentially) dominate label2, then label1 must contain
> all the categories contained in label2 (i.e., *:c1,c3 can potentially
> dominate *:c3 where as *:c1 can never dominate *:c3). c0, c1, etc are
> just names of categories and the only relationship between them is
> equality or non-equality.
>
> But with the sensitivity we have an ordering relationship, e.g., s3 is
> greater than (or higher, or strictly dominates) s1. The numbering
> applied to the sensitivity seems to imply (or define?) what that
> ordering is (s3 is greater than s1 because 3 is greater than 1). Is
> this numerical ordering a fixed part of the SELinux MLS policy or are
> the sensitivities simply "names" and how the policy is written defines
> the ordering. That is, is it possible for a configuration of SELinux
> MLS to have s0 strictly dominate s3?
Yes - they are just names and the dominance relationship is defined by
the policy configuration.
Computing dominance has been handled in a couple of different ways in
the past:
1) Model it as a permission check, with a MLS constraint defined on the
permission and allowing the type relationship.
2) Introduce an interface to the kernel security server to provide
dominance computations.
See the mailing list archives for more discussion.
>
> My reason for asking is, if the "numerical ordering" of the
> sensitivities is always true then I can easily write my own functions
> to perform dominance checks of the MLS labels and those functions do
> not need to consult the SELinux API. If the sensitivities are just
> "names" and the policy instance can define any ordering relationship,
> then any functions written to perform dominance checks must call the
> SELinux API and seem non-trivial because no dominance check (only) API
> is provided and the TE behavior will somehow need to be "filtered"
> from the security check result.
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: questions about persistent storage of security contexts
2008-07-22 12:32 ` Stephen Smalley
@ 2008-07-22 14:30 ` Andy Warner
2008-07-22 15:08 ` Stephen Smalley
0 siblings, 1 reply; 11+ messages in thread
From: Andy Warner @ 2008-07-22 14:30 UTC (permalink / raw)
To: Stephen Smalley; +Cc: Eric Paris, selinux
[-- Attachment #1: Type: text/plain, Size: 2973 bytes --]
Stephen Smalley wrote:
> On Tue, 2008-07-22 at 13:58 +0200, Andy Warner wrote:
>
>> Thanks for the info, all is now clear!
>>
>> One more question (from an SELinux newbie!) that has been nagging away
>> at me in regards to the MLS portion of the security context. In the
>> MLS label we have the sensitivity (s0, s1, etc) and the category (c0,
>> c2, etc). Now, as for the categories, its seems clear that in order
>> for label1 to (potentially) dominate label2, then label1 must contain
>> all the categories contained in label2 (i.e., *:c1,c3 can potentially
>> dominate *:c3 where as *:c1 can never dominate *:c3). c0, c1, etc are
>> just names of categories and the only relationship between them is
>> equality or non-equality.
>>
>> But with the sensitivity we have an ordering relationship, e.g., s3 is
>> greater than (or higher, or strictly dominates) s1. The numbering
>> applied to the sensitivity seems to imply (or define?) what that
>> ordering is (s3 is greater than s1 because 3 is greater than 1). Is
>> this numerical ordering a fixed part of the SELinux MLS policy or are
>> the sensitivities simply "names" and how the policy is written defines
>> the ordering. That is, is it possible for a configuration of SELinux
>> MLS to have s0 strictly dominate s3?
>>
>
> Yes - they are just names and the dominance relationship is defined by
> the policy configuration.
>
> Computing dominance has been handled in a couple of different ways in
> the past:
> 1) Model it as a permission check, with a MLS constraint defined on the
> permission and allowing the type relationship.
> 2) Introduce an interface to the kernel security server to provide
> dominance computations.
>
> See the mailing list archives for more discussion.
>
>
Is there any requirement that the MLS policy be Bell-LaPadula ? Or can
it contain arbitrary information flows? (I am guessing the latter). If
not BL, then does that make dominance relationships only something that
can be determined for a subset of policy instances? I am assuming the
LSPP evaluation uses a BL policy instance (?).
Thanks again for the info!
>> My reason for asking is, if the "numerical ordering" of the
>> sensitivities is always true then I can easily write my own functions
>> to perform dominance checks of the MLS labels and those functions do
>> not need to consult the SELinux API. If the sensitivities are just
>> "names" and the policy instance can define any ordering relationship,
>> then any functions written to perform dominance checks must call the
>> SELinux API and seem non-trivial because no dominance check (only) API
>> is provided and the TE behavior will somehow need to be "filtered"
>> from the security check result.
>>
>
>
>
>
> --
> This message was distributed to subscribers of the selinux mailing list.
> If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
> the words "unsubscribe selinux" without quotes as the message.
>
>
[-- Attachment #2: Type: text/html, Size: 3549 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: questions about persistent storage of security contexts
2008-07-22 14:30 ` Andy Warner
@ 2008-07-22 15:08 ` Stephen Smalley
0 siblings, 0 replies; 11+ messages in thread
From: Stephen Smalley @ 2008-07-22 15:08 UTC (permalink / raw)
To: Andy Warner; +Cc: Eric Paris, selinux
On Tue, 2008-07-22 at 16:30 +0200, Andy Warner wrote:
>
>
> Stephen Smalley wrote:
> > On Tue, 2008-07-22 at 13:58 +0200, Andy Warner wrote:
> >
> > > Thanks for the info, all is now clear!
> > >
> > > One more question (from an SELinux newbie!) that has been nagging away
> > > at me in regards to the MLS portion of the security context. In the
> > > MLS label we have the sensitivity (s0, s1, etc) and the category (c0,
> > > c2, etc). Now, as for the categories, its seems clear that in order
> > > for label1 to (potentially) dominate label2, then label1 must contain
> > > all the categories contained in label2 (i.e., *:c1,c3 can potentially
> > > dominate *:c3 where as *:c1 can never dominate *:c3). c0, c1, etc are
> > > just names of categories and the only relationship between them is
> > > equality or non-equality.
> > >
> > > But with the sensitivity we have an ordering relationship, e.g., s3 is
> > > greater than (or higher, or strictly dominates) s1. The numbering
> > > applied to the sensitivity seems to imply (or define?) what that
> > > ordering is (s3 is greater than s1 because 3 is greater than 1). Is
> > > this numerical ordering a fixed part of the SELinux MLS policy or are
> > > the sensitivities simply "names" and how the policy is written defines
> > > the ordering. That is, is it possible for a configuration of SELinux
> > > MLS to have s0 strictly dominate s3?
> > >
> >
> > Yes - they are just names and the dominance relationship is defined by
> > the policy configuration.
> >
> > Computing dominance has been handled in a couple of different ways in
> > the past:
> > 1) Model it as a permission check, with a MLS constraint defined on the
> > permission and allowing the type relationship.
> > 2) Introduce an interface to the kernel security server to provide
> > dominance computations.
> >
> > See the mailing list archives for more discussion.
> >
> >
> Is there any requirement that the MLS policy be Bell-LaPadula ? Or can
> it contain arbitrary information flows? (I am guessing the latter). If
> not BL, then does that make dominance relationships only something
> that can be determined for a subset of policy instances? I am assuming
> the LSPP evaluation uses a BL policy instance (?).
The example security server in SELinux implements a combination of RBAC,
TE, and (optional) MLS. The MLS policy is oriented toward BLP but the
precise restrictions are defined through policy configuration, in
particular the policy writer defines a set of MLS constraints on the
Flask classes and permissions that establish what relationship must
exist between the subject and object in order for the permission to be
authorized. Thus, one could use the MLS engine to implement other
hierarchical schemes like Biba instead or a variant of BLP.
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2008-07-22 15:09 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-21 23:10 questions about persistent storage of security contexts Andrew Warner
2008-07-22 0:35 ` Eric Paris
2008-07-22 1:40 ` KaiGai Kohei
2008-07-22 10:39 ` Andrew Warner
2008-07-22 11:13 ` KaiGai Kohei
2008-07-22 11:34 ` Andy Warner
2008-07-22 2:01 ` Stephen Smalley
2008-07-22 11:58 ` Andy Warner
2008-07-22 12:32 ` Stephen Smalley
2008-07-22 14:30 ` Andy Warner
2008-07-22 15:08 ` Stephen Smalley
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.