Skip to contentSkip to conversation

Is the CIL project still active

DISCUSSION Richard Haines 3 participants 5 messages Jul 29, 2012 – Jul 30, 2012 SELinux security module

lore
Share & tools
lore
#0 lore raw

I'm only planning to run this in the same way as checkpolicy so not worried about AOSP etc.

I'm using the most suitable CIL statements (block, macro etc.), but as the policy is limited, not that many. I've converted all modules to blocks, figured out the classmap/classmapping statements and almost finished, although I'll probably wait for the next CIL release as I have come across three minor problems:

1) Cannot call a macro within a booleanif block.

2) The mlsconstrain statements seem to be generated in reverse order but need to check manually as APOL etc doesn't handle them. Are there any utilities that will allow me to compare mlsconstrain statements within a binary policy?

3) Cannot generate a file context without at least one category (example always wants s0:c0-s0:c0 instead of the normal s0).

Otherwise the current CIL compiler is running well.

Richard

Quoted 91 lines · Joshua Brindle

From: Joshua Brindle <[email protected]>
Subject: Re: Is the CIL project still active
To: "Richard Haines" <[email protected]>
Cc: [email protected], "Jeremy Solt" <[email protected]>, [email protected]
Date: Tuesday, 24 July, 2012, 13:29

Quoted 1 line · Richard Haines

Glad to hear its still going as I started converting

the Android

Quoted 1 line

policy to CIL using the current compiler that works ok

so far. However

Quoted 1 line

I'm having problems defining 'sets of classes' for

example with M4:

Since it is a small policy it should be possible to do a real, semantic
conversion (using blocks and ignoring legacy file types). Is that what
you are doing?

However, I'm not sure if CIL will be able to be in Android anytime soon.
It could still be used on the host side like checkpolicy/libsepol are
now but since CIL is currently statically linked against libsepol (GPL)
it would be prohibited in the AOSP userspace IIUC.

Quoted 2 lines

define(`dir_file_class_set (dir file lnk_file sock_file

fifo_file

Quoted 3 lines

chr_file blk_file))

I've tried various methods using classmap/classmapping

etc. but failed

Quoted 3 lines

to work out how to define in CIL:

mlsconstrain dir_file_class_set { create relabelfrom

relabelto }

Quoted 3 lines

(l2 eq h2 and (l1 eq l2 or t1 == mlstrustedsubject));

I can produce CIL mlsconstrain statements when I define

them with each

Quoted 1 line

class separately but not as a set. Is it possible with

the current

Quoted 1 line

release of CIL ? (if not I'll just produce an entry for

each class so

Quoted 7 lines

I can continue).

Thanks
Richard

--- On Fri, 20/7/12, James Carter<[email protected]>

Quoted 9 lines · wrote:
Quoted 9 lines

From: James Carter<[email protected]>
Subject: Re: Is the CIL project still active
To: "Richard Haines"<[email protected]>
Cc: [email protected]
Date: Friday, 20 July, 2012, 20:13

Quoted 1 line · Richard Haines

Does anyone know the status of the CIL project

as it

Quoted 3 lines
Quoted 3 lines

looked useful and would seem ideal for SEAndroid.

There are still a few more bugs that need to be

fixed so

Quoted 2 lines
Quoted 2 lines

that it can
correctly compile a CIL-transformed Refpolicy.

Progress has

Quoted 10 lines
Quoted 8 lines

been slow
recently, but it is not going to be abandoned.

--
James Carter<[email protected]>
National Security Agency

Quoted 2 lines

--
This message was distributed to subscribers of the

selinux mailing list.

Quoted 2 lines

If you no longer wish to subscribe, send mail to
[email protected]

with

Quoted 1 line

the words "unsubscribe selinux" without quotes as the

message.

Quoted 1 line
Quoted 8 lines

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#1 lore raw
Quoted 11 lines · Richard Haines

I'm only planning to run this in the same way as checkpolicy so not worried about AOSP etc.

I'm using the most suitable CIL statements (block, macro etc.), but as the policy is limited, not that many. I've converted all modules to blocks, figured out the classmap/classmapping statements and almost finished, although I'll probably wait for the next CIL release as I have come across three minor problems:

1) Cannot call a macro within a booleanif block.

That has been fixed at some point since the last release.

Quoted 2 lines

2) The mlsconstrain statements seem to be generated in reverse order but need to check manually as APOL etc doesn't handle them.

Generated in the binary in reverse order? I don't understand what you are referring to here.

Quoted 4 lines

Are there any
utilities that will allow me to compare mlsconstrain statements within a binary policy?

sediff doesn't handle constraints and I don't know of a tool that will do that comparison.

Quoted 3 lines

3) Cannot generate a file context without at least one category (example always wants s0:c0-s0:c0 instead of the normal s0).

This does need to be fixed.

Quoted 2 lines

Otherwise the current CIL compiler is running well.

Thanks for your feedback.
Jim

Quoted 111 lines

Richard

Quoted 91 lines · Joshua Brindle

From: Joshua Brindle <[email protected]>
Subject: Re: Is the CIL project still active
To: "Richard Haines" <[email protected]>
Cc: [email protected], "Jeremy Solt" <[email protected]>, [email protected]
Date: Tuesday, 24 July, 2012, 13:29

Quoted 1 line · Richard Haines

Glad to hear its still going as I started converting

the Android

Quoted 1 line

policy to CIL using the current compiler that works ok

so far. However

Quoted 1 line

I'm having problems defining 'sets of classes' for

example with M4:

Since it is a small policy it should be possible to do a real, semantic
conversion (using blocks and ignoring legacy file types). Is that what
you are doing?

However, I'm not sure if CIL will be able to be in Android anytime soon.
It could still be used on the host side like checkpolicy/libsepol are
now but since CIL is currently statically linked against libsepol (GPL)
it would be prohibited in the AOSP userspace IIUC.

Quoted 2 lines

define(`dir_file_class_set (dir file lnk_file sock_file

fifo_file

Quoted 3 lines

chr_file blk_file))

