Skip to contentSkip to conversation

CIL/SELinux Userspace Integration

DISCUSSION Richard Haines 2 participants 2 messages Dec 7, 2011 SELinux security module

lore
Share & tools
lore
#0 lore raw

Thanks for the updates The deny_unknown, permissionset and generating policy.conf all worked okay.

I've had a couple of other minor problems:

1) I added a 'policycap' statement in a block. secilc processed the CIL statements but failed to gen the policy. I then moved it to the global namespace and then worked okay. I assume that policycap must always be in the global namespace.

2) Are there any known issues regarding typetransition rules as I'm having problems generating a policy. For example secilc will throw 'Error: Duplicate rule defined (line: xxx)'. I then comment out the typetransition statement (that actually looks okay) and it fails with another one, however semodule -i .. will compile it okay. In the end I can get both secilc and semodule to build the binary policy once I remove enough typetransition statements to keep both of them happy. (both seem to be happy with about 16 typetransition statements in policy but semodule can take a few more !!!)

The policy consists of 10 CIL modules (files) with about 1,200 lines of CIL statements - but nothing complex just the SELinux Notebook moules I'm converting to CIL as an exercise.

I've had both problems on the original integration you sent plus the updates you pushed today (7th Dec).

Richard

Quoted 78 lines · Steve Lawrence

From: Steve Lawrence <[email protected]>
Subject: Re: CIL/SELinux Userspace Integration
To: "Richard Haines" <[email protected]>
Cc: [email protected]
Date: Wednesday, 7 December, 2011, 13:32

Quoted 3 lines · Richard Haines

Steve,

Thanks for this, it seems to work fine with the policy

samples I've been

Quoted 3 lines

using. I've had a couple of minor problems though:

1) A macro does not work with permissionset as one of

the parameters (all

Quoted 1 line

     the other parameters worked

okay).

Quoted 1 line

Thanks for finding this. Just pushed a commit that fixes this.

Quoted 1 line

2) Macro comments are not permitted. I notice they are

not present in the

Quoted 1 line

     test files so has it been

dropped.

Quoted 1 line

Yep. Macro comments have been dropped. I've updated it on the wiki.

Quoted 1 line

3) I could not find a way to generate the policy.conf

file. I set the

Quoted 1 line

     DEBUG=1 in the CIL Makefile

like I used to but no file.

Quoted 1 line

In selinux userspace, make DEBUG=1 doesn't define the DEBUG macro that
the CIL code uses to enable debugging. You'll have to add '-DDEBUG' to
the CFLAGS in the userspace Makefile to enable building of the
policy.conf file.

Quoted 1 line

4) To set deny_unknown in secilc.c required a 'U' in

the getopt line:

Quoted 1 line

   getopt_long(argc, argv, "hvtU:MDc:",
.....

Quoted 1 line

Thanks, fixed and pushed.

Quoted 1 line

5) I could not load a new policy that had a boolean

and supporting

Quoted 1 line

     statements in it. The actual

binary policy was fine (using apol), but

Quoted 1 line

     load_policy had problems. I

started with a Fedora 16 base and added

Quoted 1 line

     the new Integration code with

no problems. Is it a known problem as

Quoted 2 lines

     if not I'll check further.
     The errors I had when running

semodule with a boolean were (Note: I

Quoted 1 line

     had already built a new base

policy (SELINUXTYPE=rch-test1) with no

Quoted 1 line

     problems):

Hmmm, this is interesting. Both seinfo and apol are fine with my
CIL-generated binary, but fails to load when I add booleans. I also
generated a similar mdp policy.conf, ran checkpolicy, and that failed to
load as well. sediff also shows the two binaries to be the same.

Quoted 12 lines

I'll look into this more, but because of that, I'm thinking this is a
kernel bug. If anyone else wants to look at it, I've attached a simple
file that is the standard mdp.conf with a single boolean defined, and
single conditional statement using that boolean. This builds a binary
fine, and apol/seinfo have no problem with it, but fails to load with
load_policy.

--
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 6 lines · Richard Haines

Thanks for the updates The deny_unknown, permissionset and generating policy.conf all worked okay.

I've had a couple of other minor problems:

1) I added a 'policycap' statement in a block. secilc processed the CIL statements but failed to gen the policy. I then moved it to the global namespace and then worked okay. I assume that policycap must always be in the global namespace.

There isn't anything in theory that requires the policycap statement to be global. However, putting a policycap in a block will namespace it, so this:

(block foo
(policycap bar))

results in the policy capability "foo.bar". Right now, the only valid policy capabilities are "network_peer_controls" and "open_perms". So "foo.bar" as well as any namespaced policy cap will never work in practice. However, there is a bug that this error isn't check at the right spot. I've fixed this, so you should at least get a better error message now.

Quoted 2 lines

2) Are there any known issues regarding typetransition rules as I'm having problems generating a policy. For example secilc will throw 'Error: Duplicate rule defined (line: xxx)'. I then comment out the typetransition statement (that actually looks okay) and it fails with another one, however semodule -i .. will compile it okay. In the end I can get both secilc and semodule to build the binary policy once I remove enough typetransition statements to keep both of them happy. (both seem to be happy with about 16 typetransition statements in policy but semodule can take a few more !!!)

No known issues with typetransitions. Can you send the policy you're having trouble with and I'll take a look?

Quoted 101 lines

The policy consists of 10 CIL modules (files) with about 1,200 lines of CIL statements - but nothing complex just the SELinux Notebook moules I'm converting to CIL as an exercise.

I've had both problems on the original integration you sent plus the updates you pushed today (7th Dec).

Richard

Quoted 90 lines · Steve Lawrence

From: Steve Lawrence<[email protected]>
Subject: Re: CIL/SELinux Userspace Integration
To: "Richard Haines"<[email protected]>
Cc: [email protected]
Date: Wednesday, 7 December, 2011, 13:32

Quoted 3 lines · Richard Haines

Steve,

Thanks for this, it seems to work fine with the policy

samples I've been

Quoted 3 lines

using. I've had a couple of minor problems though:

1) A macro does not work with permissionset as one of

the parameters (all

Quoted 1 line

the other parameters worked

okay).

Quoted 1 line

Thanks for finding this. Just pushed a commit that fixes this.

Quoted 1 line

2) Macro comments are not permitted. I notice they are

not present in the

Quoted 1 line

test files so has it been

dropped.

Quoted 1 line

Yep. Macro comments have been dropped. I've updated it on the wiki.

Quoted 1 line

3) I could not find a way to generate the policy.conf

file. I set the

Quoted 1 line

DEBUG=1 in the CIL Makefile

like I used to but no file.

Quoted 1 line

In selinux userspace, make DEBUG=1 doesn't define the DEBUG macro that
the CIL code uses to enable debugging. You'll have to add '-DDEBUG' to
the CFLAGS in the userspace Makefile to enable building of the
policy.conf file.

Quoted 1 line

4) To set deny_unknown in secilc.c required a 'U' in

the getopt line:

Quoted 1 line

getopt_long(argc, argv, "hvtU:MDc:",
.....

Quoted 1 line

Thanks, fixed and pushed.

Quoted 1 line

5) I could not load a new policy that had a boolean

and supporting

Quoted 1 line

statements in it. The actual

binary policy was fine (using apol), but

Quoted 1 line

load_policy had problems. I

started with a Fedora 16 base and added

Quoted 1 line

the new Integration code with

no problems. Is it a known problem as

Quoted 2 lines

if not I'll check further.
The errors I had when running

semodule with a boolean were (Note: I

Quoted 1 line

had already built a new base

policy (SELINUXTYPE=rch-test1) with no

Quoted 1 line

problems):

Hmmm, this is interesting. Both seinfo and apol are fine with my
CIL-generated binary, but fails to load when I add booleans. I also
generated a similar mdp policy.conf, ran checkpolicy, and that failed to
load as well. sediff also shows the two binaries to be the same.

I'll look into this more, but because of that, I'm thinking this is a
kernel bug. If anyone else wants to look at it, I've attached a simple
file that is the standard mdp.conf with a single boolean defined, and
single conditional statement using that boolean. This builds a binary
fine, and apol/seinfo have no problem with it, but fails to load with
load_policy.

--
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.