I've tried various methods using classmap/classmapping

etc. but failed

Quoted 3 lines

to work out how to define in CIL:

mlsconstrain dir_file_class_set { create relabelfrom

relabelto }

Quoted 3 lines

(l2 eq h2 and (l1 eq l2 or t1 == mlstrustedsubject));

I can produce CIL mlsconstrain statements when I define

them with each

Quoted 1 line

class separately but not as a set. Is it possible with

the current

Quoted 1 line

release of CIL ? (if not I'll just produce an entry for

each class so

Quoted 7 lines

I can continue).

Thanks
Richard

--- On Fri, 20/7/12, James Carter<[email protected]>

Quoted 9 lines · wrote:
Quoted 9 lines

From: James Carter<[email protected]>
Subject: Re: Is the CIL project still active
To: "Richard Haines"<[email protected]>
Cc: [email protected]
Date: Friday, 20 July, 2012, 20:13

Quoted 1 line · Richard Haines

Does anyone know the status of the CIL project

as it

Quoted 3 lines
Quoted 3 lines

looked useful and would seem ideal for SEAndroid.

There are still a few more bugs that need to be

fixed so

Quoted 2 lines
Quoted 2 lines

that it can
correctly compile a CIL-transformed Refpolicy.

Progress has

Quoted 10 lines
Quoted 8 lines

been slow
recently, but it is not going to be abandoned.

--
James Carter<[email protected]>
National Security Agency

Quoted 2 lines

--
This message was distributed to subscribers of the

selinux mailing list.

Quoted 2 lines

If you no longer wish to subscribe, send mail to
[email protected]

with

Quoted 1 line

the words "unsubscribe selinux" without quotes as the

message.

Quoted 1 line
Quoted 8 lines

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

Signature · 8 lines
James Carter <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw

Regarding the mlsconstrain reverse order problem:

I've taken one example from the sepolicy and my corresponding entry in CIL format. As you can see the generated output is different but I'm not sure what is actually generated in the binary policy file.

sepolicy from seandroid repository - mls file entry:
mlsconstrain process { transition dyntransition }

	     ((h1 eq h2 and l1 eq l2) or t1 == mlstrustedsubject);

The entry generated in the policy.conf file:
mlsconstrain process { transition dyntransition }

	     ((h1 eq h2 and l1 eq l2) or t1 == mlstrustedsubject);

I generated this entry in the mls CIL file using the CIL format:
(mlsconstrain (kernel.process (transition dyntransition))

    (and (or (eq h1 h2) (eq l1 l2)) (eq t1 mlstrustedsubject)))

The entry generated in the policy.conf file is:

mlsconstrain kernel.process { transition dyntransition };
	(((h2 eq h1) or (l2 eq l1)) and (mlstrustedsubject eq t1));

As you can see the (xx eq yy) entries are reversed and the 'or' is first with the 'and' second. It could be that I've mis-understood the CIL format.

Richard

Quoted 196 lines · James Carter

From: James Carter <[email protected]>
Subject: Re: Is the CIL project still active
To: "Richard Haines" <[email protected]>
Cc: "Joshua Brindle" <[email protected]>, "Jeremy Solt" <[email protected]>, [email protected]
Date: Monday, 30 July, 2012, 15:05

Quoted 1 line · Richard Haines

I'm only planning to run this in the same way as

checkpolicy so not

Quoted 3 lines

worried about AOSP etc.

I'm using the most suitable CIL statements (block,

macro etc.), but as

Quoted 1 line

the policy is limited, not that many. I've converted

all modules to

Quoted 1 line

blocks, figured out the classmap/classmapping

statements and almost

Quoted 1 line

finished, although I'll probably wait for the next CIL

release as I

Quoted 4 lines

have come across three minor problems:

1) Cannot call a macro within a booleanif block.

That has been fixed at some point since the last release.

Quoted 1 line

2) The mlsconstrain statements seem to be generated in

reverse order but

Quoted 1 line

    need to check manually as APOL etc doesn't

handle them.

Generated in the binary in reverse order? I don't understand what you
are referring to here.

Quoted 2 lines

  Are there any
    utilities that will allow me to compare

mlsconstrain statements within

Quoted 2 lines

    a binary policy?

sediff doesn't handle constraints and I don't know of a tool that will
do that comparison.

Quoted 1 line

3) Cannot generate a file context without at least one

category (example

Quoted 1 line

    always wants s0:c0-s0:c0 instead of the

normal s0).

Quoted 1 line

This does need to be fixed.

Quoted 2 lines

Otherwise the current CIL compiler is running well.

Thanks for your feedback.
Jim

Quoted 3 lines

Richard

--- On Tue, 24/7/12, Joshua Brindle <[email protected]>

Quoted 5 lines · wrote:
Quoted 5 lines

From: Joshua Brindle <[email protected]>
Subject: Re: Is the CIL project still active
To: "Richard Haines" <[email protected]>
Cc: [email protected],

"Jeremy Solt" <[email protected]>,
[email protected]

Quoted 3 lines
Quoted 3 lines

Date: Tuesday, 24 July, 2012, 13:29

Quoted 1 line · Richard Haines

Glad to hear its still going as I started

converting

Quoted 2 lines
Quoted 2 lines

the Android

Quoted 1 line

policy to CIL using the current compiler that

works ok

Quoted 2 lines
Quoted 2 lines

so far. However

Quoted 1 line

I'm having problems defining 'sets of

classes' for

Quoted 3 lines
Quoted 3 lines

example with M4:

Since it is a small policy it should be possible

to do a

Quoted 2 lines
Quoted 2 lines

real, semantic
conversion (using blocks and ignoring legacy file

types). Is

Quoted 4 lines
Quoted 4 lines

that what
you are doing?

However, I'm not sure if CIL will be able to be in

Android

Quoted 4 lines
Quoted 4 lines

anytime soon.
It could still be used on the host side like
checkpolicy/libsepol are
now but since CIL is currently statically linked

against

Quoted 2 lines
Quoted 2 lines

libsepol (GPL)
it would be prohibited in the AOSP userspace

IIUC.

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

define(`dir_file_class_set (dir file lnk_file

sock_file

Quoted 4 lines
Quoted 4 lines

fifo_file

Quoted 3 lines

chr_file blk_file))

I've tried various methods using

classmap/classmapping

Quoted 4 lines
Quoted 4 lines

etc. but failed

Quoted 3 lines

to work out how to define in CIL:

mlsconstrain dir_file_class_set { create

relabelfrom

Quoted 2 lines
Quoted 2 lines

relabelto }

Quoted 1 line

(l2 eq h2 and (l1 eq l2 or t1 ==

mlstrustedsubject));

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

I can produce CIL mlsconstrain statements

when I define

Quoted 2 lines
Quoted 2 lines

them with each

Quoted 1 line

class separately but not as a set. Is it

possible with

Quoted 2 lines
Quoted 2 lines

the current

Quoted 1 line

release of CIL ? (if not I'll just produce an

entry for

Quoted 7 lines
Quoted 7 lines

each class so

Quoted 6 lines

I can continue).

Thanks
Richard

Quoted 5 lines
Quoted 5 lines
Quoted 1 line

--- On Fri, 20/7/12, James Carter<[email protected]>

Quoted 3 lines · wrote:
Quoted 3 lines

From: James Carter<[email protected]>
Subject: Re: Is the CIL project still

active

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

To: "Richard Haines"<[email protected]>
Cc: [email protected]
Date: Friday, 20 July, 2012, 20:13

Quoted 1 line · Richard Haines

Does anyone know the status of the

CIL project

Quoted 2 lines
Quoted 2 lines

as it

Quoted 1 line
Quoted 1 line

looked useful and would seem ideal for

SEAndroid.

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

There are still a few more bugs that need

to be

Quoted 3 lines
Quoted 3 lines

fixed so

Quoted 2 lines
Quoted 2 lines

that it can
correctly compile a CIL-transformed

Refpolicy.

Quoted 3 lines
Quoted 3 lines

Progress has

Quoted 2 lines
Quoted 2 lines

been slow
recently, but it is not going to be

abandoned.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines

--
James Carter<[email protected]>
National Security Agency

--
This message was distributed to subscribers

of the

Quoted 2 lines
Quoted 2 lines

selinux mailing list.

Quoted 1 line

If you no longer wish to subscribe, send mail

to

Quoted 3 lines
Quoted 3 lines
Quoted 1 line

[email protected]

with

Quoted 1 line

the words "unsubscribe selinux" without

quotes as the

Quoted 5 lines
Quoted 5 lines

message.

Quoted 1 line

--
This message was distributed to subscribers of the

selinux

Quoted 2 lines
Quoted 2 lines

mailing list.
If you no longer wish to subscribe, send mail to

[email protected]

Quoted 2 lines
Quoted 2 lines

with
the words "unsubscribe selinux" without quotes as

the

Quoted 6 lines
Quoted 2 lines

message.

Quoted 13 lines
Quoted 2 lines

--
This message was distributed to subscribers of the

selinux mailing list.

Quoted 1 line

If you no longer wish to subscribe, send mail to [email protected]

with

Quoted 1 line

the words "unsubscribe selinux" without quotes as the

message.

Signature · 2 lines
James Carter <[email protected]>
National Security Agency

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.

#3 lore raw
Quoted 10 lines · Richard Haines

Regarding the mlsconstrain reverse order problem:

I've taken one example from the sepolicy and my corresponding entry in CIL format. As you can see the generated output is different but I'm not sure what is actually generated in the binary policy file.

sepolicy from seandroid repository - mls file entry:
mlsconstrain process { transition dyntransition }

	     ((h1 eq h2 and l1 eq l2) or t1 == mlstrustedsubject);
Quoted 7 lines

The entry generated in the policy.conf file:
mlsconstrain process { transition dyntransition }

	     ((h1 eq h2 and l1 eq l2) or t1 == mlstrustedsubject);

I generated this entry in the mls CIL file using the CIL format:
(mlsconstrain (kernel.process (transition dyntransition))

    (and (or (eq h1 h2) (eq l1 l2)) (eq t1 mlstrustedsubject)))

I think that should be:

      (or (and (eq h1 h2) (eq l1 l2)) (eq t2 mlstrustedsubject)))

That would be the prefix notation.

Quoted 8 lines

The entry generated in the policy.conf file is:

mlsconstrain kernel.process { transition dyntransition };
	(((h2 eq h1) or (l2 eq l1)) and (mlstrustedsubject eq t1));

As you can see the (xx eq yy) entries are reversed and the 'or' is first with the 'and' second. It could be that I've mis-understood the CIL format.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#4 lore raw
Quoted 15 lines · Stephen Smalley
Quoted 14 lines · Richard Haines

Regarding the mlsconstrain reverse order problem:

I've taken one example from the sepolicy and my corresponding entry in CIL format. As you can see the generated output is different but I'm not sure what is actually generated in the binary policy file.

sepolicy from seandroid repository - mls file entry:
mlsconstrain process { transition dyntransition }

	     ((h1 eq h2 and l1 eq l2) or t1 == mlstrustedsubject);

The entry generated in the policy.conf file:
mlsconstrain process { transition dyntransition }

	     ((h1 eq h2 and l1 eq l2) or t1 == mlstrustedsubject);
Quoted 8 lines
Quoted 3 lines

I generated this entry in the mls CIL file using the CIL format:
(mlsconstrain (kernel.process (transition dyntransition))

    (and (or (eq h1 h2) (eq l1 l2)) (eq t1 mlstrustedsubject)))

I think that should be:

      (or (and (eq h1 h2) (eq l1 l2)) (eq t2 mlstrustedsubject)))

That would be the prefix notation.

Sorry, s/t2/t1/

Quoted 11 lines
Quoted 9 lines

The entry generated in the policy.conf file is:

mlsconstrain kernel.process { transition dyntransition };
	(((h2 eq h1) or (l2 eq l1)) and (mlstrustedsubject eq t1));

As you can see the (xx eq yy) entries are reversed and the 'or' is first with the 'and' second. It could be that I've mis-understood the CIL format.

Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.